Decompiled source of Recede v0.1.1

NoteBoxz.RecedeMod.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using GameNetcodeStuff;
using HarmonyLib;
using LethalModDataLib.Attributes;
using Microsoft.CodeAnalysis;
using NoteBoxz.RecedeMod.NetcodePatcher;
using NotezyLib;
using NotezyLib.Utils;
using RecedeMod.MoonPatches;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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.RecedeMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("RecedeMod")]
[assembly: AssemblyTitle("NoteBoxz.RecedeMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 RecedeMod
{
	[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.RecedeMod", "RecedeMod", "0.1.1")]
	public class RecedeMod : BaseUnityPlugin
	{
		private readonly string targetSceneName = "NotezLevel4Recede";

		private bool isPatchActive = false;

		[ModData(/*Could not decode attribute arguments.*/)]
		public static bool VistedRecede;

		[ModData(/*Could not decode attribute arguments.*/)]
		public static bool SeenTimeTravelTip;

		public static RecedeMod 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.RecedeMod v0.1.1 has loaded!");
		}

		public static bool IsVFXRenderer(Renderer renderer)
		{
			if ((Object)(object)((Component)renderer).GetComponent<ParticleSystem>() != (Object)null)
			{
				return true;
			}
			Component component = ((Component)renderer).GetComponent("VisualEffect");
			if ((Object)(object)component != (Object)null)
			{
				return true;
			}
			if (renderer is ParticleSystemRenderer)
			{
				return true;
			}
			if (renderer is LineRenderer)
			{
				return true;
			}
			return false;
		}

		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, "recedespeicalassets");
			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.RecedeMod.dynamic");
			}
			IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes()
				where t.Namespace == "RecedeMod.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.RecedeMod.permanent");
			}
			Logger.LogDebug((object)"Patching permanent patches...");
			IEnumerable<Type> enumerable = from t in Assembly.GetExecutingAssembly().GetTypes()
				where t.Namespace == "RecedeMod.Patches"
				select t;
			foreach (Type item in enumerable)
			{
				PermanentHarmony.PatchAll(item);
			}
			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);
					}
				}
			}
		}

		public static void LogMessage(object message)
		{
			Logger.LogMessage(message);
		}

		public static void LogDebug(object message)
		{
			Logger.LogDebug(message);
		}

		public static void LogWarning(object message)
		{
			Logger.LogWarning(message);
		}

		public static void LogError(object message)
		{
			Logger.LogError(message);
		}

		public static void LogFatal(object message)
		{
			Logger.LogFatal(message);
		}

		public static void LogInfo(object message)
		{
			Logger.LogInfo(message);
		}
	}
	[ExecuteInEditMode]
	public class Clockhands : MonoBehaviour
	{
		public Transform HourHand = null;

		public Transform MinuteHand = null;

		public float HourHandDegreesPerHour = 30f;

		public float MinuteHandDegreesPerMinute = 6f;

		public float MinuteHandDegreesPerHour = 360f;

		public int NumberOfHours = 18;

		public float LengthOfHours = 60f;

		public float MaxTime = 1080f;

		public float RotationOffset = 0f;

		public float CurrentTime = 0f;

		public bool Running = false;

		public void Update()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (Running)
			{
				float num = CurrentTime / LengthOfHours % (float)NumberOfHours;
				float num2 = CurrentTime % LengthOfHours / LengthOfHours * 60f;
				float num3 = (0f - num) * HourHandDegreesPerHour + RotationOffset;
				float num4 = (0f - num2) * MinuteHandDegreesPerMinute + RotationOffset;
				if (Application.isEditor)
				{
					HourHand.localRotation = Quaternion.Euler(0f, 0f, num3);
					MinuteHand.localRotation = Quaternion.Euler(0f, 0f, num4);
				}
				else
				{
					HourHand.localRotation = Quaternion.Slerp(HourHand.localRotation, Quaternion.Euler(0f, 0f, num3), Time.deltaTime * 14f);
					MinuteHand.localRotation = Quaternion.Slerp(MinuteHand.localRotation, Quaternion.Euler(0f, 0f, num4), Time.deltaTime * 14f);
				}
			}
		}
	}
	public class RecedeEnemy : MonoBehaviour
	{
		public float NormalizedExistanceTime;

		public EnemyAI ai = null;

		public RecedeVisibilty visibility = null;

		private Vector3 initalPosition;

		private Quaternion initalRotation;

		public string SpawnAnimationName = "";

		public void Start()
		{
			//IL_0008: 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_0019: 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_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)
			initalPosition = ((Component)this).transform.position;
			initalRotation = ((Component)this).transform.rotation;
			if ((Object)(object)ai.creatureAnimator != (Object)null)
			{
				AnimatorStateInfo currentAnimatorStateInfo = ai.creatureAnimator.GetCurrentAnimatorStateInfo(0);
				SpawnAnimationName = (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("") ? "" : ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash.ToString());
			}
		}

		public void FixedUpdate()
		{
			visibility.NormalizedExistanceTime = NormalizedExistanceTime;
		}
	}
	public class RecedeMoonController : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayedTip>d__19 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RecedeMoonController <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayedTip>d__19(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 (!RecedeMod.VistedRecede)
					{
						HUDManager.Instance.DisplayTip("Welcome to Recede!", "Entities that appear as echo ghosts won't be able to interact with you", false, false, "LC_Tip1");
					}
					RecedeMod.VistedRecede = 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();
			}
		}

		[CompilerGenerated]
		private sealed class <WaitSetExistanceForAllEnemies>d__22 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RecedeMoonController <>4__this;

			private RecedeEnemy[] <>s__1;

			private int <>s__2;

			private RecedeEnemy <recedeEnemy>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitSetExistanceForAllEnemies>d__22(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<recedeEnemy>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					RecedeMod.LogMessage("RecedeMod: Setting existance times for all enemies...");
					<>s__1 = Object.FindObjectsOfType<RecedeEnemy>();
					<>s__2 = 0;
					break;
				case 2:
					<>1__state = -1;
					<recedeEnemy>5__3 = null;
					<>s__2++;
					break;
				}
				if (<>s__2 < <>s__1.Length)
				{
					<recedeEnemy>5__3 = <>s__1[<>s__2];
					<>4__this.AssignRecedeEnemyToExistance(<recedeEnemy>5__3);
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				}
				<>s__1 = 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();
			}
		}

		[Header("Recede Moon Settings")]
		public RecedePlayer LocalPlayer = null;

		public RecedeTimeMachine timeMachine = null;

		public List<RecedePlayer> AllRecedePlayers = new List<RecedePlayer>();

		[Header("Recede Moon HUD Elements")]
		public HUDElement Clock2 = null;

		public GameObject Clock2Instance = null;

		public Animator Clock2Animator = null;

		public TMP_Text clockNumber2 = null;

		public Image clockIcon2 = null;

		public bool clock2Enabled = false;

		public bool preSpawnedAllEnemies = false;

		public Animator TransitionAnim = null;

		private bool BSETrueWhenStart = false;

		[Header("Debug Settings")]
		private bool showDebugMenu = false;

		private Rect debugWindowRect = new Rect(20f, 20f, 350f, 400f);

		private Vector2 scrollPosition;

		private GUIStyle headerStyle = null;

		private GUIStyle errorStyle = null;

		private GUIStyle textInputStyle = null;

		private GUIStyle toggleStyle = null;

		private Texture2D toggleOnTexture = null;

		private Texture2D toggleOffTexture = null;

		private bool stylesInitialized = false;

		private string timeOffsetInput = "0";

		private bool DTMMM = false;

		public static bool debugMode;

		public static RecedeMoonController Instance { get; private set; }

		public void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public void Start()
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected O, but got Unknown
			GameObject val = RecedeMod.assetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/RecedeMod/Prefabs/RecedeRealProfitQuota.prefab");
			Clock2Instance = Object.Instantiate<GameObject>(val, HUDManager.Instance.HUDContainer.transform);
			((Object)Clock2Instance).name = "RecedeClock";
			Clock2Animator = Clock2Instance.GetComponentInChildren<Animator>();
			clockNumber2 = ((Component)Clock2Instance.transform.Find("Container/Box/TimeNumber")).gameObject.GetComponent<TMP_Text>();
			clockIcon2 = ((Component)Clock2Instance.transform.Find("Container/Box/Image")).gameObject.GetComponent<Image>();
			Clock2 = new HUDElement();
			Clock2.canvasGroup = Clock2Instance.GetComponent<CanvasGroup>();
			HUDManager.Instance.HUDElements = Extensions.AddToArray<HUDElement>(HUDManager.Instance.HUDElements, Clock2);
			RecedeMod.LogInfo("RecedeMod: Added second clock to HUD");
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				RecedePlayer recedePlayer = ((Component)val2).gameObject.AddComponent<RecedePlayer>();
				recedePlayer.playerController = val2;
				recedePlayer.visibility = ((Component)val2).gameObject.AddComponent<RecedeVisibilty>();
				GameObject gameObject = ((Component)((Component)val2).transform.Find("ScavengerModel")).gameObject;
				if ((Object)(object)gameObject != (Object)null)
				{
					recedePlayer.visibility.GameObjects.Add(new RecedeVisGameObject(gameObject, ((Component)this).gameObject.activeSelf));
				}
				else
				{
					RecedeMod.LogError("RecedeMod: Could not find ScavengerModel on player " + val2.playerUsername);
				}
				recedePlayer.visibility.HiddenMaterial = RecedeMod.assetBundle.LoadAsset<Material>("Assets/LethalCompany/Mods/RecedeMod/Materials/BaseEchoMaterial.mat");
				recedePlayer.visibility.HideMethod = RecedeHideMethod.ChangeMaterial;
				if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)val2)
				{
					LocalPlayer = recedePlayer;
				}
				AllRecedePlayers.Add(recedePlayer);
			}
			timeMachine = Object.FindObjectOfType<RecedeTimeMachine>();
			((Component)TransitionAnim).transform.SetParent(((Component)StartOfRound.Instance.localPlayerController.gameplayCamera).transform);
			((Component)TransitionAnim).transform.localPosition = new Vector3(0f, 0f, 1f);
			((Component)TransitionAnim).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			BSETrueWhenStart = RoundManager.Instance.begunSpawningEnemies;
			((UnityEvent)StartOfRound.Instance.StartNewRoundEvent).AddListener(new UnityAction(OnNewRoundStarted));
		}

		private void OnNewRoundStarted()
		{
			((MonoBehaviour)this).StartCoroutine(DelayedTip());
		}

		[IteratorStateMachine(typeof(<DelayedTip>d__19))]
		private IEnumerator DelayedTip()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedTip>d__19(0)
			{
				<>4__this = this
			};
		}

		private void Update()
		{
			Clock2Animator.SetBool("visible", HUDManager.Instance.quotaAnimator.GetBool("visible") && clock2Enabled);
			Clock2.targetAlpha = ((LocalPlayer.CurrentTimeline == RecedeTimeline.Present) ? 0f : HUDManager.Instance.Clock.targetAlpha);
			if (BSETrueWhenStart && !RoundManager.Instance.begunSpawningEnemies)
			{
				BSETrueWhenStart = false;
			}
			if (!BSETrueWhenStart && !preSpawnedAllEnemies && RoundManager.Instance.begunSpawningEnemies)
			{
				PrespawnEnemies();
				preSpawnedAllEnemies = true;
			}
		}

		public void PrespawnEnemies()
		{
			RoundManager instance = RoundManager.Instance;
			RecedeMod.LogMessage("RecedeMod: Pre-spawning enemies...");
			int currentHour = instance.currentHour;
			for (int i = 0; i < TimeOfDay.Instance.numberOfHours; i++)
			{
				instance.currentHour += instance.hourTimeBetweenEnemySpawnBatches;
				instance.SpawnDaytimeEnemiesOutside();
				instance.SpawnEnemiesOutside();
				for (int j = 0; j < instance.allEnemyVents.Length; j++)
				{
					if (instance.allEnemyVents[j].occupied)
					{
						RecedeMod.LogInfo("Found enemy vent which has its time up: " + ((Object)((Component)instance.allEnemyVents[j]).gameObject).name + ". Spawning " + instance.allEnemyVents[j].enemyType.enemyName + " from vent.");
						instance.SpawnEnemyFromVent(instance.allEnemyVents[j]);
					}
				}
				if (instance.allEnemyVents.Length != 0 && !instance.cannotSpawnMoreInsideEnemies)
				{
					if (StartOfRound.Instance.connectedPlayersAmount + 1 > 0 && TimeOfDay.Instance.daysUntilDeadline <= 2 && (((float)(instance.valueOfFoundScrapItems / TimeOfDay.Instance.profitQuota) > 0.8f && TimeOfDay.Instance.normalizedTimeOfDay > 0.3f) || (float)instance.valueOfFoundScrapItems / instance.totalScrapValueInLevel > 0.65f || StartOfRound.Instance.daysPlayersSurvivedInARow >= 5) && instance.minEnemiesToSpawn == 0)
					{
						RecedeMod.LogInfo("Min enemy spawn chance per hour set to 1!!!");
						instance.minEnemiesToSpawn = 1;
					}
					instance.PlotOutEnemiesForNextHour();
				}
				else
				{
					RecedeMod.LogInfo($"Could not spawn more enemies; vents #: {instance.allEnemyVents.Length}. CannotSpawnMoreInsideEnemies: {instance.cannotSpawnMoreInsideEnemies}");
				}
			}
			instance.currentHour = currentHour;
			((MonoBehaviour)this).StartCoroutine(WaitSetExistanceForAllEnemies());
		}

		[IteratorStateMachine(typeof(<WaitSetExistanceForAllEnemies>d__22))]
		public IEnumerator WaitSetExistanceForAllEnemies()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitSetExistanceForAllEnemies>d__22(0)
			{
				<>4__this = this
			};
		}

		public void AssignRecedeEnemyToExistance(RecedeEnemy recedeEnemy, bool forceRandom = false)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			float normalizedExistanceTime = Mathf.Clamp(Random.value, 0.15f, 0.9f);
			if (RecedeTimeOfDay.Instance.trueCurrentDayTime > 120f && !forceRandom)
			{
				normalizedExistanceTime = RecedeTimeOfDay.Instance.trueNormalizedTimeOfDay;
			}
			SyncEnemyExistanceClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)recedeEnemy.ai).NetworkObject), normalizedExistanceTime);
		}

		[ClientRpc]
		public void SyncEnemyExistanceClientRpc(NetworkObjectReference enemyNetworkObject, float normalizedExistanceTime)
		{
			//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(48585203u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyNetworkObject, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref normalizedExistanceTime, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 48585203u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				RecedeEnemy recedeEnemy = default(RecedeEnemy);
				if (((NetworkObjectReference)(ref enemyNetworkObject)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<RecedeEnemy>(ref recedeEnemy))
				{
					recedeEnemy.NormalizedExistanceTime = normalizedExistanceTime;
					recedeEnemy.visibility.NormalizedExistanceTime = normalizedExistanceTime;
					RecedeMod.LogInfo($"RecedeEnemy {((Object)recedeEnemy.ai).name} synced with NormalizedExistanceTime: {normalizedExistanceTime}");
				}
				else
				{
					RecedeMod.LogError("Failed to sync RecedeEnemy: NetworkObjectReference is invalid or does not contain a RecedeEnemy component.");
				}
			}
		}

		[ClientRpc]
		public void DropSpesficItemOnplayerClientRpc(ulong PlayerID, int SlotIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: 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(2573467411u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, PlayerID);
				BytePacker.WriteValueBitPacked(val2, SlotIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2573467411u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB playerByClientId = PlayerUtils.GetPlayerByClientId(PlayerID);
			if ((Object)(object)playerByClientId == (Object)null)
			{
				return;
			}
			GrabbableObject val3 = playerByClientId.ItemSlots[SlotIndex];
			if ((Object)(object)val3 == (Object)null)
			{
				RecedeMod.LogWarning($"Player {playerByClientId.playerUsername} does not have an item in slot {SlotIndex} to drop.");
				return;
			}
			val3.parentObject = null;
			val3.heldByPlayerOnServer = false;
			val3.EnablePhysics(true);
			val3.EnableItemMeshes(true);
			((Component)val3).transform.localScale = val3.originalScale;
			val3.isHeld = false;
			val3.isPocketed = false;
			Debug.Log((object)$"Drop spsefic held item A {val3.startFallingPosition}; item parent: {((Component)val3).transform.parent}; {((Component)val3).transform.parent.InverseTransformPoint(((Component)val3).transform.position)}; {((Component)val3).transform.position}");
			Debug.DrawRay(((Component)val3).transform.position, Vector3.up, Color.red, 25f);
			val3.startFallingPosition = ((Component)val3).transform.parent.InverseTransformPoint(((Component)val3).transform.position);
			val3.FallToGround(true, false, default(Vector3));
			val3.fallTime = Random.Range(-0.3f, 0.05f);
			if (((NetworkBehaviour)playerByClientId).IsOwner)
			{
				val3.DiscardItem();
				SyncBatteryForItemServerRpc((int)(val3.insertedBattery.charge * 100f), NetworkObjectReference.op_Implicit(((NetworkBehaviour)val3).NetworkObject));
			}
			else if (!val3.itemProperties.syncDiscardFunction)
			{
				val3.playerHeldBy = null;
			}
			else
			{
				val3.DiscardItem();
			}
			if (((NetworkBehaviour)playerByClientId).IsOwner)
			{
				((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
				((Behaviour)HUDManager.Instance.itemSlotIcons[SlotIndex]).enabled = false;
				HUDManager.Instance.ClearControlTips();
			}
			playerByClientId.ItemSlots[SlotIndex] = null;
			if ((Object)(object)playerByClientId.currentlyHeldObjectServer == (Object)(object)val3)
			{
				playerByClientId.isHoldingObject = false;
				if ((Object)(object)playerByClientId.currentlyHeldObjectServer != (Object)null)
				{
					playerByClientId.SetSpecialGrabAnimationBool(false, playerByClientId.currentlyHeldObjectServer);
				}
				playerByClientId.playerBodyAnimator.SetBool("cancelHolding", true);
				playerByClientId.playerBodyAnimator.SetTrigger("Throw");
			}
			playerByClientId.activatingItem = false;
			playerByClientId.twoHanded = false;
			playerByClientId.carryWeight = 1f;
			playerByClientId.currentlyHeldObjectServer = null;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncBatteryForItemServerRpc(int charge, NetworkObjectReference itemNetworkObject)
		{
			//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_00f1: 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.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1426002861u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, charge);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1426002861u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SyncBatteryForItemClientRpc(charge, itemNetworkObject);
				}
			}
		}

		[ClientRpc]
		public void SyncBatteryForItemClientRpc(int charge, NetworkObjectReference itemNetworkObject)
		{
			//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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			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(1802225486u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, charge);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1802225486u, 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);
			GrabbableObject val4 = default(GrabbableObject);
			if (((NetworkObjectReference)(ref itemNetworkObject)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<GrabbableObject>(ref val4))
			{
				if (val4.insertedBattery != null)
				{
					float num = (float)charge / 100f;
					val4.insertedBattery = new Battery(num <= 0f, num);
					val4.ChargeBatteries();
					RecedeMod.LogInfo($"Synced battery charge for item {((Object)((Component)val4).gameObject).name} to {charge}%");
				}
				else
				{
					RecedeMod.LogWarning("Item " + ((Object)((Component)val4).gameObject).name + " does not have an inserted battery to sync.");
				}
			}
			else
			{
				RecedeMod.LogError("Failed to sync battery: NetworkObjectReference is invalid or does not contain a GrabbableObject component.");
			}
		}

		public void SetClock2(float timeNormalized, float numberOfHours)
		{
			if (!((Object)(object)Clock2Instance == (Object)null) && !((Object)(object)clockNumber2 == (Object)null))
			{
				string formmatedTime = RecedeTimeOfDay.Instance.GetFormmatedTime(timeNormalized, numberOfHours, createNewLine: false);
				clockNumber2.text = formmatedTime;
			}
		}

		public void SetClockIcon2(DayMode dayMode)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			clockIcon2.sprite = HUDManager.Instance.clockIcons[dayMode];
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
			if ((Object)(object)Clock2Instance != (Object)null)
			{
				HUDManager.Instance.HUDElements = Extensions.RemoveFromArray<HUDElement>(HUDManager.Instance.HUDElements, Clock2);
				Object.Destroy((Object)(object)Clock2Instance);
				RecedeMod.LogInfo("RecedeMod: Removed second clock from HUD");
			}
			foreach (RecedePlayer allRecedePlayer in AllRecedePlayers)
			{
				if ((Object)(object)allRecedePlayer != (Object)null)
				{
					Object.Destroy((Object)(object)allRecedePlayer.visibility);
					Object.Destroy((Object)(object)allRecedePlayer);
				}
			}
			RecedeEnemy[] array = Object.FindObjectsOfType<RecedeEnemy>();
			foreach (RecedeEnemy recedeEnemy in array)
			{
				Object.Destroy((Object)(object)recedeEnemy.visibility);
				Object.Destroy((Object)(object)recedeEnemy);
			}
			Object.Destroy((Object)(object)((Component)TransitionAnim).gameObject);
			if ((Object)(object)toggleOnTexture != (Object)null)
			{
				Object.Destroy((Object)(object)toggleOnTexture);
			}
			if ((Object)(object)toggleOffTexture != (Object)null)
			{
				Object.Destroy((Object)(object)toggleOffTexture);
			}
		}

		public void OnGUI()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Invalid comparison between Unknown and I4
			//IL_003d: 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)
			//IL_0058: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!debugMode)
			{
				return;
			}
			if (showDebugMenu)
			{
				if (!stylesInitialized)
				{
					InitializeStyles();
					stylesInitialized = true;
				}
				debugWindowRect = GUI.Window(0, debugWindowRect, new WindowFunction(DrawDebugWindow), "Recede Moon Debug Menu");
			}
			if ((int)Event.current.type == 4 && (int)Event.current.keyCode == 100 && Event.current.control)
			{
				showDebugMenu = !showDebugMenu;
			}
		}

		private void InitializeStyles()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Expected O, but got Unknown
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			headerStyle = new GUIStyle(GUI.skin.label);
			headerStyle.fontStyle = (FontStyle)1;
			errorStyle = new GUIStyle(GUI.skin.label);
			errorStyle.normal.textColor = Color.red;
			textInputStyle = new GUIStyle(GUI.skin.textField);
			textInputStyle.fontSize = 14;
			textInputStyle.padding = new RectOffset(5, 5, 5, 5);
			textInputStyle.margin = new RectOffset(5, 5, 5, 5);
			textInputStyle.alignment = (TextAnchor)3;
			textInputStyle.wordWrap = false;
			textInputStyle.fixedHeight = 30f;
			textInputStyle.stretchWidth = true;
			textInputStyle.stretchHeight = false;
			textInputStyle.normal.background = Texture2D.whiteTexture;
			textInputStyle.normal.textColor = Color.white;
			textInputStyle.focused.background = Texture2D.whiteTexture;
			textInputStyle.focused.textColor = Color.white;
			textInputStyle.hover.background = Texture2D.whiteTexture;
			textInputStyle.hover.textColor = Color.white;
			textInputStyle.active.background = Texture2D.whiteTexture;
			textInputStyle.active.textColor = Color.white;
			textInputStyle.border = new RectOffset(5, 5, 5, 5);
			textInputStyle.contentOffset = new Vector2(0f, 0f);
			textInputStyle.clipping = (TextClipping)0;
			toggleStyle = new GUIStyle(GUI.skin.toggle);
			toggleStyle.fontSize = 14;
			toggleStyle.padding = new RectOffset(5, 5, 5, 5);
			toggleStyle.margin = new RectOffset(5, 5, 5, 5);
			toggleStyle.alignment = (TextAnchor)3;
			toggleStyle.wordWrap = false;
			toggleStyle.fixedHeight = 30f;
			toggleStyle.stretchWidth = true;
			toggleStyle.stretchHeight = false;
			toggleOffTexture = new Texture2D(1, 1);
			toggleOffTexture.SetPixel(0, 0, new Color(0.35f, 0.35f, 0.35f, 1f));
			toggleOffTexture.Apply();
			toggleOnTexture = new Texture2D(1, 1);
			toggleOnTexture.SetPixel(0, 0, Color.red);
			toggleOnTexture.Apply();
			toggleStyle.normal.background = toggleOffTexture;
			toggleStyle.normal.textColor = Color.white;
			toggleStyle.onNormal.background = toggleOnTexture;
			toggleStyle.onNormal.textColor = Color.black;
			toggleStyle.focused.background = toggleOffTexture;
			toggleStyle.focused.textColor = Color.white;
			toggleStyle.onFocused.background = toggleOnTexture;
			toggleStyle.onFocused.textColor = Color.black;
			toggleStyle.hover.background = toggleOffTexture;
			toggleStyle.hover.textColor = Color.white;
			toggleStyle.onHover.background = toggleOnTexture;
			toggleStyle.onHover.textColor = Color.black;
			toggleStyle.active.background = toggleOffTexture;
			toggleStyle.active.textColor = Color.white;
			toggleStyle.onActive.background = toggleOnTexture;
			toggleStyle.onActive.textColor = Color.black;
			toggleStyle.border = new RectOffset(5, 5, 5, 5);
			toggleStyle.contentOffset = new Vector2(0f, 0f);
			toggleStyle.clipping = (TextClipping)0;
		}

		private void DrawDebugWindow(int windowID)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			GUI.backgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.9f);
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Show Debug Menu (Ctrl+D):", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
			showDebugMenu = GUILayout.Toggle(showDebugMenu, "", Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label("Time Information", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Current N Time: {TimeOfDay.Instance.normalizedTimeOfDay:F4}", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Current D Time: {TimeOfDay.Instance.currentDayTime}", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Current Clock: " + ((TMP_Text)HUDManager.Instance.clockNumber).text.Replace("\n", " "), Array.Empty<GUILayoutOption>());
			GUILayout.Label($"True N Time: {RecedeTimeOfDay.Instance.trueNormalizedTimeOfDay:F4}", Array.Empty<GUILayoutOption>());
			GUILayout.Label($"True D Time: {RecedeTimeOfDay.Instance.trueCurrentDayTime}", Array.Empty<GUILayoutOption>());
			GUILayout.Label("True Clock: " + clockNumber2.text.Replace("\n", " "), Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Timeline: {LocalPlayer.CurrentTimeline}", Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.Label("Time Controls", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Time Travel Offset (seconds):", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			timeOffsetInput = GUILayout.TextField(timeOffsetInput, textInputStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!float.TryParse(timeOffsetInput, out var result))
			{
				GUILayout.Label("Invalid input. Please enter a valid number.", errorStyle, Array.Empty<GUILayoutOption>());
			}
			if (GUILayout.Button("Time Travel " + RecedeTimeOfDay.Instance.GetFormmatedTime((RecedeTimeOfDay.Instance.trueCurrentDayTime + result) / TimeOfDay.Instance.totalTime, TimeOfDay.Instance.numberOfHours, createNewLine: false), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }))
			{
				RecedeTimeOfDay.Instance.TimeTravel(result);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				DTMMM = GUILayout.Toggle(DTMMM, "Disable Time Machine", toggleStyle, Array.Empty<GUILayoutOption>());
				timeMachine.Disabled.Value = DTMMM;
			}
			GUILayout.EndScrollView();
			GUI.DragWindow();
		}

		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
			((NetworkBehaviour)this).__registerRpc(48585203u, new RpcReceiveHandler(__rpc_handler_48585203), "SyncEnemyExistanceClientRpc");
			((NetworkBehaviour)this).__registerRpc(2573467411u, new RpcReceiveHandler(__rpc_handler_2573467411), "DropSpesficItemOnplayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(1426002861u, new RpcReceiveHandler(__rpc_handler_1426002861), "SyncBatteryForItemServerRpc");
			((NetworkBehaviour)this).__registerRpc(1802225486u, new RpcReceiveHandler(__rpc_handler_1802225486), "SyncBatteryForItemClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_48585203(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 enemyNetworkObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyNetworkObject, default(ForNetworkSerializable));
				float normalizedExistanceTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref normalizedExistanceTime, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeMoonController)(object)target).SyncEnemyExistanceClientRpc(enemyNetworkObject, normalizedExistanceTime);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2573467411(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerID = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
				int slotIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref slotIndex);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeMoonController)(object)target).DropSpesficItemOnplayerClientRpc(playerID, slotIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1426002861(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_0060: 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)
			{
				int charge = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref charge);
				NetworkObjectReference itemNetworkObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeMoonController)(object)target).SyncBatteryForItemServerRpc(charge, itemNetworkObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1802225486(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_0060: 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)
			{
				int charge = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref charge);
				NetworkObjectReference itemNetworkObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeMoonController)(object)target).SyncBatteryForItemClientRpc(charge, itemNetworkObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RecedeMoonController";
		}
	}
	[Serializable]
	public struct RecedePlayerSnapshot
	{
		public Vector3 position;

		public Quaternion rotation;

		public bool isInsideFactory;

		public bool isInShip;

		public Transform LastPlayerPhysicsParent;

		public Vector3 LocalPositionInPhysicsParent;

		public RecedePlayerSnapshot(RecedePlayer recedePlayer)
		{
			//IL_0008: 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_0019: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			position = ((Component)recedePlayer).transform.position;
			rotation = ((Component)recedePlayer).transform.rotation;
			isInsideFactory = recedePlayer.playerController.isInsideFactory;
			isInShip = recedePlayer.playerController.isInHangarShipRoom;
			LastPlayerPhysicsParent = recedePlayer.playerController.physicsParent;
			LocalPositionInPhysicsParent = ((Component)recedePlayer.playerController).transform.localPosition;
		}
	}
	public class RecedePlayer : MonoBehaviour
	{
		public RecedeTimeline CurrentTimeline = RecedeTimeline.Present;

		public PlayerControllerB playerController = null;

		public RecedeVisibilty visibility = null;

		public float TimeTravelOffset = 0f;

		public RecedePlayerSnapshot pastSnapshot;

		private RecedeTimeline lastTimeline = RecedeTimeline.Present;

		public float NormalizedTimeOfDay => (TimeOfDay.Instance.currentDayTime + TimeTravelOffset) / TimeOfDay.Instance.totalTime;

		public void Start()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			visibility.OnTimelineChanged.AddListener(new UnityAction(FixSuit));
		}

		public void Update()
		{
			visibility.CurrentTimeline = CurrentTimeline;
			if (lastTimeline != CurrentTimeline)
			{
				lastTimeline = CurrentTimeline;
				FixSpectate();
			}
		}

		public void FixSuit()
		{
			if (!visibility.isVisible || playerController.currentSuitID == 0)
			{
				return;
			}
			RecedeMod.LogInfo($"[Recede] Fixing suit for player {playerController.playerUsername}, CurrentSuitID: {playerController.currentSuitID}");
			bool flag = false;
			UnlockableSuit[] array = Object.FindObjectsOfType<UnlockableSuit>();
			foreach (UnlockableSuit val in array)
			{
				if (val.suitID == playerController.currentSuitID)
				{
					RecedeMod.LogInfo($"[Recede] Found suit {((Object)((Component)val).gameObject).name} with ID {val.suitID} for player {playerController.playerUsername}");
					UnlockableSuit.SwitchSuitForPlayer(playerController, val.suitID, true);
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				RecedeMod.LogWarning($"[Recede] Could not find suit with ID {playerController.currentSuitID} for player {playerController.playerUsername}");
			}
		}

		public void FixSpectate()
		{
			if (!((NetworkBehaviour)playerController).IsOwner && StartOfRound.Instance.localPlayerController.isPlayerDead && (Object)(object)StartOfRound.Instance.localPlayerController.spectatedPlayerScript == (Object)(object)playerController)
			{
				StartOfRound.Instance.localPlayerController.SetSpectatedPlayerEffects(false);
				RecedeMod.LogInfo("[Recede] Fixed spectate for player " + playerController.playerUsername);
			}
		}

		public void DistableEnableVC()
		{
			try
			{
				if (!((Object)(object)RecedeMoonController.Instance.LocalPlayer == (Object)(object)playerController) && playerController.isPlayerControlled && CurrentTimeline != RecedeMoonController.Instance.LocalPlayer.CurrentTimeline)
				{
					playerController.voicePlayerState.Volume = 0f;
				}
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"[Recede] Error in DistableEnableVC: {arg}");
			}
		}

		public void UpdatePastPositions()
		{
			pastSnapshot = new RecedePlayerSnapshot(this);
		}

		public void ApplyPastPositions()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			Vector3 val = pastSnapshot.position;
			if ((Object)(object)pastSnapshot.LastPlayerPhysicsParent != (Object)null)
			{
				val = pastSnapshot.LastPlayerPhysicsParent.TransformPoint(pastSnapshot.LocalPositionInPhysicsParent);
			}
			playerController.TeleportPlayer(val, true, ((Quaternion)(ref pastSnapshot.rotation)).eulerAngles.y, false, true);
			PlayerUtils.SetPlayerInside(playerController, pastSnapshot.isInsideFactory);
			playerController.isInHangarShipRoom = pastSnapshot.isInShip;
		}

		public List<RecedePlayer> PlayersHudelingWith()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			List<RecedePlayer> list = new List<RecedePlayer>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)(object)playerController) && Vector3.Distance(((Component)val).transform.position, ((Component)playerController).transform.position) <= 3f)
				{
					RecedePlayer component = ((Component)val).GetComponent<RecedePlayer>();
					if ((Object)(object)component != (Object)null)
					{
						list.Add(component);
					}
				}
			}
			return list;
		}

		public bool IsInPastByTimeline(RecedeTimeline timeline)
		{
			return timeline switch
			{
				RecedeTimeline.Future => CurrentTimeline == RecedeTimeline.Present || CurrentTimeline == RecedeTimeline.Past, 
				RecedeTimeline.Present => CurrentTimeline == RecedeTimeline.Past, 
				RecedeTimeline.Past => false, 
				_ => throw new ArgumentOutOfRangeException("timeline", timeline, null), 
			};
		}

		public bool IsInFutureByTimeline(RecedeTimeline timeline)
		{
			return timeline switch
			{
				RecedeTimeline.Past => CurrentTimeline == RecedeTimeline.Present || CurrentTimeline == RecedeTimeline.Future, 
				RecedeTimeline.Present => CurrentTimeline == RecedeTimeline.Future, 
				RecedeTimeline.Future => false, 
				_ => throw new ArgumentOutOfRangeException("timeline", timeline, null), 
			};
		}

		public Vector3 PredictFuturePosition(float secondsInFuture)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = ((Component)this).transform.position;
			int num = 0;
			bool isInsideFactory = playerController.isInsideFactory;
			bool isInHangarShipRoom = playerController.isInHangarShipRoom;
			EntranceTeleport val = null;
			GrabbableObject[] itemSlots = playerController.ItemSlots;
			foreach (GrabbableObject val2 in itemSlots)
			{
				if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.itemProperties == (Object)null) && val2.itemProperties.isScrap)
				{
					num++;
				}
			}
			if (isInsideFactory)
			{
				EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
				foreach (EntranceTeleport val3 in array)
				{
					if (!val3.isEntranceToBuilding && Vector3.Distance(((Component)val3).transform.position, ((Component)playerController).transform.position) < 25f)
					{
						val = val3;
						break;
					}
				}
			}
			else
			{
				EntranceTeleport[] array2 = Object.FindObjectsOfType<EntranceTeleport>();
				foreach (EntranceTeleport val4 in array2)
				{
					if (val4.isEntranceToBuilding && Vector3.Distance(((Component)val4).transform.position, ((Component)playerController).transform.position) < 25f)
					{
						val = val4;
						break;
					}
				}
			}
			if (isInsideFactory && num > 0 && (Object)(object)val != (Object)null)
			{
				result = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)val).transform.position, 10f, default(NavMeshHit), (Random)null, -1, 1f);
			}
			return result;
		}
	}
	public class RecedeTeslaCoilKillZone : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass10_0
		{
			public PlayerControllerB killedPlayer;

			public float timeAtStart;

			internal bool <TryTrackBody>b__0()
			{
				return (Object)(object)killedPlayer.deadBody != (Object)null || Time.realtimeSinceStartup - timeAtStart > 1f;
			}
		}

		[CompilerGenerated]
		private sealed class <TryTrackBody>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB killedPlayer;

			public RecedeTeslaCoilKillZone <>4__this;

			private <>c__DisplayClass10_0 <>8__1;

			private WaitForEndOfFrame <endOfFrame>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TryTrackBody>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<endOfFrame>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Expected O, but got Unknown
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass10_0();
					<>8__1.killedPlayer = killedPlayer;
					<>8__1.timeAtStart = Time.realtimeSinceStartup;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.killedPlayer.deadBody != (Object)null || Time.realtimeSinceStartup - <>8__1.timeAtStart > 1f));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<endOfFrame>5__2 = new WaitForEndOfFrame();
					if ((Object)(object)<>8__1.killedPlayer.deadBody != (Object)null)
					{
						goto IL_0108;
					}
					RecedeMod.LogWarning("Could not find dead body for " + <>8__1.killedPlayer.playerUsername + " to track with Tesla Coil lightning effect!");
					break;
				case 2:
					{
						<>1__state = -1;
						<>4__this.lightningEffect.Destination.transform.position = ((Component)<>8__1.killedPlayer.deadBody.bodyParts[0]).transform.position;
						goto IL_0108;
					}
					IL_0108:
					if (((LightningBoltPrefabScriptBase)<>4__this.lightningEffect).AutomaticModeSeconds > 0f)
					{
						<>2__current = <endOfFrame>5__2;
						<>1__state = 2;
						return true;
					}
					break;
				}
				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 LightningBoltPrefabScript lightningEffect = null;

		public AudioSource audioSource = null;

		public AudioClip zapSound = null;

		public AudioClip zapfarSound = null;

		private float farDistance = 150f;

		public void Update()
		{
			((LightningBoltScript)lightningEffect).Camera = StartOfRound.Instance.activeCamera;
			audioSource.mute = StartOfRound.Instance.localPlayerController.isInsideFactory;
		}

		public void OnTriggerEnter(Collider other)
		{
			if (((Component)other).CompareTag("Player"))
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && component.isPlayerControlled && ((NetworkBehaviour)component).IsOwner)
				{
					ZapPlayerLocalClient(component);
					ZapPlayerServerRpc(((NetworkBehaviour)component).OwnerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ZapPlayerServerRpc(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_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_0071: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2361650824u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2361650824u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ZapPlayerClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void ZapPlayerClientRpc(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_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_0071: 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)
			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(4273076858u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4273076858u, 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)
				{
					ZapPlayerLocalClient(playerByClientId);
				}
			}
		}

		public void ZapPlayerLocalClient(PlayerControllerB player)
		{
			//IL_0002: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			player.KillPlayer(Vector3.zero, true, (CauseOfDeath)11, 3, default(Vector3));
			lightningEffect.Destination.transform.position = ((Component)player).transform.position;
			((LightningBoltPrefabScriptBase)lightningEffect).Trigger(0.5f);
			audioSource.pitch = Random.Range(0.8f, 1.2f);
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.localPlayerController).transform.position);
			audioSource.PlayOneShot((num > farDistance) ? zapfarSound : zapSound);
			RecedeMod.LogInfo($"ZapPlayerLocalClient: Zapped {player.playerUsername} in kill zone! Dist: {num}");
			((MonoBehaviour)this).StartCoroutine(TryTrackBody(player));
		}

		[IteratorStateMachine(typeof(<TryTrackBody>d__10))]
		private IEnumerator TryTrackBody(PlayerControllerB killedPlayer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TryTrackBody>d__10(0)
			{
				<>4__this = this,
				killedPlayer = killedPlayer
			};
		}

		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
			((NetworkBehaviour)this).__registerRpc(2361650824u, new RpcReceiveHandler(__rpc_handler_2361650824), "ZapPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(4273076858u, new RpcReceiveHandler(__rpc_handler_4273076858), "ZapPlayerClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2361650824(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeTeslaCoilKillZone)(object)target).ZapPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4273076858(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeTeslaCoilKillZone)(object)target).ZapPlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RecedeTeslaCoilKillZone";
		}
	}
	public enum RecedeTimeline
	{
		Present,
		Past,
		Future
	}
	public class RecedeTimeMachine : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <InitializeMalfunctions>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RecedeTimeMachine <>4__this;

			private List<NetworkTimeMachineMalfunctionTime> <netMalfunctions>5__1;

			private List<TimeMachineMalfunctionTime>.Enumerator <>s__2;

			private TimeMachineMalfunctionTime <malfunction>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeMalfunctions>d__16(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<netMalfunctions>5__1 = null;
				<>s__2 = default(List<TimeMachineMalfunctionTime>.Enumerator);
				<malfunction>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => ((NetworkBehaviour)<>4__this).IsSpawned));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.MalfunctionRandom = new Random(StartOfRound.Instance.randomMapSeed - 119);
					if (((NetworkBehaviour)<>4__this).IsServer)
					{
						<>4__this.PlotOutMalfunctions();
						<netMalfunctions>5__1 = new List<NetworkTimeMachineMalfunctionTime>();
						<>s__2 = <>4__this.Malfunctions.GetEnumerator();
						try
						{
							while (<>s__2.MoveNext())
							{
								<malfunction>5__3 = <>s__2.Current;
								<netMalfunctions>5__1.Add(new NetworkTimeMachineMalfunctionTime(<malfunction>5__3));
								<malfunction>5__3 = null;
							}
						}
						finally
						{
							((IDisposable)<>s__2).Dispose();
						}
						<>s__2 = default(List<TimeMachineMalfunctionTime>.Enumerator);
						<>4__this.SyncMalfunctionsClientRpc(<netMalfunctions>5__1.ToArray());
						<netMalfunctions>5__1 = 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 <WaitToShiftPlayers>d__24 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TimeMachineMalfunctionTime malfunction;

			public RecedeTimeMachine <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <WaitToShiftPlayers>d__24(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(17.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.ShiftTimeClientRpc();
					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 Animator anim = null;

		public AudioSource audioSource = null;

		public AudioSource audioSource2D = null;

		public AudioClip HumSound = null;

		public Random MalfunctionRandom = null;

		public Clockhands ShowDemHands = null;

		public List<TimeMachineMalfunctionTime> Malfunctions = new List<TimeMachineMalfunctionTime>();

		private const float MalfunctionAnimationDuration = 20f;

		private float lastActivationTrueTime = -100000f;

		public int NextMalfunctionIndex = 0;

		public NetworkVariable<bool> Disabled = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public LightningBoltPrefabScript lightningEffectA = null;

		public LightningBoltPrefabScript lightningEffectB = null;

		public TimeMachineMalfunctionTime? UpcomingMalfunction
		{
			get
			{
				try
				{
					return Malfunctions[NextMalfunctionIndex];
				}
				catch (ArgumentOutOfRangeException)
				{
					return null;
				}
			}
		}

		public void Start()
		{
			anim = ((Component)this).GetComponentInChildren<Animator>();
			audioSource = ((Component)this).GetComponent<AudioSource>();
			ShowDemHands = ((Component)this).GetComponent<Clockhands>();
			((MonoBehaviour)this).StartCoroutine(InitializeMalfunctions());
		}

		[IteratorStateMachine(typeof(<InitializeMalfunctions>d__16))]
		public IEnumerator InitializeMalfunctions()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeMalfunctions>d__16(0)
			{
				<>4__this = this
			};
		}

		public void PlotOutMalfunctions()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			float num = 250f;
			float num2 = RecedeTimeOfDay.Instance.TimeOfDay.totalTime - 100f;
			float num3 = MalfunctionRandom.Next(4, 9) * (((int)TimeOfDay.Instance.currentLevelWeather != 5) ? 1 : 2);
			float num4 = num2 / num3;
			float num5 = 20f;
			float num6 = num - num5;
			for (int i = 0; (float)i < num3; i++)
			{
				float num7 = (float)i * num4 + num;
				float num8 = MalfunctionRandom.Next(-(int)(num4 / 4f), (int)(num4 / 4f));
				float num9 = num7 + num8;
				if (num9 < num6 + num5)
				{
					num9 = num6 + num5;
				}
				num9 = Mathf.Clamp(num9, 0f, num2 - 1f);
				Malfunctions.Add(new TimeMachineMalfunctionTime(num9, MalfunctionRandom));
				num6 = num9;
			}
			RecedeMod.LogDebug($"Plotted out {Malfunctions.Count} malfunctions.");
			RecedeMod.LogDebug("Malfunction times:");
			foreach (TimeMachineMalfunctionTime malfunction in Malfunctions)
			{
				RecedeMod.LogDebug($"- {malfunction.startTime} -");
				RecedeMod.LogDebug($"  PastOffset: {malfunction.PastOffset}");
				RecedeMod.LogDebug($"  FutureOffset: {malfunction.FutureOffset}");
				foreach (KeyValuePair<ulong, float> playerOffset in malfunction.PlayerOffsets)
				{
					RecedeMod.LogDebug($"    Player {playerOffset.Key}: {playerOffset.Value}");
				}
			}
		}

		[ClientRpc]
		public void SyncMalfunctionsClientRpc(NetworkTimeMachineMalfunctionTime[] malfunctions)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			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(555114217u, val, (RpcDelivery)0);
				bool flag = malfunctions != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkTimeMachineMalfunctionTime>(malfunctions, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 555114217u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			RecedeMod.LogDebug($"Received {malfunctions.Length} malfunctions from server.");
			Malfunctions = new List<TimeMachineMalfunctionTime>();
			foreach (NetworkTimeMachineMalfunctionTime netMalfunction in malfunctions)
			{
				Malfunctions.Add(new TimeMachineMalfunctionTime(netMalfunction));
			}
			RecedeMod.LogDebug("Malfunction times:");
			foreach (TimeMachineMalfunctionTime malfunction in Malfunctions)
			{
				RecedeMod.LogDebug($"- {malfunction.startTime} -");
				RecedeMod.LogDebug($"  PastOffset: {malfunction.PastOffset}");
				RecedeMod.LogDebug($"  FutureOffset: {malfunction.FutureOffset}");
				foreach (KeyValuePair<ulong, float> playerOffset in malfunction.PlayerOffsets)
				{
					RecedeMod.LogDebug($"    Player {playerOffset.Key}: {playerOffset.Value}");
				}
			}
		}

		public void TriggerFX()
		{
			RecedeMoonController.Instance.TransitionAnim.Play("TransitionFX");
			audioSource2D.Play();
		}

		public void Update()
		{
			((LightningBoltScript)lightningEffectA).Camera = StartOfRound.Instance.activeCamera;
			((LightningBoltScript)lightningEffectB).Camera = StartOfRound.Instance.activeCamera;
			if (UpcomingMalfunction == null || Disabled.Value)
			{
				return;
			}
			ShowDemHands.CurrentTime = UpcomingMalfunction.startTime;
			if (!UpcomingMalfunction.SetValuesForPast && RecedeTimeOfDay.Instance.trueCurrentDayTime >= UpcomingMalfunction.startTime + UpcomingMalfunction.PastOffset)
			{
				SavePastPositions();
				UpcomingMalfunction.SetValuesForPast = true;
				RecedeMod.LogInfo($"[TimeMachine] Setting past values for malfunction at {UpcomingMalfunction.startTime} (current time: {RecedeTimeOfDay.Instance.trueCurrentDayTime})");
			}
			if (RecedeTimeOfDay.Instance.trueCurrentDayTime >= UpcomingMalfunction.startTime && !(RecedeTimeOfDay.Instance.trueCurrentDayTime < lastActivationTrueTime + 20f))
			{
				RecedeMod.LogMessage($"[TimeMachine] Activating malfunction! at {UpcomingMalfunction.startTime} (current time: {RecedeTimeOfDay.Instance.trueCurrentDayTime})");
				lastActivationTrueTime = RecedeTimeOfDay.Instance.trueCurrentDayTime;
				if (((NetworkBehaviour)this).IsServer)
				{
					((MonoBehaviour)this).StartCoroutine(WaitToShiftPlayers(UpcomingMalfunction));
				}
				if (((NetworkBehaviour)this).IsServer)
				{
					ActivateTimeMachineServerRpc();
				}
				NextMalfunctionIndex++;
			}
		}

		public void SavePastPositions()
		{
			foreach (RecedePlayer allRecedePlayer in RecedeMoonController.Instance.AllRecedePlayers)
			{
				allRecedePlayer.UpdatePastPositions();
			}
		}

		[ServerRpc]
		public void ActivateTimeMachineServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_0107: 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_00c2: 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(3124909193u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3124909193u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				ActivateTimeMachineClientRpc();
			}
		}

		[ClientRpc]
		public void ActivateTimeMachineClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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(570084958u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 570084958u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			anim.Play("Activate");
			audioSource.Play();
			((LightningBoltPrefabScriptBase)lightningEffectA).Trigger(18f);
			((LightningBoltPrefabScriptBase)lightningEffectB).Trigger(18f);
			try
			{
				lastActivationTrueTime = RecedeTimeOfDay.Instance.trueCurrentDayTime;
			}
			catch
			{
			}
		}

		[IteratorStateMachine(typeof(<WaitToShiftPlayers>d__24))]
		private IEnumerator WaitToShiftPlayers(TimeMachineMalfunctionTime malfunction)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitToShiftPlayers>d__24(0)
			{
				<>4__this = this,
				malfunction = malfunction
			};
		}

		[ClientRpc]
		public void ShiftTimeClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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(3620300429u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3620300429u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ShiftTime();
				}
			}
		}

		public void ShiftTime()
		{
			if (UpcomingMalfunction == null)
			{
				return;
			}
			foreach (RecedePlayer allRecedePlayer in RecedeMoonController.Instance.AllRecedePlayers)
			{
				if (!allRecedePlayer.playerController.isPlayerControlled)
				{
					continue;
				}
				if (((NetworkBehaviour)allRecedePlayer.playerController).IsOwner && !RecedeMod.SeenTimeTravelTip)
				{
					HUDManager.Instance.DisplayTip("Time Travel", "The ship is in it's own timeline represented by the cyan clock. Time travel won't effect it's midnight departure.", false, false, "LC_Tip1");
					RecedeMod.SeenTimeTravelTip = true;
				}
				if (UpcomingMalfunction.PlayerOffsets.TryGetValue(((NetworkBehaviour)allRecedePlayer.playerController).OwnerClientId, out var value))
				{
					RecedeTimeOfDay.Instance.TimeTravelPlayer(allRecedePlayer.playerController, value);
					if (value < 0f)
					{
						RecedeMod.LogInfo($"Shifting player {allRecedePlayer.playerController.playerUsername} to the past by {0f - value} seconds. Setting Pos Vals");
						allRecedePlayer.ApplyPastPositions();
					}
					else
					{
						RecedeMod.LogInfo($"Shifting player {allRecedePlayer.playerController.playerUsername} by {value} seconds.");
					}
				}
				else
				{
					RecedeMod.LogWarning($"No time offset found for player {allRecedePlayer.playerController.playerUsername} in malfunction at {UpcomingMalfunction.startTime}. Not shifting time.");
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (Disabled == null)
			{
				throw new Exception("RecedeTimeMachine.Disabled cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)Disabled).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Disabled, "Disabled");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)Disabled);
			((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
			((NetworkBehaviour)this).__registerRpc(555114217u, new RpcReceiveHandler(__rpc_handler_555114217), "SyncMalfunctionsClientRpc");
			((NetworkBehaviour)this).__registerRpc(3124909193u, new RpcReceiveHandler(__rpc_handler_3124909193), "ActivateTimeMachineServerRpc");
			((NetworkBehaviour)this).__registerRpc(570084958u, new RpcReceiveHandler(__rpc_handler_570084958), "ActivateTimeMachineClientRpc");
			((NetworkBehaviour)this).__registerRpc(3620300429u, new RpcReceiveHandler(__rpc_handler_3620300429), "ShiftTimeClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_555114217(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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				NetworkTimeMachineMalfunctionTime[] malfunctions = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<NetworkTimeMachineMalfunctionTime>(ref malfunctions, default(ForNetworkSerializable));
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((RecedeTimeMachine)(object)target).SyncMalfunctionsClientRpc(malfunctions);
				target.__rpc_exec_stage = (__RpcExecStage)0;