Decompiled source of Hide And Seek v1.4.2

HideAndSeek.dll

Decompiled a month 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.AbilityScripts.Extra;
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+71ab6a735102dae1a919c6a9c2d88b241a45428c")]
[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 VRAbilityUI
	{
		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;
				}
			}
		}

		private static IEnumerator Tryer()
		{
			try
			{
				Tick();
				currentTickLoop = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(Loop());
			}
			catch (FileNotFoundException)
			{
				Debugger.Debug.LogError("[VRAbilityUI] Could not find LCVR DLL! Using default UI...");
			}
			yield break;
		}

		private static IEnumerator Loop()
		{
			while (true)
			{
				Tick();
				yield return (object)new WaitForEndOfFrame();
			}
		}

		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> disableAllDaytimeEntities;

		public static ConfigEntry<bool> circuitBeeEnabled;

		public static ConfigEntry<bool> manticoilEnabled;

		public static ConfigEntry<bool> roamingLocustEnabled;

		public static ConfigEntry<bool> disableAllOutsideEntities;

		public static ConfigEntry<bool> baboonHawkEnabled;

		public static ConfigEntry<bool> earthLeviathanEnabled;

		public static ConfigEntry<bool> eyelessDogEnabled;

		public static ConfigEntry<bool> forestKeeperEnabled;

		public static ConfigEntry<bool> tulipSnakeEnabled;

		public static ConfigEntry<bool> mechEnabled;

		public static ConfigEntry<bool> kidnapperFoxEnabled;

		public static ConfigEntry<bool> disableAllIndoorEntities;

		public static ConfigEntry<bool> brackenEnabled;

		public static ConfigEntry<bool> bunkerSpiderEnabled;

		public static ConfigEntry<bool> coilHeadEnabled;

		public static ConfigEntry<bool> ghostGirlEnabled;

		public static ConfigEntry<bool> hoardingBugEnabled;

		public static ConfigEntry<bool> hygrodereEnabled;

		public static ConfigEntry<bool> jesterEnabled;

		public static ConfigEntry<bool> maskedEnabled;

		public static ConfigEntry<bool> nutcrackerEnabled;

		public static ConfigEntry<bool> snareFleaEnabled;

		public static ConfigEntry<bool> sporeLizardEnabled;

		public static ConfigEntry<bool> thumperEnabled;

		public static ConfigEntry<bool> butlerEnabled;

		public static ConfigEntry<bool> barberEnabled;

		public static ConfigEntry<bool> turretsEnabled;

		public static ConfigEntry<bool> landminesEnabled;

		public static ConfigEntry<bool> spikeTrapEnabled;

		public static ConfigEntry<bool> maneaterEnabled;

		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_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: 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 everytime 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 succsessfully 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)");
			disableAllDaytimeEntities = cfg.Bind<bool>("1:Entities.Daytime", "Disable All Daytime Entities", false, "Determines if daytime spawning should be disabled. (Usefull for modded maps with unique enemies)");
			circuitBeeEnabled = cfg.Bind<bool>("1:Entities.Daytime", "Spawn Circut Bees", false, "Determines if Circuit Bees should spawn.");
			manticoilEnabled = cfg.Bind<bool>("1:Entities.Daytime", "Spawn Manticoils", true, "Determines if Manticoils should spawn.");
			roamingLocustEnabled = cfg.Bind<bool>("1:Entities.Daytime", "Spawn Roaming Locusts", true, "Determines if Roaming Locusts should spawn.");
			disableAllOutsideEntities = cfg.Bind<bool>("1:Entities.Outside", "Disable All Outside Entities", false, "Determines if outside spawning should be disabled. (Usefull for modded maps with unique enemies)");
			eyelessDogEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Eyeless Dogs", false, "Determines if Eyeless Dogs should spawn.");
			forestKeeperEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Forest Keepers", false, "Determines if Forest Keepers should spawn.");
			earthLeviathanEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Earth Leviathans", false, "Determines if Earth Leviathans should spawn.");
			baboonHawkEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Baboon Hawks", false, "Determines if Baboon Hawks should spawn.");
			tulipSnakeEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Tulip Snakes", false, "Determines if Tulip Snakes should spawn.");
			mechEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Old Bird", false, "Determines if Old Birds should spawn.");
			kidnapperFoxEnabled = cfg.Bind<bool>("1:Entities.Outside", "Spawn Foxes", false, "Determines if Foxes should spawn.");
			disableAllIndoorEntities = cfg.Bind<bool>("1:Entities.Indoor", "Disable All Indoor Entities", false, "Determines if indoor spawning should be disabled. (Usefull for modded maps with unique enemies)");
			brackenEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Brackens", false, "Determines if Brackens should spawn.");
			bunkerSpiderEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Bunker Spiders", false, "Determines if Bunker Spiders should spawn.");
			coilHeadEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Coil Heads", false, "Determines if Coil Heads should spawn.");
			ghostGirlEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Ghost Girls", false, "Determines if Ghost Girls should spawn.");
			hoardingBugEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Hoarding Bugs", false, "Determines if Hoarding Bugs should spawn.");
			hygrodereEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Hygroderes (Slimes)", false, "Determines if Hygroderes (Slimes) should spawn.");
			jesterEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Jesters", false, "Determines if Jesters should spawn.");
			maskedEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Masked (Player Mimics)", false, "Determines if Masked (Player Mimics) should spawn.");
			nutcrackerEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Nutcrackers", false, "Determines if Nutcrackers should spawn.");
			snareFleaEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Snare Fleas", false, "Determines if Snare Fleas should spawn.");
			sporeLizardEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Spore Lizards", false, "Determines if Spore Lizards should spawn.");
			thumperEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Thumpers", false, "Determines if Thumpers should spawn.");
			butlerEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Butlers", false, "Determines if Butlers should spawn.");
			barberEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Barbers", false, "Determines if Barbers should spawn.");
			maneaterEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Maneaters", false, "Determines if Maneaters should spawn.");
			turretsEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Turrets", false, "Determines if Turrets should spawn.");
			landminesEnabled = cfg.Bind<bool>("1:Entities.Indoor", "Spawn Land Mines", false, "Determines if Land Mines should spawn.");
			spikeTrapEnabled = cfg.Bind<bool>("1:Entities.Indoor", "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 abilites 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 spesified 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 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 += SyncingPatch.LevelLoading;
			NetworkEvent += SyncingPatch.LevelLoaded;
			NetworkEvent += SyncingPatch.PlayerChosen;
			NetworkEvent += SyncingPatch.SeekersChosen;
			NetworkEvent += SyncingPatch.LockDoor;
			NetworkEvent += SyncingPatch.OpenDoor;
			NetworkEvent += SyncingPatch.PlayerTeleported;
			NetworkEvent += SyncingPatch.DisplayTip;
			NetworkEvent += SyncingPatch.LeverFlipped;
			NetworkEvent += SyncingPatch.SellCurrentItem;
			NetworkEvent += SyncingPatch.MoneyChanged;
			NetworkEvent += SyncingPatch.DestroyItem;
			NetworkEvent += SyncingPatch.BuyAbility;
			NetworkEvent += SyncingPatch.ActivateAbility;
			NetworkEvent += SyncingPatch.SetDayTime;
			NetworkEvent += SyncingPatch.GrabItem;
			NetworkEvent += SyncingPatch.RequestAbilityConfig;
			NetworkEvent += SyncingPatch.ReceiveAbilityConfig;
			NetworkEvent += SyncingPatch.RevivePlayerLocal;
			NetworkMessage.OnReceivedFromClient += EventRecivedRpc;
		}

		public override void OnDestroy()
		{
			Debugger.Debug.LogMessage("NetworkHandler OnDestroy(): Disconnecting Events....");
			NetworkEvent -= SyncingPatch.LevelLoading;
			NetworkEvent -= SyncingPatch.LevelLoaded;
			NetworkEvent -= SyncingPatch.PlayerChosen;
			NetworkEvent -= SyncingPatch.SeekersChosen;
			NetworkEvent -= SyncingPatch.LockDoor;
			NetworkEvent -= SyncingPatch.OpenDoor;
			NetworkEvent -= SyncingPatch.PlayerTeleported;
			NetworkEvent -= SyncingPatch.DisplayTip;
			NetworkEvent -= SyncingPatch.LeverFlipped;
			NetworkEvent -= SyncingPatch.SellCurrentItem;
			NetworkEvent -= SyncingPatch.MoneyChanged;
			NetworkEvent -= SyncingPatch.DestroyItem;
			NetworkEvent -= SyncingPatch.BuyAbility;
			NetworkEvent -= SyncingPatch.ActivateAbility;
			NetworkEvent -= SyncingPatch.SetDayTime;
			NetworkEvent -= SyncingPatch.GrabItem;
			NetworkEvent -= SyncingPatch.RequestAbilityConfig;
			NetworkEvent -= SyncingPatch.ReceiveAbilityConfig;
			NetworkEvent -= SyncingPatch.RevivePlayerLocal;
			((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("[Server] Event! + " + eventName + " Info: " + message);
			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));
			}
		}
	}
	public class Objective
	{
		private static Dictionary<ulong, bool> objectiveReached = new Dictionary<ulong, bool>();

		public static bool roundStarted = false;

		public static bool objectiveReleased = false;

		private static Coroutine currentTickLoop = null;

		public static void StartTicking()
		{
			if (currentTickLoop != null)
			{
				((MonoBehaviour)TimeOfDay.Instance).StopCoroutine(currentTickLoop);
				currentTickLoop = null;
			}
			currentTickLoop = ((MonoBehaviour)TimeOfDay.Instance).StartCoroutine(Tick());
		}

		private static IEnumerator Tick()
		{
			while (true)
			{
				if (StartOfRound.Instance.inShipPhase && roundStarted)
				{
					roundStarted = false;
					objectiveReleased = false;
					objectiveReached.Clear();
				}
				else if (!StartOfRound.Instance.shipHasLanded && !roundStarted)
				{
					roundStarted = true;
				}
				if (!Config.objective.Value.Equals("Ship", StringComparison.CurrentCultureIgnoreCase))
				{
					break;
				}
				PlayerControllerB localPlayer = GameNetworkManager.Instance.localPlayerController;
				if (TimeOfDay.Instance.currentDayTime >= Config.timeObjectiveAvailable.Value)
				{
					if (!objectiveReleased)
					{
						objectiveReleased = true;
						if (Plugin.seekers.Contains(localPlayer))
						{
							HUDManager.Instance.DisplayTip("Hide And Seek", "The exits have been unlocked, the hiders are escaping!", true, false, "LC_Tip1");
						}
						else if (Plugin.zombies.Contains(localPlayer))
						{
							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");
						}
					}
					PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
					foreach (PlayerControllerB player in array)
					{
						if (!player.isPlayerDead && player.isPlayerControlled && !Plugin.seekers.Contains(player) && !Plugin.zombies.Contains(player) && player.isInHangarShipRoom && !PlayerReachedObjective(player))
						{
							SetPlayerReachedObjective(player, b: true);
							((Graphic)player.usernameBillboardText).color = Config.objectiveNameColor.Value;
							RoundManagerPatch.PlayerDied("Objective");
							if ((Object)(object)localPlayer == (Object)(object)player)
							{
								HUDManager.Instance.DisplayTip("Hide And Seek", "You have reached the objective!", false, false, "LC_Tip1");
							}
							else
							{
								HUDManager.Instance.DisplayTip("Hide And Seek", "'" + player.playerUsername + "' has reached the objective!", true, false, "LC_Tip1");
							}
							if (((NetworkBehaviour)localPlayer).IsHost)
							{
								NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 200, 0f, player.actualClientId));
							}
						}
					}
				}
				yield return (object)new WaitForEndOfFrame();
			}
			Debug.LogError((object)("[ObjectiveManager] No objective has been set! '" + Config.objective.Value + "' Returing..."));
		}

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

		public static bool PlayerReachedObjective(PlayerControllerB player)
		{
			if (!objectiveReached.ContainsKey(player.actualClientId))
			{
				return false;
			}
			return objectiveReached[player.actualClientId];
		}
	}
	[BepInPlugin("gogozooom.HideAndSeek", "Hide And Seek", "1.4.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "gogozooom.HideAndSeek";

		public const string PLUGIN_NAME = "Hide And Seek";

		public const string PLUGIN_VERSION = "1.4.1";

		public static ManualLogSource _Logger;

		public static Plugin instance;

		public static Config _Config;

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

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

		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 static class PatchesManager
	{
		public static Action<ulong> playerRevived;

		public static void ReviveAfterWaitAndCallRpc(PlayerControllerB player, float wait = 5f)
		{
			if (!StartOfRound.Instance.shipHasLanded)
			{
				Debugger.Debug.LogError("Can't revive someone while the ship is leaving!");
			}
			else
			{
				((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ReviveAfterWaitAndCallRpcC(player, wait));
			}
		}

		private static IEnumerator ReviveAfterWaitAndCallRpcC(PlayerControllerB player, float wait = 5f)
		{
			yield return (object)new WaitForSeconds(wait);
			RevivePlayerAndCallRpc(player);
		}

		public static void RevivePlayerAndCallRpc(PlayerControllerB player)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			NetworkHandler.Instance.EventSendRpc(".revivePlayerLocal", new MessageProperties(__bool: false, "", 0, 0f, player.actualClientId));
		}

		private static void ReviveVRPlayerLocal(PlayerControllerB player)
		{
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if (localPlayerController.isPlayerDead == Object.op_Implicit((Object)(object)player))
			{
				VRSession.Instance.VolumeManager.Saturation = 0f;
				VRSession.Instance.VolumeManager.VignetteIntensity = 0f;
				((Renderer)localPlayerController.thisPlayerModelArms).enabled = true;
				localPlayerController.isPlayerControlled = false;
				localPlayerController.takingFallDamage = false;
				((Behaviour)VRSession.Instance.LocalPlayer.LeftHandInteractor).enabled = true;
				((Behaviour)VRSession.Instance.LocalPlayer.RightHandInteractor).enabled = true;
				HangarShipDoor val = Object.FindObjectOfType<HangarShipDoor>();
				Transform val2 = ((Component)val).transform.Find("HangarDoorLeft (1)");
				Transform val3 = ((Component)val).transform.Find("HangarDoorRight (1)");
				Component val4 = (Component)(object)((Component)val).transform.Find("Cube");
				((Collider)((Component)val2).GetComponent<BoxCollider>()).isTrigger = false;
				((Collider)((Component)val3).GetComponent<BoxCollider>()).isTrigger = false;
				((Collider)val4.GetComponent<BoxCollider>()).isTrigger = false;
				((Collider)((Component)localPlayerController).GetComponent<CharacterController>()).excludeLayers = LayerMask.op_Implicit(0);
				VRSession.Instance.HUD.ToggleSpectatorLight((bool?)false);
			}
		}

		public static IEnumerator GiveZombieItems(PlayerControllerB player)
		{
			if (!string.IsNullOrEmpty(Config.zombieItemSlot1.Value))
			{
				yield return RoundManagerPatch.SpawnNewItemCoroutine(Config.zombieItemSlot1.Value, player);
			}
			if (!string.IsNullOrEmpty(Config.zombieItemSlot2.Value))
			{
				yield return RoundManagerPatch.SpawnNewItemCoroutine(Config.zombieItemSlot2.Value, player);
			}
			if (!string.IsNullOrEmpty(Config.zombieItemSlot3.Value))
			{
				yield return RoundManagerPatch.SpawnNewItemCoroutine(Config.zombieItemSlot3.Value, player);
			}
			if (!string.IsNullOrEmpty(Config.zombieItemSlot4.Value))
			{
				yield return RoundManagerPatch.SpawnNewItemCoroutine(Config.zombieItemSlot4.Value, player);
			}
		}

		private static IEnumerator FixTip()
		{
			yield return (object)new WaitForSeconds(2f);
			HUDManager.Instance.tipsPanelAnimator.SetTrigger("TriggerHint");
		}

		public static void RevivePlayerLocal(PlayerControllerB player)
		{
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Expected O, but got Unknown
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Expected O, but got Unknown
			if ((Object)(object)player == (Object)null)
			{
				Debugger.Debug.LogError($"RevivePlayer({player}) Tried to revive null player!");
				return;
			}
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				Debugger.Debug.LogError($"RevivePlayer({player}) No start of round instance!");
				return;
			}
			if (instance.shipIsLeaving)
			{
				Debugger.Debug.LogError($"RevivePlayer({player}) Tried to revive, but has already left!");
				return;
			}
			GameObject val = null;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player)
			{
				val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD");
				val.SetActive(false);
			}
			Debugger.Debug.Log("Reviving players A");
			try
			{
				ReviveVRPlayerLocal(player);
			}
			catch (Exception)
			{
				Debugger.Debug.LogError("ReviveVRPlayerLocal Ran into an error!");
			}
			player.ResetPlayerBloodObjects(player.isPlayerDead);
			if (player.isPlayerDead || player.isPlayerControlled)
			{
				player.isClimbingLadder = false;
				player.clampLooking = false;
				player.inVehicleAnimation = false;
				player.disableMoveInput = false;
				player.ResetZAndXRotation();
				((Collider)player.thisController).enabled = true;
				player.health = 100;
				player.hasBeenCriticallyInjured = false;
				player.disableLookInput = false;
				player.disableInteract = false;
				Debugger.Debug.Log("Reviving players B");
				if (player.isPlayerDead)
				{
					player.isPlayerDead = false;
					player.isPlayerControlled = true;
					player.isInElevator = true;
					player.isInHangarShipRoom = true;
					player.isInsideFactory = false;
					player.parentedToElevatorLastFrame = false;
					player.overrideGameOverSpectatePivot = null;
					instance.SetPlayerObjectExtrapolate(false);
					player.TeleportPlayer(instance.playerSpawnPositions[0].position, false, 0f, false, true);
					player.setPositionOfDeadPlayer = false;
					player.DisablePlayerModel(((Component)player).gameObject, true, true);
					((Behaviour)player.helmetLight).enabled = false;
					Debugger.Debug.Log("Reviving players C");
					player.Crouch(false);
					player.criticallyInjured = false;
					if ((Object)(object)player.playerBodyAnimator != (Object)null)
					{
						player.playerBodyAnimator.SetBool("Limp", false);
					}
					player.bleedingHeavily = false;
					player.activatingItem = false;
					player.twoHanded = false;
					player.inShockingMinigame = false;
					player.inSpecialInteractAnimation = false;
					player.freeRotationInInteractAnimation = false;
					player.disableSyncInAnimation = false;
					player.inAnimationWithEnemy = null;
					player.holdingWalkieTalkie = false;
					player.speakingToWalkieTalkie = false;
					Debugger.Debug.Log("Reviving players D");
					player.isSinking = false;
					player.isUnderwater = false;
					player.sinkingValue = 0f;
					player.statusEffectAudio.Stop();
					player.DisableJetpackControlsLocally();
					player.health = 100;
					Debugger.Debug.Log("Reviving players E");
					player.mapRadarDotAnimator.SetBool("dead", false);
					player.externalForceAutoFade = Vector3.zero;
					if (((NetworkBehaviour)player).IsOwner)
					{
						HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
						player.hasBegunSpectating = false;
						HUDManager.Instance.RemoveSpectateUI();
						HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
						player.hinderedMultiplier = 1f;
						player.isMovementHindered = 0;
						player.sourcesCausingSinking = 0;
						HUDManager.Instance.HideHUD(false);
						Debugger.Debug.Log("Reviving players E2");
						player.reverbPreset = instance.shipReverb;
					}
				}
				Debugger.Debug.Log("Reviving players F");
				SoundManager.Instance.earsRingingTimer = 0f;
				player.voiceMuffledByEnemy = false;
				SoundManager.Instance.playerVoicePitchTargets[(uint)player.actualClientId] = 1f;
				SoundManager.Instance.SetPlayerPitch(1f, (int)player.actualClientId);
				if ((Object)(object)player.currentVoiceChatIngameSettings == (Object)null)
				{
					instance.RefreshPlayerVoicePlaybackObjects();
				}
				if ((Object)(object)player.currentVoiceChatIngameSettings != (Object)null)
				{
					if ((Object)(object)player.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						player.currentVoiceChatIngameSettings.InitializeComponents();
					}
					if ((Object)(object)player.currentVoiceChatIngameSettings.voiceAudio == (Object)null)
					{
						return;
					}
					((Component)player.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
				}
				Debugger.Debug.Log("Reviving players G");
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			localPlayerController.bleedingHeavily = false;
			localPlayerController.criticallyInjured = false;
			localPlayerController.playerBodyAnimator.SetBool("Limp", false);
			localPlayerController.health = 100;
			HUDManager.Instance.UpdateHealthUI(100, false);
			localPlayerController.spectatedPlayerScript = null;
			((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
			Debugger.Debug.Log($"Reviving players H {player.deadBody}");
			instance.SetSpectateCameraToGameOverMode(false, localPlayerController);
			instance.livingPlayers++;
			instance.UpdatePlayerVoiceEffects();
			if (Object.op_Implicit((Object)(object)val))
			{
				val.SetActive(true);
				((MonoBehaviour)instance).StartCoroutine(FixTip());
			}
			if (!Plugin.zombies.Contains(player))
			{
				Plugin.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 val2 = (EntranceTeleport)AccessTools.Method(typeof(RoundManager), "FindMainEntranceScript", (Type[])null, (Type[])null).Invoke(null, new object[1] { true });
						val2.TeleportPlayer();
					}
				}
				else
				{
					EntranceTeleport val3 = (EntranceTeleport)AccessTools.Method(typeof(RoundManager), "FindMainEntranceScript", (Type[])null, (Type[])null).Invoke(null, new object[1] { false });
					val3.TeleportPlayer();
				}
			}
			if (GameNetworkManager.Instance.isHostingGame)
			{
				Debugger.Debug.LogError("Giving player items!");
				((MonoBehaviour)instance).StartCoroutine(GiveZombieItems(player));
			}
			((Graphic)player.usernameBillboardText).color = Config.zombieNameColor.Value;
			playerRevived?.Invoke(player.actualClientId);
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public class RoundManagerPatch
	{
		public static RoundManager instance;

		public static int playersTeleported;

		public static int playersAlive;

		public static ulong leverLastFlippedBy = 999uL;

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

		private static bool shipLeaving = false;

		public static bool levelLoading = false;

		public static SelectableLevel currentLevel;

		public static ulong lastSeekerId = 10001uL;

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

		private static bool seekersWon = false;

		private static List<PlayerControllerB> revivedPlayers = new List<PlayerControllerB>();

		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void AwakePatch()
		{
			Debugger.Debug.LogMessage("RoundManager Awake started with variables..:");
			Debugger.Debug.LogMessage($"instance = {instance}");
			Debugger.Debug.LogMessage($"playersTeleported = {playersTeleported}");
			Debugger.Debug.LogMessage($"playersAlive = {playersAlive}");
			Debugger.Debug.LogMessage($"leverLastFlippedBy = {leverLastFlippedBy}");
			Debugger.Debug.LogMessage($"itemSpawnPositions = {itemSpawnPositions}");
			if (leverLastFlippedBy != 999)
			{
				Debugger.Debug.LogError("Player left half way through! Fixing variables");
				playersTeleported = 0;
				playersAlive = 0;
				leverLastFlippedBy = 999uL;
				levelLoading = false;
				lastSeekerId = 10001uL;
				pastSeekers.Clear();
				itemSpawnPositions.Clear();
				revivedPlayers.Clear();
				Plugin.seekers.Clear();
				Plugin.zombies.Clear();
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref RoundManager __instance)
		{
			if (!AudioManager.LoadedAudio)
			{
				Debugger.Debug.LogWarning("Loading AudioManager Audio!");
				((MonoBehaviour)__instance).StartCoroutine(AudioManager.LoadAudioCoroutine());
			}
			Debugger.Debug.Log($"StartPatch, AbilityManager: Enabled = {Config.abilitiesEnabled.Value}");
			if (Config.abilitiesEnabled.Value)
			{
				((MonoBehaviour)Object.FindObjectOfType<RoundManager>()).StartCoroutine(AbilityManager.ConnectStart());
				Objective.StartTicking();
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch()
		{
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: 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)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			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)
				{
					PlayerDied("Player Died!");
				}
			}
			if (StartOfRound.Instance.shipIsLeaving && !shipLeaving)
			{
				shipLeaving = true;
			}
			else
			{
				if (!StartOfRound.Instance.inShipPhase || !shipLeaving)
				{
					return;
				}
				shipLeaving = false;
				if (Plugin.seekers.Count <= 0)
				{
					return;
				}
				PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val in array)
				{
					if (((Component)val).gameObject.activeSelf)
					{
						if (!Plugin.seekers.Contains(val) && !seekersWon)
						{
							NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 250, 0f, val.actualClientId));
							NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "You won, and got a reward!", -1, 0f, val.actualClientId));
						}
						else if (Plugin.seekers.Contains(val) && seekersWon)
						{
							NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 400, 0f, val.actualClientId));
							NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "You won, and got a reward!", -1, 0f, val.actualClientId));
						}
					}
				}
			}
		}

		[HarmonyPatch("LoadNewLevel")]
		[HarmonyPrefix]
		private static bool LoadLevelPatch(ref int randomSeed, ref SelectableLevel newLevel)
		{
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c9f: Unknown result type (might be due to invalid IL or missing references)
			Debugger.Debug.LogMessage("[LoadLevelPatch] LoadLevel Start!");
			if (levelLoading)
			{
				Debugger.Debug.LogError("levelLoading is true! This should be abnormal!");
				return false;
			}
			levelLoading = true;
			instance = Object.FindFirstObjectByType<RoundManager>();
			revivedPlayers.Clear();
			Plugin.seekers.Clear();
			Plugin.zombies.Clear();
			playersTeleported = 0;
			SyncingPatch.TeleportPlayer();
			seekersWon = false;
			currentLevel = newLevel;
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				return true;
			}
			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));
			}
			foreach (SpawnableEnemyWithRarity daytimeEnemy in newLevel.DaytimeEnemies)
			{
				Debugger.Debug.Log("Checking DaytimeEnemey: " + daytimeEnemy.enemyType.enemyName);
				if (Config.disableAllDaytimeEntities.Value)
				{
					Debugger.Debug.Log("DisableAllDaytimeEntities is true! " + daytimeEnemy.enemyType.enemyName);
					daytimeEnemy.rarity = 0;
					continue;
				}
				switch (daytimeEnemy.enemyType.enemyName)
				{
				case "Red Locust Bees":
					if (!Config.circuitBeeEnabled.Value)
					{
						daytimeEnemy.rarity = 0;
					}
					break;
				case "Manticoil":
					if (!Config.manticoilEnabled.Value)
					{
						daytimeEnemy.rarity = 0;
					}
					break;
				case "Docile Locust Bees":
					if (!Config.roamingLocustEnabled.Value)
					{
						daytimeEnemy.rarity = 0;
					}
					break;
				}
				Debugger.Debug.Log(daytimeEnemy.enemyType.enemyName + ".Rarity = " + daytimeEnemy.rarity);
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
			{
				Debugger.Debug.Log("Checking OutsideEnemey: " + outsideEnemy.enemyType.enemyName);
				if (Config.disableAllOutsideEntities.Value)
				{
					Debugger.Debug.Log("DisableAllOutsideEntities is true! " + outsideEnemy.enemyType.enemyName);
					outsideEnemy.rarity = 0;
					continue;
				}
				switch (outsideEnemy.enemyType.enemyName)
				{
				case "MouthDog":
					if (!Config.eyelessDogEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "ForestGiant":
					if (!Config.forestKeeperEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "Baboon hawk":
					if (!Config.baboonHawkEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "Earth Leviathan":
					if (!Config.earthLeviathanEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "RadMech":
					if (!Config.mechEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "Tulip Snake":
					if (!Config.tulipSnakeEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				case "BushWolf":
					if (!Config.kidnapperFoxEnabled.Value)
					{
						outsideEnemy.rarity = 0;
					}
					break;
				}
				Debugger.Debug.Log(outsideEnemy.enemyType.enemyName + ".Rarity = " + outsideEnemy.rarity);
			}
			foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
			{
				Debugger.Debug.Log("Checking Enemey: " + enemy.enemyType.enemyName);
				if (Config.disableAllIndoorEntities.Value)
				{
					Debugger.Debug.Log("DisableAllIndoorEntities is true! " + enemy.enemyType.enemyName);
					enemy.rarity = 0;
					continue;
				}
				switch (enemy.enemyType.enemyName)
				{
				case "Centipede":
					if (!Config.snareFleaEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Bunker Spider":
					if (!Config.bunkerSpiderEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Hoarding bug":
					if (!Config.hoardingBugEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Flowerman":
					if (!Config.brackenEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Crawler":
					if (!Config.thumperEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Blob":
					if (!Config.hygrodereEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Girl":
					if (!Config.ghostGirlEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Puffer":
					if (!Config.sporeLizardEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Nutcracker":
					if (!Config.nutcrackerEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Jester":
					if (!Config.jesterEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Spring":
					if (!Config.coilHeadEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Masked":
					if (!Config.maskedEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Butler":
					if (!Config.butlerEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "Clay Surgeon":
					if (!Config.barberEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				case "CaveDweller":
					if (!Config.maneaterEnabled.Value)
					{
						enemy.rarity = 0;
					}
					break;
				}
				Debugger.Debug.Log(enemy.enemyType.enemyName + ".Rarity = " + enemy.rarity);
			}
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val2 in array)
			{
				if (val2.isPlayerControlled)
				{
					Debugger.Debug.LogMessage("Found " + ((Object)val2).name + "! Adding to active list.");
					list.Add(val2);
				}
			}
			int num = 1;
			num = ((!Config.numberOfSeekers.Value.Contains("%")) ? int.Parse(Config.numberOfSeekers.Value) : Mathf.FloorToInt(float.Parse(Config.numberOfSeekers.Value.Replace("%", "")) / 100f * (float)list.Count));
			if (num >= list.Count)
			{
				num = list.Count - 1;
			}
			if (num <= 0)
			{
				num = 1;
			}
			Debugger.Debug.LogWarning($"Number of seekers this round! = '{num}'");
			string text = "";
			for (int k = 0; k < num; k++)
			{
				PlayerControllerB val3 = PickRandomSeeker();
				Plugin.seekers.Add(val3);
				if (text != "")
				{
					text += ", ";
				}
				text += val3.playerUsername;
				NetworkHandler.Instance.EventSendRpc(".playerChosen", new MessageProperties(__bool: false, "", 0, 0f, ((NetworkBehaviour)val3).NetworkObjectId));
			}
			NetworkHandler.Instance.EventSendRpc(".seekersChosen", new MessageProperties(__bool: false, text, 0, 0f, 0uL));
			itemSpawnPositions.Clear();
			((MonoBehaviour)instance).StartCoroutine(GivePlayersItems());
			levelLoading = false;
			NetworkHandler.Instance.EventSendRpc(".levelLoaded", new MessageProperties(__bool: false, "", 0, 0f, 0uL));
			return true;
		}

		public static PlayerControllerB PickRandomSeeker()
		{
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: 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)
			string text = Config.seekerChooseBehavior.Value.ToLower().Trim().Replace(" ", "");
			if (Plugin.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> list3 = new List<ulong>();
				PlayerControllerB[] array5 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val6 in array5)
				{
					Debugger.Debug.Log($"Searching {val6}, {val6.isPlayerControlled}, {val6.actualClientId}");
					if (val6.isPlayerControlled && val6.actualClientId != lastSeekerId && !Plugin.seekers.Contains(val6))
					{
						Debugger.Debug.Log($"Added {val6}!");
						list3.Add(val6.actualClientId);
					}
				}
				if (list3.Count > 0)
				{
					int index2 = Random.Range(0, list3.Count);
					Debugger.Debug.Log("[NoDouble] RandomPlayerNumber = " + index2);
					num = list3[index2];
				}
				else
				{
					num = GameNetworkManager.Instance.localPlayerController.actualClientId;
				}
				break;
			}
			case "turns":
			{
				List<ulong> list = new List<ulong>();
				PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val in array)
				{
					if (val.isPlayerControlled && !pastSeekers.Contains(val.actualClientId) && !Plugin.seekers.Contains(val))
					{
						list.Add(val.actualClientId);
					}
				}
				if (list.Count <= 0)
				{
					pastSeekers.Clear();
					PlayerControllerB[] array2 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
					foreach (PlayerControllerB val2 in array2)
					{
						if (val2.isPlayerControlled && !Plugin.seekers.Contains(val2))
						{
							list.Add(val2.actualClientId);
						}
					}
				}
				int num2 = Random.Range(0, list.Count);
				Debugger.Debug.Log($"[Turns] RandomPlayerNumber = '{num2}' Number In Current Pool '{list.Count}'");
				num = list[num2];
				if (list.Contains(num))
				{
					list.Remove(num);
					pastSeekers.Add(num);
				}
				Debugger.Debug.LogWarning("---- New Pools! ----");
				Debugger.Debug.LogWarning("CurrentPool = ");
				Debugger.Debug.Log(list.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" && Plugin.seekers.Count > 0)
				{
					float num3 = float.PositiveInfinity;
					PlayerControllerB[] array3 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
					foreach (PlayerControllerB val3 in array3)
					{
						if (val3.isPlayerControlled && !Plugin.seekers.Contains(val3))
						{
							Vector3 val4 = ((Component)val3).transform.position - ((Component)Plugin.seekers[0]).transform.position;
							if (((Vector3)(ref val4)).magnitude < num3)
							{
								num = val3.actualClientId;
							}
						}
					}
					Debugger.Debug.Log("[Closets] Closest player number = " + num);
					break;
				}
				List<ulong> list2 = new List<ulong>();
				PlayerControllerB[] array4 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val5 in array4)
				{
					if (val5.isPlayerControlled && !Plugin.seekers.Contains(val5))
					{
						list2.Add(val5.actualClientId);
					}
				}
				int index = Random.Range(0, list2.Count);
				Debugger.Debug.Log("[Random] RandomPlayerNumber = " + index);
				num = list2[index];
				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 static PlayerControllerB GetPlayerWithClientId(ulong playerId)
		{
			PlayerControllerB val = null;
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val2 in array)
			{
				Debugger.Debug.Log($"Looped through {((Object)val2).name}; Client id {val2.actualClientId}; Is controlled; {val2.isPlayerControlled}");
				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.LogWarning("'" + val3.playerUsername + "' found with an incorrect actualClientId!");
					}
				}
				if (flag)
				{
					return GetPlayerWithClientId(playerId);
				}
			}
			Debugger.Debug.Log($"GetPlayerWithClientId({playerId}) Got player '{val}' with '{playerId}'");
			return val;
		}

		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 static void PlayerDied(string reason = "", bool checking = false)
		{
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val in array)
			{
				if (!val.isPlayerDead && ((Component)val).gameObject.tag != "Decoy")
				{
					if (Plugin.zombies.Contains(val))
					{
						num4++;
					}
					else if (Plugin.seekers.Contains(val))
					{
						num3++;
					}
					else if (Objective.PlayerReachedObjective(val))
					{
						num2++;
					}
					else
					{
						num++;
					}
				}
			}
			if (StartOfRound.Instance.shipIsLeaving)
			{
				return;
			}
			StartMatchLever val2 = Object.FindAnyObjectByType<StartMatchLever>();
			if (num3 <= 0)
			{
				if (!checking)
				{
					NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
					{
						_string = "Seeker Died; Hiders Win!",
						_bool = true
					});
				}
				Debugger.Debug.LogMessage("_________ SEEKER DIED! _________");
				if (!StartOfRound.Instance.shipHasLanded)
				{
					return;
				}
				val2.EndGame();
				val2.LeverAnimation();
				PlayerControllerB[] array2 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val3 in array2)
				{
					if (!val3.isPlayerDead && val3.isPlayerControlled && !Plugin.seekers.Contains(val3) && !Plugin.zombies.Contains(val3))
					{
						int _int = Mathf.RoundToInt((1080f - Config.timeSeekerIsReleased.Value) * 12f / 60f);
						NetworkHandler networkHandler = NetworkHandler.Instance;
						ulong actualClientId = val3.actualClientId;
						networkHandler.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", _int, 0f, actualClientId));
					}
				}
				return;
			}
			if (!checking)
			{
				Debugger.Debug.LogMessage("_________ PLAYER DIED! _________");
			}
			if (num <= 0 && GameNetworkManager.Instance.connectedPlayers != 1)
			{
				if (num2 > 0)
				{
					if (!checking)
					{
						NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
						{
							_string = "Objective Reached; Hiders Win!",
							_bool = true
						});
					}
					Debugger.Debug.LogMessage($"_________ HIDERS WON! _________ Objectives Complete? '{num2}'");
					val2.EndGame();
					val2.LeverAnimation();
					PlayerControllerB[] array3 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
					foreach (PlayerControllerB val4 in array3)
					{
						if (!val4.isPlayerDead && val4.isPlayerControlled && !Plugin.seekers.Contains(val4) && !Plugin.zombies.Contains(val4))
						{
							int _int2 = Mathf.RoundToInt((1080f - Config.timeSeekerIsReleased.Value) * 12f / 60f);
							NetworkHandler networkHandler2 = NetworkHandler.Instance;
							ulong actualClientId = val4.actualClientId;
							networkHandler2.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", _int2, 0f, actualClientId));
						}
					}
				}
				else
				{
					if (!seekersWon)
					{
						seekersWon = true;
					}
					if (!checking)
					{
						NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "", 0, 0f, 0uL)
						{
							_string = "Seeker Won!",
							_bool = true
						});
					}
					Debugger.Debug.LogMessage($"_________ SEEKER WON! _________ {GameNetworkManager.Instance.connectedPlayers} Connected player amount. != 1?: {StartOfRound.Instance.connectedPlayersAmount != 1} ");
					val2.EndGame();
					val2.LeverAnimation();
				}
			}
			else if (num >= 1 && !checking)
			{
				if (num == 1)
				{
					if (Config.shipLeaveEarly.Value && Config.timeWhenLastHider.Value > TimeOfDay.Instance.currentDayTime)
					{
						NetworkHandler.Instance.EventSendRpc(".setDayTime", new MessageProperties(__bool: false, "", 0, Config.timeWhenLastHider.Value, 0uL));
					}
					if (reason != "Objective")
					{
						NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, "1 Hider Remains...", 0, 0f, 0uL));
					}
				}
				else if (reason != "Objective")
				{
					NetworkHandler.Instance.EventSendRpc(".tip", new MessageProperties(__bool: false, $"{num} Hiders Remain...", 0, 0f, 0uL));
				}
			}
			if (!checking)
			{
				PlayerControllerB[] array4 = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
				foreach (PlayerControllerB val5 in array4)
				{
					if (!val5.isPlayerDead || Plugin.zombies.Contains(val5) || Plugin.seekers.Contains(val5) || (revivedPlayers.Contains(val5) && Config.deadZombiesRespawn.Value))
					{
						continue;
					}
					int num5 = Mathf.RoundToInt((TimeOfDay.Instance.currentDayTime - Config.timeSeekerIsReleased.Value) * 12f / 60f);
					if (num5 < 0)
					{
						num5 = 0;
					}
					Debugger.Debug.LogError($"Hider {val5.playerUsername} recived a reward of {num5}, survived for = {TimeOfDay.Instance.currentDayTime - Config.timeSeekerIsReleased.Value}");
					NetworkHandler networkHandler3 = NetworkHandler.Instance;
					ulong actualClientId = val5.actualClientId;
					networkHandler3.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", num5, 0f, actualClientId));
					foreach (PlayerControllerB seeker in Plugin.seekers)
					{
						NetworkHandler.Instance.EventSendRpc(".moneyChanged", new MessageProperties(__bool: false, "silent", 50, 0f, seeker.actualClientId));
					}
					Plugin.zombies.Add(val5);
					revivedPlayers.Add(val5);
					if (num > 0 && Config.deadHidersRespawn.Value)
					{
						PatchesManager.ReviveAfterWaitAndCallRpc(val5, Config.zombieSpawnDelay.Value);
					}
				}
			}
			if (!checking)
			{
				Debugger.Debug.LogMessage($"_________ ({num + num3}) Players Left! _________");
			}
		}

		public static IEnumerator GivePlayersItems()
		{
			List<PlayerControllerB> players = new List<PlayerControllerB>();
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB player in array)
			{
				if (player.isPlayerControlled)
				{
					players.Add(player);
				}
			}
			Debugger.Debug.LogMessage("Game Has Started = " + GameNetworkManager.Instance.gameHasStarted);
			while (true)
			{
				if (itemSpawnPositions.Count == 0 || playersTeleported == 0 || !StartOfRound.Instance.shipHasLanded)
				{
					if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost)
					{
						PlayerDied("Before Item Give", checking: true);
					}
					if (!StartOfRound.Instance.shipIsLeaving)
					{
						yield return (object)new WaitForSeconds(1f);
						continue;
					}
					break;
				}
				int tries = 5;
				while ((itemSpawnPositions.Count < players.Count || playersTeleported < players.Count || !StartOfRound.Instance.shipHasLanded) && tries > 0)
				{
					Debugger.Debug.Log($"[Progress Inter] Not fully there! We have: {tries} left before ending automatically! {playersTeleported}, {itemSpawnPositions.Count}");
					yield return (object)new WaitForSeconds(1f);
					tries--;
				}
				Debugger.Debug.Log($"[Final] Players Teleported: {playersTeleported}, item Spawn Positions: {itemSpawnPositions.Count}");
				foreach (PlayerControllerB player2 in players)
				{
					if (Plugin.seekers.Contains(player2))
					{
						if (!string.IsNullOrEmpty(Config.seekerItemSlot1.Value))
						{
							yield return SpawnNewItemCoroutine(Config.seekerItemSlot1.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.seekerItemSlot2.Value))
						{
							yield return SpawnNewItemCoroutine(Config.seekerItemSlot2.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.seekerItemSlot3.Value))
						{
							yield return SpawnNewItemCoroutine(Config.seekerItemSlot3.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.seekerItemSlot4.Value))
						{
							yield return SpawnNewItemCoroutine(Config.seekerItemSlot4.Value, player2);
						}
					}
					else
					{
						if (!string.IsNullOrEmpty(Config.hiderItemSlot1.Value))
						{
							yield return SpawnNewItemCoroutine(Config.hiderItemSlot1.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.hiderItemSlot2.Value))
						{
							yield return SpawnNewItemCoroutine(Config.hiderItemSlot2.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.hiderItemSlot3.Value))
						{
							yield return SpawnNewItemCoroutine(Config.hiderItemSlot3.Value, player2);
						}
						if (!string.IsNullOrEmpty(Config.hiderItemSlot4.Value))
						{
							yield return SpawnNewItemCoroutine(Config.hiderItemSlot4.Value, player2);
						}
					}
				}
				break;
			}
		}

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

		public static IEnumerator SpawnNewItemCoroutine(string itemName, PlayerControllerB player, bool forceSamePosition = false)
		{
			Debugger.Debug.LogMessage("SpawnNewItem()!");
			Item[] items = Resources.FindObjectsOfTypeAll<Item>();
			string targetItem = itemName;
			if (itemName.Contains(","))
			{
				string[] itemNames = itemName.Split(",");
				int r = Random.Range(0, itemNames.Length);
				targetItem = itemNames[r];
			}
			int i = 0;
			Item[] array = items;
			foreach (Item item2 in array)
			{
				if (item2.itemName.ToLower().Trim() == targetItem.ToLower().Trim())
				{
					break;
				}
				i++;
			}
			if (i == items.Length)
			{
				Debugger.Debug.LogWarning("Could not find " + targetItem + " in items id list! (Look at README.md to see item IDs)");
				yield break;
			}
			Vector3 itemSpawnPosition2 = ((Component)player).transform.position;
			bool newPositionFound = false;
			Debugger.Debug.Log($"Spawing Item with spawn positions: {itemSpawnPositions.Count}");
			foreach (var idVector in itemSpawnPositions)
			{
				Debugger.Debug.Log($"Scanning {idVector.playerId} with position {idVector.position}");
				if (idVector.playerId == player.actualClientId)
				{
					newPositionFound = true;
					itemSpawnPosition2 = idVector.position;
					Debugger.Debug.Log($"New Item Spawn Position! {itemSpawnPosition2}");
				}
			}
			if (!newPositionFound)
			{
				Debugger.Debug.LogError("Could not find Spawn Position for player");
			}
			if (forceSamePosition)
			{
				itemSpawnPosition2 = ((Component)player).transform.position;
			}
			itemSpawnPosition2 += Vector3.up * 0.3f;
			GrabbableObject newItem = Object.Instantiate<GameObject>(items[i].spawnPrefab, itemSpawnPosition2, Quaternion.identity).GetComponent<GrabbableObject>();
			newItem.fallTime = 0f;
			((Component)newItem).GetComponent<NetworkObject>().Spawn(false);
			((NetworkBehaviour)newItem).NetworkObject.ChangeOwnership(player.actualClientId);
			Debugger.Debug.LogMessage($"Spawning {((Object)newItem).name} for {player.playerUsername} at position {((Component)newItem).transform.position}");
			yield return (object)new WaitForEndOfFrame();
			int totalItems = 0;
			GrabbableObject[] itemSlots = player.ItemSlots;
			foreach (GrabbableObject item in itemSlots)
			{
				if (Object.op_Implicit((Object)(object)item))
				{
					totalItems++;
				}
			}
			if (totalItems < 4)
			{
				NetworkHandler networkHandler = NetworkHandler.Instance;
				ulong actualClientId = player.actualClientId;
				string _extraMessage = ((NetworkBehaviour)newItem).NetworkObjectId.ToString();
				networkHandler.EventSendRpc(".grabItem", new MessageProperties(__bool: false, "", 0, 0f, actualClientId, default(Vector3), __null: false, _extraMessage));
			}
			yield return (object)new WaitForEndOfFrame();
		}

		public static bool IsRoundActive()
		{
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] array = Object.FindObjectsByType<PlayerControllerB>((FindObjectsSortMode)0);
			foreach (PlayerControllerB val in array)
			{
				if (val.isPlayerControlled)
				{
					list.Add(val);
				}
			}
			return playersTeleported >= list.Count && StartOfRound.Instance.shipHasLanded;
		}
	}
	[HarmonyPatch(typeof(Turret))]
	public class TurretPatch
	{
		[HarmonyPatch("CheckForPlayersInLineOfSight")]
		[HarmonyPrefix]
		private static bool CheckForPlayersInLineOfSightPatch(ref Turret __instance, ref PlayerControllerB __result, ref float radius, ref bool angleRangeCheck)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Invalid comparison between Unknown and I4
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Invalid comparison between Unknown and I4
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			if (Config.abilitiesEnabled.Value)
			{
				NetworkObject networkObject = ((NetworkBehaviour)__instance).NetworkObject;
				SpawnAbilityInfo spawnAbilityInfo = ((networkObject != null) ? ((Component)networkObject).gameObject.GetComponent<SpawnAbilityInfo>() : null);
				if (Object.op_Implicit((Object)(object)spawnAbilityInfo))
				{
					Vector3 val = __instance.aimPoint.forward;
					val = Quaternion.Euler(0f, (float)(-(int)__instance.rotationRange) / radius, 0f) * val;
					float num = __instance.rotationRange / radius * 2f;
					Ray val2 = default(Ray);
					RaycastHit val3 = default(RaycastHit);
					for (int i = 0; i <= 6; i++)
					{
						((Ray)(ref val2))..ctor(__instance.centerPoint.position, val);
						bool flag = (bool)AccessTools.Field(typeof(Turret), "enteringBerserkMode").GetValue(__instance);
						if (Physics.Raycast(val2, ref val3, 30f, 1051400, (QueryTriggerInteraction)1))
						{
							AccessTools.Field(typeof(Turret), "shootRay").SetValue(__instance, val2);
							AccessTools.Field(typeof(Turret), "hit").SetValue(__instance, val3);
							if (((Component)((RaycastHit)(ref val3)).transform).CompareTag("Player"))
							{
								PlayerControllerB component = ((Component)((RaycastHit)(ref val3)).transform).GetComponent<PlayerControllerB>();
								if (!((Object)(object)component == (Object)null))
								{
									if (angleRangeCheck && Vector3.Angle(((Component)component).transform.position + Vector3.up * 1.75f - __instance.centerPoint.position, __instance.forwardFacingPos.forward) > __instance.rotationRange)
									{
										__result = null;
										return false;
									}
									if ((Object)(object)component == (Object)(object)spawnAbilityInfo.creatorPlayer || spawnAbilityInfo.otherFriendlies.Contains(component))
									{
										Debugger.Debug.LogError("Turret: Canceled behavior because is friendly!");
										__result = null;
										return false;
									}
									__result = component;
									return false;
								}
								continue;
							}
							if (((int)__instance.turretMode == 2 || !((int)__instance.turretMode != 3 || flag)) && ((Component)((RaycastHit)(ref val3)).transform).tag.StartsWith("PlayerRagdoll"))
							{
								Rigidbody component2 = ((Component)((RaycastHit)(ref val3)).transform).GetComponent<Rigidbody>();
								if ((Object)(object)component2 != (Object)null)
								{
									component2.AddForce(((Vector3)(ref val)).normalized * 42f, (ForceMode)1);
								}
							}
						}
						val = Quaternion.Euler(0f, num / 6f, 0f) * val;
					}
					__result = null;
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void StartPatch(Turret __instance)
		{
			if (!Config.turretsEnabled.Value && TimeOfDay.Instance.currentDayTime <= Config.timeSeekerIsReleased.Value)
			{
				Debugger.Debug.LogWarning("Turret Found! Deleteing...");
				((NetworkBehaviour)__instance).NetworkObject.Despawn(true);
				Debugger.Debug.Log("Deleteing...");
			}
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	public class LandminePatch
	{
		[HarmonyPatch("OnTriggerEnter")]
		[HarmonyPrefix]
		private static bool OnTriggerEnterPatch(ref Landmine __instance, ref Collider other)
		{
			if (Config.abilitiesEnabled.Value)
			{
				NetworkObject networkObject = ((NetworkB