using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalModDataLib.Attributes;
using Microsoft.CodeAnalysis;
using NoteBoxz.ParallaxMod.NetcodePatcher;
using NotezyLib.Utils;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.VFX;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("NoteBoxz.ParallaxMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.6.0")]
[assembly: AssemblyInformationalVersion("0.1.6")]
[assembly: AssemblyProduct("ParallaxMod")]
[assembly: AssemblyTitle("NoteBoxz.ParallaxMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ParallaxMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("NoteBoxz.ParallaxMod", "ParallaxMod", "0.1.6")]
public class ParallaxMod : BaseUnityPlugin
{
private readonly string targetSceneName = "NotezLevel1Parallax";
private bool isPatchActive = false;
[ModData(/*Could not decode attribute arguments.*/)]
public static bool VistedParallax;
[ModData(/*Could not decode attribute arguments.*/)]
public static bool GotParaTip;
public static ParallaxMod Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? PermanentHarmony { get; set; }
internal static Harmony? DynamicHarmony { get; set; }
internal static AssetBundle assetBundle { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
NetcodePatcher();
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
LoadAssetBundle();
Logger.LogInfo((object)"NoteBoxz.ParallaxMod v0.1.6 has loaded!");
}
internal static void LoadAssetBundle()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (directoryName == null)
{
throw new InvalidOperationException("Unable to determine assembly location.");
}
string text = Path.Combine(directoryName, "parallaxspeicalassets");
assetBundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)assetBundle == (Object)null)
{
throw new InvalidOperationException("Failed to load AssetBundle.");
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
if (!(((Scene)(ref scene)).name == targetSceneName) || isPatchActive)
{
return;
}
if (DynamicHarmony == null)
{
DynamicHarmony = new Harmony("NoteBoxz.ParallaxMod.dynamic");
}
IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes()
where t.Namespace == "ParallaxMod.MoonPatches"
select t;
foreach (Type item in enumerable)
{
DynamicHarmony.PatchAll(item);
}
isPatchActive = true;
Logger.LogInfo((object)("Dynamic patches applied for " + targetSceneName));
}
private void OnSceneUnloaded(Scene scene)
{
if (((Scene)(ref scene)).name == targetSceneName && isPatchActive)
{
CleanUpBeforeUnPatch();
Harmony? dynamicHarmony = DynamicHarmony;
if (dynamicHarmony != null)
{
dynamicHarmony.UnpatchSelf();
}
isPatchActive = false;
Logger.LogInfo((object)("Dynamic patches removed for " + targetSceneName));
}
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (PermanentHarmony == null)
{
PermanentHarmony = new Harmony("NoteBoxz.ParallaxMod.permanent");
}
Logger.LogDebug((object)"Patching permanent patches...");
IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes()
where t.Namespace == "ParallaxMod.Patches"
select t;
foreach (Type item in enumerable)
{
PermanentHarmony.PatchAll(item);
Logger.LogDebug((object)("Patched permanent type: " + item.Name));
}
Logger.LogDebug((object)"Finished patching!");
}
private void CleanUpBeforeUnPatch()
{
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching all patches...");
Harmony? permanentHarmony = PermanentHarmony;
if (permanentHarmony != null)
{
permanentHarmony.UnpatchSelf();
}
Harmony? dynamicHarmony = DynamicHarmony;
if (dynamicHarmony != null)
{
dynamicHarmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
private void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
[RequireComponent(typeof(MeshFilter))]
public class MeshNoiseDistorter : MonoBehaviour
{
public float noiseScale = 1f;
public float distortionStrength = 0.1f;
public float animationSpeed = 1f;
public Vector3 noiseOffset;
public bool useCulling = true;
private Mesh originalMesh = null;
private Vector3[] originalVertices = (Vector3[])(object)new Vector3[0];
private Vector3[] distortedVertices = (Vector3[])(object)new Vector3[0];
private MeshFilter meshFilter = null;
private Renderer meshRenderer = null;
private bool isVisible = true;
private void Start()
{
meshFilter = ((Component)this).GetComponent<MeshFilter>();
meshRenderer = ((Component)this).GetComponent<Renderer>();
originalMesh = meshFilter.mesh;
originalVertices = originalMesh.vertices;
distortedVertices = (Vector3[])(object)new Vector3[originalVertices.Length];
}
private void Update()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Expected O, but got Unknown
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
if (useCulling)
{
bool flag = meshRenderer.isVisible;
if (flag != isVisible || flag)
{
isVisible = flag;
if (!isVisible)
{
return;
}
}
else if (!isVisible)
{
return;
}
}
for (int i = 0; i < originalVertices.Length; i++)
{
Vector3 val = originalVertices[i];
float num = Mathf.PerlinNoise((val.x + noiseOffset.x) * noiseScale, (val.y + noiseOffset.y) * noiseScale);
float num2 = Mathf.PerlinNoise((val.y + noiseOffset.y) * noiseScale, (val.z + noiseOffset.z) * noiseScale);
float num3 = Mathf.PerlinNoise((val.z + noiseOffset.z) * noiseScale, (val.x + noiseOffset.x) * noiseScale);
Vector3 val2 = new Vector3(num, num2, num3) * distortionStrength;
distortedVertices[i] = val + val2;
}
Mesh val3 = new Mesh();
val3.vertices = distortedVertices;
val3.triangles = originalMesh.triangles;
val3.normals = originalMesh.normals;
val3.uv = originalMesh.uv;
meshFilter.mesh = val3;
noiseOffset += Vector3.one * animationSpeed * Time.deltaTime;
}
private void OnDisable()
{
if ((Object)(object)meshFilter != (Object)null)
{
meshFilter.mesh = originalMesh;
}
}
private void OnBecameVisible()
{
isVisible = true;
}
private void OnBecameInvisible()
{
isVisible = false;
}
}
public enum ParallaxDimention
{
None,
Red,
Blue
}
public class ParallaxDimentionVisibilty : MonoBehaviour
{
public class VisibilityStateTracker
{
private Renderer renderer;
private bool wasDimensionDisabled = false;
public VisibilityStateTracker(Renderer source)
{
renderer = source;
}
public void DisableForDimension()
{
wasDimensionDisabled = renderer.enabled;
if (wasDimensionDisabled)
{
renderer.enabled = false;
}
}
public void EnableForDimension()
{
if (wasDimensionDisabled)
{
renderer.enabled = true;
wasDimensionDisabled = false;
}
}
}
private class ColliderStateTracker
{
private Collider? collider3D;
private Collider2D? collider2D;
private bool wasDimensionDisabled = false;
public ColliderStateTracker(Collider collider)
{
collider3D = collider;
}
public ColliderStateTracker(Collider2D collider)
{
collider2D = collider;
}
public void DisableForDimension()
{
if ((Object)(object)collider3D != (Object)null)
{
wasDimensionDisabled = collider3D.enabled;
if (wasDimensionDisabled)
{
collider3D.enabled = false;
}
}
else if ((Object)(object)collider2D != (Object)null)
{
wasDimensionDisabled = ((Behaviour)collider2D).enabled;
if (wasDimensionDisabled)
{
((Behaviour)collider2D).enabled = false;
}
}
}
public void EnableForDimension()
{
if (wasDimensionDisabled)
{
if ((Object)(object)collider3D != (Object)null)
{
collider3D.enabled = true;
}
else if ((Object)(object)collider2D != (Object)null)
{
((Behaviour)collider2D).enabled = true;
}
wasDimensionDisabled = false;
}
}
}
private class AudioSourceStateTracker
{
private AudioSource audioSource;
private bool wasDimensionDisabled = false;
private bool wasInitiallyMuted = false;
public AudioSourceStateTracker(AudioSource source)
{
audioSource = source;
}
public void DisableForDimension()
{
wasDimensionDisabled = ((Behaviour)audioSource).enabled;
if (wasDimensionDisabled)
{
audioSource.mute = true;
}
}
public void EnableForDimension()
{
if (wasDimensionDisabled)
{
wasInitiallyMuted = audioSource.mute;
audioSource.mute = !wasInitiallyMuted;
wasDimensionDisabled = false;
}
}
}
private class LayerStateTracker
{
private GameObject targetObject;
private int originalLayer;
private int dimensionLayer;
public LayerStateTracker(GameObject obj, int dimLayer)
{
targetObject = obj;
originalLayer = obj.layer;
dimensionLayer = dimLayer;
}
public void DisableForDimension()
{
if ((Object)(object)targetObject != (Object)null)
{
targetObject.layer = dimensionLayer;
}
}
public void EnableForDimension()
{
if ((Object)(object)targetObject != (Object)null)
{
targetObject.layer = originalLayer;
}
}
}
[Tooltip("The dimension this object belongs to")]
public ParallaxDimention Dimention = ParallaxDimention.None;
[Tooltip("The layer to use when object should be hidden in another dimension")]
public int DimentionLayer = 23;
[Tooltip("Should colliders be disabled in other dimensions")]
public bool DisableCollidersInOtherDimensions = true;
[Tooltip("Should audio sources be disabled in other dimensions")]
public bool DisableAudioInOtherDimensions = true;
[SerializeField]
[HideInInspector]
private bool isHidden = false;
[HideInInspector]
public List<Renderer> ExtraRenderers = new List<Renderer>();
public UnityEvent OnBecameVisibleInDimension = new UnityEvent();
public UnityEvent OnBecameHiddenInDimension = new UnityEvent();
private List<LayerStateTracker> trackedLayers = new List<LayerStateTracker>();
private List<ColliderStateTracker> trackedColliders = new List<ColliderStateTracker>();
private List<AudioSourceStateTracker> trackedAudioSources = new List<AudioSourceStateTracker>();
private ParallaxMoonController? parallaxController;
private void Start()
{
parallaxController = ParallaxMoonController.Instance;
CacheLayers();
CacheColliders();
CacheAudioSources();
UpdateVisibility();
}
private void CacheLayers()
{
trackedLayers.Clear();
Renderer[] components = ((Component)this).GetComponents<Renderer>();
foreach (Renderer val in components)
{
trackedLayers.Add(new LayerStateTracker(((Component)val).gameObject, DimentionLayer));
}
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
foreach (Renderer val2 in componentsInChildren)
{
if ((Object)(object)((Component)val2).gameObject != (Object)(object)((Component)this).gameObject)
{
trackedLayers.Add(new LayerStateTracker(((Component)val2).gameObject, DimentionLayer));
}
}
foreach (Renderer extraRenderer in ExtraRenderers)
{
if ((Object)(object)extraRenderer != (Object)null)
{
trackedLayers.Add(new LayerStateTracker(((Component)extraRenderer).gameObject, DimentionLayer));
}
}
}
private void CacheColliders()
{
trackedColliders.Clear();
Collider[] components = ((Component)this).GetComponents<Collider>();
foreach (Collider collider in components)
{
trackedColliders.Add(new ColliderStateTracker(collider));
}
Collider2D[] components2 = ((Component)this).GetComponents<Collider2D>();
foreach (Collider2D collider2 in components2)
{
trackedColliders.Add(new ColliderStateTracker(collider2));
}
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>();
foreach (Collider val in componentsInChildren)
{
if ((Object)(object)((Component)val).gameObject != (Object)(object)((Component)this).gameObject)
{
trackedColliders.Add(new ColliderStateTracker(val));
}
}
Collider2D[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Collider2D>();
foreach (Collider2D val2 in componentsInChildren2)
{
if ((Object)(object)((Component)val2).gameObject != (Object)(object)((Component)this).gameObject)
{
trackedColliders.Add(new ColliderStateTracker(val2));
}
}
}
private void CacheAudioSources()
{
trackedAudioSources.Clear();
AudioSource[] components = ((Component)this).GetComponents<AudioSource>();
foreach (AudioSource source in components)
{
trackedAudioSources.Add(new AudioSourceStateTracker(source));
}
AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren<AudioSource>();
foreach (AudioSource val in componentsInChildren)
{
if ((Object)(object)((Component)val).gameObject != (Object)(object)((Component)this).gameObject)
{
trackedAudioSources.Add(new AudioSourceStateTracker(val));
}
}
}
private void LateUpdate()
{
if (!((Object)(object)parallaxController == (Object)null))
{
UpdateVisibility();
if ((Object)(object)parallaxController == (Object)null)
{
Object.Destroy((Object)(object)this);
}
}
}
private void UpdateVisibility()
{
if ((Object)(object)parallaxController == (Object)null)
{
return;
}
bool flag = parallaxController.CurrentDimention != Dimention;
if (flag == isHidden)
{
return;
}
if (((Object)((Component)this).gameObject).name.Contains("Player"))
{
ParallaxMod.Logger.LogInfo((object)$"Updating visibility for {((Object)((Component)this).gameObject).name}. Current Dimension: {parallaxController.CurrentDimention}, Object Dimension: {Dimention}, Should be hidden: {flag}");
}
if (flag)
{
if (((Object)((Component)this).gameObject).name.Contains("Player"))
{
ParallaxMod.Logger.LogInfo((object)$"Hiding {((Object)((Component)this).gameObject).name} in dimension {parallaxController.CurrentDimention}");
}
HideInOtherDimension();
OnBecameHiddenInDimension.Invoke();
}
else
{
RestoreVisibility();
OnBecameVisibleInDimension.Invoke();
}
isHidden = flag;
}
private void HideInOtherDimension()
{
foreach (LayerStateTracker trackedLayer in trackedLayers)
{
trackedLayer.DisableForDimension();
}
if (DisableCollidersInOtherDimensions)
{
foreach (ColliderStateTracker trackedCollider in trackedColliders)
{
trackedCollider.DisableForDimension();
}
}
if (!DisableAudioInOtherDimensions)
{
return;
}
foreach (AudioSourceStateTracker trackedAudioSource in trackedAudioSources)
{
trackedAudioSource.DisableForDimension();
}
}
private void RestoreVisibility()
{
foreach (LayerStateTracker trackedLayer in trackedLayers)
{
try
{
trackedLayer.EnableForDimension();
}
catch (Exception arg)
{
ParallaxMod.Logger.LogError((object)$"Failed to restore layer visibility for {trackedLayer}: {arg}");
}
}
if (DisableCollidersInOtherDimensions)
{
foreach (ColliderStateTracker trackedCollider in trackedColliders)
{
try
{
trackedCollider.EnableForDimension();
}
catch (Exception arg2)
{
ParallaxMod.Logger.LogError((object)$"Failed to restore collider visibility for {trackedCollider}: {arg2}");
}
}
}
if (!DisableAudioInOtherDimensions)
{
return;
}
foreach (AudioSourceStateTracker trackedAudioSource in trackedAudioSources)
{
try
{
trackedAudioSource.EnableForDimension();
}
catch (Exception arg3)
{
ParallaxMod.Logger.LogError((object)$"Failed to restore audio visibility for {trackedAudioSource}: {arg3}");
}
}
}
private void OnEnable()
{
UpdateVisibility();
}
public void OnDestroy()
{
if (isHidden)
{
RestoreVisibility();
}
}
}
public class ParallaxEntranceTeleport : MonoBehaviour
{
public ParallaxDimention Dimention = ParallaxDimention.None;
public ParallaxDimentionVisibilty Vis = null;
public ParallaxDimentionVisibilty VisIndoor = null;
public EntranceTeleport OutdoorTeleport = null;
public EntranceTeleport IndoorTeleport = null;
public void Awake()
{
ParallaxMod.Logger.LogMessage((object)$"ParallaxEntranceTeleport: Awake for {OutdoorTeleport.entranceId} in {Dimention}");
Vis.Dimention = Dimention;
}
public void Update()
{
Vis.Dimention = Dimention;
if ((Object)(object)VisIndoor != (Object)null)
{
VisIndoor.Dimention = Dimention;
}
}
public void FindIndoorTeleport()
{
if ((Object)(object)IndoorTeleport != (Object)null)
{
return;
}
EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
foreach (EntranceTeleport val in array)
{
if (!((Object)(object)val == (Object)(object)OutdoorTeleport) && !val.isEntranceToBuilding && val.entranceId == OutdoorTeleport.entranceId)
{
IndoorTeleport = val;
break;
}
}
if ((Object)(object)IndoorTeleport == (Object)null)
{
ParallaxMod.Logger.LogWarning((object)$"ParallaxEntranceTeleport: Could not find indoor teleport for {OutdoorTeleport.entranceId}");
}
else
{
AddVisToTeleports();
}
}
public void AddVisToTeleports()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
GameObject val = TryFindDoorModel(((Component)IndoorTeleport).transform.position);
if ((Object)(object)val == (Object)null)
{
ParallaxMod.Logger.LogFatal((object)$"ParallaxEntranceTeleport: Could not find door model near Indoor Teleport {IndoorTeleport.entranceId} at {((Component)IndoorTeleport).transform.position}");
Object.Destroy((Object)(object)Vis);
Object.Destroy((Object)(object)this);
}
else
{
VisIndoor = ((Component)IndoorTeleport).gameObject.AddComponent<ParallaxDimentionVisibilty>();
VisIndoor.ExtraRenderers.AddRange(val.GetComponentsInChildren<Renderer>());
VisIndoor.Dimention = Dimention;
ParallaxMod.Logger.LogMessage((object)$"ParallaxEntranceTeleport: Added ParallaxDimentionVisibilty to Indoor Teleport {IndoorTeleport.entranceId} for {Dimention}");
}
}
public GameObject TryFindDoorModel(Vector3 Pos)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
List<GameObject> list = Object.FindObjectsOfType<GameObject>().ToList();
list.Sort(delegate(GameObject a, GameObject b)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Distance(a.transform.position, Pos);
float value = Vector3.Distance(b.transform.position, Pos);
return num.CompareTo(value);
});
foreach (GameObject item in list)
{
string text = SplitByCapitalization(((Object)item).name).ToLowerInvariant();
if (text.Contains("fire"))
{
return item;
}
}
return null;
static string SplitByCapitalization(string input)
{
if (string.IsNullOrEmpty(input))
{
return "";
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(input[0]);
for (int i = 1; i < input.Length; i++)
{
if (char.IsUpper(input[i]) && !char.IsWhiteSpace(input[i - 1]))
{
stringBuilder.Append(' ');
}
stringBuilder.Append(input[i]);
}
return stringBuilder.ToString();
}
}
}
public class ParallaxGrabableObject : MonoBehaviour
{
public ParallaxDimention Dimention = ParallaxDimention.None;
public ParallaxDimentionVisibilty DimentionVisibilty = null;
public GrabbableObject ItemScript = null;
private bool PrevLethalMinSettings;
private object? pikminItemSettings;
private FieldInfo? excludeFromGetItemsCheckField;
private void Start()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
DimentionVisibilty.OnBecameHiddenInDimension.AddListener(new UnityAction(OnBecomeHidden));
DimentionVisibilty.OnBecameVisibleInDimension.AddListener(new UnityAction(OnBecomeVisible));
if ((Object)(object)ItemScript.playerHeldBy != (Object)null)
{
Dimention = ParallaxMoonController.Instance.PlayerDimentions[ItemScript.playerHeldBy];
}
}
public void Update()
{
DimentionVisibilty.Dimention = Dimention;
}
private void OnBecomeHidden()
{
if (Chainloader.PluginInfos.ContainsKey("NoteBoxz.LethalMin"))
{
LETHALMIN_DISABLESETTINGS();
}
}
private void OnBecomeVisible()
{
if (Chainloader.PluginInfos.ContainsKey("NoteBoxz.LethalMin"))
{
LETHALMIN_RESTORESETTINGS();
}
}
public void LETHALMIN_DISABLESETTINGS()
{
try
{
if (pikminItemSettings == null)
{
pikminItemSettings = ((Component)ItemScript).GetComponent("PikminItemSettings");
if (pikminItemSettings == null)
{
Debug.LogWarning((object)"PikminItemSettings component not found on ItemScript");
return;
}
Type type = pikminItemSettings.GetType();
excludeFromGetItemsCheckField = type.GetField("ExcludeFromGetItemsCheck", BindingFlags.Instance | BindingFlags.Public);
if (excludeFromGetItemsCheckField == null)
{
Debug.LogWarning((object)"ExcludeFromGetItemsCheck field not found in PikminItemSettings");
return;
}
PrevLethalMinSettings = (bool)excludeFromGetItemsCheckField.GetValue(pikminItemSettings);
}
if (excludeFromGetItemsCheckField != null && pikminItemSettings != null)
{
excludeFromGetItemsCheckField.SetValue(pikminItemSettings, true);
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error in LETHALMIN_DISABLESETTINGS: " + ex.Message));
}
}
public void LETHALMIN_RESTORESETTINGS()
{
try
{
if (excludeFromGetItemsCheckField != null && pikminItemSettings != null)
{
excludeFromGetItemsCheckField.SetValue(pikminItemSettings, PrevLethalMinSettings);
}
}
catch (Exception ex)
{
Debug.LogError((object)("Error in LETHALMIN_RESTORESETTINGS: " + ex.Message));
}
}
}
public class ParallaxMoonController : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <DelayedTip>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ParallaxMoonController <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedTip>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!ParallaxMod.VistedParallax)
{
HUDManager.Instance.DisplayTip("Welcome to Parallax!", "You can change your dimension by going through the rifts scattered around the map.", false, false, "LC_Tip1");
}
ParallaxMod.VistedParallax = true;
<>4__this.ChangeDimention(ParallaxDimention.None, StartOfRound.Instance.localPlayerController);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SendScrapToRandomDimensions>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ParallaxMoonController <>4__this;
private ParallaxGrabableObject[] <list>5__1;
private int <RedCount>5__2;
private int <BlueCount>5__3;
private int <NoneCount>5__4;
private ParallaxGrabableObject[] <>s__5;
private int <>s__6;
private ParallaxGrabableObject <scrap>5__7;
private int <randomValue>5__8;
private ParallaxGrabableObject[] <>s__9;
private int <>s__10;
private ParallaxGrabableObject <scrap>5__11;
private NetworkObjectReference <netObjRef>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SendScrapToRandomDimensions>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<list>5__1 = null;
<>s__5 = null;
<scrap>5__7 = null;
<>s__9 = null;
<scrap>5__11 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<list>5__1 = Object.FindObjectsOfType<ParallaxGrabableObject>();
<RedCount>5__2 = 0;
<BlueCount>5__3 = 0;
<NoneCount>5__4 = 0;
<>s__5 = <list>5__1;
for (<>s__6 = 0; <>s__6 < <>s__5.Length; <>s__6++)
{
<scrap>5__7 = <>s__5[<>s__6];
if (!<scrap>5__7.ItemScript.isInShipRoom && <scrap>5__7.ItemScript.isInFactory)
{
<randomValue>5__8 = Random.Range(0, 100);
if (<randomValue>5__8 < 45)
{
<scrap>5__7.Dimention = ParallaxDimention.Red;
<RedCount>5__2++;
}
else if (<randomValue>5__8 < 90)
{
<scrap>5__7.Dimention = ParallaxDimention.Blue;
<BlueCount>5__3++;
}
else
{
<scrap>5__7.Dimention = ParallaxDimention.None;
<NoneCount>5__4++;
}
ParallaxMod.Logger.LogDebug((object)$"Assigned scrap {((Object)<scrap>5__7).name} to dimension {<scrap>5__7.Dimention}");
<scrap>5__7 = null;
}
}
<>s__5 = null;
if (!((NetworkBehaviour)<>4__this).IsServer)
{
return false;
}
ParallaxMod.Logger.LogDebug((object)$"Scrap Dimension Assignment Complete: Red={<RedCount>5__2}, Blue={<BlueCount>5__3}, None={<NoneCount>5__4}. Syncing to clients...");
<>s__9 = <list>5__1;
<>s__10 = 0;
break;
case 1:
<>1__state = -1;
<scrap>5__11 = null;
<>s__10++;
break;
}
if (<>s__10 < <>s__9.Length)
{
<scrap>5__11 = <>s__9[<>s__10];
<netObjRef>5__12 = new NetworkObjectReference(((Component)<scrap>5__11.ItemScript).GetComponent<NetworkObject>());
<>4__this.SyncScrapDimentionClientRpc(<netObjRef>5__12, <scrap>5__11.Dimention);
<>2__current = (object)new WaitForSeconds(0.05f);
<>1__state = 1;
return true;
}
<>s__9 = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpawnRiftsRoutine>d__12 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ParallaxMoonController <>4__this;
private int <OutdoorRifts>5__1;
private int <IndoorRifts>5__2;
private int <i>5__3;
private int <i>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnRiftsRoutine>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<OutdoorRifts>5__1 = Random.Range(5, 15);
<i>5__3 = 0;
goto IL_0084;
case 1:
<>1__state = -1;
<i>5__3++;
goto IL_0084;
case 2:
{
<>1__state = -1;
<i>5__4++;
break;
}
IL_0084:
if (<i>5__3 < <OutdoorRifts>5__1)
{
<>4__this.SpawnRift();
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
<IndoorRifts>5__2 = Random.Range(10, 25);
<i>5__4 = 0;
break;
}
if (<i>5__4 < <IndoorRifts>5__2)
{
<>4__this.SpawnRift(Indoor: true);
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ParallaxMoonController Instance;
public GameObject RiftPrefab = null;
public ParallaxDimention CurrentDimention = ParallaxDimention.None;
public Dictionary<PlayerControllerB, ParallaxDimention> PlayerDimentions = new Dictionary<PlayerControllerB, ParallaxDimention>();
public List<ParallaxRift> Rifts = new List<ParallaxRift>();
public float RiftSpawnInterval = 4f;
private float RiftSpawnTimer = 0f;
private void Awake()
{
Instance = this;
}
public void Start()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
PlayerDimentions[val] = ParallaxDimention.None;
ParallaxPlayer parallaxPlayer = ((Component)val).gameObject.AddComponent<ParallaxPlayer>();
parallaxPlayer.playerController = val;
}
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
foreach (GrabbableObject val2 in array)
{
if ((Object)(object)((Component)val2).GetComponentInChildren<ParallaxGrabableObject>() == (Object)null)
{
ParallaxGrabableObject parallaxGrabableObject = ((Component)val2).gameObject.AddComponent<ParallaxGrabableObject>();
ParallaxDimentionVisibilty dimentionVisibilty = ((Component)val2).gameObject.AddComponent<ParallaxDimentionVisibilty>();
parallaxGrabableObject.DimentionVisibilty = dimentionVisibilty;
parallaxGrabableObject.ItemScript = val2;
}
}
((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnNewRoundStarted));
RiftPrefab = ParallaxMod.assetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/ParallaxMod/Prefabs/Rift.prefab");
}
private void OnNewRoundStarted()
{
if (((NetworkBehaviour)this).IsServer)
{
((MonoBehaviour)this).StartCoroutine(SendScrapToRandomDimensions());
((MonoBehaviour)this).StartCoroutine(SpawnRiftsRoutine());
}
((MonoBehaviour)this).StartCoroutine(DelayedTip());
}
[IteratorStateMachine(typeof(<SendScrapToRandomDimensions>d__10))]
private IEnumerator SendScrapToRandomDimensions()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SendScrapToRandomDimensions>d__10(0)
{
<>4__this = this
};
}
[ClientRpc]
public void SyncScrapDimentionClientRpc(NetworkObjectReference scrapRef, ParallaxDimention dimention)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(492679783u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref scrapRef, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref dimention, default(ForEnums));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 492679783u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val3 = default(NetworkObject);
if (((NetworkObjectReference)(ref scrapRef)).TryGet(ref val3, (NetworkManager)null))
{
GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
if ((Object)(object)component != (Object)null)
{
ParallaxGrabableObject component2 = ((Component)component).GetComponent<ParallaxGrabableObject>();
if ((Object)(object)component2 != (Object)null)
{
component2.Dimention = dimention;
ParallaxMod.Logger.LogDebug((object)$"Synchronized scrap {((Object)component).name} to dimension {dimention} on client.");
}
else
{
ParallaxMod.Logger.LogWarning((object)("Scrap " + ((Object)component).name + " does not have ParallaxDimentionVisibilty component."));
}
}
else
{
ParallaxMod.Logger.LogWarning((object)"NetworkObject is not a GrabbableObject.");
}
}
else
{
ParallaxMod.Logger.LogWarning((object)"Failed to resolve NetworkObjectReference.");
}
}
[IteratorStateMachine(typeof(<SpawnRiftsRoutine>d__12))]
private IEnumerator SpawnRiftsRoutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnRiftsRoutine>d__12(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DelayedTip>d__13))]
private IEnumerator DelayedTip()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedTip>d__13(0)
{
<>4__this = this
};
}
public void Update()
{
if (((NetworkBehaviour)this).IsServer)
{
RiftSpawnTimer += Time.deltaTime;
if (RiftSpawnTimer >= RiftSpawnInterval)
{
RiftSpawnTimer = 0f;
RiftSpawnInterval = Random.Range(10f, 20f);
SpawnRift(Random.value > 0.5f);
}
}
}
public void SpawnRift(bool Indoor = false)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
Scene sceneByName = SceneManager.GetSceneByName(RoundManager.Instance.currentLevel.sceneName);
GameObject val = (Indoor ? GameObject.FindGameObjectsWithTag("AINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("AINode").Length - 1)] : GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)]);
if ((Object)(object)val == (Object)null)
{
ParallaxMod.Logger.LogWarning((object)"No valid rift spawn points found.");
return;
}
GameObject val2 = Object.Instantiate<GameObject>(RiftPrefab, val.transform.position, val.transform.rotation);
SceneManager.MoveGameObjectToScene(val2, sceneByName);
val2.GetComponent<NetworkObject>().Spawn(false);
val2.GetComponent<ParallaxRift>().SetDimentionServerRpc((ParallaxDimention)Random.Range(0, 3));
if (Rifts.Count > 50)
{
((NetworkBehaviour)Rifts[0]).NetworkObject.Despawn(true);
Rifts.RemoveAt(0);
ParallaxMod.Logger.LogInfo((object)"Despawned oldest rift to maintain limit.");
}
ManualLogSource logger = ParallaxMod.Logger;
Vector3 position = val2.transform.position;
logger.LogDebug((object)("Spawned new rift at " + ((object)(Vector3)(ref position)).ToString()));
}
public override void OnDestroy()
{
((NetworkBehaviour)this).OnDestroy();
ParallaxMod.Logger.LogInfo((object)"ParallaxMoonController is being destroyed. Cleaning up...");
Object.Destroy((Object)(object)((Component)ParallaxPortalFX.instance.PortalVFX).gameObject);
ParallaxDimentionVisibilty[] array = Object.FindObjectsOfType<ParallaxDimentionVisibilty>();
foreach (ParallaxDimentionVisibilty parallaxDimentionVisibilty in array)
{
Object.Destroy((Object)(object)parallaxDimentionVisibilty);
}
ParallaxGrabableObject[] array2 = Object.FindObjectsOfType<ParallaxGrabableObject>();
foreach (ParallaxGrabableObject parallaxGrabableObject in array2)
{
Object.Destroy((Object)(object)parallaxGrabableObject);
}
ParallaxPlayer[] array3 = Object.FindObjectsOfType<ParallaxPlayer>();
foreach (ParallaxPlayer parallaxPlayer in array3)
{
Object.Destroy((Object)(object)parallaxPlayer);
}
ParallaxRift[] array4 = Object.FindObjectsOfType<ParallaxRift>();
foreach (ParallaxRift parallaxRift in array4)
{
if (((NetworkBehaviour)this).IsServer)
{
((NetworkBehaviour)parallaxRift).NetworkObject.Despawn(true);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void ChangeDimentionServerRpc(ParallaxDimention newDimention, ulong playerId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2902152007u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref newDimention, default(ForEnums));
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2902152007u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB playerByClientId = PlayerUtils.GetPlayerByClientId(playerId);
if (playerByClientId != null)
{
ChangeDimentionClientRpc(newDimention, playerId);
}
}
}
[ClientRpc]
public void ChangeDimentionClientRpc(ParallaxDimention newDimention, ulong playerId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3459425519u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref newDimention, default(ForEnums));
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3459425519u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB playerByClientId = PlayerUtils.GetPlayerByClientId(playerId);
if (playerByClientId != null)
{
ChangeDimention(newDimention, playerByClientId);
}
}
}
public void ChangeDimention(ParallaxDimention newDimention, PlayerControllerB player)
{
ParallaxMod.Logger.LogMessage((object)$"Player {player.playerUsername} changing dimention to {newDimention}");
if (((NetworkBehaviour)player).IsOwner)
{
ParallaxPortalFX.instance.TranitionToDimention(newDimention);
CurrentDimention = newDimention;
if (!ParallaxMod.GotParaTip && newDimention != 0)
{
HUDManager.Instance.DisplayTip("Dimensions", "Only items and fire exits are affect by dimensions. Players and Enemies are unaffected.", false, false, "LC_Tip1");
ParallaxMod.GotParaTip = true;
}
}
PlayerDimentions[player] = newDimention;
GrabbableObject[] itemSlots = player.ItemSlots;
foreach (GrabbableObject val in itemSlots)
{
if (!((Object)(object)val == (Object)null) && (Object)(object)((Component)val).GetComponentInChildren<ParallaxGrabableObject>() != (Object)null)
{
((Component)val).GetComponentInChildren<ParallaxGrabableObject>().Dimention = newDimention;
}
}
((Component)player).GetComponent<ParallaxPlayer>().UpdateDimention(newDimention);
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(492679783u, new RpcReceiveHandler(__rpc_handler_492679783), "SyncScrapDimentionClientRpc");
((NetworkBehaviour)this).__registerRpc(2902152007u, new RpcReceiveHandler(__rpc_handler_2902152007), "ChangeDimentionServerRpc");
((NetworkBehaviour)this).__registerRpc(3459425519u, new RpcReceiveHandler(__rpc_handler_3459425519), "ChangeDimentionClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_492679783(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference scrapRef = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref scrapRef, default(ForNetworkSerializable));
ParallaxDimention dimention = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref dimention, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxMoonController)(object)target).SyncScrapDimentionClientRpc(scrapRef, dimention);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2902152007(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ParallaxDimention newDimention = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref newDimention, default(ForEnums));
ulong playerId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxMoonController)(object)target).ChangeDimentionServerRpc(newDimention, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3459425519(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ParallaxDimention newDimention = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref newDimention, default(ForEnums));
ulong playerId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxMoonController)(object)target).ChangeDimentionClientRpc(newDimention, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ParallaxMoonController";
}
}
public class ParallaxPlayer : MonoBehaviour
{
public PlayerControllerB playerController = null;
public ParallaxDimention Dimention = ParallaxDimention.None;
public Dictionary<Renderer, Dictionary<Material, Color>> OriginalMaterials = new Dictionary<Renderer, Dictionary<Material, Color>>();
public InputAction QuickSwitchAction = null;
public InputAction QuickSwitchAction1 = null;
public InputAction QuickSwitchAction2 = null;
private void Start()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
if (!OriginalMaterials.ContainsKey(val))
{
OriginalMaterials[val] = new Dictionary<Material, Color>();
}
OriginalMaterials[val][val2] = val2.color;
}
}
}
private void LateUpdate()
{
}
public void UpdateDimention(ParallaxDimention newDimention)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
Dimention = newDimention;
switch (newDimention)
{
case ParallaxDimention.None:
ResetMaterials();
break;
case ParallaxDimention.Red:
SetMaterialColors(Color.red);
break;
case ParallaxDimention.Blue:
SetMaterialColors(Color.blue);
break;
}
}
public void SetMaterialColors(Color color)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
val2.color = color;
}
}
}
public void ResetMaterials()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Renderer, Dictionary<Material, Color>> originalMaterial in OriginalMaterials)
{
Renderer key = originalMaterial.Key;
foreach (KeyValuePair<Material, Color> item in originalMaterial.Value)
{
Material key2 = item.Key;
Color value = item.Value;
key2.color = value;
}
}
}
public void OnDestroy()
{
ResetMaterials();
}
}
public class ParallaxPortalFX : MonoBehaviour
{
[CompilerGenerated]
private sealed class <DelayedParenting>d__16 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ParallaxPortalFX <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedParenting>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((Component)<>4__this.PortalVFX).transform.SetParent(((Component)StartOfRound.Instance.localPlayerController.gameplayCamera).transform);
((Component)<>4__this.PortalVFX).transform.localPosition = new Vector3(0f, 0f, 1f);
((Component)<>4__this.PortalVFX).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
<>4__this.PortalVFX.Reinit();
<>4__this.PortalVFX.Stop();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <DoPortalEffect>d__20 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ParallaxDimention dimention;
public ParallaxPortalFX <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DoPortalEffect>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.PortalVFX.Play();
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.PortalVFX.Stop();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static ParallaxPortalFX instance;
public Volume RedDimentionFX = null;
public Volume BlueDimentionFX = null;
public Volume NoneDimentionFX = null;
public Volume TransitionFX = null;
public VolumeProfile RedTransitionProfile = null;
public VolumeProfile BlueTransitionProfile = null;
public VolumeProfile NoneTransitionProfile = null;
public Animator TransitionAnim = null;
public VisualEffect PortalVFX = null;
public AudioSource PortalSFX = null;
public ParallaxDimention CurrentDimention = ParallaxDimention.None;
private bool AutoVolSetPaused = true;
private bool firstTravel = true;
private void Awake()
{
if (!Application.isEditor)
{
instance = this;
}
}
private void Start()
{
if (!Application.isEditor)
{
((MonoBehaviour)this).StartCoroutine(DelayedParenting());
RedDimentionFX.weight = 0f;
BlueDimentionFX.weight = 0f;
NoneDimentionFX.weight = 0f;
}
}
[IteratorStateMachine(typeof(<DelayedParenting>d__16))]
private IEnumerator DelayedParenting()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedParenting>d__16(0)
{
<>4__this = this
};
}
private void LateUpdate()
{
if ((Object)(object)ParallaxMoonController.Instance != (Object)null)
{
CurrentDimention = ParallaxMoonController.Instance.CurrentDimention;
}
if (!AutoVolSetPaused)
{
switch (CurrentDimention)
{
case ParallaxDimention.None:
RedDimentionFX.weight = 0f;
BlueDimentionFX.weight = 0f;
NoneDimentionFX.weight = 1f;
break;
case ParallaxDimention.Red:
RedDimentionFX.weight = 1f;
BlueDimentionFX.weight = 0f;
NoneDimentionFX.weight = 0f;
break;
case ParallaxDimention.Blue:
RedDimentionFX.weight = 0f;
BlueDimentionFX.weight = 1f;
NoneDimentionFX.weight = 0f;
break;
}
}
}
public void TranitionToDimention(ParallaxDimention dimention)
{
PortalSFX.Play();
AutoVolSetPaused = true;
RedDimentionFX.weight = 0f;
BlueDimentionFX.weight = 0f;
NoneDimentionFX.weight = 0f;
switch (dimention)
{
case ParallaxDimention.None:
TransitionFX.profile = NoneTransitionProfile;
if (firstTravel)
{
firstTravel = false;
TransitionAnim.Play("TransitionToGrayFirst");
}
else
{
TransitionAnim.Play("TransitionToGray");
}
break;
case ParallaxDimention.Red:
TransitionFX.profile = RedTransitionProfile;
TransitionAnim.Play("TransitionToRed");
break;
case ParallaxDimention.Blue:
TransitionFX.profile = BlueTransitionProfile;
TransitionAnim.Play("TransitionToBlue");
break;
}
((MonoBehaviour)this).Invoke("EndTransition", 0.5f);
((MonoBehaviour)this).StartCoroutine(DoPortalEffect(dimention));
}
public void EndTransition()
{
AutoVolSetPaused = false;
}
[IteratorStateMachine(typeof(<DoPortalEffect>d__20))]
private IEnumerator DoPortalEffect(ParallaxDimention dimention)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DoPortalEffect>d__20(0)
{
<>4__this = this,
dimention = dimention
};
}
[ContextMenu("EditorDebugSwitch")]
public void EditorDebugSwitch()
{
CurrentDimention = (ParallaxDimention)((int)(CurrentDimention + 1) % 3);
TranitionToDimention((ParallaxDimention)((int)(CurrentDimention + 1) % 3));
}
}
public class ParallaxRift : NetworkBehaviour
{
public bool Ready = true;
public ParallaxDimention Dimention = ParallaxDimention.Red;
public Renderer Rend = null;
public AudioSource SFX = null;
public Animator Anim = null;
public Color NonePortalColor = new Color(0.5f, 0.5f, 0.5f, 0.25f);
public Color RedPortalColor = new Color(1f, 0f, 0f, 0.25f);
public Color BluePortalColor = new Color(0f, 0f, 1f, 0.25f);
private void Awake()
{
ParallaxMoonController.Instance.Rifts.Add(this);
}
private void Update()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
Anim.SetBool("Ready", Ready);
Color val = Color.white;
switch (Dimention)
{
case ParallaxDimention.Red:
val = RedPortalColor;
break;
case ParallaxDimention.Blue:
val = BluePortalColor;
break;
case ParallaxDimention.None:
val = NonePortalColor;
break;
}
Rend.material.color = val;
Rend.material.SetColor("_TransmittanceColor", val);
Rend.material.SetColor("_EmissiveColor", val * 2f);
if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.localPlayerController != (Object)null)
{
Vector3 val2 = ((Component)StartOfRound.Instance.localPlayerController).transform.position - ((Component)this).transform.position;
val2.y = 0f;
Quaternion val3 = Quaternion.LookRotation(val2);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, Time.deltaTime * 25f);
}
}
[ServerRpc]
public void SetDimentionServerRpc(ParallaxDimention NewDimention)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1513333524u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref NewDimention, default(ForEnums));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1513333524u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
SetDimentionClientRpc(NewDimention);
}
}
[ClientRpc]
public void SetDimentionClientRpc(ParallaxDimention NewDimention)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2323583756u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref NewDimention, default(ForEnums));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2323583756u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
Dimention = NewDimention;
}
}
}
public void OnTriggerEnter(Collider other)
{
if (!Ready || !((Component)other).CompareTag("Player"))
{
return;
}
PlayerControllerB componentInChildren = ((Component)other).GetComponentInChildren<PlayerControllerB>();
if (!((Object)(object)componentInChildren == (Object)null) && ((NetworkBehaviour)componentInChildren).IsOwner)
{
ParallaxDimention targetDimention = ParallaxDimention.None;
if (ParallaxMoonController.Instance.CurrentDimention != Dimention)
{
targetDimention = Dimention;
}
UsePortalServerRpc(((NetworkBehaviour)componentInChildren).OwnerClientId, targetDimention);
}
}
[ServerRpc(RequireOwnership = false)]
public void UsePortalServerRpc(ulong playerId, ParallaxDimention TargetDimention)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(983522424u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref TargetDimention, default(ForEnums));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 983522424u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
ParallaxMod.Logger.LogInfo((object)$"Rift (server): Player {playerId} is using portal to {TargetDimention}");
if (Object.op_Implicit((Object)(object)PlayerUtils.GetPlayerByClientId(playerId)))
{
UsePortalClientRpc(playerId, TargetDimention);
GameObject val3 = ((Random.value > 0.5f) ? GameObject.FindGameObjectsWithTag("AINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("AINode").Length - 1)] : GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)]);
MoveRiftClientRpc(val3.transform.position);
}
else
{
ParallaxMod.Logger.LogError((object)$"Rift: Player {playerId} not found!");
}
}
}
[ClientRpc]
public void UsePortalClientRpc(ulong playerId, ParallaxDimention TargetDimention)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1172661352u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((FastBufferWriter)(ref val2)).WriteValueSafe<ParallaxDimention>(ref TargetDimention, default(ForEnums));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1172661352u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB playerByClientId = PlayerUtils.GetPlayerByClientId(playerId);
if (!((Object)(object)playerByClientId == (Object)null))
{
ParallaxMod.Logger.LogInfo((object)$"Rift: Player {playerByClientId.playerUsername} is using portal to {TargetDimention}");
Ready = false;
SFX.Play();
Anim.SetTrigger("Use");
ParallaxMoonController.Instance.ChangeDimention(TargetDimention, playerByClientId);
((MonoBehaviour)this).Invoke("ResetRift", 7f);
}
}
}
[ClientRpc]
public void MoveRiftClientRpc(Vector3 NewPosition)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4239616031u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref NewPosition);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4239616031u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
((Component)this).transform.position = NewPosition;
}
}
}
public void ResetRift()
{
Ready = true;
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(1513333524u, new RpcReceiveHandler(__rpc_handler_1513333524), "SetDimentionServerRpc");
((NetworkBehaviour)this).__registerRpc(2323583756u, new RpcReceiveHandler(__rpc_handler_2323583756), "SetDimentionClientRpc");
((NetworkBehaviour)this).__registerRpc(983522424u, new RpcReceiveHandler(__rpc_handler_983522424), "UsePortalServerRpc");
((NetworkBehaviour)this).__registerRpc(1172661352u, new RpcReceiveHandler(__rpc_handler_1172661352), "UsePortalClientRpc");
((NetworkBehaviour)this).__registerRpc(4239616031u, new RpcReceiveHandler(__rpc_handler_4239616031), "MoveRiftClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_1513333524(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
ParallaxDimention dimentionServerRpc = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref dimentionServerRpc, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxRift)(object)target).SetDimentionServerRpc(dimentionServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2323583756(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ParallaxDimention dimentionClientRpc = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref dimentionClientRpc, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxRift)(object)target).SetDimentionClientRpc(dimentionClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_983522424(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong playerId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
ParallaxDimention targetDimention = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref targetDimention, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxRift)(object)target).UsePortalServerRpc(playerId, targetDimention);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1172661352(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong playerId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
ParallaxDimention targetDimention = default(ParallaxDimention);
((FastBufferReader)(ref reader)).ReadValueSafe<ParallaxDimention>(ref targetDimention, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxRift)(object)target).UsePortalClientRpc(playerId, targetDimention);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4239616031(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 newPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref newPosition);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ParallaxRift)(object)target).MoveRiftClientRpc(newPosition);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ParallaxRift";
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "NoteBoxz.ParallaxMod";
public const string PLUGIN_NAME = "ParallaxMod";
public const string PLUGIN_VERSION = "0.1.6";
}
}
namespace ParallaxMod.MoonPatches
{
[HarmonyPatch(typeof(GrabbableObject))]
public class GrabbableObjectPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPostfix(GrabbableObject __instance)
{
if (!((Object)(object)ParallaxMoonController.Instance == (Object)null) && !((Object)(object)((Component)__instance).GetComponentInChildren<ParallaxGrabableObject>() != (Object)null))
{
ParallaxGrabableObject parallaxGrabableObject = ((Component)__instance).gameObject.AddComponent<ParallaxGrabableObject>();
ParallaxDimentionVisibilty dimentionVisibilty = ((Component)__instance).gameObject.AddComponent<ParallaxDimentionVisibilty>();
parallaxGrabableObject.DimentionVisibilty = dimentionVisibilty;
parallaxGrabableObject.ItemScript = __instance;
ParallaxMod.Logger.LogInfo((object)("Added ParallaxDimentionVisibilty to " + ((Object)((Component)__instance).gameObject).name));
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
public class PlayerControllerBPatch
{
}
[HarmonyPatch(typeof(RoundManager))]
public class RoundManagerPatch
{
[HarmonyPatch("SetExitIDs")]
[HarmonyPostfix]
private static void SetExitIDsPostfix(RoundManager __instance)
{
if (!((Object)(object)ParallaxMoonController.Instance == (Object)null))
{
ParallaxEntranceTeleport[] array = Object.FindObjectsOfType<ParallaxEntranceTeleport>();
foreach (ParallaxEntranceTeleport parallaxEntranceTeleport in array)
{
parallaxEntranceTeleport.FindIndoorTeleport();
}
}
}
}
}
namespace ParallaxMod.Patches
{
[HarmonyPatch(typeof(GameNetworkManager))]
public class GameNetworkManagerPatch
{
public static bool HasRegistred;
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPostfix(GameNetworkManager __instance)
{
if (HasRegistred)
{
ParallaxMod.Logger.LogWarning((object)"ParallaxMod: Already registered prefabs to Network.");
return;
}
GameObject[] array = ParallaxMod.assetBundle.LoadAllAssets<GameObject>();
foreach (GameObject val in array)
{
if (!((Object)(object)val.GetComponent<NetworkObject>() == (Object)null) && ((Behaviour)val.GetComponent<NetworkObject>()).enabled)
{
((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(val);
ParallaxMod.Logger.LogInfo((object)("Registered Prefab to Network: " + ((Object)val).name));
}
}
HasRegistred = true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace NoteBoxz.ParallaxMod.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}