Decompiled source of Hide And Seek Nightly v26.5.10

HideAndSeek.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Debugger;
using GameNetcodeStuff;
using HarmonyLib;
using HideAndSeek;
using HideAndSeek.AbilityScripts;
using HideAndSeek.AudioScripts;
using HideAndSeek.Patches;
using LCVR;
using LCVR.Player;
using LethalCompanyInputUtils.Api;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.XR;
using UnityEngine.Networking;
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: AssemblyCompany("HideAndSeek")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8e1453d407f7dbab2e4e49ec0ced36870bce4e6a")]
[assembly: AssemblyProduct("HideAndSeek")]
[assembly: AssemblyTitle("HideAndSeek")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Debugger
{
	public static class Debug
	{
		private static bool warned = false;

		private static readonly string WARNmESSAGE = "DebugEnabled is false! (Make sure to turn this on when trying to read Debug.Log()'s messages)";

		public static void Log(object m)
		{
			if (Config.debugEnabled.Value)
			{
				Plugin._Logger.LogInfo(m);
			}
			else if (!warned)
			{
				warned = true;
				Plugin._Logger.LogWarning((object)WARNmESSAGE);
			}
		}

		public static void LogMessage(object m)
		{
			if (Config.debugEnabled.Value)
			{
				Plugin._Logger.LogMessage(m);
			}
			else if (!warned)
			{
				warned = true;
				Plugin._Logger.LogWarning((object)WARNmESSAGE);
			}
		}

		public static void LogWarning(object m)
		{
			if (Config.debugEnabled.Value)
			{
				Plugin._Logger.LogWarning(m);
			}
			else if (!warned)
			{
				warned = true;
				Plugin._Logger.LogWarning((object)WARNmESSAGE);
			}
		}

		public static void LogError(object m)
		{
			if (Config.debugEnabled.Value)
			{
				Plugin._Logger.LogError(m);
			}
			else if (!warned)
			{
				warned = true;
				Plugin._Logger.LogWarning((object)WARNmESSAGE);
			}
		}
	}
}
namespace HideAndSeek
{
	public class AbilityConfig
	{
		public bool syncedWithHost = false;

		public string abilityName = "genericNull";

		public int abilityCost = 10;

		public bool seekerAbility = true;

		public bool hiderAbility = true;

		public bool requiresRoundActive = true;

		public bool requiresSeekerActive = true;

		public float abilityDelay = 10f;

		public bool oneTimeUse = false;

		public AbilityConfig(string _abilityName = "genericNull", int _abilityCost = 10, float _abilityDelay = 10f, bool _oneTimeUse = false, bool _seekerAbility = true, bool _hiderAbility = true, bool _requriesRoundActive = true, bool _requiresSeekerActive = true)
		{
			abilityName = _abilityName;
			abilityCost = _abilityCost;
			seekerAbility = _seekerAbility;
			hiderAbility = _hiderAbility;
			requiresRoundActive = _requriesRoundActive;
			requiresSeekerActive = _requiresSeekerActive;
			abilityDelay = _abilityDelay;
			oneTimeUse = _oneTimeUse;
		}
	}
	public class ObjectivesManager : MonoBehaviour
	{
		public static ObjectivesManager instance;

		public bool objectiveReleased = false;

		public Dictionary<PlayerControllerB, bool> playersReachedObjective = new Dictionary<PlayerControllerB, bool>();

		public static void Init()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			instance = new GameObject().AddComponent<ObjectivesManager>();
		}

		private void Start()
		{
			HideAndSeekGM hideAndSeekGM = HideAndSeekGM.instance;
			hideAndSeekGM.roundStarted = (Action)Delegate.Combine(hideAndSeekGM.roundStarted, new Action(OnRoundStart));
		}

		private void Update()
		{
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			if (Config.objective.Value.Equals("Ship", StringComparison.CurrentCultureIgnoreCase))
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (!(TimeOfDay.Instance.currentDayTime >= Config.timeObjectiveAvailable.Value))
				{
					return;
				}
				if (!objectiveReleased)
				{
					objectiveReleased = true;
					if (HideAndSeekGM.instance.seekers.Contains(localPlayerController))
					{
						HUDManager.Instance.DisplayTip("Hide And Seek", "The exits have been unlocked, the hiders are escaping!", true, false, "LC_Tip1");
					}
					else if (HideAndSeekGM.instance.zombies.Contains(localPlayerController))
					{
						HUDManager.Instance.DisplayTip("Hide And Seek", "The exits have been unlocked, the hiders are escaping!", true, false, "LC_Tip1");
					}
					else
					{
						HUDManager.Instance.DisplayTip("Hide And Seek", "The exits have been unlocked, escape back to the ship now!", false, false, "LC_Tip1");
					}
				}
				{
					foreach (PlayerControllerB allConnectedPlayer in HideAndSeekGM.GetAllConnectedPlayers("Update Player Objectives"))
					{
						if (!allConnectedPlayer.isPlayerDead && !HideAndSeekGM.instance.seekers.Contains(allConnectedPlayer) && !HideAndSeekGM.instance.zombies.Contains(allConnectedPlayer) && allConnectedPlayer.isInHangarShipRoom && !PlayerReachedObjective(allConnectedPlayer))
						{
							SetPlayerReachedObjective(allConnectedPlayer, b: true);
							((Graphic)allConnectedPlayer.usernameBillboardText).color = Config.objectiveNameColor.Value;
							HideAndSeekGM.instance.UpdateGameState("Player Reached Objective");
							if ((Object)(object)localPlayerController == (Object)(object)allConnectedPlayer)
							{
								HUDManager.Instance.DisplayTip("Hide And Seek", "You have reached the objective!", false, false, "LC_Tip1");
							}
							else
							{
								HUDManager.Instance.DisplayTip("Hide And Seek", "'" + allConnectedPlayer.playerUsername + "' has reached the objective!", true, false, "LC_Tip1");
							}
							if (((NetworkBehaviour)localPlayerController).IsHost)
							{
								NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 200, 0f, allConnectedPlayer.actualClientId));
							}
						}
					}
					return;
				}
			}
			Debug.LogError((object)("[ObjectiveManager] No objective has been set! '" + Config.objective.Value + "' Disabling Objective..."));
			((Component)this).gameObject.SetActive(false);
		}

		private void OnRoundStart()
		{
			objectiveReleased = false;
			playersReachedObjective.Clear();
		}

		public void SetPlayerReachedObjective(PlayerControllerB player, bool b)
		{
			if (!playersReachedObjective.ContainsKey(player))
			{
				playersReachedObjective.Add(player, b);
			}
			else
			{
				playersReachedObjective[player] = b;
			}
		}

		public bool PlayerReachedObjective(PlayerControllerB player)
		{
			if (!playersReachedObjective.ContainsKey(player))
			{
				return false;
			}
			return playersReachedObjective[player];
		}
	}
	public class VRAbilityUI
	{
		[CompilerGenerated]
		private sealed class <Loop>d__18 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				Tick();
				<>2__current = (object)new WaitForEndOfFrame();
				<>1__state = 1;
				return true;
			}

			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 <Tryer>d__17 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				try
				{
					Tick();
					currentTickLoop = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(Loop());
				}
				catch (FileNotFoundException)
				{
					Debugger.Debug.LogError("[VRAbilityUI] Could not find LCVR DLL! Using default UI...");
					return false;
				}
				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();
			}
		}

		private static GameObject UIObject;

		private static AbilityUI abilityUI;

		private static GameObject tutorialUI;

		private static TrackedPoseDriver leftHand;

		private static TrackedPoseDriver rightHand;

		private static TrackedPoseDriver camera;

		private static Coroutine currentTickLoop = null;

		private static bool usingVr = false;

		public static InputAction AbilityMenuInput;

		public static InputAction ModifierInput;

		public static InputAction SellInput;

		public static InputAction NavigateInput;

		public static InputAction ActivateInput;

		private static bool menuOpen = false;

		private static int turnProvider = -1;

		private static bool modifierInputDown = false;

		private static bool sellInputDown = false;

		private static bool leftInput;

		private static bool rightInput;

		private static bool upInput;

		private static bool downInput;

		public static void StartTicking()
		{
			CreateInputActions();
			if (currentTickLoop != null)
			{
				((MonoBehaviour)GameNetworkManager.Instance).StopCoroutine(currentTickLoop);
				camera = null;
				rightHand = null;
				leftHand = null;
				UIObject = null;
				abilityUI = null;
				currentTickLoop = null;
			}
			currentTickLoop = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(Tryer());
		}

		private static void Tick()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_0180: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Invalid comparison between Unknown and I4
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Invalid comparison between Unknown and I4
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected I4, but got Unknown
			UsingVR();
			if (!usingVr)
			{
				return;
			}
			if ((Object)(object)UIObject == (Object)null)
			{
				CreateUIObject();
			}
			if (!Object.op_Implicit((Object)(object)UIObject))
			{
				return;
			}
			Vector3 position = Vector3.zero;
			if (!Object.op_Implicit((Object)(object)leftHand) || !Object.op_Implicit((Object)(object)rightHand) || !Object.op_Implicit((Object)(object)camera))
			{
				GetTrackedDrivers();
			}
			if (Object.op_Implicit((Object)(object)leftHand) && Object.op_Implicit((Object)(object)rightHand))
			{
				Vector3 val = ((Component)leftHand).transform.position - ((Component)rightHand).transform.position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				float num = Mathf.Clamp(1f - Mathf.Pow(magnitude, 2f), 0f, 1f);
				float num2 = num * 0.4f;
				position = (((Component)leftHand).transform.position + ((Component)rightHand).transform.position) / 2f;
				position += Vector3.up * 0.9f * num2;
				Vector3 val2 = position - ((Component)camera).transform.position;
				Vector3 val3 = position;
				val = new Vector3(val2.x, 0f, val2.z);
				position = val3 + ((Vector3)(ref val)).normalized * num2;
			}
			((Transform)UIObject.GetComponent<RectTransform>()).position = position;
			if (Object.op_Implicit((Object)(object)camera))
			{
				((Transform)UIObject.GetComponent<RectTransform>()).LookAt(((Component)camera).transform, Vector3.up);
			}
			if ((((Component)abilityUI).gameObject.activeSelf || tutorialUI.gameObject.activeSelf) && !menuOpen)
			{
				menuOpen = true;
				if (Config.disableVRTurningWhileMenuOpen.Value && (int)Plugin.Config.TurnProvider.Value != 2)
				{
					turnProvider = (int)Plugin.Config.TurnProvider.Value;
					Plugin.Config.TurnProvider.Value = (TurnProviderOption)2;
				}
			}
			else if (menuOpen)
			{
				menuOpen = false;
				if (Config.disableVRTurningWhileMenuOpen.Value && (int)Plugin.Config.TurnProvider.Value == 2)
				{
					Plugin.Config.TurnProvider.Value = (TurnProviderOption)turnProvider;
				}
			}
		}

		[IteratorStateMachine(typeof(<Tryer>d__17))]
		private static IEnumerator Tryer()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Tryer>d__17(0);
		}

		[IteratorStateMachine(typeof(<Loop>d__18))]
		private static IEnumerator Loop()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Loop>d__18(0);
		}

		private static void CreateInputActions()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			AbilityMenuInput = new InputAction("OpenAbilityMenu", (InputActionType)1, "<XRController>{LeftHand}/thumbstickClicked", (string)null, (string)null, (string)null);
			AbilityMenuInput.performed += ProssesAbilityMenuInput;
			AbilityMenuInput.canceled += ProssesAbilityMenuInput;
			AbilityMenuInput.Enable();
			ModifierInput = new InputAction("InputModifier", (InputActionType)0, "<XRController>{LeftHand}/gripPressed", (string)null, (string)null, (string)null);
			ModifierInput.performed += ProssesModifierInput;
			ModifierInput.canceled += ProssesModifierInput;
			ModifierInput.Enable();
			SellInput = new InputAction("SellItem", (InputActionType)0, "<XRController>{LeftHand}/trigger", (string)null, (string)null, (string)null);
			SellInput.performed += ProssesSellInput;
			SellInput.canceled += ProssesSellInput;
			SellInput.Enable();
			NavigateInput = new InputAction("Navigate", (InputActionType)0, "<XRController>{RightHand}/joystick", (string)null, (string)null, (string)null);
			NavigateInput.performed += ProssesNavigateInput;
			NavigateInput.canceled += ProssesNavigateInput;
			NavigateInput.Enable();
			ActivateInput = new InputAction("Activate", (InputActionType)1, "<XRController>{RightHand}/primaryButton", (string)null, (string)null, (string)null);
			ActivateInput.performed += ProssesActivateInput;
			ActivateInput.canceled += ProssesActivateInput;
			ActivateInput.Enable();
		}

		private static void ProssesAbilityMenuInput(CallbackContext context)
		{
			float num = ((CallbackContext)(ref context)).ReadValue<float>();
			if (num > 0f && modifierInputDown)
			{
				abilityUI.ToggleAbilityUI();
			}
		}

		private static void ProssesModifierInput(CallbackContext context)
		{
			float num = ((CallbackContext)(ref context)).ReadValue<float>();
			if (num > 0.2f && !modifierInputDown)
			{
				modifierInputDown = true;
			}
			else if (num < 0.2f && modifierInputDown)
			{
				modifierInputDown = false;
			}
		}

		private static void ProssesSellInput(CallbackContext context)
		{
			//IL_002e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			float num = ((CallbackContext)(ref context)).ReadValue<float>();
			if (num >= 0.5f && !sellInputDown)
			{
				sellInputDown = true;
				AbilityInstance.localInstance.SellInputPressed();
			}
			else if (num < 0.5f && sellInputDown)
			{
				sellInputDown = false;
				AbilityInstance.localInstance.SellInputCanceled();
			}
		}

		private static void ProssesNavigateInput(CallbackContext context)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = ((CallbackContext)(ref context)).ReadValue<Vector2>();
			if (val.y > 0.2f && !upInput)
			{
				abilityUI.UpInput();
				upInput = true;
			}
			else if (val.y < 0.2f && upInput)
			{
				upInput = false;
			}
			if (val.y < -0.2f && !downInput)
			{
				abilityUI.DownInput();
				downInput = true;
			}
			else if (val.y > -0.2f && downInput)
			{
				downInput = false;
			}
			if (val.x > 0.2f && !rightInput)
			{
				abilityUI.RightInput();
				rightInput = true;
			}
			else if (val.x < 0.2f && rightInput)
			{
				rightInput = false;
			}
			if (val.x < -0.2f && !leftInput)
			{
				abilityUI.LeftInput();
				leftInput = true;
			}
			else if (val.x > -0.2f && leftInput)
			{
				leftInput = false;
			}
		}

		private static void ProssesActivateInput(CallbackContext context)
		{
			float num = ((CallbackContext)(ref context)).ReadValue<float>();
			if (num > 0f)
			{
				abilityUI.ActivateAbility();
			}
		}

		private static void CreateUIObject()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			UIObject = new GameObject();
			((Object)UIObject).name = "VRUICanvas";
			Canvas val = UIObject.GetComponent<Canvas>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = UIObject.AddComponent<Canvas>();
			}
			val.renderMode = (RenderMode)2;
			abilityUI = Object.FindAnyObjectByType<AbilityUI>();
			tutorialUI = abilityUI.tutorialMenu;
			if ((Object)(object)abilityUI == (Object)null)
			{
				Object.Destroy((Object)(object)UIObject);
				Debugger.Debug.LogError("abilityUI is == null!");
				return;
			}
			((Component)abilityUI).transform.parent = UIObject.transform;
			tutorialUI.transform.parent = UIObject.transform;
			((Component)abilityUI).transform.Rotate(Vector3.up, 180f, (Space)1);
			tutorialUI.transform.Rotate(Vector3.up, 180f, (Space)1);
			tutorialUI.transform.localPosition = Vector3.zero;
			((Component)((Component)abilityUI).transform.Find("Background")).gameObject.SetActive(false);
			((Component)tutorialUI.transform.Find("Background")).gameObject.SetActive(false);
			UIObject.transform.localScale = Vector3.one / 6f;
		}

		private static void GetTrackedDrivers()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			TrackedPoseDriver[] array = Object.FindObjectsByType<TrackedPoseDriver>((FindObjectsSortMode)0);
			foreach (TrackedPoseDriver val in array)
			{
				InputActionProperty trackingStateInput = val.trackingStateInput;
				if (((InputActionProperty)(ref trackingStateInput)).action.name.ToLower().Contains("left"))
				{
					leftHand = val;
					continue;
				}
				trackingStateInput = val.trackingStateInput;
				if (((InputActionProperty)(ref trackingStateInput)).action.name.ToLower().Contains("right"))
				{
					rightHand = val;
				}
				else if (((Object)((Component)val).gameObject).name == "MainCamera")
				{
					camera = val;
				}
			}
		}

		private static void Try()
		{
			usingVr = VRSession.InVR;
		}

		public static void UsingVR()
		{
			try
			{
				Try();
			}
			catch (Exception)
			{
			}
		}

		public static void OnApplicationQuit()
		{
			if (turnProvider != -1)
			{
				Plugin.Config.TurnProvider.Value = (TurnProviderOption)turnProvider;
			}
		}
	}
	public class Config
	{
		public static ConfigEntry<bool> debugEnabled;

		public static ConfigEntry<bool> abilitiesEnabled;

		public static ConfigEntry<bool> creditsResetOnNewRound;

		public static ConfigEntry<int> deadBodySellValue;

		public static ConfigEntry<bool> disableVRTurningWhileMenuOpen;

		public static ConfigEntry<string> objective;

		public static ConfigEntry<float> timeObjectiveAvailable;

		public static ConfigEntry<Color> objectiveNameColor;

		public static ConfigEntry<bool> lockShipLever;

		public static ConfigEntry<bool> disableAllEntities;

		public static ConfigEntry<string> disabledEntities;

		public static ConfigEntry<bool> turretsEnabled;

		public static ConfigEntry<bool> landminesEnabled;

		public static ConfigEntry<bool> spikeTrapEnabled;

		public static ConfigEntry<Color> seekerNameColor;

		public static ConfigEntry<string> seekerChooseBehavior;

		public static ConfigEntry<string> numberOfSeekers;

		public static ConfigEntry<string> extraSeekerChooseBehavior;

		public static ConfigEntry<bool> isSeekerImmune;

		public static ConfigEntry<bool> hostilesIgnoreSeeker;

		public static ConfigEntry<bool> shotgunInfiniteAmmo;

		public static ConfigEntry<bool> shotgunAutoReload;

		public static ConfigEntry<bool> teleportSeekerToEntrance;

		public static ConfigEntry<bool> forceSeekerInside;

		public static ConfigEntry<bool> shipLeaveEarly;

		public static ConfigEntry<float> timeWhenLastHider;

		public static ConfigEntry<float> timeSeekerIsReleased;

		public static ConfigEntry<string> seekerItemSlot1;

		public static ConfigEntry<string> seekerItemSlot2;

		public static ConfigEntry<string> seekerItemSlot3;

		public static ConfigEntry<string> seekerItemSlot4;

		public static ConfigEntry<Color> hiderNameColor;

		public static ConfigEntry<bool> teleportHidersToEntrance;

		public static ConfigEntry<bool> forceHidersInside;

		public static ConfigEntry<bool> lockHidersInside;

		public static ConfigEntry<bool> infiniteFlashlightBattery;

		public static ConfigEntry<string> hiderItemSlot1;

		public static ConfigEntry<string> hiderItemSlot2;

		public static ConfigEntry<string> hiderItemSlot3;

		public static ConfigEntry<string> hiderItemSlot4;

		public static ConfigEntry<Color> zombieNameColor;

		public static ConfigEntry<bool> deadHidersRespawn;

		public static ConfigEntry<bool> deadZombiesRespawn;

		public static ConfigEntry<bool> zombiesCanUseAbilities;

		public static ConfigEntry<float> zombieSpawnDelay;

		public static ConfigEntry<string> zombieSpawnLocation;

		public static ConfigEntry<string> zombieItemSlot1;

		public static ConfigEntry<string> zombieItemSlot2;

		public static ConfigEntry<string> zombieItemSlot3;

		public static ConfigEntry<string> zombieItemSlot4;

		public Config(ConfigFile cfg)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			debugEnabled = cfg.Bind<bool>("0:Debug/Other", "DebugEnabled", false, "Used for random feature testing and debug logging. (Should be disabled for end user)");
			abilitiesEnabled = cfg.Bind<bool>("0:Gamemode.Abilities", "Abilities Enabled", true, "Enables Abilities! Hold 'c' to sell scrap and press 't' to open the abilities menu to spend your credits on.");
			creditsResetOnNewRound = cfg.Bind<bool>("0:Gamemode.Abilities", "Credits Reset On New Round", false, "Makes everyone's credits go back to 0 when a new round starts");
			deadBodySellValue = cfg.Bind<int>("0:Gamemode.Abilities", "Dead Body Value", 100, "How much a dead body is worth when selling");
			disableVRTurningWhileMenuOpen = cfg.Bind<bool>("0:Gamemode.Abilities", "Disable VR Turning While Menu Open", false, "(In VR Mode) Disables turning while the ability menu is open to make browsing through the abilities a little less weird. (WARNING: This is a little buggy, as the vr rig rotation gets reset every time the menu opens! Which is probably not any better than with this off)");
			objective = cfg.Bind<string>("0:Gamemode.Objective", "Hider Objective", "Ship", "'None' There will be no objective, 'Ship' The interior exits will be unlocked and the hiders have to get back to the ship, (More may come?)");
			timeObjectiveAvailable = cfg.Bind<float>("0:Gamemode.Objective", "Time Objective Available", 900f, "The time the clock would be when the objective comes into play. 900 = 9:00 PM, 960 = 10:00 PM, +60 = +1 hour (Can't be lower than when the seeker is released!)");
			objectiveNameColor = cfg.Bind<Color>("2:Players.Hider", "Objective Reached Name Color", new Color(1f, 0f, 1f), "The color the player's name tag will be when they have successfully reached the objective.");
			lockShipLever = cfg.Bind<bool>("2:Players.Seeker", "Lock Ship Lever", true, "Will not allow the ship lever to be pulled during a round (Does not apply to the host or the seekers)");
			disableAllEntities = cfg.Bind<bool>("1:Entities", "Disable All Entities", true, "Determines if all entity spawning should be disabled.");
			disabledEntities = cfg.Bind<string>("1:Entities", "Entity BlackList", "", "Enter an entity's internal name separated by commas to prevent them from spawning. (Entity's names can be found in console upon landing on a moon)");
			turretsEnabled = cfg.Bind<bool>("1:Traps", "Spawn Turrets", false, "Determines if Turrets should spawn.");
			landminesEnabled = cfg.Bind<bool>("1:Traps", "Spawn Land Mines", false, "Determines if Land Mines should spawn.");
			spikeTrapEnabled = cfg.Bind<bool>("1:Traps", "Spawn Spike Traps", false, "Determines if Spike Traps should spawn.");
			seekerNameColor = cfg.Bind<Color>("2:Players.Seeker", "Seeker Name Color", new Color(1f, 0f, 0f), "The color the player's name tag will be.");
			seekerChooseBehavior = cfg.Bind<string>("2:Players.Seeker", "Seeker Choose Behavior", "Turns", "'None' (Just a random range generator), 'No Double' (Next Seeker can't be last seeker), 'Turns' (Will not pick someone that was already seeker, resets when everyone got a chance), 'Lever' (The seeker is the lever puller)");
			numberOfSeekers = cfg.Bind<string>("2:Players.Seeker", "Number of Seekers", "20%", "'1'-[connected players] (Example '3') OR '1%'-'100%' of connected players will be the seeker. (Example 20%). No matter what this is set to, (Example '0' or '100%') there will ALWAYS be at least 1 hider and 1 seeker (Unless there is only one connected player, then they would just be seeker)");
			extraSeekerChooseBehavior = cfg.Bind<string>("2:Players.Seeker", "Extra Seeker Choose Behavior", "Closest", "'None' (Just a random range generator), 'Turns' (Will not pick someone that was already seeker, resets when everyone got a chance), 'Closest' (Players nearest to the first seeker will be seeker)");
			isSeekerImmune = cfg.Bind<bool>("2:Players.Seeker", "Is Seeker Immune", false, "Determines if the seeker could be harmed or not (not recommended while abilities are enabled)");
			shotgunInfiniteAmmo = cfg.Bind<bool>("2:Players.Seeker", "Shotgun Infinite Ammo", true, "Disables the need for ammo for the shotgun.");
			shotgunAutoReload = cfg.Bind<bool>("2:Players.Seeker", "Shotgun Auto Reload", false, "(Only works if 'shotgunInfiniteAmmo' is enabled) Disables the need to reload a new shell, and lets you shoot like normal again.");
			shipLeaveEarly = cfg.Bind<bool>("2:Players.Seeker", "Make Ship Leave Early", true, "Skips the time when there is one hider left (Time defined by 'timeWhenLastHider')");
			timeWhenLastHider = cfg.Bind<float>("2:Players.Seeker", "Last Hider Time", 900f, "The time the clock is set to when there is one hider left. 900 = 9:00 PM, 960 = 10:00 PM, +60 = +1 hour (Requires makeShipLeaveEarly = true, to be enabled!)");
			timeSeekerIsReleased = cfg.Bind<float>("2:Players.Seeker", "Seeking Time", 195f, "The time the seeker is released to wreak havoc in the land. 180 = 9:00 PM, 240 = 10:00 PM, +60 = +1 hour");
			teleportSeekerToEntrance = cfg.Bind<bool>("2:Players.Seeker", "Teleport Seeker To Entrance", true, "Determines if the seeker should be teleported to the entrance on landing.");
			forceSeekerInside = cfg.Bind<bool>("2:Players.Seeker", "Teleport Seeker Inside", true, "Determines if the seeker should be teleported into the building on landing. (teleportSeekerToEntrance Should Be Enabled!)");
			seekerItemSlot1 = cfg.Bind<string>("2:Players.Seeker", "Seeker Item Slot 1", "Shotgun", "The id of the item that will spawn in the first slot of the seeker. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			seekerItemSlot2 = cfg.Bind<string>("2:Players.Seeker", "Seeker Item Slot 2", "Pro-flashlight", "The id of the item that will spawn in the second slot of the seeker. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			seekerItemSlot3 = cfg.Bind<string>("2:Players.Seeker", "Seeker Item Slot 3", "", "The id of the item that will spawn in the third slot of the seeker. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			seekerItemSlot4 = cfg.Bind<string>("2:Players.Seeker", "Seeker Item Slot 4", "", "The id of the item that will spawn in the fourth slot of the seeker. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			hiderNameColor = cfg.Bind<Color>("2:Players.Hider", "Hider Name Color", new Color(1f, 1f, 1f), "The color the player's name tag will be.");
			teleportHidersToEntrance = cfg.Bind<bool>("2:Players.Hider", "Teleport Hiders To Entrance", true, "Determines if all the hiders should be teleported to the entrance on landing.");
			forceHidersInside = cfg.Bind<bool>("2:Players.Hider", "Teleport Hiders Inside", true, "Determines if all the hiders should be teleported into the building on landing. (teleportHidersToEntrance Should Be Enabled!)");
			lockHidersInside = cfg.Bind<bool>("2:Players.Hider", "Lock Hiders Inside", true, "Determines if all the hiders should be locked inside the building. (forceHidersInside Should Be Enabled!)");
			infiniteFlashlightBattery = cfg.Bind<bool>("2:Players.Hider", "Infinite Flashlight Battery", true, "Makes the flashlight never run out of battery.");
			hiderItemSlot1 = cfg.Bind<string>("2:Players.Hider", "Hider Item Slot 1", "flashlight", "The id of the item that will spawn in the first slot of the hider. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			hiderItemSlot2 = cfg.Bind<string>("2:Players.Hider", "Hider Item Slot 2", "", "The id of the item that will spawn in the second slot of the hider. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			hiderItemSlot3 = cfg.Bind<string>("2:Players.Hider", "Hider Item Slot 3", "", "The id of the item that will spawn in the third slot of the hider. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			hiderItemSlot4 = cfg.Bind<string>("2:Players.Hider", "Hider Item Slot 4", "", "The id of the item that will spawn in the fourth slot of the hider. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			zombieNameColor = cfg.Bind<Color>("2:Players.Zombie", "Zombie Name Color", new Color(0f, 1f, 0f), "The color the player's name tag will be.");
			deadHidersRespawn = cfg.Bind<bool>("2:Players.Zombie", "Dead Hiders Respawn", true, "(If true) : When a hider is killed, they will turn into a zombie, assisting the seeker.");
			deadZombiesRespawn = cfg.Bind<bool>("2:Players.Zombie", "Dead Zombies Respawn", false, "(If true) : When a zombie dies, they will respawn again.");
			zombiesCanUseAbilities = cfg.Bind<bool>("2:Players.Zombie", "Zombies Can Use Abilities", false, "(If true) : The zombies will be able to use seeker abilities.");
			zombieSpawnDelay = cfg.Bind<float>("2:Players.Zombie", "Zombie Spawn Delay", 8f, "When a player dies, the thread will yield for the specified amount of seconds before attempting to respawn them as a zombie.");
			zombieSpawnLocation = cfg.Bind<string>("2:Players.Zombie", "Zombie Spawn Location", "Inside", "'Inside' : Teleports Zombies inside when spawning, 'Entrance' : Teleports Zombies to the main entrance when spawning, 'Ship' : Spawns Zombies in the ship");
			zombieItemSlot1 = cfg.Bind<string>("2:Players.Zombie", "Zombie Item Slot 1", "Stop sign, Yield sign, Shovel", "The id of the item that will spawn in the first slot of the zombie. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			zombieItemSlot2 = cfg.Bind<string>("2:Players.Zombie", "Zombie Item Slot 2", "", "The id of the item that will spawn in the second slot of the zombie. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			zombieItemSlot3 = cfg.Bind<string>("2:Players.Zombie", "Zombie Item Slot 3", "", "The id of the item that will spawn in the third slot of the zombie. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
			zombieItemSlot4 = cfg.Bind<string>("2:Players.Zombie", "Zombie Item Slot 4", "", "The id of the item that will spawn in the fourth slot of the zombie. 'item1, item2' will randomly choose between the items listed (See README.md for list of Item IDs)");
		}
	}
	public class InputConfigs : LcInputActions
	{
		private static InputConfigs instance;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction Escape { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction AbilityMenuKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction SellKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ScrollAbilitiesInput { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction FavoriteKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction BackKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ForwardKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ScrollCategoriesInput { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction UpKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction DownKey { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ActivateKey { get; set; }

		public static InputConfigs GetInputClass()
		{
			if (instance == null)
			{
				instance = new InputConfigs();
			}
			return instance;
		}
	}
	public class HideAndSeekGM : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <GivePlayersItems>d__31 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HideAndSeekGM <>4__this;

			private List<PlayerControllerB> <players>5__1;

			private int <tries>5__2;

			private List<PlayerControllerB>.Enumerator <>s__3;

			private PlayerControllerB <player>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 3) <= 7u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<players>5__1 = null;
				<>s__3 = default(List<PlayerControllerB>.Enumerator);
				<player>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Expected O, but got Unknown
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<players>5__1 = GetAllConnectedPlayers("GivePlayersItems");
						Debugger.Debug.LogMessage("Game Has Started = " + GameNetworkManager.Instance.gameHasStarted);
						goto IL_00ec;
					case 1:
						<>1__state = -1;
						goto IL_00ec;
					case 2:
						<>1__state = -1;
						<tries>5__2--;
						goto IL_01bc;
					case 3:
						<>1__state = -3;
						goto IL_02e2;
					case 4:
						<>1__state = -3;
						goto IL_0334;
					case 5:
						<>1__state = -3;
						goto IL_0386;
					case 6:
						<>1__state = -3;
						goto IL_0527;
					case 7:
						<>1__state = -3;
						goto IL_0431;
					case 8:
						<>1__state = -3;
						goto IL_0483;
					case 9:
						<>1__state = -3;
						goto IL_04d6;
					case 10:
						{
							<>1__state = -3;
							goto IL_0527;
						}
						IL_00ec:
						if (<>4__this.itemSpawnPositions.Count == 0 || <>4__this.playersTeleported == 0 || !StartOfRound.Instance.shipHasLanded)
						{
							if (StartOfRound.Instance.shipIsLeaving)
							{
								return false;
							}
							<>2__current = (object)new WaitForSeconds(1f);
							<>1__state = 1;
							return true;
						}
						<tries>5__2 = 5;
						goto IL_01bc;
						IL_0483:
						if (!string.IsNullOrEmpty(Config.hiderItemSlot3.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.hiderItemSlot3.Value, <player>5__4);
							<>1__state = 9;
							return true;
						}
						goto IL_04d6;
						IL_04d6:
						if (!string.IsNullOrEmpty(Config.hiderItemSlot4.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.hiderItemSlot4.Value, <player>5__4);
							<>1__state = 10;
							return true;
						}
						goto IL_0527;
						IL_02e2:
						if (!string.IsNullOrEmpty(Config.seekerItemSlot2.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.seekerItemSlot2.Value, <player>5__4);
							<>1__state = 4;
							return true;
						}
						goto IL_0334;
						IL_01bc:
						if ((<>4__this.itemSpawnPositions.Count < <players>5__1.Count || <>4__this.playersTeleported < <players>5__1.Count || !StartOfRound.Instance.shipHasLanded) && <tries>5__2 > 0)
						{
							Debugger.Debug.Log($"[Progress Inter] Not fully there! We have: {<tries>5__2} left before ending automatically! {<>4__this.playersTeleported}, {<>4__this.itemSpawnPositions.Count}");
							<>2__current = (object)new WaitForSeconds(1f);
							<>1__state = 2;
							return true;
						}
						Debugger.Debug.Log($"[Final] Players Teleported: {<>4__this.playersTeleported}, item Spawn Positions: {<>4__this.itemSpawnPositions.Count}");
						<>s__3 = <players>5__1.GetEnumerator();
						<>1__state = -3;
						goto IL_052f;
						IL_0527:
						<player>5__4 = null;
						goto IL_052f;
						IL_0334:
						if (!string.IsNullOrEmpty(Config.seekerItemSlot3.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.seekerItemSlot3.Value, <player>5__4);
							<>1__state = 5;
							return true;
						}
						goto IL_0386;
						IL_0386:
						if (!string.IsNullOrEmpty(Config.seekerItemSlot4.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.seekerItemSlot4.Value, <player>5__4);
							<>1__state = 6;
							return true;
						}
						goto IL_0527;
						IL_052f:
						if (<>s__3.MoveNext())
						{
							<player>5__4 = <>s__3.Current;
							if (<>4__this.seekers.Contains(<player>5__4))
							{
								if (!string.IsNullOrEmpty(Config.seekerItemSlot1.Value))
								{
									<>2__current = <>4__this.SpawnNewItemCoroutine(Config.seekerItemSlot1.Value, <player>5__4);
									<>1__state = 3;
									return true;
								}
								goto IL_02e2;
							}
							if (!string.IsNullOrEmpty(Config.hiderItemSlot1.Value))
							{
								<>2__current = <>4__this.SpawnNewItemCoroutine(Config.hiderItemSlot1.Value, <player>5__4);
								<>1__state = 7;
								return true;
							}
							goto IL_0431;
						}
						<>m__Finally1();
						<>s__3 = default(List<PlayerControllerB>.Enumerator);
						return false;
						IL_0431:
						if (!string.IsNullOrEmpty(Config.hiderItemSlot2.Value))
						{
							<>2__current = <>4__this.SpawnNewItemCoroutine(Config.hiderItemSlot2.Value, <player>5__4);
							<>1__state = 8;
							return true;
						}
						goto IL_0483;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__3).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

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

			private object <>2__current;

			public PlayerControllerB player;

			public HideAndSeekGM <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (!string.IsNullOrEmpty(Config.zombieItemSlot1.Value))
					{
						<>2__current = <>4__this.SpawnNewItemCoroutine(Config.zombieItemSlot1.Value, player);
						<>1__state = 1;
						return true;
					}
					goto IL_008a;
				case 1:
					<>1__state = -1;
					goto IL_008a;
				case 2:
					<>1__state = -1;
					goto IL_00d4;
				case 3:
					<>1__state = -1;
					goto IL_011e;
				case 4:
					{
						<>1__state = -1;
						break;
					}
					IL_008a:
					if (!string.IsNullOrEmpty(Config.zombieItemSlot2.Value))
					{
						<>2__current = <>4__this.SpawnNewItemCoroutine(Config.zombieItemSlot2.Value, player);
						<>1__state = 2;
						return true;
					}
					goto IL_00d4;
					IL_011e:
					if (!string.IsNullOrEmpty(Config.zombieItemSlot4.Value))
					{
						<>2__current = <>4__this.SpawnNewItemCoroutine(Config.zombieItemSlot4.Value, player);
						<>1__state = 4;
						return true;
					}
					break;
					IL_00d4:
					if (!string.IsNullOrEmpty(Config.zombieItemSlot3.Value))
					{
						<>2__current = <>4__this.SpawnNewItemCoroutine(Config.zombieItemSlot3.Value, player);
						<>1__state = 3;
						return true;
					}
					goto IL_011e;
				}
				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 <SpawnNewItemCoroutine>d__33 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string itemName;

			public PlayerControllerB player;

			public bool forceSamePosition;

			public HideAndSeekGM <>4__this;

			private Item[] <items>5__1;

			private string <targetItem>5__2;

			private int <i>5__3;

			private Vector3 <itemSpawnPosition>5__4;

			private GrabbableObject <newItem>5__5;

			private int <totalItems>5__6;

			private string[] <itemNames>5__7;

			private int <r>5__8;

			private Item[] <>s__9;

			private int <>s__10;

			private Item <item>5__11;

			private List<(ulong playerId, Vector3 position)>.Enumerator <>s__12;

			private (ulong playerId, Vector3 position) <idVector>5__13;

			private GrabbableObject[] <>s__14;

			private int <>s__15;

			private GrabbableObject <item>5__16;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<items>5__1 = null;
				<targetItem>5__2 = null;
				<newItem>5__5 = null;
				<itemNames>5__7 = null;
				<>s__9 = null;
				<item>5__11 = null;
				<>s__12 = default(List<(ulong, Vector3)>.Enumerator);
				<>s__14 = null;
				<item>5__16 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b3: Expected O, but got Unknown
				//IL_0392: Unknown result type (might be due to invalid IL or missing references)
				//IL_0398: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0234: Unknown result type (might be due to invalid IL or missing references)
				//IL_0239: Unknown result type (might be due to invalid IL or missing references)
				//IL_0252: Unknown result type (might be due to invalid IL or missing references)
				//IL_0257: Unknown result type (might be due to invalid IL or missing references)
				//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: Expected O, but got Unknown
				//IL_0214: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<items>5__1 = Resources.FindObjectsOfTypeAll<Item>();
					<targetItem>5__2 = itemName;
					if (itemName.Contains(","))
					{
						<itemNames>5__7 = itemName.Split(",");
						<r>5__8 = Random.Range(0, <itemNames>5__7.Length);
						<targetItem>5__2 = <itemNames>5__7[<r>5__8];
						<itemNames>5__7 = null;
					}
					<i>5__3 = 0;
					<>s__9 = <items>5__1;
					for (<>s__10 = 0; <>s__10 < <>s__9.Length; <>s__10++)
					{
						<item>5__11 = <>s__9[<>s__10];
						if (<item>5__11.itemName.ToLower().Trim() == <targetItem>5__2.ToLower().Trim())
						{
							break;
						}
						<i>5__3++;
						<item>5__11 = null;
					}
					<>s__9 = null;
					if (<i>5__3 == <items>5__1.Length)
					{
						return false;
					}
					<itemSpawnPosition>5__4 = ((Component)player).transform.position;
					<>s__12 = <>4__this.itemSpawnPositions.GetEnumerator();
					try
					{
						while (<>s__12.MoveNext())
						{
							<idVector>5__13 = <>s__12.Current;
							if (<idVector>5__13.playerId == player.actualClientId)
							{
								<itemSpawnPosition>5__4 = <idVector>5__13.position;
							}
						}
					}
					finally
					{
						((IDisposable)<>s__12).Dispose();
					}
					<>s__12 = default(List<(ulong, Vector3)>.Enumerator);
					if (forceSamePosition)
					{
						<itemSpawnPosition>5__4 = ((Component)player).transform.position;
					}
					<itemSpawnPosition>5__4 += Vector3.up * 0.3f;
					<newItem>5__5 = Object.Instantiate<GameObject>(<items>5__1[<i>5__3].spawnPrefab, <itemSpawnPosition>5__4, Quaternion.identity).GetComponent<GrabbableObject>();
					<newItem>5__5.fallTime = 0f;
					((Component)<newItem>5__5).GetComponent<NetworkObject>().Spawn(false);
					((NetworkBehaviour)<newItem>5__5).NetworkObject.ChangeOwnership(player.actualClientId);
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<totalItems>5__6 = 0;
					<>s__14 = player.ItemSlots;
					for (<>s__15 = 0; <>s__15 < <>s__14.Length; <>s__15++)
					{
						<item>5__16 = <>s__14[<>s__15];
						if (Object.op_Implicit((Object)(object)<item>5__16))
						{
							<totalItems>5__6++;
						}
						<item>5__16 = null;
					}
					<>s__14 = null;
					if (<totalItems>5__6 < 4)
					{
						NetworkHandler instance = NetworkHandler.Instance;
						ulong actualClientId = player.actualClientId;
						string _extraMessage = ((NetworkBehaviour)<newItem>5__5).NetworkObjectId.ToString();
						instance.EventSendRpc(".grabItem", new MessageProperties(__bool: false, "", 0, 0f, actualClientId, default(Vector3), __null: false, _extraMessage));
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public static HideAndSeekGM instance;

		public RoundManager roundManager;

		public int playersTeleported;

		public int playersAlive;

		public ulong leverLastFlippedBy = 999uL;

		public ulong lastSeekerId = 10001uL;

		public List<(ulong playerId, Vector3 position)> itemSpawnPositions = new List<(ulong, Vector3)>();

		public List<ulong> pastSeekers = new List<ulong>();

		public Action<ulong> playerRevived;

		public Action roundStarted;

		public Action backInOrbit;

		public Action shipLeaving;

		public List<PlayerControllerB> seekers = new List<PlayerControllerB>();

		public List<PlayerControllerB> zombies = new List<PlayerControllerB>();

		private List<PlayerControllerB> rewardedPlayers = new List<PlayerControllerB>();

		public bool levelLoading = false;

		public bool gameEndedEarly = false;

		public SelectableLevel currentLevel;

		private bool seekersWon = false;

		public static void Init()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			instance = new GameObject().AddComponent<HideAndSeekGM>();
			((Object)instance).name = "HideAndSeekGM";
		}

		private void Start()
		{
			if (!AudioManager.LoadedAudio)
			{
				Debugger.Debug.LogWarning("Loading AudioManager Audio!");
				((MonoBehaviour)this).StartCoroutine(AudioManager.LoadAudioCoroutine());
			}
			Debugger.Debug.Log($"StartPatch, AbilityManager: Enabled = {Config.abilitiesEnabled.Value}");
			if (Config.abilitiesEnabled.Value)
			{
				((MonoBehaviour)this).StartCoroutine(AbilityManager.ConnectStart());
				backInOrbit = (Action)Delegate.Combine(backInOrbit, new Action(OnReturnToOrbit));
			}
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance.localPlayerController) || !((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer)
			{
				return;
			}
			int livingPlayers = StartOfRound.Instance.livingPlayers;
			if (playersAlive < livingPlayers)
			{
				Debugger.Debug.LogWarning("Player count reset to: " + livingPlayers);
				playersAlive = livingPlayers;
			}
			else if (playersAlive > livingPlayers)
			{
				Debugger.Debug.LogWarning("Player died! New Count: " + livingPlayers);
				playersAlive = livingPlayers;
				if (TimeOfDay.Instance.currentDayTime != 0f && !StartOfRound.Instance.shipIsLeaving)
				{
					UpdateGameState("Player Died");
				}
			}
		}

		private void OnReturnToOrbit()
		{
			//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)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			if (!GameNetworkManager.Instance.isHostingGame || seekers.Count == 0 || gameEndedEarly)
			{
				return;
			}
			foreach (PlayerControllerB allConnectedPlayer in GetAllConnectedPlayers("Award On Round End"))
			{
				if (!seekers.Contains(allConnectedPlayer) && !seekersWon)
				{
					Debugger.Debug.LogMessage("Award Hider " + (object)allConnectedPlayer);
					NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 250, 0f, allConnectedPlayer.actualClientId));
					NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "You won, and got a reward!", -1, 0f, allConnectedPlayer.actualClientId));
				}
				else if (seekers.Contains(allConnectedPlayer) && seekersWon)
				{
					Debugger.Debug.LogMessage("Award Seeker " + (object)allConnectedPlayer);
					NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 400, 0f, allConnectedPlayer.actualClientId));
					NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "You won, and got a reward!", -1, 0f, allConnectedPlayer.actualClientId));
				}
			}
		}

		public void OnLevelLoaded(SelectableLevel newLevel)
		{
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			levelLoading = true;
			roundManager = Object.FindFirstObjectByType<RoundManager>();
			rewardedPlayers.Clear();
			seekers.Clear();
			zombies.Clear();
			gameEndedEarly = false;
			playersTeleported = 0;
			NetworkEvents.TeleportPlayer();
			seekersWon = false;
			currentLevel = newLevel;
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)Abilities.turretPrefab) || !Object.op_Implicit((Object)(object)Abilities.landminePrefab))
			{
				SpawnableMapObject[] spawnableMapObjects = currentLevel.spawnableMapObjects;
				foreach (SpawnableMapObject val in spawnableMapObjects)
				{
					if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
					{
						Abilities.turretPrefab = val.prefabToSpawn;
					}
					if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null)
					{
						Abilities.landminePrefab = val.prefabToSpawn;
					}
				}
			}
			foreach (NetworkObject item in Abilities.objectsToDespawnNextRound)
			{
				if (item.IsSpawned)
				{
					item.Despawn(true);
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
			Abilities.objectsToDespawnNextRound = new List<NetworkObject>();
			NetworkHandler.Instance.EventSendRpc(".levelLoading");
			if (Config.abilitiesEnabled.Value && Config.creditsResetOnNewRound.Value)
			{
				NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: true, "", 0, 0f, 0uL, default(Vector3), __null: true));
			}
			List<string> list = Config.disabledEntities.Value.ToLower().Split(',').ToList();
			List<SpawnableEnemyWithRarity> daytimeEnemies = newLevel.DaytimeEnemies;
			List<SpawnableEnemyWithRarity> outsideEnemies = newLevel.OutsideEnemies;
			List<SpawnableEnemyWithRarity> enemies = newLevel.Enemies;
			List<SpawnableEnemyWithRarity> list2 = new List<SpawnableEnemyWithRarity>(daytimeEnemies.Count + outsideEnemies.Count + enemies.Count);
			list2.AddRange(daytimeEnemies);
			list2.AddRange(outsideEnemies);
			list2.AddRange(enemies);
			List<SpawnableEnemyWithRarity> list3 = list2;
			foreach (SpawnableEnemyWithRarity item2 in list3)
			{
				Debugger.Debug.Log("[" + item2.enemyType.enemyName + "] Checking Enemy");
				if (Config.disableAllEntities.Value)
				{
					Debugger.Debug.Log("[" + item2.enemyType.enemyName + "] DisableAllIndoorEntities is true!");
					item2.rarity = 0;
				}
				else if (list.Contains(item2.enemyType.enemyName.ToLower()))
				{
					Debugger.Debug.Log("[" + item2.enemyType.enemyName + "] Entity found in blacklist! Removing...");
					item2.rarity = 0;
				}
				else
				{
					Debugger.Debug.Log($"{item2.enemyType.enemyName}.Rarity = {item2.rarity}");
				}
			}
			List<PlayerControllerB> allConnectedPlayers = GetAllConnectedPlayers("Round Start");
			int num = 1;
			num = ((!Config.numberOfSeekers.Value.Contains("%")) ? int.Parse(Config.numberOfSeekers.Value) : Mathf.FloorToInt(float.Parse(Config.numberOfSeekers.Value.Replace("%", "")) / 100f * (float)allConnectedPlayers.Count));
			if (num >= allConnectedPlayers.Count)
			{
				num = allConnectedPlayers.Count - 1;
			}
			if (num <= 0)
			{
				num = 1;
			}
			Debugger.Debug.LogWarning($"Number of seekers this round! = '{num}'");
			string text = "";
			for (int j = 0; j < num; j++)
			{
				PlayerControllerB val2 = PickRandomSeeker();
				seekers.Add(val2);
				if (text != "")
				{
					text += ", ";
				}
				text += val2.playerUsername;
				NetworkHandler.Instance.EventSendRpc(".playerChosen", new MessageProperties(__bool: false, "", 0, 0f, ((NetworkBehaviour)val2).NetworkObjectId));
			}
			NetworkHandler.Instance.EventSendRpc(".seekersChosen", new MessageProperties(__bool: false, text, 0, 0f, 0uL));
			itemSpawnPositions.Clear();
			((MonoBehaviour)this).StartCoroutine(GivePlayersItems());
			levelLoading = false;
			NetworkHandler.Instance.EventSendRpc(".levelLoaded");
		}

		public PlayerControllerB PickRandomSeeker()
		{
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			string text = Config.seekerChooseBehavior.Value.ToLower().Trim().Replace(" ", "");
			if (seekers.Count > 0)
			{
				text = Config.extraSeekerChooseBehavior.Value.ToLower().Trim().Replace(" ", "");
			}
			ulong num = 10001uL;
			Debugger.Debug.Log("Random Type ['" + text + "']");
			switch (text)
			{
			case "nodouble":
			{
				List<ulong> list = new List<ulong>();
				foreach (PlayerControllerB allConnectedPlayer in GetAllConnectedPlayers("Chosing Seeker, (NoDouble)"))
				{
					if (allConnectedPlayer.actualClientId != lastSeekerId && !seekers.Contains(allConnectedPlayer))
					{
						Debugger.Debug.Log($"Added {allConnectedPlayer}!");
						list.Add(allConnectedPlayer.actualClientId);
					}
				}
				if (list.Count > 0)
				{
					int index = Random.Range(0, list.Count);
					Debugger.Debug.Log("[NoDouble] RandomPlayerNumber = " + index);
					num = list[index];
				}
				else
				{
					num = GameNetworkManager.Instance.localPlayerController.actualClientId;
				}
				break;
			}
			case "turns":
			{
				List<ulong> list3 = new List<ulong>();
				foreach (PlayerControllerB allConnectedPlayer2 in GetAllConnectedPlayers("Chosing Seeker (Turns)"))
				{
					if (!pastSeekers.Contains(allConnectedPlayer2.actualClientId) && !seekers.Contains(allConnectedPlayer2))
					{
						list3.Add(allConnectedPlayer2.actualClientId);
					}
				}
				if (list3.Count <= 0)
				{
					pastSeekers.Clear();
					foreach (PlayerControllerB allConnectedPlayer3 in GetAllConnectedPlayers("Chosing Seeker (Turns Exausted)"))
					{
						if (!seekers.Contains(allConnectedPlayer3))
						{
							list3.Add(allConnectedPlayer3.actualClientId);
						}
					}
				}
				int num3 = Random.Range(0, list3.Count);
				Debugger.Debug.Log($"[Turns] RandomPlayerNumber = '{num3}' Number In Current Pool '{list3.Count}'");
				num = list3[num3];
				if (list3.Contains(num))
				{
					list3.Remove(num);
					pastSeekers.Add(num);
				}
				Debugger.Debug.LogWarning("---- New Pools! ----");
				Debugger.Debug.LogWarning("CurrentPool = ");
				Debugger.Debug.Log(list3.ToArray());
				Debugger.Debug.LogWarning("PastSeekers = ");
				Debugger.Debug.Log(pastSeekers.ToArray());
				break;
			}
			case "lever":
				if (leverLastFlippedBy != 999)
				{
					Debugger.Debug.Log($"It using new lever thingy hehehe; Player id ({leverLastFlippedBy})");
					num = leverLastFlippedBy;
					break;
				}
				goto default;
			default:
			{
				if (text == "closest" && seekers.Count > 0)
				{
					float num2 = float.PositiveInfinity;
					foreach (PlayerControllerB allConnectedPlayer4 in GetAllConnectedPlayers("Chosing Seeker (Closest)"))
					{
						if (allConnectedPlayer4.isPlayerControlled && !seekers.Contains(allConnectedPlayer4))
						{
							Vector3 val = ((Component)allConnectedPlayer4).transform.position - ((Component)seekers[0]).transform.position;
							if (((Vector3)(ref val)).magnitude < num2)
							{
								num = allConnectedPlayer4.actualClientId;
							}
						}
					}
					Debugger.Debug.Log("[Closets] Closest player number = " + num);
					break;
				}
				List<ulong> list2 = new List<ulong>();
				foreach (PlayerControllerB allConnectedPlayer5 in GetAllConnectedPlayers("Chosing Seeker (Random)"))
				{
					if (!seekers.Contains(allConnectedPlayer5))
					{
						list2.Add(allConnectedPlayer5.actualClientId);
					}
				}
				int index2 = Random.Range(0, list2.Count);
				Debugger.Debug.Log("[Random] RandomPlayerNumber = " + index2);
				num = list2[index2];
				break;
			}
			}
			PlayerControllerB playerWithClientId = GetPlayerWithClientId(num);
			if ((Object)(object)playerWithClientId == (Object)null)
			{
				Debugger.Debug.LogWarning($"Could not find player with id: '{num}' using id: '0' instead");
				playerWithClientId = GetPlayerWithClientId(0uL);
			}
			lastSeekerId = num;
			return playerWithClientId;
		}

		public PlayerControllerB GetPlayerWithClientId(ulong playerId)
		{
			PlayerControllerB val = null;
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val2 in array)
			{
				if (playerId == 0)
				{
					if (GetFRFRId(val2) == playerId)
					{
						val = val2;
						break;
					}
				}
				else if (val2.actualClientId == playerId)
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				bool flag = false;
				PlayerControllerB[] array2 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val3 in array2)
				{
					if (((NetworkBehaviour)val3).OwnerClientId != val3.actualClientId)
					{
						flag = true;
						val3.actualClientId = ((NetworkBehaviour)val3).OwnerClientId;
						Debugger.Debug.LogError("'" + val3.playerUsername + "' found with an incorrect actualClientId! ------------------------");
					}
				}
				if (flag)
				{
					return GetPlayerWithClientId(playerId);
				}
			}
			Debugger.Debug.Log($"GetPlayerWithClientId({playerId}) Got player '{val}' with '{playerId}'");
			return val;
		}

		public (int aliveHiders, int aliveSeekers, int hidersObjectiveCompleted, int aliveZombies) GetAlivePlayerCount()
		{
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			foreach (PlayerControllerB allConnectedPlayer in GetAllConnectedPlayers("Get Alive Player Count"))
			{
				if (!allConnectedPlayer.isPlayerDead && ((Component)allConnectedPlayer).gameObject.tag != "Decoy")
				{
					if (zombies.Contains(allConnectedPlayer))
					{
						num4++;
					}
					else if (seekers.Contains(allConnectedPlayer))
					{
						num2++;
					}
					else if (ObjectivesManager.instance.PlayerReachedObjective(allConnectedPlayer))
					{
						num3++;
					}
					else
					{
						num++;
					}
				}
			}
			return (num, num2, num3, num2);
		}

		public void UpdateGameState(string reason)
		{
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			bool isHostingGame = GameNetworkManager.Instance.isHostingGame;
			Debugger.Debug.LogError("UpdateGameState being called because '" + reason + "'");
			GameState gameState = GetGameState();
			var (num, num2, num3, _) = GetAlivePlayerCount();
			switch (gameState)
			{
			case GameState.HidersRemain:
				if (num == 1 && Config.shipLeaveEarly.Value && Config.timeWhenLastHider.Value > TimeOfDay.Instance.currentDayTime)
				{
					NetworkHandler.Instance.EventSendRpc(".setDayTime", new MessageProperties(__bool: false, "", 0, Config.timeWhenLastHider.Value, 0uL));
				}
				NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, $"{num} Hiders Remain...", 0, 0f, 0uL));
				break;
			case GameState.HidersDied:
				seekersWon = true;
				NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
				{
					_string = "Seeker Won!",
					_bool = true
				});
				EndRound();
				break;
			case GameState.SeekersDied:
				NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
				{
					_string = "Seeker Died; Hiders Win!",
					_bool = true
				});
				if (!StartOfRound.Instance.shipHasLanded)
				{
					break;
				}
				EndRound();
				if (!isHostingGame)
				{
					break;
				}
				foreach (PlayerControllerB allConnectedPlayer in GetAllConnectedPlayers("Reward Hiders"))
				{
					if (!allConnectedPlayer.isPlayerDead && allConnectedPlayer.isPlayerControlled && !seekers.Contains(allConnectedPlayer) && !zombies.Contains(allConnectedPlayer))
					{
						int _int2 = Mathf.RoundToInt((1080f - Config.timeSeekerIsReleased.Value) * 12f / 60f);
						NetworkHandler networkHandler2 = NetworkHandler.Instance;
						ulong actualClientId = allConnectedPlayer.actualClientId;
						networkHandler2.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", _int2, 0f, actualClientId));
					}
				}
				break;
			case GameState.HidersReachedObjective:
				NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
				{
					_string = "Objective Reached; Hiders Win!",
					_bool = true
				});
				EndRound();
				if (!isHostingGame)
				{
					break;
				}
				foreach (PlayerControllerB allConnectedPlayer2 in GetAllConnectedPlayers("Reward Objective Reachers"))
				{
					if (!allConnectedPlayer2.isPlayerDead && allConnectedPlayer2.isPlayerControlled && !seekers.Contains(allConnectedPlayer2) && !zombies.Contains(allConnectedPlayer2))
					{
						int _int = Mathf.RoundToInt((1080f - Config.timeSeekerIsReleased.Value) * 12f / 60f);
						NetworkHandler networkHandler = NetworkHandler.Instance;
						ulong actualClientId = allConnectedPlayer2.actualClientId;
						networkHandler.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", _int, 0f, actualClientId));
					}
				}
				break;
			}
			if (!isHostingGame || !StartOfRound.Instance.shipHasLanded)
			{
				return;
			}
			foreach (PlayerControllerB allConnectedPlayer3 in GetAllConnectedPlayers("Reward Players Who Just Died"))
			{
				if (!allConnectedPlayer3.isPlayerDead || zombies.Contains(allConnectedPlayer3) || seekers.Contains(allConnectedPlayer3) || rewardedPlayers.Contains(allConnectedPlayer3))
				{
					continue;
				}
				rewardedPlayers.Add(allConnectedPlayer3);
				int num4 = Mathf.RoundToInt((TimeOfDay.Instance.currentDayTime - Config.timeSeekerIsReleased.Value) * 12f / 60f);
				if (num4 < 0)
				{
					num4 = 0;
				}
				Debugger.Debug.LogError($"Hider {allConnectedPlayer3.playerUsername} recived a reward of {num4}, survived for = {TimeOfDay.Instance.currentDayTime - Config.timeSeekerIsReleased.Value}");
				NetworkHandler networkHandler3 = NetworkHandler.Instance;
				ulong actualClientId = allConnectedPlayer3.actualClientId;
				networkHandler3.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", num4, 0f, actualClientId));
				foreach (PlayerControllerB seeker in seekers)
				{
					NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 50, 0f, seeker.actualClientId));
				}
				if (num > 0 && Config.deadHidersRespawn.Value)
				{
					PatchHelper.ReviveAfterWaitAndCallRpc(allConnectedPlayer3, Config.zombieSpawnDelay.Value);
				}
			}
		}

		public GameState GetGameState()
		{
			var (num, num2, num3, num4) = GetAlivePlayerCount();
			if (num2 <= 0)
			{
				return GameState.SeekersDied;
			}
			if (num <= 0)
			{
				if (num3 > 0)
				{
					return GameState.HidersReachedObjective;
				}
				return GameState.HidersDied;
			}
			return GameState.HidersRemain;
		}

		public bool ShouldGameEndEarly()
		{
			if (GetGameState() != 0)
			{
				gameEndedEarly = true;
				EndRound();
				return true;
			}
			return false;
		}

		public void EndRound()
		{
			StartMatchLever val = Object.FindAnyObjectByType<StartMatchLever>();
			val.EndGame();
			val.LeverAnimation();
			if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer)
			{
				NetworkHandler.Instance.EventSendRpc(".roundEnded");
			}
		}

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

		public void SpawnNewItem(string itemName, PlayerControllerB player, bool forceSamePosition = false)
		{
			((MonoBehaviour)RoundManager.Instance).StartCoroutine(SpawnNewItemCoroutine(itemName, player, forceSamePosition));
		}

		[IteratorStateMachine(typeof(<SpawnNewItemCoroutine>d__33))]
		public IEnumerator SpawnNewItemCoroutine(string itemName, PlayerControllerB player, bool forceSamePosition = false)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SpawnNewItemCoroutine>d__33(0)
			{
				<>4__this = this,
				itemName = itemName,
				player = player,
				forceSamePosition = forceSamePosition
			};
		}

		private static ulong GetFRFRId(PlayerControllerB player)
		{
			string text = ((Object)player).name.Replace("Player", "").Replace(" ", "").Replace("(", "")
				.Replace(")", "");
			if (text == "")
			{
				return 0uL;
			}
			return ulong.Parse(text);
		}

		public bool IsRoundActive()
		{
			List<PlayerControllerB> allConnectedPlayers = GetAllConnectedPlayers("Is Round Active");
			return playersTeleported >= allConnectedPlayers.Count && StartOfRound.Instance.shipHasLanded;
		}

		public void MakeZombie(PlayerControllerB player)
		{
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			if (zombies.Contains(player))
			{
				return;
			}
			zombies.Add(player);
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player)
			{
				((Renderer)player.thisPlayerModelArms).enabled = true;
				string value = Config.zombieSpawnLocation.Value;
				string text = value;
				if (!(text == "Entrance"))
				{
					if (text == "Inside")
					{
						EntranceTeleport val = (EntranceTeleport)AccessTools.Method(typeof(RoundManager), "FindMainEntranceScript", (Type[])null, (Type[])null).Invoke(null, new object[1] { true });
						val.TeleportPlayer();
					}
				}
				else
				{
					EntranceTeleport val2 = (EntranceTeleport)AccessTools.Method(typeof(RoundManager), "FindMainEntranceScript", (Type[])null, (Type[])null).Invoke(null, new object[1] { false });
					val2.TeleportPlayer();
				}
			}
			if (GameNetworkManager.Instance.isHostingGame)
			{
				Debugger.Debug.LogError("Giving zombie items!");
				((MonoBehaviour)this).StartCoroutine(GiveZombieItems(player));
			}
			((Graphic)player.usernameBillboardText).color = Config.zombieNameColor.Value;
			playerRevived?.Invoke(player.actualClientId);
		}

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

		public static List<PlayerControllerB> GetAllConnectedPlayers(string reason)
		{
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val in array)
			{
				if (val.isPlayerControlled || val.isPlayerDead)
				{
					list.Add(val);
				}
			}
			return list;
		}
	}
	public enum GameState
	{
		HidersRemain,
		HidersDied,
		SeekersDied,
		HidersReachedObjective
	}
	public class NetworkHandler : NetworkBehaviour
	{
		public LethalClientMessage<string> NetworkMessage = new LethalClientMessage<string>("HASMessage", (Action<string>)null, (Action<string, ulong>)null);

		public static NetworkHandler Instance { get; private set; }

		public event Action<string, MessageProperties> NetworkEvent;

		public override void OnNetworkSpawn()
		{
			this.NetworkEvent = null;
			NetworkMessage = new LethalClientMessage<string>("HASMessage", (Action<string>)null, (Action<string, ulong>)null);
			if (Object.op_Implicit((Object)(object)Instance) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
			{
				NetworkHandler instance = Instance;
				if (instance != null)
				{
					NetworkObject component = ((Component)instance).gameObject.GetComponent<NetworkObject>();
					if (component != null)
					{
						component.Despawn(true);
					}
				}
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
			Debugger.Debug.LogMessage("NetworkHandler OnNetworkSpawn(): Connecting Events....");
			NetworkEvent += NetworkEvents.LevelLoading;
			NetworkEvent += NetworkEvents.LevelLoaded;
			NetworkEvent += NetworkEvents.PlayerChosen;
			NetworkEvent += NetworkEvents.SeekersChosen;
			NetworkEvent += NetworkEvents.LockDoor;
			NetworkEvent += NetworkEvents.OpenDoor;
			NetworkEvent += NetworkEvents.PlayerTeleported;
			NetworkEvent += NetworkEvents.DisplayTip;
			NetworkEvent += NetworkEvents.LeverFlipped;
			NetworkEvent += NetworkEvents.SellCurrentItem;
			NetworkEvent += NetworkEvents.MoneyChanged;
			NetworkEvent += NetworkEvents.DestroyItem;
			NetworkEvent += NetworkEvents.BuyAbility;
			NetworkEvent += NetworkEvents.ActivateAbility;
			NetworkEvent += NetworkEvents.SetDayTime;
			NetworkEvent += NetworkEvents.GrabItem;
			NetworkEvent += NetworkEvents.RequestAbilityConfig;
			NetworkEvent += NetworkEvents.ReceiveAbilityConfig;
			NetworkEvent += NetworkEvents.RevivePlayerLocal;
			NetworkEvent += NetworkEvents.RoundEnded;
			NetworkMessage.OnReceivedFromClient += EventRecivedRpc;
		}

		public override void OnDestroy()
		{
			Debugger.Debug.LogMessage("NetworkHandler OnDestroy(): Disconnecting Events....");
			NetworkEvent -= NetworkEvents.LevelLoading;
			NetworkEvent -= NetworkEvents.LevelLoaded;
			NetworkEvent -= NetworkEvents.PlayerChosen;
			NetworkEvent -= NetworkEvents.SeekersChosen;
			NetworkEvent -= NetworkEvents.LockDoor;
			NetworkEvent -= NetworkEvents.OpenDoor;
			NetworkEvent -= NetworkEvents.PlayerTeleported;
			NetworkEvent -= NetworkEvents.DisplayTip;
			NetworkEvent -= NetworkEvents.LeverFlipped;
			NetworkEvent -= NetworkEvents.SellCurrentItem;
			NetworkEvent -= NetworkEvents.MoneyChanged;
			NetworkEvent -= NetworkEvents.DestroyItem;
			NetworkEvent -= NetworkEvents.BuyAbility;
			NetworkEvent -= NetworkEvents.ActivateAbility;
			NetworkEvent -= NetworkEvents.SetDayTime;
			NetworkEvent -= NetworkEvents.GrabItem;
			NetworkEvent -= NetworkEvents.RequestAbilityConfig;
			NetworkEvent -= NetworkEvents.ReceiveAbilityConfig;
			NetworkEvent -= NetworkEvents.RevivePlayerLocal;
			NetworkEvent -= NetworkEvents.RoundEnded;
			((NetworkBehaviour)this).OnDestroy();
		}

		public void EventSendRpc(string eventName, MessageProperties message = null)
		{
			//IL_003f: 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)
			if (message != null)
			{
				this.NetworkEvent?.Invoke(eventName, message);
			}
			else
			{
				this.NetworkEvent?.Invoke(eventName, new MessageProperties(__bool: false, "", 0, 0f, 0uL, default(Vector3), __null: true));
			}
			Debugger.Debug.LogMessage("[NetworkHandler] Sending Event! + " + eventName);
			string text = eventName + "|" + JsonUtility.ToJson((object)message);
			NetworkMessage.SendAllClients(text, false, false);
		}

		public void EventRecivedRpc(string data, ulong playerID)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			string arg = data.Split("|")[0];
			string text = data.Split("|")[1];
			MessageProperties messageProperties = (MessageProperties)JsonUtility.FromJson(text, typeof(MessageProperties));
			if (messageProperties != null)
			{
				this.NetworkEvent?.Invoke(arg, messageProperties);
			}
			else
			{
				this.NetworkEvent?.Invoke(arg, new MessageProperties(__bool: false, "", 0, 0f, 0uL, default(Vector3), __null: true));
			}
		}
	}
	[BepInPlugin("gogozooom.HideAndSeek", "Hide And Seek Nightly", "1.5.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "gogozooom.HideAndSeek";

		public const string PLUGIN_NAME = "Hide And Seek Nightly";

		public const string PLUGIN_VERSION = "1.5.0.0";

		public static ManualLogSource _Logger;

		public static Plugin instance;

		public static Config _Config;

		public static AssetBundle networkHandlerBundle;

		public static AssetBundle abilityRadialMenuBundle;

		public static AssetBundle tutorialRadialMenuBundle;

		private readonly Harmony harmony = new Harmony("gogozooom.HideAndSeek");

		private void Awake()
		{
			instance = this;
			_Logger = ((BaseUnityPlugin)this).Logger;
			_Config = new Config(((BaseUnityPlugin)this).Config);
			Debugger.Debug.Log("Patching .RoundManagerPatch");
			harmony.PatchAll(typeof(RoundManagerPatch));
			Debugger.Debug.Log("Patching .TurretPatch");
			harmony.PatchAll(typeof(TurretPatch));
			Debugger.Debug.Log("Patching .LandminePatch");
			harmony.PatchAll(typeof(LandminePatch));
			Debugger.Debug.Log("Patching .SpikeRoofTrapPatch");
			harmony.PatchAll(typeof(SpikeRoofTrapPatch));
			Debugger.Debug.Log("Patching .ShotgunPatch");
			harmony.PatchAll(typeof(ShotgunPatch));
			Debugger.Debug.Log("Patching .PlayerControllerBPatch");
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			Debugger.Debug.Log("Patching .EntranceTeleportPatch");
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			Debugger.Debug.Log("Patching .TerminalPatch");
			harmony.PatchAll(typeof(TerminalPatch));
			Debugger.Debug.Log("Patching .TimeOfDayPatch");
			harmony.PatchAll(typeof(TimeOfDayPatch));
			Debugger.Debug.Log("Patching .HUDManagerPatch");
			harmony.PatchAll(typeof(HUDManagerPatch));
			Debugger.Debug.Log("Patching .GameNetworkManagerPatch");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			Debugger.Debug.Log("Patching .StartOfRoundPatch");
			harmony.PatchAll(typeof(StartOfRoundPatch));
			Debugger.Debug.Log("Patching .InteractTriggerPatch");
			harmony.PatchAll(typeof(InteractTriggerPatch));
			Debugger.Debug.Log("Patching .GrabbableObjectPatch");
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			Debugger.Debug.Log("Patching .DeadBodyInfoPatch");
			harmony.PatchAll(typeof(DeadBodyInfoPatch));
			Debugger.Debug.Log("Patching .HoarderBugAIPatch");
			harmony.PatchAll(typeof(HoarderBugAIPatch));
			Debugger.Debug.Log("Patching .CrawlerAIPatch");
			harmony.PatchAll(typeof(CrawlerAIPatch));
			Debugger.Debug.Log("Patching .FlowermanAIPatch");
			harmony.PatchAll(typeof(FlowermanAIPatch));
			Debugger.Debug.Log("Patching .MaskedPlayerEnemyPatch");
			harmony.PatchAll(typeof(MaskedPlayerEnemyPatch));
			Debugger.Debug.Log("Patching .StartMatchLeverPatch");
			harmony.PatchAll(typeof(StartMatchLeverPatch));
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "networkhandler");
			networkHandlerBundle = AssetBundle.LoadFromFile(text);
			string text2 = Path.Combine(directoryName, "abilityradialmenu");
			abilityRadialMenuBundle = AssetBundle.LoadFromFile(text2);
			string text3 = Path.Combine(directoryName, "tutorialmenu");
			tutorialRadialMenuBundle = AssetBundle.LoadFromFile(text3);
			AbilitySpriteManager.LoadSprites();
			((MonoBehaviour)this).StartCoroutine(AudioManager.LoadAudioCoroutine());
			_Logger.LogInfo((object)"Plugin gogozooom.HideAndSeek is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "HideAndSeek";

		public const string PLUGIN_NAME = "HideAndSeek";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace HideAndSeek.Patches
{
	public class MessageProperties
	{
		public bool _null = true;

		public bool _bool = false;

		public string _string = "";

		public int _int = 0;

		public float _float = 0f;

		public ulong _ulong = 0uL;

		public Vector3 _Vector3 = default(Vector3);

		public string _extraMessage;

		public MessageProperties(bool __bool = false, string __string = "", int __int = 0, float __float = 0f, ulong __ulong = 0uL, Vector3 __Vector3 = default(Vector3), bool __null = false, string __extraMessage = null)
		{
			//IL_0039: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			_bool = __bool;
			_string = __string;
			_int = __int;
			_float = __float;
			_ulong = __ulong;
			_Vector3 = __Vector3;
			_null = __null;
			_extraMessage = __extraMessage;
		}
	}
	internal class NetworkEvents
	{
		[CompilerGenerated]
		private sealed class <GrabObjectCoroutine>d__21 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB __this;

			public GrabbableObject currentlyGrabbingObject;

			private Traverse <trav>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<trav>5__1 = Traverse.Create((object)__this);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					currentlyGrabbingObject.parentObject = __this.localItemHolder;
					if ((Object)(object)currentlyGrabbingObject.itemProperties.grabSFX != (Object)null)
					{
						__this.itemAudio.PlayOneShot(currentlyGrabbingObject.itemProperties.grabSFX, 1f);
					}
					<trav>5__1.Field("grabbedObjectValidated").SetValue((object)true);
					__this.isHoldingObject = true;
					<>2__current = (object)new WaitForSeconds(__this.grabObjectAnimationTime - 0.2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					__this.playerBodyAnimator.SetBool("GrabValidated", true);
					__this.isGrabbingObjectAnimation = false;
					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 <TeleportSelf>d__23 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public bool waitForShipToLand;

			private PlayerControllerB <localPlayer>5__1;

			private TimeOfDay <timeOfDay>5__2;

			private bool <isHost>5__3;

			private Vector3 <entrancePosition>5__4;

			private EntranceTeleport <entranceScript>5__5;

			private int <aliveSeekers>5__6;

			private List<PlayerControllerB>.Enumerator <>s__7;

			private PlayerControllerB <player>5__8;

			private EntranceTeleport <entranceScript>5__9;

			private int <itemAmount>5__10;

			private GrabbableObject[] <>s__11;

			private int <>s__12;

			private GrabbableObject <slot>5__13;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<localPlayer>5__1 = null;
				<timeOfDay>5__2 = null;
				<entranceScript>5__5 = null;
				<>s__7 = default(List<PlayerControllerB>.Enumerator);
				<player>5__8 = null;
				<entranceScript>5__9 = null;
				<>s__11 = null;
				<slot>5__13 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Expected O, but got Unknown
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0283: Unknown result type (might be due to invalid IL or missing references)
				//IL_0287: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0291: Unknown result type (might be due to invalid IL or missing references)
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_029b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: Expected O, but got Unknown
				//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: 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_05f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0601: Expected O, but got Unknown
				//IL_0511: Unknown result type (might be due to invalid IL or missing references)
				//IL_051b: Expected O, but got Unknown
				//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<localPlayer>5__1 = GameNetworkManager.Instance.localPlayerController;
					<timeOfDay>5__2 = Object.FindObjectOfType<TimeOfDay>();
					<isHost>5__3 = ((NetworkBehaviour)<localPlayer>5__1).IsServer;
					if (waitForShipToLand)
					{
						goto IL_0089;
					}
					goto IL_00a3;
				case 1:
					<>1__state = -1;
					goto IL_0089;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0089:
					if (<timeOfDay>5__2.currentDayTime <= 130f)
					{
						<>2__current = (object)new WaitForSecondsRealtime(0.5f);
						<>1__state = 1;
						return true;
					}
					goto IL_00a3;
					IL_00a3:
					if (StartOfRound.Instance.shipIsLeaving || HideAndSeekGM.instance.ShouldGameEndEarly())
					{
						Debugger.Debug.LogError("Round Ending Prematurely");
						return false;
					}
					if (<isHost>5__3)
					{
						NetworkHandler.Instance.EventSendRpc(".lockDoor");
					}
					Debugger.Debug.Log($"TIME TO TELEPORT! Local Player '{<localPlayer>5__1}' Seekers '{HideAndSeekGM.instance.seekers}'");
					if (HideAndSeekGM.instance.seekers.Contains(<localPlayer>5__1))
					{
						Debugger.Debug.LogMessage("[SEEKER] Attempted to teleport " + <localPlayer>5__1.playerUsername + " but they are the seeker!");
						if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
						{
							Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(<localPlayer>5__1);
						}
						<localPlayer>5__1.isInElevator = true;
						<localPlayer>5__1.isInHangarShipRoom = true;
						<localPlayer>5__1.isInsideFactory = false;
						<localPlayer>5__1.averageVelocity = 0f;
						<localPlayer>5__1.velocityLastFrame = Vector3.zero;
						<localPlayer>5__1.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true);
						NetworkHandler.Instance.EventSendRpc(".teleported", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
						{
							_null = false,
							_Vector3 = StartOfRound.Instance.playerSpawnPositions[0].position,
							_ulong = <localPlayer>5__1.actualClientId
						});
						break;
					}
					Debugger.Debug.LogMessage("[HIDER] Teleporting to entrance... inside" + Config.forceHidersInside.Value);
					<localPlayer>5__1.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3));
					<entrancePosition>5__4 = (Vector3)AccessTools.Method(typeof(RoundManager), "FindMainEntrancePosition", (Type[])null, (Type[])null).Invoke(null, new object[2]
					{
						true,
						!Config.forceHidersInside.Value
					});
					<entranceScript>5__5 = (EntranceTeleport)AccessTools.Method(typeof(RoundManager), "FindMainEntranceScript", (Type[])null, (Type[])null).Invoke(null, new object[1] { Config.forceHidersInside.Value });
					if ((Object)(object)<entranceScript>5__5 != (Object)null)
					{
						if (Config.teleportHidersToEntrance.Value)
						{
							<entranceScript>5__5.TeleportPlayer();
							Debugger.Debug.LogMessage("Player [" + <localPlayer>5__1.playerUsername + "] teleported to entrance...");
						}
						else
						{
							<entranceScript>5__5.TeleportPlayer();
							Debugger.Debug.LogError("teleportPlayerOutOfShip NOT IMPLEMENTED! [" + <localPlayer>5__1.playerUsername + "] teleported to entrance...");
						}
						NetworkHandler.Instance.EventSendRpc(".teleported", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
						{
							_null = false,
							_Vector3 = <entrancePosition>5__4,
							_ulong = <localPlayer>5__1.actualClientId
						});
					}
					else
					{
						Debugger.Debug.LogError("Failed to find entrance");
					}
					<entranceScript>5__5 = null;
					break;
				}
				if (<timeOfDay>5__2.currentDayTime < Config.timeSeekerIsReleased.Value)
				{
					<aliveSeekers>5__6 = 0;
					<>s__7 = HideAndSeekGM.instance.seekers.GetEnumerator();
					try
					{
						while (<>s__7.MoveNext())
						{
							<player>5__8 = <>s__7.Current;
							if (!<player>5__8.isPlayerDead && ((Component)<player>5__8).gameObject.activeSelf)
							{
								<aliveSeekers>5__6++;
							}
							<player>5__8 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__7).Dispose();
					}
					<>s__7 = default(List<PlayerControllerB>.Enumerator);
					if (<aliveSeekers>5__6 <= 0)
					{
						Object.FindAnyObjectByType<StartMatchLever>().EndGame();
						Debugger.Debug.LogError("All Seekers Died Before The Round Started!");
						return false;
					}
					if (!<timeOfDay>5__2.timeHasStarted)
					{
						return false;
					}
					<>2__current = (object)new WaitForSeconds(1f);