Decompiled source of Something v0.3.3

plugins/Snowlance.Something.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dawn;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using Snowlance.Something.NetcodePatcher;
using Something.Enemies;
using Something.Enemies.Something;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Snowlance.Something")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.3.2.0")]
[assembly: AssemblyInformationalVersion("0.3.2+c7f3c9984192fce212cf59a8a51758a7d5b8a917")]
[assembly: AssemblyProduct("Something")]
[assembly: AssemblyTitle("Snowlance.Something")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Something
{
	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "NearOtherPlayers")]
		public static bool NearOtherPlayersPrefix(PlayerControllerB __instance, ref bool __result)
		{
			try
			{
				if (Plugin.IsPlayerHaunted(__instance))
				{
					__result = false;
					return false;
				}
				return true;
			}
			catch
			{
				return true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
		public static void OnShipLandedMiscEventsPostfix()
		{
			Plugin.onShipLanded.Invoke();
		}
	}
	[BepInPlugin("Snowlance.Something", "Something", "0.3.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public static ConfigEntry<bool> configMinimalSpoilerVersion;

		private readonly Harmony harmony = new Harmony("Snowlance.Something");

		public static UnityEvent onShipLanded = new UnityEvent();

		public const float turnCompassSpeedGlobal = 50f;

		public static ManualLogSource logger { get; private set; }

		public static DuskMod Mod { get; private set; }

		public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;

		public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).First();
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = ((BaseUnityPlugin)Instance).Logger;
			harmony.PatchAll();
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "something_mainassets"));
			Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.RegisterContentHandlers();
			InitializeNetworkBehaviours();
			SomethingInputs.Init();
			InitConfigs();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.Something v0.3.2 has loaded!");
		}

		private void InitConfigs()
		{
			configMinimalSpoilerVersion = ((BaseUnityPlugin)this).Config.Bind<bool>("Spoilers", "Minimal Spoiler Version", true, "Replaces most spoilers for the game with alternatives.");
		}

		public static bool IsPlayerHaunted(PlayerControllerB player)
		{
			if (StartOfRound.Instance.inShipPhase)
			{
				return false;
			}
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (spawnedEnemy is SomethingAI && (Object)(object)spawnedEnemy.targetPlayer == (Object)(object)player)
				{
					return true;
				}
			}
			return false;
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			logger.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	public class SomethingContentHandler : ContentHandler<SomethingContentHandler>
	{
		public class AubreyPlushAssets : AssetBundleLoader<AubreyPlushAssets>
		{
			public AubreyPlushAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class BasilPlushAssets : AssetBundleLoader<BasilPlushAssets>
		{
			public BasilPlushAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class BunnybunAssets : AssetBundleLoader<BunnybunAssets>
		{
			public BunnybunAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class KeytarAssets : AssetBundleLoader<KeytarAssets>
		{
			public KeytarAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class MailboxAssets : AssetBundleLoader<MailboxAssets>
		{
			public MailboxAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class PolaroidAssets : AssetBundleLoader<PolaroidAssets>
		{
			public PolaroidAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class RabbitAssets : AssetBundleLoader<RabbitAssets>
		{
			public RabbitAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public class SomethingAssets : AssetBundleLoader<SomethingAssets>
		{
			[LoadFromBundle("Something.prefab")]
			public GameObject SomethingPrefab { get; private set; } = null;


			public SomethingAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public AubreyPlushAssets? AubreyPlush;

		public BasilPlushAssets? BasilPlush;

		public BunnybunAssets? Bunnybun;

		public KeytarAssets? Keytar;

		public MailboxAssets? Mailbox;

		public PolaroidAssets? Polaroid;

		public RabbitAssets? Rabbit;

		public SomethingAssets? Something;

		public SomethingContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<AubreyPlushAssets>("aubreyplush", ref AubreyPlush, false);
			((ContentHandler)this).RegisterContent<BasilPlushAssets>("basilplush", ref BasilPlush, false);
			((ContentHandler)this).RegisterContent<BunnybunAssets>("bunnybun", ref Bunnybun, false);
			((ContentHandler)this).RegisterContent<KeytarAssets>("keytar", ref Keytar, false);
			((ContentHandler)this).RegisterContent<MailboxAssets>("mailbox", ref Mailbox, false);
			((ContentHandler)this).RegisterContent<PolaroidAssets>("polaroid", ref Polaroid, false);
			((ContentHandler)this).RegisterContent<RabbitAssets>("rabbit", ref Rabbit, false);
			((ContentHandler)this).RegisterContent<SomethingAssets>("something", ref Something, false);
		}
	}
	internal class SomethingInputs : LcInputActions
	{
		public static SomethingInputs Instance;

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

		public static void Init()
		{
			Instance = new SomethingInputs();
		}
	}
	public static class SomethingKeys
	{
		public const string Namespace = "something";

		internal static NamespacedKey LastVersion = NamespacedKey.From("something", "last_version");

		public static readonly NamespacedKey<DawnEnemyInfo> Something = NamespacedKey<DawnEnemyInfo>.From("something", "something");

		public static readonly NamespacedKey<DawnEnemyInfo> Rabbit = NamespacedKey<DawnEnemyInfo>.From("something", "rabbit");

		public static readonly NamespacedKey<DawnItemInfo> AubreyPlush = NamespacedKey<DawnItemInfo>.From("something", "aubrey_plush");

		public static readonly NamespacedKey<DawnItemInfo> BasilPlush = NamespacedKey<DawnItemInfo>.From("something", "basil_plush");

		public static readonly NamespacedKey<DawnItemInfo> Bunnybun = NamespacedKey<DawnItemInfo>.From("something", "bunnybun");

		public static readonly NamespacedKey<DawnItemInfo> Keytar = NamespacedKey<DawnItemInfo>.From("something", "keytar");

		public static readonly NamespacedKey<DawnItemInfo> Mailbox = NamespacedKey<DawnItemInfo>.From("something", "mailbox");

		public static readonly NamespacedKey<DawnItemInfo> Polaroid = NamespacedKey<DawnItemInfo>.From("something", "polaroid");
	}
	[HarmonyPatch]
	public class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
			if (Utils.testing)
			{
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			if (!Utils.isBeta)
			{
				return;
			}
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			logger.LogDebug((object)text);
			string text2 = array[0];
			string text3 = text2;
			if (!(text3 == "/index"))
			{
				if (text3 == "/targetting")
				{
					Utils.DEBUG_disableTargetting = !Utils.DEBUG_disableTargetting;
					HUDManager.Instance.DisplayTip("DisableTargetting: ", Utils.DEBUG_disableTargetting.ToString(), false, false, "LC_Tip1");
				}
				else
				{
					Utils.ChatCommand(array);
				}
			}
			else
			{
				SpringCatAI.SpringCatKillIndex = int.Parse(array[1]);
				HUDManager.Instance.DisplayTip("SpringCatKillIndex", SpringCatAI.SpringCatKillIndex.ToString(), false, false, "LC_Tip1");
			}
		}
	}
	internal class TestingHUDOverlay : MonoBehaviour
	{
		public static TestingHUDOverlay? Instance;

		public GameObject toggle1Obj;

		public Text toggle1Label;

		public Toggle toggle1;

		public GameObject toggle2Obj;

		public Text toggle2Label;

		public Toggle toggle2;

		public Text label1;

		public Text label2;

		public Text label3;

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

		public void Update()
		{
			toggle1Obj.SetActive(toggle1Label.text != "");
			toggle2Obj.SetActive(toggle2Label.text != "");
		}
	}
	public static class Utils
	{
		public static bool isBeta;

		public static bool _testing;

		public static bool trailerMode;

		public static bool DEBUG_disableSpawning;

		public static bool DEBUG_disableTargetting;

		public static bool DEBUG_disableHostTargetting;

		public static bool DEBUG_disableMoving;

		public static bool localPlayerFrozen;

		public static bool testing => _testing && isBeta;

		public static bool inTestRoom => (Object)(object)StartOfRound.Instance?.testRoom != (Object)null;

		public static GameObject[] allAINodes => insideAINodes.Concat(outsideAINodes).ToArray();

		public static GameObject[] insideAINodes
		{
			get
			{
				if (RoundManager.Instance.insideAINodes != null && RoundManager.Instance.insideAINodes.Length != 0)
				{
					return RoundManager.Instance.insideAINodes;
				}
				return GameObject.FindGameObjectsWithTag("AINode");
			}
		}

		public static GameObject[] outsideAINodes
		{
			get
			{
				if (RoundManager.Instance.outsideAINodes != null && RoundManager.Instance.outsideAINodes.Length != 0)
				{
					return RoundManager.Instance.outsideAINodes;
				}
				return GameObject.FindGameObjectsWithTag("OutsideAINode");
			}
		}

		public static void ChatCommand(string[] args)
		{
			switch (args[0])
			{
			case "/spawning":
				DEBUG_disableSpawning = !DEBUG_disableSpawning;
				HUDManager.Instance.DisplayTip("Disable Spawning", DEBUG_disableSpawning.ToString(), false, false, "LC_Tip1");
				break;
			case "/hazards":
			{
				Dictionary<string, GameObject> allHazards = GetAllHazards();
				{
					foreach (KeyValuePair<string, GameObject> item in allHazards)
					{
						Plugin.logger.LogDebug((object)item);
					}
					break;
				}
			}
			case "/testing":
				_testing = !_testing;
				HUDManager.Instance.DisplayTip("Testing", _testing.ToString(), false, false, "LC_Tip1");
				break;
			case "/surfaces":
			{
				FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces;
				foreach (FootstepSurface val3 in footstepSurfaces)
				{
					Plugin.logger.LogDebug((object)val3.surfaceTag);
				}
				break;
			}
			case "/enemies":
			{
				foreach (SpawnableEnemyWithRarity enemy in GetEnemies())
				{
					Plugin.logger.LogDebug((object)((Object)enemy.enemyType).name);
				}
				break;
			}
			case "/refresh":
				RoundManager.Instance.RefreshEnemiesList();
				HoarderBugAI.RefreshGrabbableObjectsInMapList();
				break;
			case "/levels":
			{
				SelectableLevel[] levels = StartOfRound.Instance.levels;
				foreach (SelectableLevel val2 in levels)
				{
					Plugin.logger.LogDebug((object)((Object)val2).name);
				}
				break;
			}
			case "/dungeon":
				Plugin.logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
				break;
			case "/dungeons":
			{
				IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
				foreach (IndoorMapType val in dungeonFlowTypes)
				{
					Plugin.logger.LogDebug((object)((Object)val.dungeonFlow).name);
				}
				break;
			}
			}
		}

		public static void LogChat(string msg)
		{
			HUDManager.Instance.AddChatMessage(msg, "Server", -1, false);
		}

		public static Transform? GetClosestAINodeToPosition(Vector3 pos)
		{
			//IL_002b: 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)
			Transform result = null;
			float num = float.PositiveInfinity;
			GameObject[] array = allAINodes;
			foreach (GameObject val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					float num2 = Vector3.Distance(pos, val.transform.position);
					if (!(num2 > num))
					{
						num = num2;
						result = val.transform;
					}
				}
			}
			return result;
		}

		public static Vector3 GetBestThrowDirection(Vector3 origin, Vector3 forward, int rayCount, float maxDistance, LayerMask layerMask)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = forward;
			float num = 0f;
			RaycastHit val2 = default(RaycastHit);
			for (int i = 0; i < rayCount; i++)
			{
				float num2 = (float)i * (360f / (float)rayCount);
				Vector3 val = Quaternion.Euler(0f, num2, 0f) * ((Vector3)(ref forward)).normalized;
				if (Physics.Raycast(origin + Vector3.up * 0.5f, val, ref val2, maxDistance, LayerMask.op_Implicit(layerMask)))
				{
					if (((RaycastHit)(ref val2)).distance > num)
					{
						result = val;
						num = ((RaycastHit)(ref val2)).distance;
					}
					continue;
				}
				return val;
			}
			return result;
		}

		public static Vector3 GetSpeed()
		{
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			float num = Plugin.localPlayer.movementSpeed / Plugin.localPlayer.carryWeight;
			if (Plugin.localPlayer.sinkingValue > 0.73f)
			{
				num = 0f;
			}
			else
			{
				if (Plugin.localPlayer.isCrouching)
				{
					num /= 1.5f;
				}
				else if (Plugin.localPlayer.criticallyInjured && !Plugin.localPlayer.isCrouching)
				{
					num *= Plugin.localPlayer.limpMultiplier;
				}
				if (Plugin.localPlayer.isSpeedCheating)
				{
					num *= 15f;
				}
				if (Plugin.localPlayer.movementHinderedPrev > 0)
				{
					num /= 2f * Plugin.localPlayer.hinderedMultiplier;
				}
				if (Plugin.localPlayer.drunkness > 0f)
				{
					num *= StartOfRound.Instance.drunknessSpeedEffect.Evaluate(Plugin.localPlayer.drunkness) / 5f + 1f;
				}
				if (!Plugin.localPlayer.isCrouching && Plugin.localPlayer.crouchMeter > 1.2f)
				{
					num *= 0.5f;
				}
				if (!Plugin.localPlayer.isCrouching)
				{
					float num2 = Vector3.Dot(Plugin.localPlayer.playerGroundNormal, Plugin.localPlayer.walkForce);
					if (num2 > 0.05f)
					{
						Plugin.localPlayer.slopeModifier = Mathf.MoveTowards(Plugin.localPlayer.slopeModifier, num2, (Plugin.localPlayer.slopeModifierSpeed + 0.45f) * Time.deltaTime);
					}
					else
					{
						Plugin.localPlayer.slopeModifier = Mathf.MoveTowards(Plugin.localPlayer.slopeModifier, num2, Plugin.localPlayer.slopeModifierSpeed / 2f * Time.deltaTime);
					}
					num = Mathf.Max(num * 0.8f, num + Plugin.localPlayer.slopeIntensity * Plugin.localPlayer.slopeModifier);
				}
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, 0f, 0f);
			int num3 = Physics.OverlapSphereNonAlloc(((Component)Plugin.localPlayer).transform.position, 0.65f, Plugin.localPlayer.nearByPlayers, StartOfRound.Instance.playersMask);
			for (int i = 0; i < num3; i++)
			{
				val += Vector3.Normalize((((Component)Plugin.localPlayer).transform.position - ((Component)Plugin.localPlayer.nearByPlayers[i]).transform.position) * 100f) * 1.2f;
			}
			int num4 = Physics.OverlapSphereNonAlloc(((Component)Plugin.localPlayer).transform.position, 1.25f, Plugin.localPlayer.nearByPlayers, 524288);
			for (int j = 0; j < num4; j++)
			{
				EnemyAICollisionDetect component = ((Component)Plugin.localPlayer.nearByPlayers[j]).gameObject.GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript != (Object)null && !component.mainScript.isEnemyDead && Vector3.Distance(((Component)Plugin.localPlayer).transform.position, ((Component)Plugin.localPlayer.nearByPlayers[j]).transform.position) < component.mainScript.enemyType.pushPlayerDistance)
				{
					val += Vector3.Normalize((((Component)Plugin.localPlayer).transform.position - ((Component)Plugin.localPlayer.nearByPlayers[j]).transform.position) * 100f) * component.mainScript.enemyType.pushPlayerForce;
				}
			}
			Vector3 val2 = Plugin.localPlayer.walkForce * num * Plugin.localPlayer.sprintMultiplier + new Vector3(0f, Plugin.localPlayer.fallValue, 0f) + val;
			return val2 + Plugin.localPlayer.externalForces;
		}

		public static void FreezePlayer(PlayerControllerB player, bool value)
		{
			localPlayerFrozen = value;
			player.disableInteract = value;
			player.disableLookInput = value;
			player.disableMoveInput = value;
		}

		public static void DespawnItemInSlotOnClient(int itemSlot)
		{
			((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false;
			Plugin.localPlayer.DestroyItemInSlotAndSync(itemSlot);
		}

		public static void MakePlayerInvisible(PlayerControllerB player, bool value)
		{
			GameObject gameObject = ((Component)((Component)player).gameObject.transform.Find("ScavengerModel")).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				Plugin.logger.LogError((object)"ScavengerModel not found");
				return;
			}
			((Component)gameObject.transform.Find("LOD1")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("LOD2")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("LOD3")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/LevelSticker")).gameObject.SetActive(!value);
			((Component)gameObject.transform.Find("metarig/spine/spine.001/spine.002/spine.003/BetaBadge")).gameObject.SetActive(!value);
			((Component)player.playerBadgeMesh).gameObject.SetActive(!value);
		}

		public static List<SpawnableEnemyWithRarity> GetEnemies()
		{
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			return (from x in GameObject.Find("Terminal").GetComponentInChildren<Terminal>().moonsCatalogueList.SelectMany((SelectableLevel x) => x.Enemies.Concat(x.DaytimeEnemies).Concat(x.OutsideEnemies))
				where x != null && (Object)(object)x.enemyType != (Object)null && ((Object)x.enemyType).name != null
				select x).GroupBy((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name, (string k, IEnumerable<SpawnableEnemyWithRarity> v) => v.First()).ToList();
		}

		public static EnemyVent GetClosestVentToPosition(Vector3 pos)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			float num = 2000f;
			EnemyVent result = null;
			EnemyVent[] allEnemyVents = RoundManager.Instance.allEnemyVents;
			foreach (EnemyVent val in allEnemyVents)
			{
				float num2 = Vector3.Distance(pos, ((Component)val.floorNode).transform.position);
				if (num2 < num)
				{
					num = num2;
					result = val;
				}
			}
			return result;
		}

		public static bool CalculatePath(Vector3 fromPos, Vector3 toPos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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)
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(fromPos, RoundManager.Instance.navHit, 1.75f, -1);
			Vector3 navMeshPosition2 = RoundManager.Instance.GetNavMeshPosition(toPos, RoundManager.Instance.navHit, 1.75f, -1);
			NavMeshPath val = new NavMeshPath();
			return NavMesh.CalculatePath(navMeshPosition, navMeshPosition2, -1, val) && Vector3.Distance(val.corners[val.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(navMeshPosition2, RoundManager.Instance.navHit, 2.7f, -1)) <= 1.55f;
		}

		public static bool CalculatePath(Vector3 fromPos, Vector3 toPos, Vector3 mainEntranceInsidePosition, Vector3 mainEntranceOutsidePosition, bool isOutside)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0014: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!CalculatePath(fromPos, toPos))
			{
				Vector3 toPos2 = (isOutside ? mainEntranceOutsidePosition : mainEntranceInsidePosition);
				Vector3 fromPos2 = (isOutside ? mainEntranceInsidePosition : mainEntranceOutsidePosition);
				return CalculatePath(fromPos, toPos2) && CalculatePath(fromPos2, toPos);
			}
			return true;
		}

		public static T? GetClosestGameObjectOfType<T>(Vector3 position) where T : Component
		{
			//IL_0028: 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)
			T[] array = Object.FindObjectsOfType<T>();
			T result = default(T);
			float num = float.PositiveInfinity;
			T[] array2 = array;
			foreach (T val in array2)
			{
				float num2 = Vector3.Distance(position, ((Component)val).transform.position);
				if (num2 < num)
				{
					num = num2;
					result = val;
				}
			}
			return result;
		}

		public static void Shuffle<T>(this List<T> list)
		{
			int num = list.Count;
			while (num > 1)
			{
				num--;
				int index = Random.Range(0, num + 1);
				T value = list[index];
				list[index] = list[num];
				list[num] = value;
			}
		}

		public static T GetRandom<T>(this IEnumerable<T> source, Random? random = null)
		{
			if (source == null)
			{
				throw new ArgumentNullException("source");
			}
			if (random == null)
			{
				random = new Random();
			}
			T result = default(T);
			int num = 0;
			foreach (T item in source)
			{
				num++;
				if (random.Next(num) == 0)
				{
					result = item;
				}
			}
			if (num == 0)
			{
				throw new InvalidOperationException("Sequence contains no elements.");
			}
			return result;
		}

		public static T? GetClosestToPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector) where T : class
		{
			//IL_0032: 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)
			T result = null;
			float num = float.PositiveInfinity;
			foreach (T item in list)
			{
				if (item != null)
				{
					float num2 = Vector3.Distance(position, positionSelector(item));
					if (!(num2 >= num))
					{
						result = item;
						num = num2;
					}
				}
			}
			return result;
		}

		public static T? GetFarthestFromPosition<T>(this IEnumerable<T> list, Vector3 position, Func<T, Vector3> positionSelector) where T : class
		{
			//IL_0032: 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)
			T result = null;
			float num = 0f;
			foreach (T item in list)
			{
				if (item != null)
				{
					float num2 = Vector3.Distance(position, positionSelector(item));
					if (!(num2 <= num))
					{
						result = item;
						num = num2;
					}
				}
			}
			return result;
		}

		public static Dictionary<string, GameObject> GetAllHazards()
		{
			Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
			List<SpawnableMapObject> list = (from x in StartOfRound.Instance.levels.SelectMany((SelectableLevel level) => level.spawnableMapObjects)
				group x by ((Object)x.prefabToSpawn).name into g
				select g.First()).ToList();
			foreach (SpawnableMapObject item in list)
			{
				dictionary.Add(((Object)item.prefabToSpawn).name, item.prefabToSpawn);
			}
			return dictionary;
		}

		public static Vector3 GetRandomNavMeshPositionInAnnulus(Vector3 center, float minRadius, float maxRadius, int sampleCount = 10)
		{
			//IL_0001: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0054: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			float y = center.y;
			if (minRadius >= maxRadius)
			{
				Plugin.logger.LogWarning((object)"minRadius should be less than maxRadius. Returning original position.");
				return center;
			}
			NavMeshHit val2 = default(NavMeshHit);
			for (int i = 0; i < sampleCount; i++)
			{
				Vector3 insideUnitSphere = Random.insideUnitSphere;
				insideUnitSphere.y = 0f;
				((Vector3)(ref insideUnitSphere)).Normalize();
				float num = Random.Range(minRadius, maxRadius);
				Vector3 val = center + insideUnitSphere * num;
				val.y = y;
				if (NavMesh.SamplePosition(val, ref val2, 2f, -1))
				{
					return ((NavMeshHit)(ref val2)).position;
				}
			}
			Plugin.logger.LogWarning((object)"Unable to find valid NavMesh position in annulus. Returning original position.");
			return center;
		}

		public static List<Vector3> GetEvenlySpacedNavMeshPositions(Vector3 center, int count, float minRadius, float maxRadius)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			if (count <= 0 || minRadius > maxRadius)
			{
				Plugin.logger.LogWarning((object)"Invalid parameters for turret spawn positions.");
				return list;
			}
			float y = center.y;
			float num = 360f / (float)count;
			Vector3 val = default(Vector3);
			NavMeshHit val2 = default(NavMeshHit);
			for (int i = 0; i < count; i++)
			{
				float num2 = (float)i * num;
				float num3 = num2 * (MathF.PI / 180f);
				float num4 = Random.Range(minRadius, maxRadius);
				float num5 = Mathf.Cos(num3) * num4;
				float num6 = Mathf.Sin(num3) * num4;
				((Vector3)(ref val))..ctor(center.x + num5, y, center.z + num6);
				if (NavMesh.SamplePosition(val, ref val2, 2f, -1))
				{
					list.Add(((NavMeshHit)(ref val2)).position);
				}
				else
				{
					Plugin.logger.LogWarning((object)$"Could not find valid NavMesh position for turret {i}. Skipping.");
				}
			}
			return list;
		}

		public static PlayerControllerB[] GetNearbyPlayers(Vector3 position, float distance = 10f, List<PlayerControllerB>? ignoredPlayers = null)
		{
			//IL_0050: 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)
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && (ignoredPlayers == null || !ignoredPlayers.Contains(val)) && !(Vector3.Distance(position, ((Component)val).transform.position) > distance))
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		public static void RebuildRig(PlayerControllerB pcb)
		{
			if ((Object)(object)pcb != (Object)null && (Object)(object)pcb.playerBodyAnimator != (Object)null)
			{
				pcb.playerBodyAnimator.WriteDefaultValues();
				RigBuilder component = ((Component)pcb.playerBodyAnimator).GetComponent<RigBuilder>();
				if (component != null)
				{
					component.Build();
				}
			}
		}

		public static bool IsPlayerChild(PlayerControllerB player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return player.thisPlayerBody.localScale.y < 1f;
		}

		public static PlayerControllerB? GetFarthestPlayerFromPosition(Vector3 position, float minDistance = 0f)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			float num = minDistance;
			PlayerControllerB result = null;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled)
				{
					float num2 = Vector3.Distance(position, ((Component)val).transform.position);
					if (!(num2 < num))
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		public static float CanPathToPoint(Vector3 startPos, Vector3 endPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0054: 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)
			NavMeshPath val = new NavMeshPath();
			if (!NavMesh.CalculatePath(startPos, endPos, -1, val) || (int)val.status > 0)
			{
				return -1f;
			}
			float num = 0f;
			if (val.corners.Length > 1)
			{
				for (int i = 1; i < val.corners.Length; i++)
				{
					num += Vector3.Distance(val.corners[i - 1], val.corners[i]);
				}
			}
			return num;
		}

		public static void PlaySoundAtPosition(Vector3 pos, AudioClip clip, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f)
		{
			//IL_0006: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(new GameObject("TempSoundEffectObj"), pos, Quaternion.identity);
			AudioSource val2 = val.AddComponent<AudioSource>();
			OccludeAudio val3 = val.AddComponent<OccludeAudio>();
			val3.lowPassOverride = 20000f;
			val2.rolloffMode = (AudioRolloffMode)1;
			if (randomizePitch)
			{
				val2.pitch = Random.Range(0.94f, 1.06f);
			}
			val2.clip = clip;
			val2.volume = volume;
			val2.spatialBlend = (spatial3D ? 1 : 0);
			val2.minDistance = min3DDistance;
			val2.maxDistance = max3DDistance;
			val2.Play();
			Object.Destroy((Object)(object)val, val2.clip.length);
		}

		public static void PlaySoundAtPosition(Vector3 pos, AudioClip[] clips, float volume = 1f, bool randomizePitch = true, bool spatial3D = true, float min3DDistance = 1f, float max3DDistance = 10f)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(0, clips.Length);
			PlaySoundAtPosition(pos, clips[num], volume, randomizePitch, spatial3D, min3DDistance, max3DDistance);
		}

		public static PlayerControllerB? GetRandomPlayer()
		{
			PlayerControllerB[] array = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => (Object)(object)x != (Object)null && x.isPlayerControlled).ToArray();
			if (array.Length == 0)
			{
				return null;
			}
			int num = Random.Range(0, array.Length);
			return array[num];
		}

		public static GrabbableObject? SpawnItem(NamespacedKey<DawnItemInfo> key, Vector3 position, Quaternion rotation = default(Quaternion), float fallTime = 0f)
		{
			//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)
			if (!Plugin.IsServerOrHost)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(((Registry<DawnItemInfo>)(object)LethalContent.Items)[key].Item.spawnPrefab, position, rotation, StartOfRound.Instance.propsContainer);
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			component.fallTime = fallTime;
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			return component;
		}

		public static void MufflePlayer(PlayerControllerB player, bool muffle)
		{
			if ((Object)(object)player.currentVoiceChatAudioSource == (Object)null)
			{
				StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
			}
			if ((Object)(object)player.currentVoiceChatAudioSource != (Object)null)
			{
				OccludeAudio component = ((Component)player.currentVoiceChatAudioSource).GetComponent<OccludeAudio>();
				((Component)player.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = (muffle ? 5f : 1f);
				component.overridingLowPass = muffle;
				component.lowPassOverride = (muffle ? 500f : 20000f);
				player.voiceMuffledByEnemy = muffle;
			}
		}
	}
	[HarmonyPatch]
	public class UtilsPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")]
		public static bool SpawnInsideEnemiesFromVentsIfReadyPrefix()
		{
			if (Utils.isBeta && Utils.DEBUG_disableSpawning)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "SpawnDaytimeEnemiesOutside")]
		public static bool SpawnDaytimeEnemiesOutsidePrefix()
		{
			if (Utils.isBeta && Utils.DEBUG_disableSpawning)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "SpawnEnemiesOutside")]
		public static bool SpawnEnemiesOutsidePrefix()
		{
			if (Utils.isBeta && Utils.DEBUG_disableSpawning)
			{
				return false;
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.Something";

		public const string PLUGIN_NAME = "Something";

		public const string PLUGIN_VERSION = "0.3.2";
	}
}
namespace Something.Items
{
	internal class BunnyBunBehavior : PhysicsProp
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((PhysicsProp)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BunnyBunBehavior";
		}
	}
	internal class KeytarBehavior : PhysicsProp
	{
		public AudioSource ItemAudio;

		public AudioClip[] songs;

		private PlayerControllerB previousPlayerHeldBy;

		private int songIndex;

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
		}

		public override void DiscardItem()
		{
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			((GrabbableObject)this).DiscardItem();
		}

		public override void PocketItem()
		{
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			((GrabbableObject)this).PocketItem();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				ItemAudio.Stop();
				ItemAudio.clip = songs[songIndex];
				ItemAudio.Play();
				if (songIndex >= songs.Length - 1)
				{
					songIndex = 0;
				}
				else
				{
					songIndex++;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((PhysicsProp)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "KeytarBehavior";
		}
	}
	public class PolaroidBehavior : PhysicsProp
	{
		public AudioSource audioSource;

		public SpriteRenderer renderer;

		public Animator animator;

		public Sprite[] goodPhotos;

		public Sprite[] altGoodPhotos;

		public Sprite[] badPhotos;

		public Sprite[] altBadPhotos;

		private bool isLocalPlayerCursed;

		private Random random;

		private int photoType;

		private int photoIndex;

		private bool wasHeld;

		public static List<PolaroidBehavior> Instances { get; private set; } = new List<PolaroidBehavior>();


		private int goodWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Good Weight").Value;

		private int badWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Bad Weight").Value;

		private int cursedWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Cursed Weight").Value;

		private float badSomethingChance => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<float>("Bad Something Chance").Value;

		private BoundedRange goodValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Good Value").Value;

		private BoundedRange badValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Bad Value").Value;

		private BoundedRange cursedValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Cursed Value").Value;

		public override void Start()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			((GrabbableObject)this).Start();
			Instances.Add(this);
			random = new Random(StartOfRound.Instance.randomMapSeed + Instances.Count);
			Plugin.onShipLanded.AddListener(new UnityAction(OnShipLanded));
			if (!wasHeld)
			{
				photoType = RoundManager.Instance.GetRandomWeightedIndex(new int[3] { goodWeight, badWeight, cursedWeight }, random);
				BoundedRange val = cursedValue;
				if (photoType != 2)
				{
					val = ((photoType == 0) ? goodValue : badValue);
					Sprite[] array = ((photoType == 0) ? goodPhotos : badPhotos);
					photoIndex = random.Next(0, array.Length);
				}
				((GrabbableObject)this).SetScrapValue((int)val.GetRandomInRange(random));
				ChangeSprite(photoType, photoIndex);
			}
		}

		private void OnShipLanded()
		{
			if (isLocalPlayerCursed)
			{
				SpawnSomethingServerRpc(Plugin.localPlayer.actualClientId);
			}
		}

		public override void OnDestroy()
		{
			Instances.Remove(this);
			((NetworkBehaviour)this).OnDestroy();
		}

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			if (!wasHeld && (photoType == 2 || (photoType == 1 && RandomExtensions.NextFloat(random, 0f, 1f) < badSomethingChance)))
			{
				if (photoType == 2)
				{
					string trigger = (Plugin.configMinimalSpoilerVersion.Value ? "playalt" : "play");
					((Behaviour)animator).enabled = true;
					animator.SetTrigger(trigger);
					if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Plugin.localPlayer)
					{
						audioSource.Play();
						isLocalPlayerCursed = true;
					}
				}
				if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Plugin.localPlayer)
				{
					SpawnSomethingServerRpc(((GrabbableObject)this).playerHeldBy.actualClientId);
				}
			}
			wasHeld = true;
		}

		public void SpawnSomething(PlayerControllerB playerToHaunt)
		{
			//IL_0061: 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)
			if (((NetworkBehaviour)this).IsServer && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving && ContentHandler<SomethingContentHandler>.Instance != null && ContentHandler<SomethingContentHandler>.Instance.Something != null)
			{
				SomethingAI component = Object.Instantiate<GameObject>(ContentHandler<SomethingContentHandler>.Instance.Something.SomethingPrefab, Vector3.zero, Quaternion.identity).GetComponent<SomethingAI>();
				((NetworkBehaviour)component).NetworkObject.Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)component);
				component.ChangeTargetPlayerClientRpc(playerToHaunt.actualClientId);
			}
		}

		public override void EnableItemMeshes(bool enable)
		{
			((GrabbableObject)this).EnableItemMeshes(enable);
			((Renderer)renderer).enabled = enable;
		}

		public override void LoadItemSaveData(int saveData)
		{
			wasHeld = true;
			Decode(saveData, out var type, out var index);
			ChangeSprite(type, index);
		}

		public override int GetItemDataToSave()
		{
			return Encode(photoType, photoIndex);
		}

		public int GetAltPhotoIndex()
		{
			if (photoType == 2)
			{
				return -1;
			}
			int num = ((photoType == 0) ? goodPhotos.Length : badPhotos.Length);
			int num2 = ((photoType == 0) ? altGoodPhotos.Length : altBadPhotos.Length);
			return photoIndex * num2 / num;
		}

		private int Encode(int type, int index)
		{
			return (type << 8) | index;
		}

		private void Decode(int value, out int type, out int index)
		{
			index = value & 0xFF;
			type = (value >> 8) & 3;
		}

		public void ChangeSprite(int type, int index)
		{
			photoType = type;
			photoIndex = index;
			if (photoType != 2)
			{
				bool value = Plugin.configMinimalSpoilerVersion.Value;
				int num = (value ? GetAltPhotoIndex() : index);
				Sprite[] array = ((photoType != 0) ? (value ? altBadPhotos : badPhotos) : (value ? altGoodPhotos : goodPhotos));
				renderer.sprite = array[num];
				Plugin.logger.LogDebug((object)$"Changed sprite: {photoType}-{photoIndex}");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnSomethingServerRpc(ulong hauntedPlayerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(72547334u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hauntedPlayerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 72547334u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					SpawnSomething(Plugin.PlayerFromId(hauntedPlayerId));
				}
			}
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(72547334u, new RpcReceiveHandler(__rpc_handler_72547334), "SpawnSomethingServerRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_72547334(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong hauntedPlayerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref hauntedPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PolaroidBehavior)(object)target).SpawnSomethingServerRpc(hauntedPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PolaroidBehavior";
		}
	}
	internal class SweetheartsMorgenshternBehavior : PhysicsProp
	{
		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((PhysicsProp)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SweetheartsMorgenshternBehavior";
		}
	}
}
namespace Something.Enemies
{
	internal class RabbitAI : EnemyAI
	{
		public Transform turnCompass;

		public override void Start()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)"Rabbit spawned");
			((EnemyAI)this).Start();
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_0013: 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_0022: 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)
			((EnemyAI)this).Update();
			if (Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 80f, 5, 1f))
			{
				Plugin.localPlayer.JumpToFearLevel(1f, true);
			}
		}

		public void LateUpdate()
		{
			//IL_0016: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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)
			turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position);
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 50f * Time.deltaTime);
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit == (Object)(object)Plugin.localPlayer)
			{
				playerWhoHit.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 7, default(Vector3));
			}
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((EnemyAI)this).__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RabbitAI";
		}
	}
	internal class SpringCatAI : EnemyAI
	{
		public enum State
		{
			Inactive,
			Active
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass52_0
		{
			public PlayerControllerB player;

			public SpringCatAI <>4__this;

			internal bool <KeepPlayerInMouthForDelay>b__0()
			{
				return (!player.isPlayerControlled && (Object)(object)player.deadBody != (Object)null) || !((EnemyAI)<>4__this).inSpecialAnimation;
			}
		}

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

			private object <>2__current;

			public float freezeTime;

			public SpringCatAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Utils.FreezePlayer(((EnemyAI)<>4__this).targetPlayer, value: true);
					<>2__current = (object)new WaitForSeconds(freezeTime);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Utils.FreezePlayer(((EnemyAI)<>4__this).targetPlayer, value: false);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public PlayerControllerB player;

			public float delay;

			public SpringCatAI <>4__this;

			private <>c__DisplayClass52_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Expected O, but got Unknown
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass52_0();
					<>8__1.player = player;
					<>8__1.<>4__this = <>4__this;
					Plugin.logger.LogDebug((object)"KeepPlayerInMouthForDelay");
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (!<>8__1.player.isPlayerControlled && (Object)(object)<>8__1.player.deadBody != (Object)null) || !((EnemyAI)<>8__1.<>4__this).inSpecialAnimation));
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					if (!((EnemyAI)<>4__this).inSpecialAnimation)
					{
						Plugin.logger.LogError((object)"No longer inspecialanimation");
						<>4__this.ResetVariables();
						return false;
					}
					<>8__1.player.deadBody.attachedTo = <>4__this.MouthTransform;
					<>8__1.player.deadBody.attachedLimb = <>8__1.player.deadBody.bodyParts[5];
					<>8__1.player.deadBody.matchPositionExactly = true;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>8__1.player.deadBody.attachedTo = null;
					<>8__1.player.deadBody.attachedLimb = null;
					<>8__1.player.deadBody.matchPositionExactly = 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 static int SpringCatKillIndex = 1;

		public Transform turnCompass;

		public GameObject ScanNode;

		public Transform MeshTransform;

		public Transform RightHandTransform;

		public Transform LeftHandTransform;

		public Transform ChestTransform;

		public Transform HeadTransform;

		public Transform MouthTransform;

		public GameObject Container;

		public AudioClip GlassBreakSFX;

		private BreakerBox? breakerBox;

		private bool grabbingPlayer;

		private bool grabbingRight;

		private bool playerInChest;

		private int bodyPartLeft = -1;

		private int bodyPartRight = -1;

		private float timeSinceMeow;

		private float timeSinceSwitchLights;

		private float timeSinceRecalcPath;

		private Queue<Vector3> etchPath = new Queue<Vector3>();

		private bool followingPath = false;

		private const float turnSpeed = 15f;

		private const float throwForce = 20f;

		private const float triggerDistance = 5f;

		private const float meowCooldown = 30f;

		private const float lightSwitchCooldown = 5f;

		private const float turnOffLightsDistance = 10f;

		private const float playerInMouthTime = 5f;

		private bool targetPlayerDead => (Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerControlled && (Object)(object)base.targetPlayer.deadBody != (Object)null;

		public override void Start()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				base.overlapColliders = (Collider[])(object)new Collider[1];
				base.thisNetworkObject = ((NetworkBehaviour)this).NetworkObject;
				base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene;
				RoundManager instance = RoundManager.Instance;
				instance.numberOfEnemiesInScene++;
				base.allAINodes = Utils.insideAINodes;
				if (!((NetworkBehaviour)this).IsServer)
				{
					RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
				}
				base.path1 = new NavMeshPath();
				base.openDoorSpeedMultiplier = base.enemyType.doorSpeedMultiplier;
				base.serverPosition = ((Component)this).transform.position;
				base.ventAnimationFinished = true;
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Error when initializing enemy variables for {((Object)((Component)this).gameObject).name} : {arg}");
			}
			base.currentBehaviourStateIndex = 0;
			breakerBox = Object.FindObjectOfType<BreakerBox>();
		}

		public override void Update()
		{
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex == 0)
			{
				timeSinceMeow += Time.deltaTime;
				if (timeSinceMeow > 30f)
				{
					base.creatureVoice.Play();
					timeSinceMeow = 0f;
				}
			}
			if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation)
			{
				return;
			}
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				if (base.currentBehaviourStateIndex == 0)
				{
					turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					MeshTransform.rotation = Quaternion.Lerp(MeshTransform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 15f * Time.deltaTime);
					HeadTransform.rotation = Quaternion.Lerp(HeadTransform.rotation, Quaternion.Euler(new Vector3(turnCompass.eulerAngles.x, turnCompass.eulerAngles.y, turnCompass.eulerAngles.z)), 15f * Time.deltaTime);
				}
				else
				{
					turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					HeadTransform.rotation = Quaternion.Lerp(HeadTransform.rotation, Quaternion.Euler(new Vector3(turnCompass.eulerAngles.x, turnCompass.eulerAngles.y, turnCompass.eulerAngles.z)), 15f * Time.deltaTime);
				}
			}
			else
			{
				HeadTransform.rotation = Quaternion.identity;
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			timeSinceSwitchLights += Time.deltaTime;
			if (base.updateDestinationInterval >= 0f)
			{
				base.updateDestinationInterval -= Time.deltaTime;
			}
			else
			{
				((EnemyAI)this).DoAIInterval();
				base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f);
			}
			if (!((Object)(object)base.targetPlayer == (Object)null))
			{
				if (!followingPath && etchPath.Count > 0)
				{
					Vector3 destination = etchPath.Dequeue();
					base.agent.SetDestination(destination);
					followingPath = true;
				}
				if (followingPath && !base.agent.pathPending && base.agent.remainingDistance < 0.1f)
				{
					followingPath = false;
				}
			}
		}

		public void LateUpdate()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				if (playerInChest)
				{
					grabbingPlayer = false;
					if (targetPlayerDead)
					{
						ResetVariables();
					}
					else
					{
						((Component)base.targetPlayer).transform.position = ChestTransform.position;
					}
				}
				else if (grabbingPlayer)
				{
					if (targetPlayerDead)
					{
						if (bodyPartLeft > -1 && bodyPartLeft <= 10)
						{
							base.targetPlayer.deadBody.secondaryAttachedTo = LeftHandTransform;
							base.targetPlayer.deadBody.secondaryAttachedLimb = base.targetPlayer.deadBody.bodyParts[bodyPartLeft];
						}
						if (bodyPartRight > -1 && bodyPartRight <= 10)
						{
							base.targetPlayer.deadBody.attachedTo = RightHandTransform;
							base.targetPlayer.deadBody.attachedLimb = base.targetPlayer.deadBody.bodyParts[bodyPartRight];
						}
						base.targetPlayer.deadBody.matchPositionExactly = true;
					}
					else
					{
						((Component)base.targetPlayer).transform.position = (grabbingRight ? RightHandTransform.position : LeftHandTransform.position);
						Vector3 val = ((Component)base.targetPlayer).transform.position - base.targetPlayer.bodyParts[5].position;
						Transform transform = ((Component)base.targetPlayer).transform;
						transform.position += val;
					}
				}
				else
				{
					bodyPartLeft = -1;
					bodyPartRight = -1;
				}
			}
			else
			{
				grabbingPlayer = false;
				bodyPartLeft = -1;
				bodyPartRight = -1;
				playerInChest = false;
			}
		}

		private void RecalculatePath()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return;
			}
			NavMeshPath val = new NavMeshPath();
			base.agent.CalculatePath(((Component)base.targetPlayer).transform.position, val);
			etchPath.Clear();
			Vector3 val2 = ((Component)this).transform.position;
			Vector3[] corners = val.corners;
			Vector3 val5 = default(Vector3);
			Vector3 val6 = default(Vector3);
			foreach (Vector3 val3 in corners)
			{
				Vector3 val4 = val3 - val2;
				if (Mathf.Abs(val4.x) > 0.01f)
				{
					((Vector3)(ref val5))..ctor(val3.x, val2.y, val2.z);
					etchPath.Enqueue(val5);
					val2 = val5;
				}
				if (Mathf.Abs(val4.z) > 0.01f)
				{
					((Vector3)(ref val6))..ctor(val2.x, val2.y, val3.z);
					etchPath.Enqueue(val6);
					val2 = val6;
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (TargetClosestPlayerInRange(5f) && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 5f)
				{
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
					BreakOutOfContainmentClientRpc();
				}
				break;
			case 1:
				if (!TargetClosestPlayer())
				{
					base.targetPlayer = null;
					base.agent.ResetPath();
					break;
				}
				if (timeSinceSwitchLights > 5f)
				{
					timeSinceSwitchLights = 0f;
					TurnOffNearbyLightsClientRpc(10f);
				}
				if (!Utils.isBeta || !Utils.DEBUG_disableMoving)
				{
					RecalculatePath();
				}
				break;
			default:
				Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
				break;
			}
		}

		private bool TargetClosestPlayerInRange(float range)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer != (Object)null && !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false))
			{
				base.targetPlayer = null;
			}
			float num = float.PositiveInfinity;
			PlayerControllerB val = null;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if (!((Object)(object)val2 == (Object)null) && ((EnemyAI)this).PlayerIsTargetable(val2, false, false) && (!Utils.isBeta || !Utils.DEBUG_disableTargetting || !val2.isHostPlayerObject))
				{
					float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position);
					if (num2 <= range && num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				base.targetPlayer = val;
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		public bool TargetClosestPlayer(float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f)
		{
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			PlayerControllerB targetPlayer = base.targetPlayer;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				if ((!Utils.isBeta || !Utils.DEBUG_disableTargetting || !StartOfRound.Instance.allPlayerScripts[i].isHostPlayerObject) && ((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false) && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, false, false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, viewWidth, 40, -1f, (Transform)null)))
				{
					base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
					if (base.tempDist < base.mostOptimalDistance)
					{
						base.mostOptimalDistance = base.tempDist;
						base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
					}
				}
			}
			if ((Object)(object)base.targetPlayer != (Object)null && bufferDistance > 0f && (Object)(object)targetPlayer != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position)) < bufferDistance)
			{
				base.targetPlayer = targetPlayer;
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

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

		private GameObject GetRandomAINode(List<GameObject> nodes)
		{
			int index = Random.Range(0, nodes.Count);
			return nodes[index];
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = default(PlayerControllerB);
			if (!base.inSpecialAnimation && base.currentBehaviourStateIndex != 0 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Plugin.localPlayer) && val.isPlayerControlled)
			{
				base.inSpecialAnimation = true;
				KillPlayerServerRpc(val.actualClientId);
			}
		}

		public void ResetVariables()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				if (grabbingPlayer || playerInChest)
				{
					base.targetPlayer.playerRigidbody.isKinematic = true;
					((Component)base.targetPlayer).transform.rotation = Quaternion.identity;
					if (base.targetPlayer.isPlayerDead && (Object)(object)base.targetPlayer.deadBody != (Object)null)
					{
						base.targetPlayer.deadBody.attachedTo = null;
						base.targetPlayer.deadBody.attachedLimb = null;
						base.targetPlayer.deadBody.secondaryAttachedTo = null;
						base.targetPlayer.deadBody.secondaryAttachedLimb = null;
						base.targetPlayer.deadBody.matchPositionExactly = false;
					}
				}
				base.targetPlayer = null;
			}
			base.inSpecialAnimation = false;
			grabbingPlayer = false;
			playerInChest = false;
			bodyPartLeft = -1;
			bodyPartRight = -1;
		}

		public void SetInSpecialAnimation()
		{
			Plugin.logger.LogDebug((object)"SetInSpecialAnimation");
			base.inSpecialAnimation = true;
		}

		public void UnSetInSpecialAnimation()
		{
			Plugin.logger.LogDebug((object)"UnSetInSpecialAnimation");
			base.inSpecialAnimation = false;
		}

		public void GrabPlayerRightHand(int bodyPart = -1)
		{
			Plugin.logger.LogDebug((object)"GrabTargetPlayerRightHand");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.inSpecialAnimation = true;
			base.targetPlayer.playerRigidbody.isKinematic = false;
			grabbingRight = true;
			grabbingPlayer = true;
			bodyPartRight = bodyPart;
		}

		public void GrabPlayerLeftHand(int bodyPart = -1)
		{
			Plugin.logger.LogDebug((object)"GrabTargetPlayerLeftHand");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.inSpecialAnimation = true;
			base.targetPlayer.playerRigidbody.isKinematic = false;
			grabbingRight = false;
			grabbingPlayer = true;
			bodyPartLeft = bodyPart;
		}

		public void DropPlayer()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)"DropTargetPlayer");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			grabbingPlayer = false;
			playerInChest = false;
			base.targetPlayer.playerRigidbody.isKinematic = true;
			((Component)base.targetPlayer).transform.rotation = Quaternion.identity;
			if (base.targetPlayer.isPlayerDead && (Object)(object)base.targetPlayer.deadBody != (Object)null)
			{
				base.targetPlayer.deadBody.attachedTo = null;
				base.targetPlayer.deadBody.attachedLimb = null;
				base.targetPlayer.deadBody.secondaryAttachedTo = null;
				base.targetPlayer.deadBody.secondaryAttachedLimb = null;
				base.targetPlayer.deadBody.matchPositionExactly = false;
			}
			base.targetPlayer = null;
			bodyPartRight = -1;
			bodyPartLeft = -1;
		}

		public void ThrowPlayer()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)"ThrowTargetPlayer");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.targetPlayer.playerRigidbody.isKinematic = true;
			grabbingPlayer = false;
			if (!((Object)(object)Plugin.localPlayer != (Object)(object)base.targetPlayer))
			{
				Plugin.localPlayer.KillPlayer(LeftHandTransform.forward * 20f, true, (CauseOfDeath)16, 0, default(Vector3));
				base.targetPlayer = null;
			}
		}

		public void KillPlayerWithDeathAnimation(int deathAnimation)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)("KillTargetPlayerWithDeathAnimation: " + deathAnimation));
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.targetPlayer.playerRigidbody.isKinematic = true;
			if (!((Object)(object)Plugin.localPlayer != (Object)(object)base.targetPlayer))
			{
				Plugin.localPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, deathAnimation, default(Vector3));
			}
		}

		public void PutPlayerInChest()
		{
			Plugin.logger.LogDebug((object)"PutTargetPlayerInChest");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.targetPlayer.playerRigidbody.isKinematic = false;
			playerInChest = true;
		}

		public void PutPlayerInMouth()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)"PutTargetPlayerInMouth");
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				Plugin.logger.LogError((object)"TargetPlayer is null");
				return;
			}
			base.targetPlayer.playerRigidbody.isKinematic = true;
			if ((Object)(object)Plugin.localPlayer == (Object)(object)base.targetPlayer)
			{
				Plugin.localPlayer.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 1, default(Vector3));
			}
			((MonoBehaviour)this).StartCoroutine(KeepPlayerInMouthForDelay(base.targetPlayer, 5f));
			base.targetPlayer = null;
		}

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

		[ServerRpc(RequireOwnership = false)]
		public void KillPlayerServerRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1739600420u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1739600420u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					int num = ((Utils.testing && Utils.isBeta) ? SpringCatKillIndex : Random.Range(1, 7));
					KillPlayerClientRpc(clientId, $"killPlayer{num}");
				}
			}
		}

		[ClientRpc]
		public void KillPlayerClientRpc(ulong clientId, string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3309836895u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3309836895u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.inSpecialAnimation = true;
				base.targetPlayer = Plugin.PlayerFromId(clientId);
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void BreakOutOfContainmentClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4116683727u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4116683727u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1);
					Container.SetActive(false);
					MeshTransform.localPosition = Vector3.zero;
					MeshTransform.localRotation = Quaternion.identity;
					base.creatureAnimator.SetTrigger("walk");
					base.creatureSFX.Play();
					base.creatureSFX.PlayOneShot(GlassBreakSFX);
				}
			}
		}

		[ClientRpc]
		public void TurnOffNearbyLightsClientRpc(float distance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2287887217u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2287887217u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			Plugin.logger.LogDebug((object)"Turning off nearby lights");
			foreach (Animator allPoweredLightsAnimator in RoundManager.Instance.allPoweredLightsAnimators)
			{
				if (Vector3.Distance(((Component)this).transform.position, ((Component)allPoweredLightsAnimator).transform.position) <= distance)
				{
					allPoweredLightsAnimator.SetBool("on", false);
				}
			}
			if ((Object)(object)breakerBox != (Object)null)
			{
				base.creatureSFX.PlayOneShot(breakerBox.switchPowerSFX);
			}
		}

		protected override void __initializeVariables()
		{
			((EnemyAI)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown