Decompiled source of HeavyItemSCPs v1.4.4

HeavyItemSCPs/ProjectSCP.HeavyItemSCPs.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using HeavyItemSCPs;
using HeavyItemSCPs.Items.SCP178;
using HeavyItemSCPs.Items.SCP323;
using HeavyItemSCPs.Items.SCP427;
using HeavyItemSCPs.Items.SCP513;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ProjectSCP.HeavyItemSCPs.NetcodePatcher;
using SCP500;
using SCPItems;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[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("ProjectSCP.HeavyItemSCPs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.4.0")]
[assembly: AssemblyInformationalVersion("1.4.4+343549327e02931852f144e9060a753c596c9468")]
[assembly: AssemblyProduct("HeavyItemSCPs")]
[assembly: AssemblyTitle("ProjectSCP.HeavyItemSCPs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.4.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;
		}
	}
}
public class SCP513_1AICollisionDetect : MonoBehaviour, IHittable
{
	public bool canCollideWithEnemies;

	public bool onlyCollideWhenGrounded;

	public SCP513_1AI mainScript => SCP513_1AI.Instance;

	private void OnTriggerStay(Collider other)
	{
		if (((Component)other).CompareTag("Player"))
		{
			if (onlyCollideWhenGrounded)
			{
				CharacterController component = ((Component)other).gameObject.GetComponent<CharacterController>();
				if (!((Object)(object)component != (Object)null) || !component.isGrounded)
				{
					return;
				}
				mainScript.OnCollideWithPlayer(other);
			}
			mainScript.OnCollideWithPlayer(other);
		}
		else if (!onlyCollideWhenGrounded && canCollideWithEnemies && ((Component)other).CompareTag("Enemy"))
		{
			EnemyAICollisionDetect component2 = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>();
			if ((Object)(object)component2 != (Object)null)
			{
				mainScript.OnCollideWithEnemy(other, component2.mainScript);
			}
		}
	}

	bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (onlyCollideWhenGrounded)
		{
			Debug.Log((object)"Enemy collision detect returned false");
			return false;
		}
		mainScript.HitEnemyOnLocalClient(force, hitDirection, playerWhoHit, playHitSFX, hitID);
		return true;
	}
}
namespace SCPItems
{
	internal class SCP500Compatibility
	{
		private static readonly ManualLogSource logger = Plugin.LoggerInstance;

		private static bool? _enabled;

		internal static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("ProjectSCP.SCP500");
				}
				return _enabled.Value;
			}
		}

		internal static bool IsLocalPlayerAffectedBySCP500
		{
			get
			{
				if (Plugin.config427_500Compatibility.Value && enabled)
				{
					return LocalPlayerAffectedBySCP500();
				}
				return false;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static bool LocalPlayerAffectedBySCP500()
		{
			return SCP500Controller.LocalPlayerAffectedBySCP500;
		}
	}
}
namespace HeavyItemSCPs
{
	public class NetworkHandlerHeavyItemSCPs : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <<ShotgunSuicideClientRpc>g__RotateShotgunCoroutine|16_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ShotgunItem shotgun;

			public float duration;

			private PlayerControllerB <player>5__1;

			private float <elapsedTime>5__2;

			private Vector3 <startRot>5__3;

			private Vector3 <endRot>5__4;

			private Vector3 <startPos>5__5;

			private Vector3 <endPos>5__6;

			private float <t>5__7;

			private Vector3 <_rotOffset>5__8;

			private Vector3 <_posOffset>5__9;

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

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

			[DebuggerHidden]
			public <<ShotgunSuicideClientRpc>g__RotateShotgunCoroutine|16_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Expected O, but got Unknown
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: 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_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<player>5__1 = ((GrabbableObject)shotgun).playerHeldBy;
						<>1__state = -3;
						if (!HallucinationManager.overrideShotgunsRotOffsets.ContainsKey((GrabbableObject)(object)shotgun))
						{
							HallucinationManager.overrideShotgunsRotOffsets.Add((GrabbableObject)(object)shotgun, ((GrabbableObject)shotgun).itemProperties.rotationOffset);
						}
						if (!HallucinationManager.overrideShotgunsPosOffsets.ContainsKey((GrabbableObject)(object)shotgun))
						{
							HallucinationManager.overrideShotgunsPosOffsets.Add((GrabbableObject)(object)shotgun, ((GrabbableObject)shotgun).itemProperties.positionOffset);
						}
						HallucinationManager.overrideShotguns.Add((GrabbableObject)(object)shotgun);
						<elapsedTime>5__2 = 0f;
						<startRot>5__3 = ((GrabbableObject)shotgun).itemProperties.rotationOffset;
						<endRot>5__4 = new Vector3(105f, -50f, -50f);
						<startPos>5__5 = ((GrabbableObject)shotgun).itemProperties.positionOffset;
						<endPos>5__6 = new Vector3(0f, 0.7f, -0.1f);
						goto IL_0203;
					case 1:
						<>1__state = -3;
						goto IL_0203;
					case 2:
						<>1__state = -3;
						if ((Object)(object)<player>5__1 == (Object)(object)Plugin.localPlayer)
						{
							Plugin.localPlayer.activatingItem = false;
							Utils.FreezePlayer(Plugin.localPlayer, value: false);
							shotgun.ShootGunAndSync(false);
							<>2__current = null;
							<>1__state = 3;
							return true;
						}
						goto IL_02c2;
					case 3:
						<>1__state = -3;
						Plugin.localPlayer.DamagePlayer(100, true, true, (CauseOfDeath)7, 0, false, shotgun.shotgunRayPoint.forward * 30f);
						goto IL_02c2;
					case 4:
						{
							<>1__state = -3;
							<>m__Finally1();
							return false;
						}
						IL_02c2:
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 4;
						return true;
						IL_0203:
						if (<elapsedTime>5__2 < duration)
						{
							<t>5__7 = <elapsedTime>5__2 / duration;
							<_rotOffset>5__8 = Vector3.Lerp(<startRot>5__3, <endRot>5__4, <t>5__7);
							<_posOffset>5__9 = Vector3.Lerp(<startPos>5__5, <endPos>5__6, <t>5__7);
							HallucinationManager.overrideShotgunsRotOffsets[(GrabbableObject)(object)shotgun] = <_rotOffset>5__8;
							HallucinationManager.overrideShotgunsPosOffsets[(GrabbableObject)(object)shotgun] = <_posOffset>5__9;
							<elapsedTime>5__2 += Time.deltaTime;
							<>2__current = null;
							<>1__state = 1;
							return true;
						}
						<>2__current = (object)new WaitForSeconds(3f);
						<>1__state = 2;
						return true;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

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

			private void <>m__Finally1()
			{
				<>1__state = -1;
				HallucinationManager.overrideShotguns.Remove((GrabbableObject)(object)shotgun);
				if ((Object)(object)<player>5__1 == (Object)(object)Plugin.localPlayer)
				{
					Plugin.localPlayer.activatingItem = false;
					Utils.FreezePlayer(Plugin.localPlayer, value: false);
				}
			}

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

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public GameObject SCP513_1Prefab;

		public static bool spawningBellMan;

		public static NetworkHandlerHeavyItemSCPs? Instance { get; private set; }

		public override void OnNetworkSpawn()
		{
			if (((NetworkBehaviour)this).IsServer && (Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
			}
			((Object)this).hideFlags = (HideFlags)61;
			Instance = this;
			logger.LogDebug((object)"NetworkHandlerHeavyItemSCPs spawned");
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		public void Update()
		{
			if (Plugin.configEnableSCP513.Value)
			{
				DoBellmanStuff();
			}
		}

		private void DoBellmanStuff()
		{
			if (SCP513Behavior.localPlayerHaunted)
			{
				if (Plugin.localPlayer.isPlayerDead || StartOfRound.Instance.firingPlayersCutsceneRunning)
				{
					logger.LogDebug((object)"This player is no longer haunted");
					SCP513Behavior.localPlayerHaunted = false;
				}
				else if ((Object)(object)SCP513_1AI.Instance != (Object)null)
				{
					spawningBellMan = false;
				}
				else if (!spawningBellMan && !StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase && Plugin.localPlayer.isPlayerControlled && !Utils.isOnCompanyMoon && Utils.allAINodes.Length != 0)
				{
					Instance?.SpawnBellManOnLocalClient();
				}
			}
		}

		public void SpawnBellManOnLocalClient()
		{
			//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)
			if (!((Object)(object)SCP513_1AI.Instance != (Object)null))
			{
				logger.LogDebug((object)"Spawning bellman");
				spawningBellMan = true;
				Object.Instantiate<GameObject>(SCP513_1Prefab, Vector3.zero, Quaternion.identity);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnGhostGirlServerRpc(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)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2349494745u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2349494745u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (Plugin.IsServerOrHost && !((Object)(object)Object.FindObjectsOfType<DressGirlAI>().FirstOrDefault() != (Object)null))
			{
				List<SpawnableEnemyWithRarity> enemies = Utils.GetEnemies();
				SpawnableEnemyWithRarity val3 = enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "DressGirl").FirstOrDefault();
				if (val3 == null)
				{
					logger.LogError((object)"Ghost girl could not be found");
				}
				else
				{
					RoundManager.Instance.SpawnEnemyGameObject(Vector3.zero, 0f, -1, val3.enemyType);
				}
			}
		}

		[ServerRpc]
		public void MimicEnemyServerRpc(ulong clientId, string enemyName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Invalid comparison between Unknown and I4
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1209691276u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				bool flag = enemyName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enemyName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1209691276u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			string enemyName2 = enemyName;
			if (!Plugin.IsServerOrHost)
			{
				return;
			}
			logger.LogDebug((object)("Attempting spawn enemy: " + enemyName2));
			EnemyType enemyType = (from x in Utils.GetEnemies()
				where ((Object)x.enemyType).name == enemyName2
				select x).FirstOrDefault().enemyType;
			if ((Object)(object)enemyType == (Object)null)
			{
				logger.LogError((object)"Couldnt find enemy to spawn in MimicEnemyServerRpc");
				return;
			}
			EnemyVent closestVentToPosition = Utils.GetClosestVentToPosition(((Component)Plugin.localPlayer).transform.position);
			if ((Object)(object)closestVentToPosition == (Object)null)
			{
				logger.LogError((object)"Couldnt find vent for mimic enemy event.");
				return;
			}
			NetworkObject val3 = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(closestVentToPosition.floorNode.position, 0f, -1, enemyType));
			EnemyAI val4 = default(EnemyAI);
			if (!((Component)val3).TryGetComponent<EnemyAI>(ref val4))
			{
				logger.LogError((object)"Couldnt get netObj in MimicEnemyClientRpc");
				return;
			}
			val4.ChangeOwnershipOfEnemy(clientId);
			MimicEnemyClientRpc(clientId, NetworkObjectReference.op_Implicit(((NetworkBehaviour)val4).NetworkObject));
		}

		[ClientRpc]
		public void MimicEnemyClientRpc(ulong clientId, NetworkObjectReference netRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2443461684u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2443461684u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
			{
				logger.LogError((object)"Couldnt get netRef in MimicEnemyClientRpc");
				return;
			}
			EnemyAI val4 = default(EnemyAI);
			if (!((Component)val3).TryGetComponent<EnemyAI>(ref val4))
			{
				logger.LogError((object)"Couldnt get netObj in MimicEnemyClientRpc");
				return;
			}
			Collider[] componentsInChildren = ((Component)((Component)val4).transform.root).gameObject.GetComponentsInChildren<Collider>();
			foreach (Collider val5 in componentsInChildren)
			{
				val5.enabled = false;
			}
			if (Plugin.localPlayer.actualClientId != clientId)
			{
				val4.EnableEnemyMesh(false, true);
				((Behaviour)val4.creatureSFX).enabled = false;
				((Behaviour)val4.creatureVoice).enabled = false;
			}
			else if (!((Object)(object)SCP513_1AI.Instance == (Object)null))
			{
				SCP513_1AI.Instance.mimicEnemy = val4;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ShotgunSuicideServerRpc(NetworkObjectReference netRef, float duration)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3147507412u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref duration, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3147507412u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (Plugin.IsServerOrHost)
				{
					ShotgunSuicideClientRpc(netRef, duration);
				}
			}
		}

		[ClientRpc]
		public void ShotgunSuicideClientRpc(NetworkObjectReference netRef, float duration)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1168501845u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref duration, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1168501845u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				ShotgunItem shotgun2 = default(ShotgunItem);
				if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
				{
					logger.LogError((object)"Cant get netObj");
				}
				else if (!((Component)val3).TryGetComponent<ShotgunItem>(ref shotgun2))
				{
					logger.LogError((object)"Cant get ShotgunItem");
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(RotateShotgunCoroutine(shotgun2, duration));
				}
			}
			[IteratorStateMachine(typeof(<<ShotgunSuicideClientRpc>g__RotateShotgunCoroutine|16_0>d))]
			static IEnumerator RotateShotgunCoroutine(ShotgunItem shotgun, float duration)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<ShotgunSuicideClientRpc>g__RotateShotgunCoroutine|16_0>d(0)
				{
					shotgun = shotgun,
					duration = duration
				};
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2349494745u, new RpcReceiveHandler(__rpc_handler_2349494745), "SpawnGhostGirlServerRpc");
			((NetworkBehaviour)this).__registerRpc(1209691276u, new RpcReceiveHandler(__rpc_handler_1209691276), "MimicEnemyServerRpc");
			((NetworkBehaviour)this).__registerRpc(2443461684u, new RpcReceiveHandler(__rpc_handler_2443461684), "MimicEnemyClientRpc");
			((NetworkBehaviour)this).__registerRpc(3147507412u, new RpcReceiveHandler(__rpc_handler_3147507412), "ShotgunSuicideServerRpc");
			((NetworkBehaviour)this).__registerRpc(1168501845u, new RpcReceiveHandler(__rpc_handler_1168501845), "ShotgunSuicideClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2349494745(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 clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavyItemSCPs)(object)target).SpawnGhostGirlServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1209691276(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0029: 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_0089: 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)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ulong clientId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string enemyName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyName, false);
			}
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((NetworkHandlerHeavyItemSCPs)(object)target).MimicEnemyServerRpc(clientId, enemyName);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}

		private static void __rpc_handler_2443461684(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavyItemSCPs)(object)target).MimicEnemyClientRpc(clientId, netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3147507412(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				float duration = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavyItemSCPs)(object)target).ShotgunSuicideServerRpc(netRef, duration);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1168501845(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				float duration = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavyItemSCPs)(object)target).ShotgunSuicideClientRpc(netRef, duration);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string? __getTypeName()
		{
			return "NetworkHandlerHeavyItemSCPs";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static GameObject? networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				if ((Object)(object)Plugin.ModAssets == (Object)null)
				{
					logger.LogError((object)"Couldnt get ModAssets to create network handler");
					return;
				}
				networkPrefab = (GameObject)Plugin.ModAssets.LoadAsset("Assets/ModAssets/NetworkHandlerHeavyItemSCPs.prefab");
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			logger.LogDebug((object)"SpawnNetworkHandler");
			if (Plugin.IsServerOrHost)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
				logger.LogDebug((object)"Spawned NetworkHandlerHeavyItemSCPs");
			}
		}
	}
	[BepInPlugin("ProjectSCP.HeavyItemSCPs", "HeavyItemSCPs", "1.4.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

		private readonly Harmony harmony = new Harmony("ProjectSCP.HeavyItemSCPs");

		public static AssetBundle? ModAssets;

		public static ConfigEntry<bool> configEnableSCP427;

		public static ConfigEntry<int> config427MinValue;

		public static ConfigEntry<int> config427MaxValue;

		public static ConfigEntry<string> config427LevelRarities;

		public static ConfigEntry<string> config427CustomLevelRarities;

		public static ConfigEntry<float> configTimeToTransform;

		public static ConfigEntry<int> configHealthPerSecondOpen;

		public static ConfigEntry<bool> config427_500Compatibility;

		public static ConfigEntry<string> config4271LevelRarities;

		public static ConfigEntry<string> config4271CustomLevelRarities;

		public static ConfigEntry<bool> configEnableSCP178;

		public static ConfigEntry<int> config178MinValue;

		public static ConfigEntry<int> config178MaxValue;

		public static ConfigEntry<int> config178PartMinValue;

		public static ConfigEntry<int> config178PartMaxValue;

		public static ConfigEntry<string> config178LevelRarities;

		public static ConfigEntry<string> config178CustomLevelRarities;

		public static ConfigEntry<string> config178PartLevelRarities;

		public static ConfigEntry<string> config178PartCustomLevelRarities;

		public static ConfigEntry<float> config178LensDistortion;

		public static ConfigEntry<float> config178ChromaticAberration;

		public static ConfigEntry<string> config178ColorTint;

		public static ConfigEntry<int> config1781MinCount;

		public static ConfigEntry<int> config1781MaxCount;

		public static ConfigEntry<bool> configEnableSCP323;

		public static ConfigEntry<int> config323MinValue;

		public static ConfigEntry<int> config323MaxValue;

		public static ConfigEntry<string> config323LevelRarities;

		public static ConfigEntry<string> config323CustomLevelRarities;

		public static ConfigEntry<bool> config323ShowInsanity;

		public static ConfigEntry<string> config3231LevelRarities;

		public static ConfigEntry<string> config3231CustomLevelRarities;

		public static ConfigEntry<bool> configEnableSCP513;

		public static ConfigEntry<int> config513MinValue;

		public static ConfigEntry<int> config513MaxValue;

		public static ConfigEntry<string> config513LevelRarities;

		public static ConfigEntry<string> config513CustomLevelRarities;

		public static ConfigEntry<bool> configUnhauntedOnBellDespawn;

		public static PlayerControllerB localPlayer => StartOfRound.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).FirstOrDefault();
		}

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			InitConfigs();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "heavy_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "heavy_assets")));
			if (configEnableSCP427.Value)
			{
				Utils.RegisterItem("Assets/ModAssets/SCP427/SCP427Item.asset", config427LevelRarities.Value, config427CustomLevelRarities.Value, config427MinValue.Value, config427MaxValue.Value);
				Utils.RegisterEnemy("Assets/ModAssets/SCP427/SCP4271Enemy.asset", "Assets/ModAssets/SCP427/Bestiary/SCP4271TN.asset", "Assets/ModAssets/SCP427/Bestiary/SCP4271TK.asset", config4271LevelRarities.Value, config4271CustomLevelRarities.Value);
			}
			if (configEnableSCP178.Value)
			{
				Utils.RegisterItem("Assets/ModAssets/SCP178/SCP1781Part_1.asset", config178PartLevelRarities.Value, config178PartCustomLevelRarities.Value, config178PartMinValue.Value, config178PartMaxValue.Value);
				Utils.RegisterItem("Assets/ModAssets/SCP178/SCP1781Part_2.asset", config178PartLevelRarities.Value, config178PartCustomLevelRarities.Value, config178PartMinValue.Value, config178PartMaxValue.Value);
				Utils.RegisterItem("Assets/ModAssets/SCP178/SCP1781Part_3.asset", config178PartLevelRarities.Value, config178PartCustomLevelRarities.Value, config178PartMinValue.Value, config178PartMaxValue.Value);
				Utils.RegisterItem("Assets/ModAssets/SCP178/SCP178Item.asset", config178LevelRarities.Value, config178CustomLevelRarities.Value, config178MinValue.Value, config178MaxValue.Value);
				Utils.RegisterEnemy("Assets/ModAssets/SCP178/SCP1781Enemy.asset", "Assets/ModAssets/SCP178/Bestiary/SCP1781TN.asset", "Assets/ModAssets/SCP178/Bestiary/SCP1781TK.asset");
				SCP1783DVision.Load();
			}
			if (configEnableSCP323.Value)
			{
				Utils.RegisterItem("Assets/ModAssets/SCP323/SCP323Item.asset", config323LevelRarities.Value, config323CustomLevelRarities.Value, config323MinValue.Value, config323MaxValue.Value);
				Utils.RegisterEnemy("Assets/ModAssets/SCP323/SCP323_1Enemy.asset", "Assets/ModAssets/SCP323/Bestiary/SCP323_1TN.asset", "Assets/ModAssets/SCP323/Bestiary/SCP323_1TK.asset", config3231LevelRarities.Value, config3231CustomLevelRarities.Value);
			}
			if (configEnableSCP513.Value)
			{
				Utils.RegisterItem("Assets/ModAssets/SCP513/SCP513Item.asset", config513LevelRarities.Value, config513CustomLevelRarities.Value, config513MinValue.Value, config513MaxValue.Value);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.HeavyItemSCPs v1.4.4 has loaded!");
		}

		private void InitConfigs()
		{
			configEnableSCP427 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Enable SCP-427", true, "Whether or not SCP-427 can spawn as scrap.");
			config427MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Minimum value", 100, "The minimum value of SCP-427.");
			config427MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Maximum value", 300, "The maximum value of SCP-427.");
			config427LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427 Rarities", "Level Rarities", "All: 10, Modded:10", "Rarities for each level. See default for formatting.");
			config427CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			configTimeToTransform = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Time to transform", 60f, "How long a player can hold the necklace before they transform into SCP-427-1. Should be higher that 30. Set to -1 to disable transforming.");
			configHealthPerSecondOpen = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Health per second open", 5, "The health gained per second while opening SCP-427.");
			config427_500Compatibility = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "SCP-500 compatibility", true, "Whether or not SCP-427 should be compatible with the SCP-500 mod. This will only work if you have the SCP-500 mod installed. If enabled, it will temporarily halt the transformation timer when holding or using SCP-427 when you take SCP-500.");
			config4271LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Level Rarities", "All: 10, Modded:10", "Rarities for each level. See default for formatting.");
			config4271CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			configEnableSCP178 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-178", "Enable SCP-178", true, "Whether or not SCP-178 can spawn as scrap.");
			config178MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Minimum value", 100, "The minimum value of SCP-178.");
			config178MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Maximum value", 150, "The maximum value of SCP-178.");
			config178LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Rarities", "Level Rarities", "All:10, Modded:10", "Rarities for each level. See default for formatting.");
			config178CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			config178PartMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Minimum value", 250, "The minimum value of SCP-178 Parts.");
			config178PartMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Maximum value", 500, "The maximum value of SCP-178 Parts.");
			config178PartLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Parts Rarities", "Level Rarities", "All:30, Modded:30", "Rarities for each level. See default for formatting.");
			config178PartCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Parts Rarities", "Custom Level Rarities", "Secret LabsLevel:150", "Rarities for modded levels. Same formatting as level rarities.");
			config178LensDistortion = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-178 3D Effects", "Lens Distortion", -0.2f, "Changes the lens distortion effect of the 3D glasses.");
			config178ChromaticAberration = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-178 3D Effects", "Chromatic Aberration", 3f, "Changes the chromatic aberration effect of the 3D glasses.");
			config178ColorTint = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 3D Effects", "Color Tint", "500,0,500", "Changes the RGB color tint effect of the 3D glasses.");
			config1781MinCount = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-1781", "Min Count", 50, "The minimum number of SCP-178-1 instances that can be spawned.");
			config1781MaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-1781", "Max Count", 100, "The maximum number of SCP-178-1 instances that can be spawned.");
			configEnableSCP323 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323", "Enable SCP-323", true, "Whether or not SCP-323 can spawn as scrap.");
			config323MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Minimum value", 100, "The minimum value of SCP-323.");
			config323MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Maximum value", 150, "The maximum value of SCP-323.");
			config323LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323 Rarities", "Level Rarities", "All: 10, Modded:10", "Rarities for each level. See default for formatting.");
			config323CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			config323ShowInsanity = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323", "Show insanity", false, "Blur the players vision when they are near SCP-323 based on their insanity.");
			config3231LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323-1 Rarities", "Level Rarities", "All: 10, Modded:10", "Rarities for each level. See default for formatting.");
			config3231CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323-1 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			configEnableSCP513 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-513", "Enable SCP-513", true, "Whether or not SCP-513 can spawn as scrap.");
			config513MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-513", "Minimum value", 150, "The minimum value of SCP-513.");
			config513MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-513", "Maximum value", 300, "The maximum value of SCP-513.");
			config513LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-513 Rarities", "Level Rarities", "All: 10, Modded:10", "Rarities for each level. See default for formatting.");
			config513CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-513 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			configUnhauntedOnBellDespawn = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-513", "Unhaunted on bell despawn", false, "When true, if the bell is despawned or sold to the company, all haunted players will become unhaunted.");
		}

		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);
					}
				}
			}
			LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	[HarmonyPatch]
	public class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static int setEventRarity = -1;

		public static int setEventIndex = -1;

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

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.isBeta)
			{
				return;
			}
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			logger.LogDebug((object)text);
			switch (array[0])
			{
			case "/search":
				if (!((Object)(object)SCP323_1AI.Instance == (Object)null))
				{
					((EnemyAI)SCP323_1AI.Instance).StartSearch(((Component)Plugin.localPlayer).transform.position, (AISearchRoutine)null);
				}
				break;
			case "/moving":
				Utils.DEBUG_disableMoving = !Utils.DEBUG_disableMoving;
				HUDManager.Instance.DisplayTip("DisableMoving: ", Utils.DEBUG_disableMoving.ToString(), false, false, "LC_Tip1");
				break;
			case "/targetting":
				Utils.DEBUG_disableTargetting = !Utils.DEBUG_disableTargetting;
				HUDManager.Instance.DisplayTip("DisableTargetting: ", Utils.DEBUG_disableTargetting.ToString(), false, false, "LC_Tip1");
				break;
			case "/playerThrowing":
				SCP4271AI.DEBUG_throwingPlayerDisabled = !SCP4271AI.DEBUG_throwingPlayerDisabled;
				HUDManager.Instance.DisplayTip("ThrowingPlayerDisabled", SCP4271AI.DEBUG_throwingPlayerDisabled.ToString(), false, false, "LC_Tip1");
				break;
			case "/allEvents":
				HallucinationManager.Instance?.RunAllEvents(int.Parse(array[1]));
				break;
			case "/setEvent":
				setEventRarity = int.Parse(array[1]);
				setEventIndex = int.Parse(array[2]);
				break;
			case "/event":
				HallucinationManager.Instance?.RunEvent(int.Parse(array[1]), int.Parse(array[2]));
				break;
			default:
				Utils.ChatCommand(array);
				break;
			}
		}
	}
	public static class Utils
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static bool isBeta = false;

		public static bool trailerMode = false;

		public static bool testing = false;

		public static bool DEBUG_disableSpawning = false;

		public static bool DEBUG_disableTargetting = false;

		public static bool DEBUG_disableMoving = false;

		public static bool localPlayerFrozen = false;

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

		public static bool isOnCompanyMoon
		{
			get
			{
				StartOfRound instance = StartOfRound.Instance;
				return instance != null && instance.currentLevel.levelID == 3;
			}
		}

		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)
					{
						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)
				{
					logger.LogDebug((object)val3.surfaceTag);
				}
				break;
			}
			case "/enemies":
			{
				foreach (SpawnableEnemyWithRarity enemy in GetEnemies())
				{
					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)
				{
					logger.LogDebug((object)((Object)val2).name);
				}
				break;
			}
			case "/dungeon":
				logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
				break;
			case "/dungeons":
			{
				IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
				foreach (IndoorMapType val in dungeonFlowTypes)
				{
					logger.LogDebug((object)((Object)val.dungeonFlow).name);
				}
				break;
			}
			}
		}

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

		public static void RegisterItem(string itemPath, string levelRarities = "", string customLevelRarities = "", int minValue = 0, int maxValue = 0)
		{
			Item val = Plugin.ModAssets.LoadAsset<Item>(itemPath);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldn't get prefab from " + itemPath));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
			val.minValue = minValue;
			val.maxValue = maxValue;
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, GetLevelRarities(levelRarities), GetCustomLevelRarities(customLevelRarities));
		}

		public static void RegisterEnemy(string enemyPath, string tnPath, string tkPath, string levelRarities = "", string customLevelRarities = "")
		{
			EnemyType val = Plugin.ModAssets.LoadAsset<EnemyType>(enemyPath);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldn't get prefab from " + enemyPath));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
			TerminalNode val2 = Plugin.ModAssets.LoadAsset<TerminalNode>(tnPath);
			TerminalKeyword val3 = Plugin.ModAssets.LoadAsset<TerminalKeyword>(tkPath);
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, GetLevelRarities(levelRarities), GetCustomLevelRarities(customLevelRarities), val2, val3);
		}

		public static Dictionary<LevelTypes, int>? GetLevelRarities(string? levelsString)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
				if (levelsString != null && levelsString != "")
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
							{
								dictionary.Add(result, result2);
							}
							else
							{
								Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				Plugin.LoggerInstance.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		public static Dictionary<string, int>? GetCustomLevelRarities(string? levelsString)
		{
			try
			{
				Dictionary<string, int> dictionary = new Dictionary<string, int>();
				if (levelsString != null)
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (int.TryParse(text3, out var result))
							{
								dictionary.Add(text2, result);
							}
							else
							{
								Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				Plugin.LoggerInstance.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		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.LoggerInstance.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);
		}

		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 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 GameObject? GetClosestGameObjectToPosition(this List<GameObject> list, Vector3 position)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject result = null;
			float num = float.PositiveInfinity;
			foreach (GameObject item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					float num2 = Vector3.Distance(position, item.transform.position);
					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 GameObject? GetRandomNode(bool outside)
		{
			logger.LogDebug((object)"Choosing random node...");
			GameObject[] array = (outside ? outsideAINodes : insideAINodes);
			if (array.Length == 0)
			{
				return null;
			}
			int num = Random.Range(0, array.Length);
			return array[num];
		}

		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)
			{
				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;
				}
			}
			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)
			{
				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
				{
					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();
		}
	}
	[HarmonyPatch]
	public class UtilsPatches
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")]
		public static bool SpawnInsideEnemiesFromVentsIfReadyPrefix()
		{
			if (Utils.DEBUG_disableSpawning)
			{
				return false;
			}
			return true;
		}

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

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

		public const string PLUGIN_NAME = "HeavyItemSCPs";

		public const string PLUGIN_VERSION = "1.4.4";
	}
}
namespace HeavyItemSCPs.Items.SCP513
{
	public class HallucinationManager : MonoBehaviour
	{
		private delegate void MethodDelegate();

		[CompilerGenerated]
		private sealed class <<BlockDoor>g__BlockDoorCoroutine|34_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private float <doorDistance>5__1;

			private float <blockPosOffset>5__2;

			private float <disappearDistance>5__3;

			private float <disappearTime>5__4;

			private DoorLock[] <doorLocks>5__5;

			private int <index>5__6;

			private DoorLock <doorLock>5__7;

			private GameObject <steelDoorObj>5__8;

			private Vector3 <blockPos>5__9;

			private float <elapsedTime>5__10;

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

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

			[DebuggerHidden]
			public <<BlockDoor>g__BlockDoorCoroutine|34_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<doorLocks>5__5 = null;
				<doorLock>5__7 = null;
				<steelDoorObj>5__8 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0220: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				//IL_0153: 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_0163: 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_016f: 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_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<doorDistance>5__1 = 10f;
					<blockPosOffset>5__2 = 1f;
					<disappearDistance>5__3 = 15f;
					<disappearTime>5__4 = 15f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<doorLocks>5__5 = GetDoorLocksNearbyPosition(((Component)Plugin.localPlayer).transform.position, <doorDistance>5__1).ToArray();
					goto IL_00e8;
				case 2:
					<>1__state = -1;
					<doorLocks>5__5 = GetDoorLocksNearbyPosition(((Component)Plugin.localPlayer).transform.position, <doorDistance>5__1).ToArray();
					goto IL_00e8;
				case 3:
					{
						<>1__state = -1;
						<elapsedTime>5__10 += 0.2f;
						if (Vector3.Distance(((Component)SCP513_1AI.Instance).transform.position, ((Component)Plugin.localPlayer).transform.position) > <disappearDistance>5__3 || SCP513_1AI.Instance.currentBehaviourState != SCP513_1AI.State.Manifesting)
						{
							break;
						}
						goto IL_025c;
					}
					IL_00e8:
					if (<doorLocks>5__5.Length == 0)
					{
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 2;
						return true;
					}
					<index>5__6 = Random.Range(0, <doorLocks>5__5.Length);
					<doorLock>5__7 = <doorLocks>5__5[<index>5__6];
					<steelDoorObj>5__8 = ((Component)((Component)((Component)<doorLock>5__7).transform.parent).transform.parent).gameObject;
					<blockPos>5__9 = RoundManager.Instance.GetNavMeshPosition(<steelDoorObj>5__8.transform.position + Vector3.forward * <blockPosOffset>5__2, default(NavMeshHit), 5f, -1);
					SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Manifesting);
					SCP513_1AI.Instance.Teleport(<blockPos>5__9);
					SCP513_1AI.Instance.SetDestinationToPosition(<blockPos>5__9);
					SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true);
					SCP513_1AI.Instance.facePlayer = true;
					<elapsedTime>5__10 = 0f;
					goto IL_025c;
					IL_025c:
					if (<elapsedTime>5__10 < <disappearTime>5__4)
					{
						<>2__current = (object)new WaitForSeconds(0.2f);
						<>1__state = 3;
						return true;
					}
					break;
				}
				return false;
			}

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

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

		[CompilerGenerated]
		private sealed class <<ChasePlayer>g__ChaseCoroutine|42_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HallucinationManager <>4__this;

			private Transform <teleportPos>5__1;

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

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

			[DebuggerHidden]
			public <<ChasePlayer>g__ChaseCoroutine|42_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<teleportPos>5__1 = SCP513_1AI.Instance.ChooseFarthestNodeFromPosition(((Component)Plugin.localPlayer).transform.position);
					if ((Object)(object)<teleportPos>5__1 == (Object)null)
					{
						logger.LogError((object)"Couldnt find farthest node from position");
						return false;
					}
					SCP513_1AI.Instance.Teleport(<teleportPos>5__1.position);
					SCP513_1AI.Instance.agent.speed = 10f;
					SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", false);
					SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Chasing);
					break;
				case 2:
					<>1__state = -1;
					<>4__this.FlickerLights();
					break;
				}
				if (SCP513_1AI.Instance.currentBehaviourState == SCP513_1AI.State.Chasing && Plugin.localPlayer.isInsideFactory != SCP513_1AI.Instance.isOutside)
				{
					<>2__current = (object)new WaitForSeconds(2.5f);
					<>1__state = 2;
					return true;
				}
				return false;
			}

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

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

		[CompilerGenerated]
		private sealed class <<FarStare>g__StareCoroutine|32_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public HallucinationManager <>4__this;

			private float <stareTime>5__1;

			private Transform <pos>5__2;

			private float <elapsedTime>5__3;

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

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

			[DebuggerHidden]
			public <<FarStare>g__StareCoroutine|32_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Expected O, but got Unknown
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Expected O, but got Unknown
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<stareTime>5__1 = 15f;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<pos>5__2 = SCP513_1AI.Instance.TryFindingHauntPosition();
					goto IL_00a3;
				case 2:
					<>1__state = -1;
					<pos>5__2 = SCP513_1AI.Instance.TryFindingHauntPosition();
					goto IL_00a3;
				case 3:
					<>1__state = -1;
					<elapsedTime>5__3 += 0.2f;
					if (SCP513_1AI.Instance.playerHasLOS)
					{
						<>2__current = (object)new WaitForSeconds(2.5f);
						<>1__state = 4;
						return true;
					}
					break;
				case 4:
					{
						<>1__state = -1;
						<>4__this.FlickerLights();
						return false;
					}
					IL_00a3:
					if ((Object)(object)<pos>5__2 == (Object)null)
					{
						<>2__current = (object)new WaitForSeconds(0.2f);
						<>1__state = 2;
						return true;
					}
					if (Random.Range(1, 4) == 1)
					{
						LogStareArt();
					}
					SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Manifesting);
					SCP513_1AI.Instance.Teleport(<pos>5__2.position);
					SCP513_1AI.Instance.facePlayer = true;
					SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true);
					RoundManager.PlayRandomClip(SCP513_1AI.Instance.creatureSFX, SCP513_1AI.Instance.AmbientSFX, true, 1f, 0, 1000);
					<elapsedTime>5__3 = 0f;
					break;
				}
				if (<elapsedTime>5__3 < <stareTime>5__1)
				{
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 3;
					return true;
				}
				return false;
			}

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

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

		[CompilerGenerated]
		private sealed class <<ForceSuicide>g__ForceSuicideCoroutine|47_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public bool hasShotgun;

			public bool hasMask;

			private int <itemSlotIndex>5__1;

			private ShotgunItem <shotgun>5__2;

			private GrabbableObject[] <>s__3;

			private int <>s__4;

			private GrabbableObject <slot>5__5;

			private HauntedMaskItem <mask>5__6;

			private GrabbableObject[] <>s__7;

			private int <>s__8;

			private GrabbableObject <slot>5__9;

			private KnifeItem <knife>5__10;

			private float <elapsedTime>5__11;

			private GrabbableObject[] <>s__12;

			private int <>s__13;

			private GrabbableObject <slot>5__14;

			private Transform <camTransform>5__15;

			private Vector3 <currentAngles>5__16;

			private float <targetX>5__17;

			private float <smoothedX>5__18;

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

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

			[DebuggerHidden]
			public <<ForceSuicide>g__ForceSuicideCoroutine|47_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<shotgun>5__2 = null;
				<>s__3 = null;
				<slot>5__5 = null;
				<mask>5__6 = null;
				<>s__7 = null;
				<slot>5__9 = null;
				<knife>5__10 = null;
				<>s__12 = null;
				<slot>5__14 = null;
				<camTransform>5__15 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0381: Unknown result type (might be due to invalid IL or missing references)
				//IL_038b: Expected O, but got Unknown
				//IL_051d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0522: Unknown result type (might be due to invalid IL or missing references)
				//IL_0575: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c7: Expected O, but got Unknown
				//IL_033e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0348: Expected O, but got Unknown
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Expected O, but got Unknown
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_0435: Unknown result type (might be due to invalid IL or missing references)
				//IL_043f: Expected O, but got Unknown
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Expected O, but got Unknown
				//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b0: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<itemSlotIndex>5__1 = 0;
					if (hasShotgun)
					{
						Utils.FreezePlayer(Plugin.localPlayer, value: true);
						Plugin.localPlayer.activatingItem = true;
						<shotgun>5__2 = null;
						<>s__3 = Plugin.localPlayer.ItemSlots;
						for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
						{
							<slot>5__5 = <>s__3[<>s__4];
							if (!((Object)(object)<slot>5__5 == (Object)null))
							{
								if (((Object)<slot>5__5.itemProperties).name == "Shotgun")
								{
									<shotgun>5__2 = (ShotgunItem)<slot>5__5;
									<itemSlotIndex>5__1 = MiscHelpers.IndexOf<GrabbableObject>((IEnumerable<GrabbableObject>)Plugin.localPlayer.ItemSlots, (GrabbableObject)(object)<shotgun>5__2);
								}
								<slot>5__5 = null;
							}
						}
						<>s__3 = null;
						if ((Object)(object)<shotgun>5__2 == (Object)null)
						{
							logger.LogError((object)"Couldnt find shotgun");
							return false;
						}
						Plugin.localPlayer.SwitchToItemSlot(<itemSlotIndex>5__1, (GrabbableObject)(object)<shotgun>5__2);
						NetworkHandlerHeavyItemSCPs.Instance?.ShotgunSuicideServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)<shotgun>5__2).NetworkObject), 5f);
						<>2__current = (object)new WaitForSeconds(10f);
						<>1__state = 2;
						return true;
					}
					if (hasMask)
					{
						Utils.FreezePlayer(Plugin.localPlayer, value: true);
						Plugin.localPlayer.activatingItem = true;
						<mask>5__6 = null;
						<>s__7 = Plugin.localPlayer.ItemSlots;
						for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
						{
							<slot