Decompiled source of Hide and Seek v0.7.3

plugins/HideAndSeek.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using AK;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using CellMenu;
using Enemies;
using FX_EffectSystem;
using GameData;
using Gamemodes;
using Gamemodes.Components;
using Gamemodes.Core;
using Gamemodes.Core.Voice;
using Gamemodes.Core.Voice.Modulators;
using Gamemodes.Extensions;
using Gamemodes.Net;
using Gamemodes.Net.Packets.Data;
using Gamemodes.UI;
using Gamemodes.UI.Menu;
using Gear;
using HNS.Components;
using HNS.Core;
using HNS.Extensions;
using HNS.Net;
using HNS.Net.Packets;
using HNS.Patches;
using HNS.Resources;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyFileVersion("0.7.3")]
[assembly: AssemblyInformationalVersion("0.7.3")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.7.3.0")]
[module: UnverifiableCode]
namespace HNS
{
	[BepInPlugin("dev.aurirex.gtfo.gamemode.hns", "Hide and Seek", "0.7.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		public const string GUID = "dev.aurirex.gtfo.gamemode.hns";

		public const string NAME = "Hide and Seek";

		public const string VERSION = "0.7.3";

		internal static ManualLogSource L;

		public override void Load()
		{
			L = ((BasePlugin)this).Log;
			GamemodeManager.RegisterMode<HideAndSeekMode>();
		}
	}
}
namespace HNS.Resources
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Data
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("HNS.Resources.Data", typeof(Data).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] HNS_Banner => (byte[])ResourceManager.GetObject("HNS_Banner", resourceCulture);

		internal static byte[] HNS_Icon => (byte[])ResourceManager.GetObject("HNS_Icon", resourceCulture);

		internal Data()
		{
		}
	}
}
namespace HNS.Patches
{
	[HarmonyPatch(typeof(BulletWeapon), "ClipIsFull")]
	public class BulletWeapon_ClipFull_Patch
	{
		public static bool Prefix(BulletWeapon __instance, ref bool __result)
		{
			__result = __instance.m_clip >= ((ItemEquippable)__instance).ClipSize;
			return false;
		}
	}
	[HarmonyPatch(typeof(BulletWeapon), "Fire")]
	public class BulletWeaponFirePatch
	{
		public static void Postfix(BulletWeapon __instance)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(((Item)__instance).Owner.Owner, ref val, false);
			if (val.IsLocal && NetSessionManager.HasSession && TeamHelper.IsSeeker(val.Team) && (int)((ItemEquippable)__instance).AmmoType == 1)
			{
				FPSCamera fPSCamera = val.PlayerAgent.FPSCamera;
				Vector3 position = fPSCamera.Position;
				Vector3 hitPoint = fPSCamera.Position + Weapon.s_weaponRayData.fireDir * 100f;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(position, Weapon.s_weaponRayData.fireDir, ref val2, 100f, LayerManager.MASK_WORLD))
				{
					hitPoint = ((RaycastHit)(ref val2)).point;
				}
				NetSessionManager.SendEpicTracer(position, hitPoint);
			}
		}
	}
	[HarmonyPatch(typeof(PUI_CommunicationMenu), "IsCmdRelevantCarry")]
	public static class PUI_CommunicationMenu__IsCmdRelevantCarry__Patch
	{
		public static bool Prefix(ref bool __result)
		{
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(LG_WeakDoorBladeDamage), "MeleeDamage")]
	public class DoorPatch
	{
		public static float DamageMax { get; set; } = 16f;


		public static float DamageBig { get; set; } = 6.5f;


		public static float DamageSmall { get; set; } = 3.25f;


		public static bool Prefix(LG_WeakDoorBladeDamage __instance, float dam, Agent sourceAgent, Vector3 position, float environmentMulti)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			PlayerAgent val = ((Il2CppObjectBase)sourceAgent).TryCast<PlayerAgent>();
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			PlayerWrapper val2 = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(val.Owner, ref val2, false);
			if (!TeamHelper.IsSeeker(val2.Team))
			{
				return true;
			}
			ManualLogSource l = Plugin.L;
			bool flag = default(bool);
			BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(22, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Original: dam: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(dam);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", env: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(environmentMulti);
			}
			l.LogDebug(val3);
			float num;
			if (!(environmentMulti < 1.75f))
			{
				if (!(environmentMulti >= 3f))
				{
					goto IL_00d8;
				}
				if (!(dam >= 17.5f))
				{
					if (!(environmentMulti >= 5f) || !(dam >= 12f))
					{
						goto IL_00d8;
					}
					num = DamageMax;
				}
				else
				{
					num = DamageMax;
				}
			}
			else if (dam < 3f)
			{
				num = DamageSmall;
			}
			else
			{
				if (!(dam >= 3f))
				{
					goto IL_00d8;
				}
				num = dam * 1.19f;
			}
			goto IL_00df;
			IL_00df:
			float num2 = num;
			ManualLogSource l2 = Plugin.L;
			val3 = new BepInExDebugLogInterpolatedStringHandler(29, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Overridden Weak Door Damage: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(num2);
			}
			l2.LogDebug(val3);
			((Il2CppObjectBase)__instance.m_door).Cast<LG_WeakDoor>().m_sync.AttemptDoorInteraction((eDoorInteractionType)7, num2, 0f, position, (Agent)null);
			return false;
			IL_00d8:
			num = DamageBig;
			goto IL_00df;
		}
	}
	[HarmonyPatch(typeof(DramaManager), "Update")]
	public class DramaManagerPatch
	{
		public static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerStamina), "UseStamina")]
	public class StaminaPatch
	{
		public static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyScanner), "OnWield")]
	public class EnemyScanner__OnWield__Patch
	{
		public static void Postfix(EnemyScanner __instance)
		{
			GameObjectExtensions.GetOrAddComponent<PlayerTrackerController>(((Component)__instance).gameObject);
		}
	}
	[HarmonyPatch(typeof(EnemyScanner), "Update")]
	public class EnemyScanner__Update__Patch
	{
		public static bool Prefix(EnemyScanner __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((ItemEquippable)__instance).Sound.UpdatePosition(((Component)__instance).transform.position);
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyAgent), "Setup")]
	public class EnemyAgent__Setup__Patch
	{
		public const float SPEED_MOVEMENT_MAX = 20f;

		public const float ACCELERATION = 30f;

		public static void Postfix(EnemyAgent __instance)
		{
			CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Coroutines.DoAfter(1f, (Action)delegate
			{
				if (!((Object)(object)__instance == (Object)null) && !((Agent)__instance).m_isBeingDestroyed && __instance.m_alive)
				{
					__instance.Anim.speed = 3f;
					EnemyLocomotion locomotion = __instance.Locomotion;
					locomotion.m_maxMovementSpeed = 20f;
					locomotion.PathMove.m_defaultAcceleration = 30f;
				}
			})), (Action)null);
		}
	}
	[HarmonyPatch(typeof(EnemyLocomotion), "SetRunMoveSpeed")]
	public class EnemyLocomotion__SetRunMoveSpeed__Patch
	{
		public static void Postfix(EnemyLocomotion __instance)
		{
			__instance.m_maxMovementSpeed = 20f;
			__instance.PathMove.m_defaultAcceleration = 30f;
		}
	}
	[HarmonyPatch(typeof(EnemyLocomotion), "SetTooHurtToRun")]
	public class EnemyLocomotion__SetTooHurtToRun__Patch
	{
		public static void Postfix(EnemyLocomotion __instance)
		{
			__instance.m_maxMovementSpeed = 20f;
			__instance.PathMove.m_defaultAcceleration = 30f;
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class AgentAI__IsTargetValid__Patch
	{
		public static bool Prefix(AgentAI __instance, ref bool __result)
		{
			AgentTarget target = __instance.m_target;
			object obj;
			if (target == null)
			{
				obj = null;
			}
			else
			{
				Agent agent = target.m_agent;
				obj = ((agent != null) ? ((Il2CppObjectBase)agent).TryCast<PlayerAgent>() : null);
			}
			PlayerAgent val = (PlayerAgent)obj;
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			PlayerWrapper val2 = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(val.Owner, ref val2, false);
			if (TeamHelper.IsHider(val2.Team) && ((Agent)val).Alive)
			{
				__result = true;
				return false;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(EnemyDetection), "UpdateTargets")]
	public static class EnemyTargetingPatch
	{
		public static bool Prefix(EnemyDetection __instance)
		{
			UpdateTargets(__instance);
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void UpdateTargets(EnemyDetection _this)
		{
			_this.m_ai.m_behaviourData.Targets.Clear();
			foreach (PlayerWrapper allValidPlayer in NetworkingManager.AllValidPlayers)
			{
				if (!(allValidPlayer == (PlayerWrapper)null) && allValidPlayer.HasAgent && TeamHelper.IsHider(allValidPlayer.Team))
				{
					AgentTarget target = _this.m_ai.m_behaviourData.GetTarget((Agent)(object)allValidPlayer.PlayerAgent);
					_this.m_ai.m_behaviourData.Targets.Add(target);
				}
			}
			_this.m_movementDetectionDistance = _this.m_ai.m_enemyAgent.EnemyDetectionData.movementDetectionDistance;
			_this.m_detectionBuildupSpeed = _this.m_ai.m_enemyAgent.EnemyDetectionData.detectionBuildupSpeed;
			_this.m_detectionCooldownSpeed = _this.m_ai.m_enemyAgent.EnemyDetectionData.detectionCooldownSpeed;
		}
	}
	[HarmonyPatch(typeof(PlayerSync), "WantsToSetFlashlightEnabled")]
	public class PlayerSync__WantsToSetFlashlightEnabled__Patch
	{
		[CompilerGenerated]
		private sealed class <FlashlightSyncRoutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerSync sync;

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

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

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

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

			private bool MoveNext()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: 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_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if ((Object)(object)sync == (Object)null)
					{
						return false;
					}
					PlayerAgent agent = sync.m_agent;
					if ((Object)(object)agent == (Object)null || agent.IsBeingDespawned || agent.IsBeingDestroyed)
					{
						return false;
					}
					Plugin.L.LogDebug((object)"Attempting to sync flashlight state ...");
					pInventoryStatus val = default(pInventoryStatus);
					val.wieldedSlot = sync.m_agent.Inventory.WieldedSlot;
					val.toolEnabled = sync.m_agent.Inventory.WantsFlashlightEnabled;
					pInventoryStatus val2 = val;
					sync.LastWantedSlot = val2.wieldedSlot;
					sync.m_inventoryStatusPacket.Send(val2, (SNet_ChannelType)3);
					_flashSyncRoutine = null;
					return false;
				}
				}
			}

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

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

		private const float ATTEMPTED_FLASHLIGHT_SYNC_TIME = 3f;

		private static Coroutine _flashSyncRoutine;

		public static bool Prefix(PlayerSync __instance, bool enable, bool broadcastOnly)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			pInventoryStatus val = default(pInventoryStatus);
			val.wieldedSlot = __instance.m_agent.Inventory.WieldedSlot;
			val.toolEnabled = enable;
			pInventoryStatus val2 = val;
			__instance.m_inventoryStatusPacket.Send(val2, (SNet_ChannelType)2);
			if (!broadcastOnly)
			{
				__instance.SyncInventoryStatus(val2);
			}
			return false;
		}

		private static void TryStopRoutine(PlayerSync routineHost)
		{
			if (_flashSyncRoutine != null)
			{
				((MonoBehaviour)routineHost).StopCoroutine(_flashSyncRoutine);
				_flashSyncRoutine = null;
			}
		}

		[IteratorStateMachine(typeof(<FlashlightSyncRoutine>d__4))]
		private static IEnumerator FlashlightSyncRoutine(PlayerSync sync)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FlashlightSyncRoutine>d__4(0)
			{
				sync = sync
			};
		}
	}
	[HarmonyPatch(typeof(LocalPlayerAgentSettings), "UpdateBlendTowardsTargetFogSetting")]
	public class LocalPlayerAgentSettings__UpdateBlendTowardsTargetFogSetting__Patch
	{
		private const float FOG_DENSITY_CLAMP_MAX = 0.001f;

		private static float _infection;

		private static float _Target_Infection;

		private static float _Target_FogDensity;

		private static float _Target_DensityHeightMaxBoost;

		public static void Prefix(LocalPlayerAgentSettings __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			FogSettings fogSettings = __instance.m_fogSettings;
			_infection = fogSettings.Infection;
			fogSettings.Infection = 0f;
			FogSettingsDataBlock targetFogSettings = __instance.m_targetFogSettings;
			_Target_Infection = targetFogSettings.Infection;
			_Target_FogDensity = targetFogSettings.FogDensity;
			_Target_DensityHeightMaxBoost = targetFogSettings.DensityHeightMaxBoost;
			targetFogSettings.Infection = 0f;
			bool flag = _Target_DensityHeightMaxBoost < _Target_FogDensity;
			float num = Math.Clamp(Math.Min(_Target_DensityHeightMaxBoost, _Target_FogDensity), 0f, 0.001f);
			targetFogSettings.FogDensity = num * (flag ? 2f : 1f);
			targetFogSettings.DensityHeightMaxBoost = num * (flag ? 1f : 2f);
		}

		public static void Postfix(LocalPlayerAgentSettings __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			FogSettings fogSettings = __instance.m_fogSettings;
			fogSettings.Infection = _infection;
			__instance.m_fogSettings = fogSettings;
			FogSettingsDataBlock targetFogSettings = __instance.m_targetFogSettings;
			targetFogSettings.Infection = _Target_Infection;
			targetFogSettings.FogDensity = _Target_FogDensity;
			targetFogSettings.DensityHeightMaxBoost = _Target_DensityHeightMaxBoost;
		}
	}
	[HarmonyPatch]
	internal class Dam_PlayerDamageLocal_NearDeath_Patches
	{
		[HarmonyTargetMethods]
		public static IEnumerable<MethodBase> TargetMethods()
		{
			return new MethodBase[2]
			{
				typeof(Dam_PlayerDamageLocal).GetMethod("UpdateNearDeathAudioParam", AccessTools.all),
				typeof(Dam_PlayerDamageLocal).GetMethod("SetNearDeathAudioEnabled", AccessTools.all)
			};
		}

		public static bool Prefix(Dam_PlayerDamageLocal __instance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(((Dam_PlayerDamageBase)__instance).Owner.Owner, ref val, false);
			if (!TeamHelper.IsSeeker(val.Team))
			{
				return true;
			}
			((Dam_PlayerDamageBase)__instance).Owner.Sound.SetRTPCValue(GAME_PARAMETERS.PLAYERHURT, 0f);
			((Dam_PlayerDamageBase)__instance).Owner.Breathing.SetBreathingHealthLow(false);
			__instance.m_breathingHealthLow = false;
			__instance.m_nearDeathAudioPlaying = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(PUI_LocalPlayerStatus), "StartHealthWarning")]
	internal static class PUI_LocalPlayerStatus_StartHealthWarning_Patch
	{
		public static bool Prefix(PUI_LocalPlayerStatus __instance)
		{
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(SNet.LocalPlayer, ref val, false);
			if (!TeamHelper.IsSeeker(val.Team))
			{
				return true;
			}
			if (__instance.m_warningRoutine != null)
			{
				CoroutineManager.StopCoroutine(__instance.m_warningRoutine);
				__instance.m_warningRoutine = null;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerBreathing), "SetBreathingHealthLow")]
	internal class PlayerBreathing_SetBreathingHealthLow_Patch
	{
		public static bool Prefix(PlayerBreathing __instance)
		{
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(__instance.m_owner.Owner, ref val, false);
			if (!TeamHelper.IsSeeker(val.Team))
			{
				return true;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(PlayerBreathing), "Setup")]
	internal static class PlayerBreathing_Setup_Patch
	{
		public static void Postfix(PlayerBreathing __instance)
		{
			((Behaviour)__instance).enabled = false;
		}
	}
	[HarmonyPatch(typeof(CM_PageMap), "OnEnable")]
	public class MapNoLegendPatch
	{
		public static void Postfix(CM_PageMap __instance)
		{
			((Component)__instance.m_mapLegend).gameObject.SetActive(false);
		}
	}
	[HarmonyPatch(typeof(MeleeWeaponFirstPerson), "OnWield")]
	public class MeleePatch_Wield
	{
		public static float SpeedMultiplierKnife = 1.15f;

		public static float SpeedMultiplierGeneric = 1.025f;

		public static void Postfix(MeleeWeaponFirstPerson __instance)
		{
			bool flag = ((Item)__instance).ArchetypeName == "Knife";
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(((Item)__instance).Owner.Owner, ref val, false);
			bool num = TeamHelper.IsSeeker(val.Team);
			float moveSpeedModifier = 1f;
			if (num)
			{
				moveSpeedModifier = SpeedMultiplierGeneric;
				if (flag)
				{
					moveSpeedModifier = SpeedMultiplierKnife;
				}
			}
			if (val.Team == 3)
			{
				moveSpeedModifier = 1.25f;
			}
			((Item)__instance).Owner.EnemyCollision.m_moveSpeedModifier = moveSpeedModifier;
		}
	}
	[HarmonyPatch(typeof(MeleeWeaponFirstPerson), "OnUnWield")]
	public class MeleePatch_UnWield
	{
		public static void Postfix(MeleeWeaponFirstPerson __instance)
		{
			((Item)__instance).Owner.EnemyCollision.m_moveSpeedModifier = 1f;
		}
	}
	[HarmonyPatch(typeof(PlayerEnemyCollision), "LateUpdate")]
	public static class PlayerEnemyCollision_Patch
	{
		public static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(MineDeployerInstance), "Setup")]
	public static class MineDeployerPatches
	{
		private static readonly Color COLOR_BARELY_VISIBLE = new Color(0.0118f, 0f, 0f, 1f);

		public static void Postfix(MineDeployerInstance __instance)
		{
			__instance.Mode = (eStickyMineMode)0;
			GameObjectExtensions.GetOrAddComponent<CustomMineController>(((Component)__instance).gameObject);
		}
	}
	[HarmonyPatch(typeof(MineDeployerInstance), "FixedUpdate")]
	public static class MineDeployerInstance_FixedUpdate_Patch
	{
		public static bool Prefix(MineDeployerInstance __instance)
		{
			//IL_004e: 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)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.Alive || !__instance.m_detectionEnabled)
			{
				return false;
			}
			__instance.m_detection.UpdateDetection();
			if (!SNet.IsMaster)
			{
				return false;
			}
			if (__instance.m_detection.DetectionRange == __instance.m_lastDetectionRange)
			{
				return false;
			}
			__instance.m_lastDetectionRange = __instance.m_detection.DetectionRange;
			pTripLineUpdate val = default(pTripLineUpdate);
			val.lineLength = __instance.m_detection.DetectionRange;
			pTripLineUpdate val2 = val;
			__instance.m_initPacket.Send(val2, (SNet_ChannelType)4);
			return false;
		}
	}
	[HarmonyPatch(typeof(MineDeployerInstance_Detect_Laser), "Setup")]
	public static class MineDeployerDetection_Patch
	{
		private static int _SCAN_MASK;

		private static int _ENEMY_MASK;

		public static int SCAN_MASK
		{
			get
			{
				if (_SCAN_MASK == 0)
				{
					_SCAN_MASK = LayerMask.GetMask(new string[7] { "EnemyDamagable", "Default", "Default_NoGraph", "Default_BlockGraph", "Dynamic", "PlayerSynced", "PlayerMover" });
				}
				return _SCAN_MASK;
			}
		}

		public static int ENEMY_MASK
		{
			get
			{
				if (_ENEMY_MASK == 0)
				{
					_ENEMY_MASK = LayerMask.GetMask(new string[3] { "EnemyDamagable", "PlayerSynced", "PlayerMover" });
				}
				return _ENEMY_MASK;
			}
		}

		public static void Postfix(MineDeployerInstance_Detect_Laser __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			__instance.m_scanMask = SCAN_MASK;
			__instance.m_enemyMask = LayerMask.op_Implicit(ENEMY_MASK);
		}
	}
	[HarmonyPatch(typeof(MineDeployerInstance_Detect_Laser), "UpdateDetection")]
	public static class MineDeployerInstance_UpdateDetection_Patch
	{
		public static event Action<MineDeployerInstance, Agent> OnAgentDetected;

		public static bool Prefix(MineDeployerInstance_Detect_Laser __instance)
		{
			CustomUpdateDetection(__instance);
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static void CustomUpdateDetection(MineDeployerInstance_Detect_Laser _this)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			if ((int)_this.m_core.Mode != 2 && (int)_this.m_core.Mode != 1)
			{
				return;
			}
			float num = _this.DetectionRange;
			if (_this.m_maxLineDistance > 0f)
			{
				RaycastHit val = default(RaycastHit);
				if (Physics.SphereCast(_this.m_lineRendererAlign.position, 0.1f, _this.m_lineRendererAlign.forward, ref val, _this.m_maxLineDistance, _this.m_scanMask))
				{
					num = ((RaycastHit)(ref val)).distance;
					GameObject gameObject = ((Component)((RaycastHit)(ref val)).collider).gameObject;
					if (CustomExtensions.IsInLayerMask(_this.m_enemyMask, gameObject))
					{
						Agent val2 = CustomExtensions.GetComponentInParents<Agent>(gameObject);
						if ((Object)(object)val2 == (Object)null)
						{
							val2 = (Agent)(object)gameObject.GetComponent<LocalPlayerAgent>();
						}
						MineDeployerInstance_UpdateDetection_Patch.OnAgentDetected?.Invoke(((Il2CppObjectBase)_this.m_core).Cast<MineDeployerInstance>(), val2);
						return;
					}
				}
				else
				{
					num = _this.m_maxLineDistance;
				}
			}
			if (num != _this.DetectionRange)
			{
				_this.UpdateDetectionRange(num);
			}
		}
	}
	[HarmonyPatch(typeof(GenericDamageComponent), "BulletDamage")]
	public static class GenericDamageComponent_Patch
	{
		public static bool Prefix(GenericDamageComponent __instance, float dam, Agent sourceAgent)
		{
			((Component)__instance).gameObject.GetComponentInParent<MineDeployerInstance>();
			return false;
		}
	}
	[HarmonyPatch(typeof(LG_PlaceStaticEnemyInNode), "Build")]
	public class NoStaticThingiesTwoPatch
	{
		public static bool Prefix(ref bool __result, LG_PlaceStaticEnemyInNode __instance)
		{
			string name = ((GameDataBlockBase<StaticSpawnDataBlock>)(object)__instance.m_dataBlock).name;
			if (!(name == "Respawner_Sack") && !(name == "InfectionSpitter"))
			{
				return true;
			}
			__result = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(WardenObjectiveManager), "CheckAndExecuteEventsOnTrigger", new Type[]
	{
		typeof(WardenObjectiveEventData),
		typeof(eWardenObjectiveEventTrigger),
		typeof(bool),
		typeof(float)
	})]
	internal static class WardenObjectiveManager__CheckAndExecuteEventsOnTrigger__Patch
	{
		public static void Prefix(WardenObjectiveEventData eventToTrigger)
		{
			if (eventToTrigger.SoundSubtitle.HasValue)
			{
				eventToTrigger.SoundID = 0u;
			}
		}
	}
	[HarmonyPatch(typeof(CM_MapDrawPixel), "StartFadeOut")]
	public class PixelsPatch
	{
		[CompilerGenerated]
		private sealed class <FadeOutRoutine>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float duration;

			public float fadeoutDuration;

			public CM_MapDrawPixel mapDrawPixel;

			private float <time>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				//IL_0084: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (duration > 0f)
					{
						<>2__current = (object)new WaitForSeconds(duration);
						<>1__state = 1;
						return true;
					}
					goto IL_0050;
				case 1:
					<>1__state = -1;
					goto IL_0050;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_0050:
					if (fadeoutDuration <= 0f)
					{
						fadeoutDuration = 3f;
					}
					<time>5__2 = 0f;
					mapDrawPixel.m_pixel.color = mapDrawPixel.m_colorStart;
					break;
				}
				if (<time>5__2 <= fadeoutDuration)
				{
					float num = Easing.EaseInExpo(<time>5__2, 0f, 1f, fadeoutDuration);
					mapDrawPixel.m_pixel.color = Color.Lerp(mapDrawPixel.m_colorStart, mapDrawPixel.m_colorFadeOut, num);
					<time>5__2 += Clock.Delta;
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				mapDrawPixel.m_pixel.color = mapDrawPixel.m_colorFadeOut;
				((MonoBehaviour)mapDrawPixel).StopAllCoroutines();
				((Component)mapDrawPixel).gameObject.SetActive(false);
				return false;
			}

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

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

		public const float DEFAULT_DISPLAY_DURATION = 0f;

		public const float DEFAULT_FADEOUT_DURATION = 3f;

		public static float DisplayDuration { get; set; } = 110f;


		public static float FadeoutDuration { get; set; } = 10f;


		public static bool Prefix(CM_MapDrawPixel __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)__instance).StopAllCoroutines();
			__instance.m_pixel.color = __instance.m_colorStart;
			((Component)__instance).gameObject.SetActive(true);
			((MonoBehaviour)__instance).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(FadeOutRoutine(__instance, DisplayDuration, FadeoutDuration)));
			return false;
		}

		[IteratorStateMachine(typeof(<FadeOutRoutine>d__11))]
		private static IEnumerator FadeOutRoutine(CM_MapDrawPixel mapDrawPixel, float duration = 0f, float fadeoutDuration = 3f)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeOutRoutine>d__11(0)
			{
				mapDrawPixel = mapDrawPixel,
				duration = duration,
				fadeoutDuration = fadeoutDuration
			};
		}
	}
	[HarmonyPatch(typeof(PlayerBreathing), "Setup")]
	internal static class PlayerBreathing__Setup__Patch
	{
		public static void Postfix(PlayerBreathing __instance)
		{
			((Behaviour)__instance).enabled = false;
		}
	}
	[HarmonyPatch(typeof(PLOC_Downed), "Enter")]
	internal static class PLOC_Downed_Patch
	{
		private static PlayerWrapper _info;

		public static bool Prefix(PLOC_Downed __instance)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			NetworkingManager.GetPlayerInfo(((PLOC_Base)__instance).m_owner.Owner, ref _info, false);
			if ((TeamHelper.SimplifyTeam((GMTeam)_info.Team) == GMTeam.PreGame || !NetSessionManager.HasSession) && _info.IsLocal)
			{
				NetworkingManager.PostChatLog(_info.PlayerColorTag + _info.NickName + "</color> <color=orange>got bopped!</color>");
				HideAndSeekMode.GameManager.ReviveLocalPlayer();
				return true;
			}
			if (!NetSessionManager.HasSession)
			{
				return true;
			}
			if (TeamHelper.IsSeeker(_info.Team) || _info.Team == 3)
			{
				((PLOC_Base)__instance).m_owner.Locomotion.ChangeState(((PLOC_Base)__instance).m_owner.Locomotion.m_lastStateEnum, false);
				return false;
			}
			return true;
		}

		public static void Postfix(PLOC_Downed __instance)
		{
			if (NetSessionManager.HasSession && TeamHelper.IsHider(_info.Team))
			{
				SpectatorController.TryExit();
				GMTeam seekerTeamForHiders = TeamHelper.GetSeekerTeamForHiders((GMTeam)_info.Team);
				NetworkingManager.AssignTeam(((PLOC_Base)__instance).m_owner.Owner, (int)seekerTeamForHiders);
			}
		}
	}
	[HarmonyPatch(typeof(PUI_GameEventLog), "OnGameEvent")]
	internal static class PUI_GameEventLog_OnGameEvent_Patch
	{
		public static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(ResourcePackPickup), "Setup")]
	public class ResourcePackPatch
	{
		public static void Postfix(ResourcePackPickup __instance)
		{
			foreach (Renderer componentsInChild in ((Component)__instance).GetComponentsInChildren<Renderer>())
			{
				componentsInChild.shadowCastingMode = (ShadowCastingMode)0;
			}
		}
	}
	[HarmonyPatch(typeof(SentryGunInstance_Detection), "CheckForPlayerTarget")]
	internal class SentryTargetingPatch
	{
		private const float SENTRY_TARGET_MAX_DISTANCE = 15f;

		private const float SENTRY_FIRING_DELAY = 0.2f;

		public static void Postfix(Transform detectionSource, ref PlayerAgent __result)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__result == (Object)null)
			{
				return;
			}
			PlayerWrapper val = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(__result.Owner, ref val, false);
			if (!TeamHelper.IsHider(val.Team))
			{
				__result = null;
			}
			SentryGunInstance_Detection componentInParent = ((Component)detectionSource).GetComponentInParent<SentryGunInstance_Detection>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return;
			}
			if (Vector3.Distance(((Component)componentInParent).gameObject.transform.position, ((Component)val.PlayerAgent).transform.position) >= 15f)
			{
				__result = null;
			}
			if ((Object)(object)__result == (Object)null)
			{
				return;
			}
			__result = null;
			componentInParent.Target = ((Component)val.PlayerAgent).gameObject;
			componentInParent.TargetAimTrans = ((Agent)val.PlayerAgent).TentacleTarget;
			if (!componentInParent.HasTarget)
			{
				componentInParent.HasTarget = true;
				Action onFoundTarget = componentInParent.OnFoundTarget;
				if (onFoundTarget != null)
				{
					onFoundTarget.Invoke();
				}
				SentryGunInstance val2 = ((Il2CppObjectBase)componentInParent.m_core).TryCast<SentryGunInstance>();
				if ((Object)(object)val2 != (Object)null)
				{
					val2.m_startFireTimer = Clock.Time + 0.2f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerGuiLayer), "ShowWardenIntel")]
	public class WardenIntelOverride
	{
		private static bool _doRun;

		public static bool Prefix()
		{
			return _doRun;
		}

		public static void ForceShowWardenIntel(string intel, float delay = 0f, float duration = 6f)
		{
			_doRun = true;
			GuiManager.PlayerLayer.ShowWardenIntel(intel, delay, duration);
			_doRun = false;
		}
	}
}
namespace HNS.Net
{
	internal static class NetSessionManager
	{
		private const int SETUP_TIME_SECONDS = 60;

		public static bool HasSession
		{
			get
			{
				if (CurrentSession != null)
				{
					return CurrentSession.IsActive;
				}
				return false;
			}
		}

		public static Session CurrentSession { get; private set; }

		internal static void Init(NetEvents events)
		{
			events.RegisterEvent<pHNSGameStart>((Action<ulong, pHNSGameStart>)OnGameStartReceived);
			events.RegisterEvent<pHNSGameStop>((Action<ulong, pHNSGameStop>)OnGameStopReceived);
			events.RegisterEvent<pEpicTracer>((Action<ulong, pEpicTracer>)OnEpicTracerReceived);
			events.RegisterEvent<pMineAction>((Action<ulong, pMineAction>)OnMineActionReceived);
			events.RegisterEvent<pXRayAction>((Action<ulong, pXRayAction>)OnXRayActionReceived);
		}

		public static void SendStartGamePacket(int? setupTime = null, params ulong[] seekers)
		{
			if (SNet.IsMaster && NetworkingManager.InLevel)
			{
				ulong[] array = new ulong[16];
				for (int i = 0; i < seekers.Length && i < 16; i++)
				{
					array[i] = seekers[i];
				}
				pHNSGameStart pHNSGameStart = default(pHNSGameStart);
				pHNSGameStart.SeekerCount = (byte)seekers.Length;
				pHNSGameStart.Seekers = array;
				pHNSGameStart.SetupTimeSeconds = (byte)setupTime.GetValueOrDefault(60);
				NetworkingManager.SendEvent<pHNSGameStart>(pHNSGameStart, (SNet_Player)null, true, (SNet_ChannelType)2);
			}
		}

		private static void OnGameStartReceived(ulong sender, pHNSGameStart data)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			ManualLogSource l = Plugin.L;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("A new game is starting!");
			}
			l.LogWarning(val);
			if (HasSession)
			{
				CurrentSession.EndSession();
				HideAndSeekMode.GameManager.StopGame(CurrentSession, aborted: true);
			}
			CurrentSession = new Session(data.SetupTimeSeconds);
			bool localPlayerIsSeeker = data.Seekers.Contains(NetworkingManager.LocalPlayerId);
			if (SNet.IsMaster)
			{
				foreach (PlayerWrapper allValidPlayer in NetworkingManager.AllValidPlayers)
				{
					if (allValidPlayer.Team == 3 || TeamHelper.IsSeeker(allValidPlayer.Team))
					{
						continue;
					}
					if (data.Seekers.Contains(allValidPlayer.ID))
					{
						GMTeam gMTeam = TeamHelper.GetSeekerTeamForPlayer((GMTeam)allValidPlayer.Team);
						if (!TeamHelper.IsSeeker(gMTeam))
						{
							gMTeam = GMTeam.Seekers;
						}
						NetworkingManager.AssignTeam(allValidPlayer.NetPlayer, (int)gMTeam);
					}
					else if (!TeamHelper.IsHider(allValidPlayer.Team))
					{
						GMTeam gMTeam2 = TeamHelper.GetHiderTeamForPlayer((GMTeam)allValidPlayer.Team);
						if (!TeamHelper.IsHider(gMTeam2))
						{
							gMTeam2 = GMTeam.Hiders;
						}
						NetworkingManager.AssignTeam(allValidPlayer.NetPlayer, (int)gMTeam2);
					}
				}
			}
			HideAndSeekMode.GameManager.StartGame(localPlayerIsSeeker, data.SetupTimeSeconds, CurrentSession);
			Plugin.PostLocalMessage("<#0C0>Hide and Seek round has started!", (eGameEventChatLogType)2);
			Plugin.PostLocalMessage($"<#CCC>{data.SeekerCount} Seekers:", (eGameEventChatLogType)2);
			ulong[] seekers = data.Seekers;
			PlayerWrapper val2 = default(PlayerWrapper);
			foreach (ulong num in seekers)
			{
				if (num != 0L)
				{
					NetworkingManager.GetPlayerInfo(num, ref val2, false);
					Plugin.PostLocalMessage(" - " + val2.PlayerColorTag + val2.NickName, (eGameEventChatLogType)2);
				}
			}
		}

		internal static void SendStopGamePacket(bool abortGame = false)
		{
			if (HasSession && SNet.IsMaster)
			{
				CurrentSession.EndSession();
				pHNSGameStop pHNSGameStop = default(pHNSGameStop);
				pHNSGameStop.Time = CurrentSession.EndTime.ToUnixTimeSeconds();
				pHNSGameStop.Aborted = abortGame;
				NetworkingManager.SendEvent<pHNSGameStop>(pHNSGameStop, (SNet_Player)null, true, (SNet_ChannelType)2);
			}
		}

		private static void OnGameStopReceived(ulong sender, pHNSGameStop data)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			if (CurrentSession != null)
			{
				CurrentSession.EndSession(DateTimeOffset.FromUnixTimeSeconds(data.Time));
				HideAndSeekMode.GameManager.StopGame(CurrentSession, data.Aborted);
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Session has ended. ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TimeSpan>(CurrentSession.FinalTime);
				}
				l.LogDebug(val);
			}
		}

		public static void SendEpicTracer(Vector3 origin, Vector3 hitPoint)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			pEpicTracer pEpicTracer = default(pEpicTracer);
			pEpicTracer.Origin = pVector3.op_Implicit(origin);
			pEpicTracer.Destination = pVector3.op_Implicit(hitPoint);
			NetworkingManager.SendEventAndInvokeLocally<pEpicTracer>(pEpicTracer, (SNet_Player)null, (SNet_ChannelType)2);
		}

		private static void OnEpicTracerReceived(ulong sender, pEpicTracer data)
		{
			CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(EpicTracer.EpicTracerRoutine(data)), (Action)null);
		}

		public static void SendMineAction(MineDeployerInstance mine, MineState state)
		{
			pMineAction pMineAction = default(pMineAction);
			pMineAction.mineReplicatorKey = mine.Replicator.Key;
			pMineAction.state = (byte)state;
			NetworkingManager.SendEventAndInvokeLocally<pMineAction>(pMineAction, (SNet_Player)null, (SNet_ChannelType)2);
		}

		private static void OnMineActionReceived(ulong sender, pMineAction data)
		{
			PlayerWrapper sender2 = default(PlayerWrapper);
			NetworkingManager.GetPlayerInfo(sender, ref sender2, false);
			MineDeployerInstance val = ToolInstanceCaches.MineCache.All.FirstOrDefault((Func<MineDeployerInstance, bool>)delegate(MineDeployerInstance mine)
			{
				ushort? obj;
				if (mine == null)
				{
					obj = null;
				}
				else
				{
					IReplicator replicator = mine.Replicator;
					obj = ((replicator != null) ? new ushort?(replicator.Key) : null);
				}
				return obj == data.mineReplicatorKey;
			});
			if (!((Object)(object)val == (Object)null))
			{
				MineState state = (MineState)data.state;
				CustomMineController.ProcessIncomingAction(sender2, val, state);
			}
		}

		public static void SendXRayAction(Vector3 origin, Vector3 direction)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			pXRayAction pXRayAction = default(pXRayAction);
			pXRayAction.Position = pVector3.op_Implicit(origin);
			pXRayAction.Direction = pVector3.op_Implicit(direction);
			NetworkingManager.SendEvent<pXRayAction>(pXRayAction, (SNet_Player)null, true, (SNet_ChannelType)2);
		}

		private static void OnXRayActionReceived(ulong sender, pXRayAction data)
		{
			XRayManager.OnXRayDataReceived(data);
		}
	}
	public class Session
	{
		public DateTimeOffset StartTime { get; private set; }

		public int SetupDuration { get; private set; } = 60;


		public DateTimeOffset SetupTime { get; private set; }

		public DateTimeOffset EndTime { get; private set; }

		public bool IsActive { get; internal set; }

		public TimeSpan HidingTime { get; internal set; } = TimeSpan.Zero;


		public TimeSpan FinalTime { get; private set; }

		public bool SetupTimeFinished => SetupTime <= DateTimeOffset.UtcNow;

		public Session(int setupDuration = 60)
		{
			StartTime = DateTimeOffset.UtcNow;
			SetupDuration = setupDuration;
			SetupTime = StartTime.AddSeconds(setupDuration);
			IsActive = true;
		}

		internal void LocalPlayerCaught()
		{
			HidingTime = DateTimeOffset.UtcNow - SetupTime;
			if (HidingTime.TotalSeconds < 0.0)
			{
				HidingTime = TimeSpan.Zero;
			}
		}

		internal void EndSession(DateTimeOffset? endTime = null)
		{
			if (IsActive)
			{
				EndTime = endTime ?? DateTimeOffset.UtcNow;
				FinalTime = EndTime - StartTime;
				IsActive = false;
			}
		}
	}
}
namespace HNS.Net.Packets
{
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct pEpicTracer
	{
		public pVector3 Origin;

		public pVector3 Destination;
	}
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	internal struct pHNSGameStart
	{
		[MarshalAs(UnmanagedType.U1)]
		public byte SeekerCount;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
		public ulong[] Seekers;

		[MarshalAs(UnmanagedType.U1)]
		public byte SetupTimeSeconds;
	}
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	internal struct pHNSGameStop
	{
		[MarshalAs(UnmanagedType.I8)]
		public long Time;

		[MarshalAs(UnmanagedType.Bool)]
		public bool Aborted;
	}
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct pMineAction
	{
		[MarshalAs(UnmanagedType.U1)]
		public byte state;

		[MarshalAs(UnmanagedType.U2)]
		public ushort mineReplicatorKey;
	}
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
	public struct pXRayAction
	{
		public pVector3 Position;

		public pVector3 Direction;
	}
}
namespace HNS.Extensions
{
	public static class MineExtensions
	{
		public static CustomMineController GetController(this MineDeployerInstance mine)
		{
			if (mine == null)
			{
				return null;
			}
			return ((Component)mine).gameObject.GetComponent<CustomMineController>();
		}
	}
}
namespace HNS.Core
{
	internal class Blinds : IDisposable
	{
		private readonly LocalPlayerAgent _localPlayer;

		private readonly Vector3 _pos;

		private readonly Vector3 _rot;

		private readonly eDimensionIndex _dim;

		private bool _isDisposed;

		public Blinds(LocalPlayerAgent localPlayer, uint dimensionDataId = 14u)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			_localPlayer = localPlayer;
			_pos = ((Agent)_localPlayer).Position;
			_rot = ((Agent)_localPlayer).TargetLookDir;
			_dim = ((Agent)_localPlayer).DimensionIndex;
			Dimension val = default(Dimension);
			Builder.CurrentFloor.GetArenaDimension(dimensionDataId, (uint)((PlayerAgent)_localPlayer).PlayerSlotIndex % 4u, ref val);
			eDimensionIndex dimensionIndex = val.DimensionIndex;
			Vector3 randomPositionInside = val.GetStartCourseNode().GetRandomPositionInside();
			((PlayerAgent)_localPlayer).TryWarpTo(dimensionIndex, randomPositionInside, _rot, false);
		}

		public void Dispose()
		{
			//IL_0027: 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)
			if (!_isDisposed && NetworkingManager.InLevel && !((Object)(object)_localPlayer == (Object)null))
			{
				((PlayerAgent)_localPlayer).TryWarpTo(_dim, _pos, _rot, false);
				_isDisposed = true;
			}
		}
	}
	public class CellSoundPlayerWrapped : ISoundPlayer
	{
		private readonly CellSoundPlayer _soundPlayer;

		public CellSoundPlayerWrapped(CellSoundPlayer soundPlayer)
		{
			_soundPlayer = soundPlayer;
		}

		public void Stop()
		{
			_soundPlayer.Stop();
		}

		public void Post(uint soundEventID)
		{
			_soundPlayer.Post(soundEventID, true);
		}

		public void Post(uint soundEventID, Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			_soundPlayer.Post(soundEventID, position);
		}

		public void Activate()
		{
		}

		public void Deactivate()
		{
		}
	}
	public class EpicTracer
	{
		private class FigMatWrapper
		{
			private bool _inUse;

			public Material Material { get; }

			public int Frame { get; private set; }

			public bool IsInUse
			{
				get
				{
					return _inUse;
				}
				set
				{
					_inUse = value;
					if (value)
					{
						Frame = Time.frameCount;
					}
				}
			}

			public FigMatWrapper(Material material)
			{
				Material = material;
			}
		}

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

			private object <>2__current;

			public pEpicTracer data;

			private float <max>5__2;

			private float <duration>5__3;

			private FigMatWrapper <matWrapper>5__4;

			private int <id>5__5;

			private Material <mat>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<matWrapper>5__4 = null;
				<mat>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<max>5__2 = 1.2f;
					<duration>5__3 = <max>5__2;
					if (!TryGetFreeMaterial(out <matWrapper>5__4))
					{
						<matWrapper>5__4 = GetOldestFigMat();
					}
					<matWrapper>5__4.IsInUse = true;
					<id>5__5 = <matWrapper>5__4.Frame;
					<mat>5__6 = <matWrapper>5__4.Material;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<duration>5__3 > 0f)
				{
					if (<id>5__5 != <matWrapper>5__4.Frame)
					{
						return false;
					}
					float x = <duration>5__3 / <max>5__2;
					float num = Mathf.Clamp(EaseInExpo(x), 0.01f, 1f);
					float num2 = EaseOutCubic(x) * 2000f;
					<mat>5__6.SetFloat(ID_SHADER_PROPERTY_OPACITY, num2);
					<mat>5__6.SetFloat(ID_SHADER_PROPERTY_WORLD_SIZE, num);
					Fig.DrawLine(pVector3.op_Implicit(data.Origin), pVector3.op_Implicit(data.Destination), TRACER_COLOR, <mat>5__6, 1f);
					<duration>5__3 -= Time.deltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<matWrapper>5__4.IsInUse = false;
				return false;
			}

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

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

		private const float EPIC_TRACER_TIME = 1.2f;

		private static readonly Color TRACER_COLOR = Color.red;

		private static FigMatWrapper[] _pool;

		private const int POOL_SIZE = 8;

		public const string SHADER_NAME = "UI/Fig";

		public const string SHADER_PROPERTY_OPACITY = "_Opacity";

		public const string SHADER_PROPERTY_SOFTNESS = "_Softness";

		public const string SHADER_PROPERTY_DOTCOUNT = "_DotCount";

		public const string SHADER_PROPERTY_DOTSNAP = "_DotSnap";

		public const string SHADER_PROPERTY_ZTEST = "_ZTest";

		public const string SHADER_PROPERTY_WORLD_SIZE = "_WorldSize";

		private static Material _tracerFigMat;

		public static Shader SHADER_UI_FIG { get; private set; }

		public static int ID_SHADER_PROPERTY_OPACITY { get; private set; }

		public static int ID_SHADER_PROPERTY_SOFTNESS { get; private set; }

		public static int ID_SHADER_PROPERTY_DOTCOUNT { get; private set; }

		public static int ID_SHADER_PROPERTY_DOTSNAP { get; private set; }

		public static int ID_SHADER_PROPERTY_ZTEST { get; private set; }

		public static int ID_SHADER_PROPERTY_WORLD_SIZE { get; private set; }

		public static Material TracerFigMat
		{
			get
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				if ((Object)(object)_tracerFigMat != (Object)null)
				{
					return _tracerFigMat;
				}
				SetupShaderAndCacheProperties();
				_tracerFigMat = new Material(SHADER_UI_FIG);
				GameObjectExtensions.DontDestroyAndSetHideFlags((Object)(object)_tracerFigMat);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_OPACITY, 2000f);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_SOFTNESS, 1f);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_DOTCOUNT, 100f);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_DOTSNAP, 0f);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_ZTEST, 4f);
				_tracerFigMat.SetFloat(ID_SHADER_PROPERTY_WORLD_SIZE, 0.05f);
				Fig.RegisterMaterial(_tracerFigMat);
				return _tracerFigMat;
			}
		}

		[IteratorStateMachine(typeof(<EpicTracerRoutine>d__2))]
		public static IEnumerator EpicTracerRoutine(pEpicTracer data)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EpicTracerRoutine>d__2(0)
			{
				data = data
			};
		}

		private static float EaseOutCubic(float x)
		{
			return 1f - Mathf.Pow(1f - x, 3f);
		}

		private static float EaseInExpo(float x)
		{
			if (x != 0f)
			{
				return Mathf.Pow(2f, 10f * x - 10f);
			}
			return 0f;
		}

		private static void TrySetupFigMatPool()
		{
			if (_pool == null)
			{
				_pool = new FigMatWrapper[8];
				for (int i = 0; i < 8; i++)
				{
					_pool[i] = CreateAndRegisterNew();
				}
			}
		}

		private static bool TryGetFreeMaterial(out FigMatWrapper matWrapper)
		{
			TrySetupFigMatPool();
			matWrapper = _pool.FirstOrDefault((FigMatWrapper i) => !i.IsInUse);
			return matWrapper != null;
		}

		private static FigMatWrapper GetOldestFigMat()
		{
			return _pool.OrderBy((FigMatWrapper i) => i.Frame).First();
		}

		private static void SetupShaderAndCacheProperties()
		{
			if (ID_SHADER_PROPERTY_OPACITY == 0)
			{
				SHADER_UI_FIG = Shader.Find("UI/Fig");
				GameObjectExtensions.DontDestroyAndSetHideFlags((Object)(object)SHADER_UI_FIG);
				ID_SHADER_PROPERTY_OPACITY = Shader.PropertyToID("_Opacity");
				ID_SHADER_PROPERTY_SOFTNESS = Shader.PropertyToID("_Softness");
				ID_SHADER_PROPERTY_DOTCOUNT = Shader.PropertyToID("_DotCount");
				ID_SHADER_PROPERTY_DOTSNAP = Shader.PropertyToID("_DotSnap");
				ID_SHADER_PROPERTY_ZTEST = Shader.PropertyToID("_ZTest");
				ID_SHADER_PROPERTY_WORLD_SIZE = Shader.PropertyToID("_WorldSize");
			}
		}

		private static FigMatWrapper CreateAndRegisterNew()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0015: 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)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0080: Expected O, but got Unknown
			SetupShaderAndCacheProperties();
			Material val = new Material(SHADER_UI_FIG);
			GameObjectExtensions.DontDestroyAndSetHideFlags((Object)val);
			val.SetFloat(ID_SHADER_PROPERTY_OPACITY, 2000f);
			val.SetFloat(ID_SHADER_PROPERTY_SOFTNESS, 1f);
			val.SetFloat(ID_SHADER_PROPERTY_DOTCOUNT, 100f);
			val.SetFloat(ID_SHADER_PROPERTY_DOTSNAP, 0f);
			val.SetFloat(ID_SHADER_PROPERTY_ZTEST, 4f);
			val.SetFloat(ID_SHADER_PROPERTY_WORLD_SIZE, 0.05f);
			Fig.RegisterMaterial(val);
			return new FigMatWrapper(val);
		}
	}
	public enum GMTeam
	{
		PreGame,
		Hiders,
		Seekers,
		Camera,
		PreGameAlpha,
		HiderAlpha,
		SeekerAlpha,
		PreGameBeta,
		HiderBeta,
		SeekerBeta,
		PreGameGamma,
		HiderGamma,
		SeekerGamma,
		PreGameDelta,
		HiderDelta,
		SeekerDelta
	}
	public class HideAndSeekGameManager
	{
		[CompilerGenerated]
		private sealed class <GameStartSetupTimeCoroutine>d__39 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public byte setupDuration;

			public Blinds blinds;

			public HideAndSeekGameManager <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				int num = <>1__state;
				HideAndSeekGameManager hideAndSeekGameManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					WaitForSeconds val = new WaitForSeconds((float)(int)setupDuration);
					<>2__current = val;
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					blinds?.Dispose();
					if (hideAndSeekGameManager._blinds == blinds)
					{
						hideAndSeekGameManager._blinds = null;
					}
					if (hideAndSeekGameManager._localPlayerIsSeeker)
					{
						hideAndSeekGameManager.AddSniperBullet();
					}
					hideAndSeekGameManager._gameTimerDisplay.StartCountdown(10, "Seekers have been released!", (Func<TimerStyleOverride?>)hideAndSeekGameManager.StyleImportant);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public int setupDuration;

			public HideAndSeekGameManager <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				int num = <>1__state;
				HideAndSeekGameManager hideAndSeekGameManager = <>4__this;
				WaitForSecondsRealtime val;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime((float)setupDuration);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					hideAndSeekGameManager._gameTimerDisplay.ResetGameTimer();
					hideAndSeekGameManager._gameTimerDisplay.StartGameTimer();
					hideAndSeekGameManager._elapsedGameTicks = 0;
					goto IL_0068;
				case 2:
					{
						<>1__state = -1;
						hideAndSeekGameManager._elapsedGameTicks++;
						if (hideAndSeekGameManager._session == null || !hideAndSeekGameManager._session.IsActive)
						{
							break;
						}
						if (hideAndSeekGameManager._localPlayerIsSeeker && hideAndSeekGameManager._elapsedGameTicks < GameTickInfiniteAmmoAtTick && hideAndSeekGameManager._elapsedGameTicks % GameTickGiveAmmoEveryXTicks == 0)
						{
							hideAndSeekGameManager.AddSniperBullet();
							hideAndSeekGameManager._gameTimerDisplay.StartCountdown(5, hideAndSeekGameManager._gameTimerDisplay.GameTimerFormatText + "\nReceived <b><color=orange>1</color></b> Sniper Bullet!", (Func<TimerStyleOverride?>)(() => TimerHUD.TSO_GREEN_BLINKING));
						}
						if (hideAndSeekGameManager._elapsedGameTicks == GameTickInfiniteAmmoAtTick)
						{
							hideAndSeekGameManager._gameTimerDisplay.StartCountdown(10, hideAndSeekGameManager._gameTimerDisplay.GameTimerFormatText + "\nAll Seekers have received <b><color=purple>Infinite Reserve Ammo</color></b> for the remainder of the round!", (Func<TimerStyleOverride?>)(() => TimerHUD.TSO_RED_WARNING_BLINKING));
							if (hideAndSeekGameManager._localPlayerIsSeeker)
							{
								GearUtils.LocalReserveAmmoAction((AmmoType)3, (AmmoAction)2, (float?)null);
								GearUtils.LocalGunClipAction((AmmoAction)2, (float?)null);
							}
						}
						if (hideAndSeekGameManager.ForceRoundEndAfterXMinutes && hideAndSeekGameManager._elapsedGameTicks >= GameTickEndGameAtTick)
						{
							if (SNet.IsMaster)
							{
								NetSessionManager.SendStopGamePacket();
							}
							return false;
						}
						goto IL_0068;
					}
					IL_0068:
					val = new WaitForSecondsRealtime(GameTickInterval);
					<>2__current = val;
					<>1__state = 2;
					return true;
				}
				return false;
			}

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

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

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

			private object <>2__current;

			public HideAndSeekGameManager <>4__this;

			private Session <session>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				int num = <>1__state;
				HideAndSeekGameManager hideAndSeekGameManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					if (!SNet.IsMaster)
					{
						return false;
					}
					<session>5__2 = hideAndSeekGameManager._session;
					WaitForSeconds val = new WaitForSeconds(5f);
					<>2__current = val;
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					if (<session>5__2 != hideAndSeekGameManager._session)
					{
						return false;
					}
					foreach (PlayerWrapper allValidPlayer in NetworkingManager.AllValidPlayers)
					{
						if (allValidPlayer.Team != 3)
						{
							NetworkingManager.AssignTeam(PlayerWrapper.op_Implicit(allValidPlayer), (int)TeamHelper.GetPreGameTeamForPlayer((GMTeam)allValidPlayer.Team));
						}
					}
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public int reviveDelay;

			public HideAndSeekGameManager <>4__this;

			public bool showSeekerMessage;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				int num = <>1__state;
				HideAndSeekGameManager hideAndSeekGameManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (reviveDelay > 0)
					{
						WaitForSeconds val = new WaitForSeconds((float)reviveDelay);
						<>2__current = val;
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!NetworkingManager.InLevel)
				{
					return false;
				}
				GamemodeBase.InstantReviveLocalPlayer();
				if ((hideAndSeekGameManager._session != null && hideAndSeekGameManager._session.IsActive) & showSeekerMessage)
				{
					hideAndSeekGameManager._gameTimerDisplay.StartCountdown(5, "You've been caught!\nFind the remaining hiders!", (Func<TimerStyleOverride?>)hideAndSeekGameManager.StyleRed);
				}
				return false;
			}

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

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

		private Blinds _blinds;

		private Coroutine _unblindPlayerCoroutine;

		private Coroutine _gameTickCoroutine;

		private int _elapsedGameTicks;

		private bool _localPlayerIsSeeker;

		private bool _startedAsSeeker;

		private Session _session;

		private TimerHUD _gameTimerDisplay;

		private TimeKeeper _timeKeeper;

		private const string GAMESTART_COUNTDOWN_FORMATTEXT = "[COUNTDOWN] until seekers are released.";

		private static readonly float GameTickInterval = 60f;

		private static readonly int GameTickInfiniteAmmoAtTick = 20;

		private static readonly int GameTickEndGameAtTick = 30;

		private static readonly int GameTickGiveAmmoEveryXTicks = 5;

		private bool ShouldSeekersHaveInfiniteAmmo => _elapsedGameTicks >= GameTickInfiniteAmmoAtTick;

		public bool ForceRoundEndAfterXMinutes { get; set; } = true;


		public HideAndSeekGameManager(TimerHUD timer, TimeKeeper timeKeeper = null)
		{
			SetTimerHud(timer);
			SetTimeKeeper(timeKeeper);
		}

		public void SetTimerHud(TimerHUD timer)
		{
			_gameTimerDisplay = timer;
		}

		public void SetTimeKeeper(TimeKeeper timeKeeper)
		{
			_timeKeeper = timeKeeper;
		}

		public void StartGame(bool localPlayerIsSeeker, byte setupDuration, Session session)
		{
			if (_session != null && _session.IsActive)
			{
				_session.EndSession();
				StopGame(_session, aborted: true);
			}
			if (NetworkingManager.LocalPlayerTeam != 3)
			{
				SpectatorController.TryExit();
			}
			PlayerTrackerController.GetCooldownDuration = GetCooldownDuration;
			_session = session;
			_gameTimerDisplay.ResetGameTimer();
			_gameTimerDisplay.StartCountdown((int)setupDuration, "[COUNTDOWN] until seekers are released.", (Func<TimerStyleOverride?>)null);
			_elapsedGameTicks = 0;
			_localPlayerIsSeeker = localPlayerIsSeeker;
			_startedAsSeeker = localPlayerIsSeeker;
			GamemodeBase.InstantReviveLocalPlayer();
			Utils.SetLocalPlayerInfection(0f);
			GearUtils.LocalTryPickupDeployedSentry();
			Blinds blinds = null;
			if (localPlayerIsSeeker)
			{
				blinds = BlindPlayer();
				EquipSniper();
			}
			GearUtils.EquipGear(((IEnumerable<GearIDRange>)GearManager.GetAllPlayerGear()).FirstOrDefault((Func<GearIDRange, bool>)((GearIDRange g) => g.PublicGearName.Contains("Optron"))), (InventorySlot)3, false);
			SetPlayerAmmo();
			_unblindPlayerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(GameStartSetupTimeCoroutine(setupDuration, blinds)), (Action)null);
			_gameTickCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(GameTickCoroutine(setupDuration)), (Action)null);
			Utils.LocallyResetAllWeakDoors();
			if (SNet.IsMaster)
			{
				HideAndSeekMode.StartFlashSpawnerRoutine();
				HideAndSeekMode.DespawnMineInstancesAndCFoamBlobs();
			}
		}

		private float GetCooldownDuration()
		{
			if (_session == null || !_session.IsActive)
			{
				return PlayerTrackerController.CooldownDuration;
			}
			float num = Math.Max(0f, (float)_elapsedGameTicks / 30f);
			return Math.Max(15f, PlayerTrackerController.CooldownDuration - PlayerTrackerController.CooldownDuration * num);
		}

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

		private static void EquipSniper()
		{
			GearUtils.EquipGear(((IEnumerable<GearIDRange>)GearManager.GetAllPlayerGear()).FirstOrDefault((Func<GearIDRange, bool>)((GearIDRange g) => g.PublicGearName.Contains("Köning"))), (InventorySlot)2, false);
		}

		private void SetPlayerAmmo()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AmmoAction val = (AmmoAction)2;
			if (_localPlayerIsSeeker && !ShouldSeekersHaveInfiniteAmmo)
			{
				val = (AmmoAction)3;
			}
			GearUtils.LocalReserveAmmoAction((AmmoType)3, val, (float?)null);
			GearUtils.LocalGunClipAction(val, (float?)null);
			GearUtils.LocalReserveAmmoAction((AmmoType)4, (AmmoAction)4, (float?)0.125f);
		}

		private void AddSniperBullet()
		{
			GearUtils.LocalGunClipAction((InventorySlot)2, (AmmoAction)6, (float?)0.5f);
		}

		public bool OnLocalPlayerCaught()
		{
			if (_session == null || !_session.IsActive)
			{
				return false;
			}
			if (!_localPlayerIsSeeker)
			{
				_localPlayerIsSeeker = true;
				_session.LocalPlayerCaught();
				string text = "<color=orange>Time spent hiding: " + _session.HidingTime.ToString("mm\\:ss") + "</color>";
				_gameTimerDisplay.StartCountdown(5, "You've been caught!\n" + text + "\nReviving in [COUNTDOWN]", (Func<TimerStyleOverride?>)StyleRed);
				Plugin.PostLocalMessage(text, (eGameEventChatLogType)2);
				EquipSniper();
				SetPlayerAmmo();
				HideAndSeekMode.SetToolAmmoForLocalPlayer();
				Utils.SetLocalPlayerInfection(0f);
				AddSniperBullet();
				DetonateAllLocalMineInstances();
			}
			else
			{
				_gameTimerDisplay.StartCountdown(5, "Reviving in [COUNTDOWN]", (Func<TimerStyleOverride?>)StyleRed);
			}
			CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(RevivePlayerRoutine(5)), (Action)null);
			return true;
		}

		private void DetonateAllLocalMineInstances()
		{
			foreach (MineDeployerInstance item in ToolInstanceCaches.MineCache.All)
			{
				if (((ItemEquippable)item).LocallyPlaced)
				{
					item.WantItemAction((PlayerAgent)null, (SyncedItemAction_New)3);
				}
			}
		}

		public void ReviveLocalPlayer(int reviveDelay = 5, bool showSeekerMessage = false)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			PlayerAgent val = default(PlayerAgent);
			if (PlayerManager.TryGetLocalPlayerAgent(ref val) && (int)val.Locomotion.m_currentStateEnum == 7)
			{
				_gameTimerDisplay.StartCountdown(reviveDelay, "Reviving in [COUNTDOWN]", (Func<TimerStyleOverride?>)StyleDefault);
				CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(RevivePlayerRoutine(5, showSeekerMessage)), (Action)null);
			}
		}

		[IteratorStateMachine(typeof(<RevivePlayerRoutine>d__32))]
		private IEnumerator RevivePlayerRoutine(int reviveDelay, bool showSeekerMessage = true)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RevivePlayerRoutine>d__32(0)
			{
				<>4__this = this,
				reviveDelay = reviveDelay,
				showSeekerMessage = showSeekerMessage
			};
		}

		internal void StopGame(Session session, bool aborted = false)
		{
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			if (_session != session)
			{
				Plugin.L.LogWarning((object)"Stopped session is not the same as the started one?? This should not happen!");
			}
			TimeSpan timeSpan = session.EndTime - session.SetupTime;
			if (!_localPlayerIsSeeker && session.HidingTime <= TimeSpan.Zero)
			{
				session.HidingTime = timeSpan;
			}
			_gameTimerDisplay.StopGameTimer();
			if (_unblindPlayerCoroutine != null)
			{
				CoroutineManager.StopCoroutine(_unblindPlayerCoroutine);
				_unblindPlayerCoroutine = null;
			}
			if (_gameTickCoroutine != null)
			{
				CoroutineManager.StopCoroutine(_gameTickCoroutine);
				_gameTickCoroutine = null;
			}
			_blinds?.Dispose();
			_blinds = null;
			Utils.SetLocalPlayerInfection(0f);
			GearUtils.LocalGunClipAction((AmmoAction)2, (float?)null);
			GearUtils.LocalReserveAmmoAction((AmmoType)3, (AmmoAction)2, (float?)null);
			string text = $"Game Over! Total time: {timeSpan:mm\\:ss} (+{session.SetupDuration}s)";
			Plugin.PostLocalMessage("<#0f0>-= Game Over! =-</color>", (eGameEventChatLogType)2);
			Plugin.PostLocalMessage($"<color=white>Total Game Time: {timeSpan:mm\\:ss} (+{session.SetupDuration}s)</color>", (eGameEventChatLogType)2);
			ManualLogSource l = Plugin.L;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Total Game Time: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TimeSpan>(timeSpan, "mm\\:ss");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (+");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(session.SetupDuration);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s)");
			}
			l.LogInfo(val);
			if (!_startedAsSeeker)
			{
				string text2 = $"<color=orange>You hid for: {session.HidingTime:mm\\:ss}</color>";
				text = text + "\n" + text2;
				Plugin.PostLocalMessage(text2, (eGameEventChatLogType)2);
				ManualLogSource l2 = Plugin.L;
				val = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("You hid for: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TimeSpan>(session.HidingTime, "mm\\:ss");
				}
				l2.LogInfo(val);
			}
			if (aborted)
			{
				ManualLogSource l3 = Plugin.L;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(17, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Game was aborted!");
				}
				l3.LogWarning(val2);
				text = "<color=red>Game aborted!</color>";
				Plugin.PostLocalMessage(text, (eGameEventChatLogType)2);
				_gameTimerDisplay.StartCountdown(5, text, (Func<TimerStyleOverride?>)StyleRed);
			}
			else
			{
				_timeKeeper?.PushSession(session);
				_gameTimerDisplay.StartCountdown(10, text, (Func<TimerStyleOverride?>)StyleImportant);
				if (SNet.IsMaster)
				{
					CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(PostGameTeamSwitchCoroutine()), (Action)null);
				}
			}
		}

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

		private TimerStyleOverride? StyleDefault()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return TimerHUD.TSO_DEFAULT;
		}

		private TimerStyleOverride? StyleImportant()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return TimerHUD.TSO_GREEN_BLINKING;
		}

		private TimerStyleOverride? StyleRed()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return TimerHUD.TSO_RED_WARNING_BLINKING;
		}

		private Blinds BlindPlayer()
		{
			PlayerAgent val = default(PlayerAgent);
			if (!PlayerManager.TryGetLocalPlayerAgent(ref val))
			{
				return null;
			}
			_blinds?.Dispose();
			_blinds = new Blinds(((Il2CppObjectBase)val).TryCast<LocalPlayerAgent>());
			return _blinds;
		}

		[IteratorStateMachine(typeof(<GameStartSetupTimeCoroutine>d__39))]
		private IEnumerator GameStartSetupTimeCoroutine(byte setupDuration, Blinds blinds)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GameStartSetupTimeCoroutine>d__39(0)
			{
				<>4__this = this,
				setupDuration = setupDuration,
				blinds = blinds
			};
		}
	}
	internal class HideAndSeekMode : GamemodeBase
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass105_0
		{
			public PackInfo info;

			internal bool <SpawnFlashbangs>b__0(ConsumablePickup_Core fb)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				return Vector3.Distance(((Component)fb).transform.position, info.position) < 0.05f;
			}
		}

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

			private object <>2__current;

			public IEnumerable<GlueGunProjectile> cfoamBlobs;

			public IEnumerable<MineDeployerInstance> mines;

			private int <count>5__2;

			private IEnumerator<GlueGunProjectile> <>7__wrap2;

			private IEnumerator<MineDeployerInstance> <>7__wrap3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				switch (<>1__state)
				{
				case -3:
				case 2:
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
					break;
				case -4:
				case 3:
					try
					{
					}
					finally
					{
						<>m__Finally2();
					}
					break;
				}
				<>7__wrap2 = null;
				<>7__wrap3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						<count>5__2 = 0;
						<>7__wrap2 = cfoamBlobs.GetEnumerator();
						<>1__state = -3;
						goto IL_00b8;
					case 2:
						<>1__state = -3;
						goto IL_00b8;
					case 3:
						{
							<>1__state = -4;
							break;
						}
						IL_00b8:
						while (<>7__wrap2.MoveNext())
						{
							ProjectileManager.WantToDestroyGlue(<>7__wrap2.Current.SyncID);
							<count>5__2++;
							if (<DespawnMineInstancesAndCFoamBlobsCoroutine>g__DoYield|101_0(ref <count>5__2))
							{
								<>2__current = null;
								<>1__state = 2;
								return true;
							}
						}
						<>m__Finally1();
						<>7__wrap2 = null;
						<>7__wrap3 = mines.GetEnumerator();
						<>1__state = -4;
						break;
					}
					while (<>7__wrap3.MoveNext())
					{
						MineDeployerInstance current = <>7__wrap3.Current;
						if (!((Object)(object)current == (Object)null) && current.Replicator != null && !((Il2CppObjectBase)current.Replicator).WasCollected)
						{
							ItemReplicationManager.DeSpawn(current.Replicator);
							<count>5__2++;
							if (<DespawnMineInstancesAndCFoamBlobsCoroutine>g__DoYield|101_0(ref <count>5__2))
							{
								<>2__current = null;
								<>1__state = 3;
								return true;
							}
						}
					}
					<>m__Finally2();
					<>7__wrap3 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap2 != null)
				{
					<>7__wrap2.Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -1;
				if (<>7__wrap3 != null)
				{
					<>7__wrap3.Dispose();
				}
			}

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

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

			private object <>2__current;

			private Stopwatch <stopWatch>5__2;

			private Il2CppArrayBase<ConsumablePickup_Core> <pickups>5__3;

			private uint[] <itemsToSpawn>5__4;

			private int <spawnCount>5__5;

			private List<PackInfo>.Enumerator <>7__wrap5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<stopWatch>5__2 = null;
				<pickups>5__3 = null;
				<itemsToSpawn>5__4 = null;
				<>7__wrap5 = default(List<PackInfo>.Enumerator);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Expected O, but got Unknown
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (!SNet.IsMaster)
						{
							return false;
						}
						<stopWatch>5__2 = Stopwatch.StartNew();
						Plugin.L.LogDebug((object)"Spawning Flashbangs ...");
						<pickups>5__3 = Object.FindObjectsOfType<ConsumablePickup_Core>();
						<itemsToSpawn>5__4 = new uint[2]
						{
							PrefabManager.Flashbang_BlockID,
							PrefabManager.Smokenade_BlockID
						};
						<spawnCount>5__5 = 0;
						<>7__wrap5 = _originalResourcePackLocations.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap5.MoveNext())
					{
						<>c__DisplayClass105_0 CS$<>8__locals0 = new <>c__DisplayClass105_0();
						CS$<>8__locals0.info = <>7__wrap5.Current;
						CS$<>8__locals0.info.LateSetup();
						if (!((IEnumerable<ConsumablePickup_Core>)<pickups>5__3).Any((ConsumablePickup_Core fb) => Vector3.Distance(((Component)fb).transform.position, CS$<>8__locals0.info.position) < 0.05f))
						{
							uint num = <itemsToSpawn>5__4[Random.Shared.Next(0, <itemsToSpawn>5__4.Length)];
							NetworkingManager.SendSpawnItemInLevel(CS$<>8__locals0.info.node, CS$<>8__locals0.info.position, num, 1f);
							<spawnCount>5__5++;
							<>2__current = null;
							<>1__state = 1;
							return true;
						}
					}
					<>m__Finally1();
					<>7__wrap5 = default(List<PackInfo>.Enumerator);
					<stopWatch>5__2.Stop();
					ManualLogSource l = Plugin.L;
					bool flag = default(bool);
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(67, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Spawning Flashbangs complete! Took ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<long>(<stopWatch>5__2.ElapsedMilliseconds);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ms total, spawned in ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(<spawnCount>5__5);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" new ones.");
					}
					l.LogDebug(val);
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

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

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

		public const string MODE_ID = "hideandseek";

		private const string NAME = "Hide and Seek";

		private const string PREFIX_ANGY_SENTRY = "Angry_";

		private const float TOOL_SELECT_COOLDOWN = 60f;

		private const float PUSH_FORCE_MULTI_DEFAULT = 2.5f;

		private const float PUSH_FORCE_MULTI_HIDER = -0.2f;

		private const float TEAM_MUTED = 0.725f;

		public static readonly Color COLOR_MUTED_TEAM_ALPHA = new Color(Color.red.r * 0.725f, Color.red.g * 0.725f, Color.red.b * 0.725f, 0.125f);

		public static readonly Color COLOR_MUTED_TEAM_BETA = new Color(Color.blue.r * 0.725f, Color.blue.g * 0.725f, Color.blue.b * 0.725f, 0.125f);

		public static readonly Color COLOR_MUTED_TEAM_GAMMA = new Color(Color.green.r * 0.725f, Color.green.g * 0.725f, Color.green.b * 0.725f, 0.125f);

		public static readonly Color COLOR_MUTED_TEAM_DELTA = new Color(Color.magenta.r * 0.725f, Color.magenta.g * 0.725f, Color.magenta.b * 0.725f, 0.125f);

		private Harmony _harmonyInstance;

		private static int DEFAULT_MASK_MELEE_ATTACK_TARGETS;

		private static int DEFAULT_MASK_MELEE_ATTACK_TARGETS_WITH_STATIC;

		private static int DEFAULT_MASK_BULLETWEAPON_RAY;

		private static int DEFAULT_MASK_BULLETWEAPON_PIERCING_PASS;

		private static int MODIFIED_MASK_MELEE_ATTACK_TARGETS;

		private static int MODIFIED_MASK_MELEE_ATTACK_TARGETS_WITH_STATIC;

		private static int MODIFIED_MASK_BULLETWEAPON_RAY;

		private static int MODIFIED_MASK_BULLETWEAPON_PIERCING_PASS;

		private static ClothesPalette _seekerPalette;

		private static ClothesPalette _spectatorPalette;

		private static ClothesPalette _palette_teamAlpha;

		private static ClothesPalette _palette_teamBeta;

		private static ClothesPalette _palette_teamGamma;

		private static ClothesPalette _palette_teamDelta;

		private static float ORIGINAL_m_nearDeathAudioLimit = -1f;

		private static readonly Color HELMET_LIGHT_DEFAULT_COLOR = new Color(0.6471f, 0.7922f, 0.6824f, 1f);

		private static float SEEKER_LIGHT_INTENSITY = 5f;

		private static float SEEKER_LIGHT_RANGE = 0.15f;

		private static Color SEEKER_LIGHT_COLOR = Color.red;

		private Sprite _icon;

		private Sprite _banner;

		private VolumeModulatorStack _vvmStack;

		private static readonly List<PackInfo> _originalResourcePackLocations = new List<PackInfo>();

		private static CustomGearSelector _gearMeleeSelector;

		private static CustomGearSelector _gearHiderSelector;

		private static CustomGearSelector _gearSeekerSelector;

		private static DateTimeOffset _pickToolCooldownEnd = DateTimeOffset.UtcNow;

		private static readonly TimeKeeper _timeKeeper = new TimeKeeper();

		internal static HNSTeam _localTeam;

		private static Coroutine _flashSpawnerRoutine;

		public static HideAndSeekGameManager GameManager { get; private set; }

		public override string ID => "hideandseek";

		public override string DisplayName => "Hide and Seek";

		public override string Description => "No Enemies\nAll Doors Open\n\n<#f00>Seekers</color> have to catch all <#0ff>Hiders</color>";

		public override Sprite SpriteLarge => _banner;

		public override Sprite SpriteSmall => _icon;

		public override ModeSettings Settings => new ModeSettings
		{
			AllowMidGameModeSwitch = false,
			PreventDefaultFailState = true,
			PreventExpeditionEnemiesSpawning = true,
			PreventPlayerRevives = true,
			PreventRespawnRoomsRespawning = true,
			BlockWorldEvents = true,
			OpenAllSecurityDoors = true,
			OpenAllWeakDoors = true,
			RemoveCheckpoints = true,
			AllowForcedTeleportation = true,
			RevealEntireMap = true,
			MapIconsToReveal = (MapIconTypes)255,
			ForceAddArenaDimension = true,
			DisableVoiceLines = true,
			UseTeamVisibility = true,
			RemoveBloodDoors = true,
			RemoveTerminalCommands = true,
			InfiniteBackpackAmmo = true,
			InfiniteSentryAmmo = true,
			InitialPushForceMultiplier = 2.5f,
			InitialSlidePushForceMultiplier = 2.5f,
			UseProximityVoiceChat = true
		};

		public static bool IsTeamGame => NetworkingManager.AllValidPlayers.Any((PlayerWrapper pi) => pi.Team >= 4);

		private static bool IsLocalPlayerAllowedToPickTool => DateTimeOffset.UtcNow > _pickToolCooldownEnd;

		private static string SendHelpMessage(string[] arg)
		{
			GamemodeBase.PostLocalChatMessage(" ");
			GamemodeBase.PostLocalChatMessage("<align=center><color=orange><b><size=120%>Welcome to Hide and Seek!</align></color></b></size>");
			GamemodeBase.PostLocalChatMessage("---------------------------------------------------------------");
			GamemodeBase.PostLocalChatMessage("Use the <u>chat-commands</u> '<#f00>/seeker</color>' and '<#0ff>/hider</color>'");
			GamemodeBase.PostLocalChatMessage("to assign yourself to the two teams.");
			GamemodeBase.PostLocalChatMessage("---------------------------------------------------------------");
			GamemodeBase.PostLocalChatMessage("<#f00>Host only:</color>");
			GamemodeBase.PostLocalChatMessage("Use the command '<color=orange>/hnsstart</color>' to start the game.");
			GamemodeBase.PostLocalChatMessage("<#888>You can use '<color=orange>/hnsstop</color>' to end an active game at any time.</color>");
			GamemodeBase.PostLocalChatMessage("---------------------------------------------------------------");
			return string.Empty;
		}

		private static string StartGame(string[] args)
		{
			if (!SNet.IsMaster)
			{
				return "Only the Master can start.";
			}
			WarpAllPlayersToMaster();
			ulong[] seekers = (from pw in NetworkingManager.AllValidPlayers
				where TeamHelper.IsSeeker(pw.Team)
				select pw.ID).ToArray();
			int? setupTime = null;
			if (args.Length >= 1 && int.TryParse(args[0], out var result) && result >= 1 && result <= 255)
			{
				setupTime = result;
			}
			NetSessionManager.SendStartGamePacket(setupTime, seekers);
			return string.Empty;
		}

		private static string StopGame(string[] args)
		{
			if (!SNet.IsMaster)
			{
				return "Only the Master can stop.";
			}
			NetSessionManager.SendStopGamePacket();
			return string.Empty;
		}

		private static string AbortGame(string[] args)
		{
			if (!SNet.IsMaster)
			{
				return "Only the Master can abort.";
			}
			NetSessionManager.SendStopGamePacket(abortGame: true);
			return string.Empty;
		}

		private static string SwitchToLobby(string[] arg)
		{
			if (NetSessionManager.HasSession)
			{
				return "Can't switch teams mid session.";
			}
			NetworkingManager.AssignTeam(SNet.LocalPlayer, (int)TeamHelper.LocalGetRealTeam(GMTeam.PreGame));
			return string.Empty;
		}

		private static string SwitchToHider(string[] arg)
		{
			if (NetSessionManager.HasSession)
			{
				return "Can't switch teams mid session.";
			}
			NetworkingManager.AssignTeam(SNet.LocalPlayer, (int)TeamHelper.LocalGetRealTeam(GMTeam.Hiders));
			return string.Empty;
		}

		private static string SwitchToSeeker(string[] arg)
		{
			if (NetSessionManager.HasSession)
			{
				return "Can't switch teams mid session.";
			}
			NetworkingManager.AssignTeam(SNet.LocalPlayer, (int)TeamHelper.LocalGetRealTeam(GMTeam.Seekers));
			return string.Empty;
		}

		private static string SwitchToSpectator(string[] arg)
		{
			if (NetSessionManager.HasSession)
			{
				return "Can't switch teams mid session.";
			}
			NetworkingManager.AssignTeam(SNet.LocalPlayer, 3);
			return string.Empty;
		}

		private static string AssignHideAndSeekTeam(string[] args)
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			if (NetSessionManager.HasSession)
			{
				return "Can't change teams while a round is active.";
			}
			if (args.Length == 0)
			{
				return $"You are currently on team {_localTeam}";
			}
			HNSTeam hNSTeam;
			if (int.TryParse(args[0], out var result))
			{
				hNSTeam = (HNSTeam)result;
			}
			else
			{
				if (!Enum.TryParse<HNSTeam>(args[0], ignoreCase: true, out var result2))
				{
					string text = args[0].ToLower();
					if (text != null)
					{
						int length = text.Length;
						if (length == 1)
						{
							switch (text[0])
							{
							case 'n':
								break;
							case 'a':
								goto IL_0107;
							case 'b':
								goto IL_010b;
							case 'c':
								goto IL_010f;
							case 'd':
								goto IL_0113;
							default:
								goto IL_0117;
							}
							goto IL_0103;
						}
						if (length != 5)
						{
							if (length == 6 && text == "remove")
							{
								goto IL_0103;
							}
						}
						else
						{
							char c = text[0];
							if (c != 'c')
							{
								if (c == 'l' && text == "leave")
								{
									goto IL_0103;
								}
							}
							else if (text == "clear")
							{
								goto IL_0103;
							}
						}
					}
					goto IL_0117;
				}
				hNSTeam = result2;
			}
			goto IL_011d;
			IL_0117:
			return "<#F00>Invalid team</color>";
			IL_011d:
			if (hNSTeam < HNSTeam.None || hNSTeam > HNSTeam.Delta)
			{
				return "<#F00>Invalid team</color>";
			}
			_localTeam = hNSTeam;
			if (hNSTeam == HNSTeam.None)
			{
				NetworkingManager.AssignTeam(SNet.LocalPlayer, (int)hNSTeam);
				return "You left the team.";
			}
			GMTeam localPlayerTeam = (GMTeam)NetworkingManager.LocalPlayerTeam;
			GMTeam gMTeam = TeamHelper.LocalGetRealTeam(localPlayerTeam);
			if (gMTeam != localPlayerTeam)
			{
				NetworkingManager.AssignTeam(SNet.LocalPlayer, (int)gMTeam);
				ManualLogSource l = Plugin.L;
				bool flag = default(bool);
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(22, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Switching to team ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<HNSTeam>(hNSTeam);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<GMTeam>(gMTeam);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
				}
				l.LogDebug(val);
				return $"Switching to team {hNSTeam}. ({TeamHelper.SimplifyTeam(gMTeam)})";
			}
			return $"Already on team {hNSTeam}.";
			IL_0103:
			hNSTeam = HNSTeam.None;
			goto IL_011d;
			IL_0113:
			hNSTeam = HNSTeam.Delta;
			goto IL_011d;
			IL_010b:
			hNSTeam = HNSTeam.Beta;
			goto IL_011d;
			IL_010f:
			hNSTeam = HNSTeam.Gamma;
			goto IL_011d;
			IL_0107:
			hNSTeam = HNSTeam.Alpha;
			goto IL_011d;
		}

		private static string ToggleSpectatorMode(string[] arg)
		{
			if (SpectatorController.IsActive)
			{
				SpectatorController.TryExit();
				return "Exiting spectator mode.";
			}
			if (SpectatorController.TryEnter())
			{
				return "Entering spectator mode.";
			}
			return "Couldn't enter spectator mode.";
		}

		private static string SelectMelee(string[] arg)
		{
			_gearMeleeSelector.Show();
			return string.Empty;
		}

		private static string SelectTool(string[] args)
		{
			if (NetSessionManager.HasSession && !IsLocalPlayerAllowedToPickTool)
			{
				return $"<i><color=red>Not allowed to change tool.</color></i> (CD: {(_pickToolCooldownEnd - DateTimeOffset.UtcNow).Seconds} seconds)";
			}
			if (TeamHelper.IsSeeker(NetworkingManager.GetLocalPlayerInfo().Team))
			{
				_gearSeekerSelector.Show();
				return string.Empty;
			}
			_gearHiderSelector.Show();
			return string.Empty;
		}

		private static string Disinfect(string[] args)
		{
			if (NetSessionManager.HasSession)
			{
				return "Can't use this command while a round is active!";
			}
			Utils.SetLocalPlayerInfection(0f);
			return string.Empty;
		}

		private static string JumpDimension(string[] args)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			if (!SNet.IsMaster)
			{
				return "Master only.";
			}
			if (NetSessionManager.HasSession)
			{
				return "Can't use this command while a round is active!";
			}
			eDimensionIndex dimension = (eDimensionIndex)0;
			if (args.Length >= 1)
			{
				if (!int.TryParse(args[0], out var result))
				{
					return "Couldn't parse dimension.";
				}
				dimension = (eDimensionIndex)result;
			}
			if ((int)dimension < 0 || (int)dimension >= 17)
			{
				return "Invalid dimension.";
			}
			PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
			Dimension val = ((IEnumerable<Dimension>)LG_LevelBuilder.Current.m_currentFloor.m_dimensions.ToArray()).FirstOrDefault((Func<Dime