Decompiled source of SCP999 v2.3.1

plugins/ProjectSCP.SCP999.dll

Decompiled 7 hours ago
using System;
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.Logging;
using Dawn;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using ItemSCPs;
using Microsoft.CodeAnalysis;
using ProjectSCP.SCP999.NetcodePatcher;
using SnowyLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem.Utilities;

[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("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[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("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("ProjectSCP.SCP999")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.3.1.0")]
[assembly: AssemblyInformationalVersion("2.3.1+d3ebea6956e62a54b39263c4a6214040da46768b")]
[assembly: AssemblyProduct("SCP999")]
[assembly: AssemblyTitle("ProjectSCP.SCP999")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ItemSCPs
{
	public class SCP999ContentHandler : ContentHandler<SCP999ContentHandler>
	{
		public class SCP999Assets : AssetBundleLoader<SCP999Assets>
		{
			public SCP999Assets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

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

		public SCP999Assets? SCP999;

		public ContainmentJarAssets? ContainmentJar;

		public SCP999ContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<SCP999Assets>("scp999", ref SCP999, false);
			((ContentHandler)this).RegisterContent<ContainmentJarAssets>("containment_jar", ref ContainmentJar, false);
		}
	}
	public static class SCP999Keys
	{
		public static readonly NamespacedKey<DawnEnemyInfo> SCP999 = NamespacedKey<DawnEnemyInfo>.From("scpnineninenine", "scpnineninenine");

		public static readonly NamespacedKey<DawnItemInfo> ContainmentJar = NamespacedKey<DawnItemInfo>.From("scpnineninenine", "jar");
	}
}
namespace SCP999
{
	internal class ContainmentJarBehavior : PhysicsProp
	{
		internal enum Contents
		{
			Empty,
			SCP999,
			Blob
		}

		public Sprite[] ItemIcons = null;

		public Material[] ItemMaterials = null;

		public ScanNodeProperties ScanNode = null;

		public MeshRenderer renderer = null;

		public Contents JarContents = Contents.Empty;

		public PlayerControllerB? lastPlayerHeldBy;

		private int jar999Value => ((AssetBundleLoader<SCP999ContentHandler.ContainmentJarAssets>)(object)ContentHandler<SCP999ContentHandler>.Instance.ContainmentJar).GetConfig<int>("SCP-999 Value").Value;

		private int jarSlimeValue => ((AssetBundleLoader<SCP999ContentHandler.ContainmentJarAssets>)(object)ContentHandler<SCP999ContentHandler>.Instance.ContainmentJar).GetConfig<int>("Slime Value").Value;

		private bool slimeTaming => ((AssetBundleLoader<SCP999ContentHandler.ContainmentJarAssets>)(object)ContentHandler<SCP999ContentHandler>.Instance.ContainmentJar).GetConfig<bool>("Slime Taming").Value;

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				lastPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Plugin.localPlayer)
				{
					int num = MiscHelpers.IndexOf<GrabbableObject>((IEnumerable<GrabbableObject>)Plugin.localPlayer.ItemSlots, (GrabbableObject)(object)this);
					HUDManager.Instance.itemSlotIcons[num].sprite = ItemIcons[(int)JarContents];
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && JarContents != 0 && !StartOfRound.Instance.inShipPhase)
			{
				OpenJarServerRpc();
			}
		}

		public override int GetItemDataToSave()
		{
			Plugin.logger.LogDebug((object)("GetItemDataToSave: " + JarContents));
			return (int)JarContents;
		}

		public override void LoadItemSaveData(int saveData)
		{
			ManualLogSource logger = Plugin.logger;
			Contents contents = (Contents)saveData;
			logger.LogDebug((object)("LoadItemSaveData: " + contents));
			((GrabbableObject)this).fallTime = 0f;
			ChangeJarContentsOnLocalClient((Contents)saveData);
		}

		public void ChangeJarContentsOnLocalClient(Contents contents)
		{
			Plugin.logger.LogDebug((object)("ChangeJarContentsOnLocalClient: " + contents));
			((Renderer)renderer).material = ItemMaterials[(int)contents];
			JarContents = contents;
			switch (JarContents)
			{
			case Contents.Empty:
				((GrabbableObject)this).SetScrapValue(0);
				break;
			case Contents.SCP999:
				((GrabbableObject)this).SetScrapValue(jar999Value);
				break;
			case Contents.Blob:
				((GrabbableObject)this).SetScrapValue(jarSlimeValue);
				break;
			}
			ScanNode.subText = "Contents: " + contents;
		}

		public override void SetControlTipsForItem()
		{
			string[] array = ((JarContents == Contents.Empty) ? Array.Empty<string>() : new string[1] { "Release " + JarContents.ToString() + " [LMB]" });
			HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties);
		}

		[ServerRpc(RequireOwnership = false)]
		private void OpenJarServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3572622651u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3572622651u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			if (JarContents == Contents.SCP999)
			{
				SCP999AI sCP999AI = (SCP999AI)(object)Utils.SpawnEnemy(SCP999Keys.SCP999, ((Component)((GrabbableObject)this).playerHeldBy).transform.position + new Vector3(0f, 0f, 3.5f), default(Quaternion));
				if (slimeTaming)
				{
					sCP999AI.SetTamed(((GrabbableObject)this).playerHeldBy);
				}
			}
			else if (JarContents == Contents.Blob)
			{
				Utils.SpawnEnemy(EnemyKeys.Blob, ((Component)((GrabbableObject)this).playerHeldBy).transform.position + new Vector3(0f, 0f, 3.5f), default(Quaternion));
			}
			ChangeJarContentsClientRpc(Contents.Empty);
		}

		[ClientRpc]
		public void ChangeJarContentsClientRpc(Contents contents)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3420106347u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<Contents>(ref contents, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3420106347u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Plugin.logger.LogDebug((object)("ChangeJarContentsClientRpc: " + contents));
					ChangeJarContentsOnLocalClient(contents);
				}
			}
		}

		[ClientRpc]
		public void NotifyPlayerClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1688014456u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1688014456u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)lastPlayerHeldBy != (Object)null && (Object)(object)lastPlayerHeldBy == (Object)(object)Plugin.localPlayer)
				{
					HUDManager.Instance.DisplayTip("You monster!", "You are a horrible person", true, false, "LC_Tip1");
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//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
			((NetworkBehaviour)this).__registerRpc(3572622651u, new RpcReceiveHandler(__rpc_handler_3572622651), "OpenJarServerRpc");
			((NetworkBehaviour)this).__registerRpc(3420106347u, new RpcReceiveHandler(__rpc_handler_3420106347), "ChangeJarContentsClientRpc");
			((NetworkBehaviour)this).__registerRpc(1688014456u, new RpcReceiveHandler(__rpc_handler_1688014456), "NotifyPlayerClientRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_3572622651(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ContainmentJarBehavior)(object)target).OpenJarServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3420106347(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Contents contents = default(Contents);
				((FastBufferReader)(ref reader)).ReadValueSafe<Contents>(ref contents, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ContainmentJarBehavior)(object)target).ChangeJarContentsClientRpc(contents);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1688014456(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ContainmentJarBehavior)(object)target).NotifyPlayerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ContainmentJarBehavior";
		}
	}
	[HarmonyPatch(typeof(DepositItemsDesk))]
	internal class DepositItemsDeskPatch
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch("delayedAcceptanceOfItems")]
		public static void delayedAcceptanceOfItemsPostFix(GrabbableObject[] objectsOnDesk)
		{
			if (!Plugin.IsServerOrHost)
			{
				return;
			}
			foreach (GrabbableObject val in objectsOnDesk)
			{
				if ((Object)(object)((Component)val).GetComponent<ContainmentJarBehavior>() != (Object)null)
				{
					ContainmentJarBehavior component = ((Component)val).GetComponent<ContainmentJarBehavior>();
					if (component.JarContents == ContainmentJarBehavior.Contents.SCP999)
					{
						component.NotifyPlayerClientRpc();
					}
				}
			}
		}
	}
	[BepInPlugin("ProjectSCP.SCP999", "SCP999", "2.3.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance = null;

		public static ManualLogSource logger = null;

		public static DuskMod Mod = null;

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

		public static List<string> Sweets = new List<string>
		{
			"Blue Candy", "Green Candy", "Pink Candy", "Purple Candy", "Rainbow Candy", "Red Candy", "Yellow Candy", "Black Candy", "Candy", "Cake",
			"SCP-559"
		};

		public const ulong RodrigoSteamID = 76561198164429786uL;

		public const ulong LizzieSteamID = 76561199094139351uL;

		public const ulong GlitchSteamID = 76561198984467725uL;

		public const ulong RatSteamID = 76561199182474292uL;

		public const ulong XuSteamID = 76561198399127090uL;

		public const ulong SlayerSteamID = 76561198077184650uL;

		public const ulong SnowySteamID = 76561198253760639uL;

		public const ulong FunoSteamID = 76561198993437314uL;

		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)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = ((BaseUnityPlugin)Instance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp999_mainassets"));
			Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.RegisterContentHandlers();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP999 v2.3.1 has loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			logger.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	public class SCP999AI : EnemyAI
	{
		public enum State
		{
			Roaming,
			Following,
			Blocking,
			Healing,
			Hyper
		}

		public Transform turnCompass = null;

		public ScanNodeProperties ScanNode = null;

		public List<AudioClip> hitSFXList = null;

		public List<AudioClip> hugSFXList = null;

		public List<AudioClip> hurtSFXList = null;

		public List<AudioClip> roamSFXList = null;

		public InteractTrigger jarTrigger = null;

		public ulong lizzieSteamId;

		public ulong snowySteamId;

		private static readonly int hugAnim = Animator.StringToHash("hugging");

		private static readonly int stretchAnim = Animator.StringToHash("stretching");

		private static readonly int hyperAnim = Animator.StringToHash("hyperDancing");

		private static readonly int walkAnim = Animator.StringToHash("walking");

		private static readonly int danceAnim = Animator.StringToHash("dancing");

		private EnemyAI? targetEnemy;

		private Turret? blockedTurret;

		private float timeSinceHealing;

		private float healingBuffTime;

		private float hyperTime;

		private float timeSinceBlockSFX;

		private float timeSinceHugSFX;

		private float hugTime;

		private float rangeMultiplier = 1f;

		private float followingRange;

		private bool walking;

		private bool hugging;

		private int candyEaten;

		private bool gettingInJar;

		private bool followPlayer = true;

		private bool followEnemy = true;

		private bool tamed = false;

		private PlayerControllerB tamedByPlayer = null;

		private bool dancing;

		public static float size => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Size").Value;

		public static int playerHealAmount => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<int>("Player Heal Amount").Value;

		public static int enemyHealAmount => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<int>("Enemy Heal Amount").Value;

		public static float playerDetectionRange => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Player Detection Range").Value;

		public static float enemyDetectionRange => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Enemy Detection Range").Value;

		public static float followRange => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Follow Range").Value;

		public static float huggingRange => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Hugging Range").Value;

		public static int maxCandy => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<int>("Max Candy").Value;

		public static float insanityDecreaseRate => ((AssetBundleLoader<SCP999ContentHandler.SCP999Assets>)(object)ContentHandler<SCP999ContentHandler>.Instance.SCP999).GetConfig<float>("Insanity Decrease Rate").Value;

		public void SwitchToBehaviourStateCustom(State state)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			switch (state)
			{
			case State.Roaming:
				SetTargetNull();
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				break;
			case State.Following:
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				break;
			case State.Blocking:
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				DoAnimationClientRpc(stretchAnim, value: true);
				break;
			case State.Healing:
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				break;
			case State.Hyper:
				tamed = false;
				tamedByPlayer = null;
				SetTargetNull();
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				DoAnimationClientRpc(walkAnim, value: false);
				DoAnimationClientRpc(hyperAnim, value: true);
				break;
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc((int)state);
		}

		public override void Start()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			Plugin.logger.LogDebug((object)"SCP-999 Spawned");
			base.currentBehaviourStateIndex = 0;
			if (!RoundManager.Instance.SpawnedEnemies.Contains((EnemyAI)(object)this))
			{
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
			}
			if (Plugin.IsServerOrHost)
			{
				if (((Component)this).transform.localScale.y != size)
				{
					ChangeSizeClientRpc(size);
				}
				SetOutsideOrInside();
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			}
		}

		public override void Update()
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			timeSinceHealing += Time.deltaTime;
			timeSinceBlockSFX += Time.deltaTime;
			timeSinceHugSFX += Time.deltaTime;
			if (healingBuffTime > 0f)
			{
				healingBuffTime -= Time.deltaTime;
			}
			if (hyperTime > 0f)
			{
				hyperTime -= Time.deltaTime;
			}
			bool flag = hugTime > 0f;
			if (flag)
			{
				hugTime -= Time.deltaTime;
			}
			if (hugging != flag)
			{
				base.creatureAnimator.SetBool(hugAnim, flag);
				hugging = flag;
			}
			if ((Object)(object)base.targetPlayer != (Object)null && base.currentBehaviourStateIndex == 2)
			{
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime);
			}
			if ((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && ((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name == "ContainmentJarItem" && ((Component)Plugin.localPlayer.currentlyHeldObjectServer).GetComponent<ContainmentJarBehavior>().JarContents == ContainmentJarBehavior.Contents.Empty)
			{
				jarTrigger.interactable = true;
			}
			else
			{
				jarTrigger.interactable = false;
			}
			if (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 0)
			{
				Vector3 velocity = base.agent.velocity;
				bool flag2 = ((Vector3)(ref velocity)).sqrMagnitude >= 0.01f;
				if (walking != flag2)
				{
					base.creatureAnimator.SetBool(walkAnim, flag2);
					walking = flag2;
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_0013: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			if (base.moveTowardsDestination)
			{
				base.agent.SetDestination(base.destination);
			}
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead || gettingInJar || BabyIsCryingNearby())
			{
				return;
			}
			if (tamed && (Object)(object)tamedByPlayer != (Object)null)
			{
				base.targetPlayer = tamedByPlayer;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 5f;
				base.agent.stoppingDistance = 0f;
				base.agent.acceleration = 8f;
				if ((((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f, false, false, true) && followPlayer) || (TargetClosestEnemy(1.5f, requireLineOfSight: true) && followEnemy))
				{
					Plugin.logger.LogDebug((object)"Start Targeting");
					SwitchToBehaviourStateCustom(State.Following);
				}
				break;
			case 1:
			{
				if (healingBuffTime > 0f)
				{
					base.agent.speed = 10f;
				}
				else
				{
					base.agent.speed = 5f;
				}
				base.agent.stoppingDistance = followingRange;
				base.agent.acceleration = 10f;
				if (!tamed && !TargetClosestEntity())
				{
					Plugin.logger.LogDebug((object)"Stop Targeting");
					SwitchToBehaviourStateCustom(State.Roaming);
					break;
				}
				if (tamed && (Object)(object)tamedByPlayer != (Object)null && base.isOutside == tamedByPlayer.isInsideFactory)
				{
					Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)tamedByPlayer).transform.position, default(NavMeshHit), 5f, -1);
					base.agent.Warp(navMeshPosition);
					SetEnemyOutsideClientRpc(!tamedByPlayer.isInsideFactory);
				}
				if (MoveToSweetsIfDroppedByPlayer())
				{
					EatSweetsIfClose();
					break;
				}
				bool flag = IsNearbyPlayerEmoting(followingRange);
				if (dancing != flag)
				{
					DoAnimationClientRpc(danceAnim, flag);
					dancing = flag;
				}
				FollowTarget();
				break;
			}
			case 2:
				base.agent.speed = 20f;
				base.agent.stoppingDistance = 0f;
				base.agent.acceleration = 15f;
				if (!MoveInFrontOfTurret())
				{
					Plugin.logger.LogDebug((object)"Stop Blocking");
					SwitchToBehaviourStateCustom(State.Following);
					blockedTurret = null;
					DoAnimationClientRpc(stretchAnim, value: false);
				}
				break;
			case 3:
				base.agent.speed = 10f;
				base.agent.stoppingDistance = huggingRange;
				base.agent.acceleration = 50f;
				MoveToHealTarget();
				break;
			case 4:
				base.agent.speed = 20f;
				base.agent.stoppingDistance = 0f;
				base.agent.acceleration = 25f;
				if (hyperTime <= 0f)
				{
					candyEaten = 0;
					SwitchToBehaviourStateCustom(State.Roaming);
					DoAnimationClientRpc(hyperAnim, value: false);
				}
				break;
			default:
				Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
				break;
			}
		}

		private bool BabyIsCryingNearby()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			CaveDwellerAI val = (from x in RoundManager.Instance.SpawnedEnemies.OfType<CaveDwellerAI>()
				where x.babyCrying && Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < x.babyCryingAudio.maxDistance
				select x).FirstOrDefault();
			if ((Object)(object)val != (Object)null)
			{
				base.agent.speed = 10f;
				base.agent.stoppingDistance = 0f;
				base.agent.acceleration = 50f;
				targetEnemy = (EnemyAI?)(object)val;
				return ((EnemyAI)this).SetDestinationToPosition(((Component)val).transform.position, true);
			}
			return false;
		}

		public void SetTamed(PlayerControllerB playerTamedTo)
		{
			tamed = true;
			tamedByPlayer = playerTamedTo;
			base.targetPlayer = playerTamedTo;
			if (playerTamedTo.playerSteamId == snowySteamId)
			{
				SetScanNodeClientRpc("Following my creator");
			}
			else if (playerTamedTo.playerSteamId == lizzieSteamId)
			{
				SetScanNodeClientRpc("Following my best friend lizzie <3");
			}
			else
			{
				SetScanNodeClientRpc("Following " + playerTamedTo.playerUsername);
			}
			SwitchToBehaviourStateCustom(State.Following);
		}

		public void SetOutsideOrInside()
		{
			//IL_000c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			GameObject closestToPosition = Utils.GetClosestToPosition<GameObject>((IEnumerable<GameObject>)Utils.outsideAINodes, ((Component)this).transform.position, (Func<GameObject, Vector3>)((GameObject x) => x.transform.position), (IEnumerable<GameObject>)null);
			GameObject closestToPosition2 = Utils.GetClosestToPosition<GameObject>((IEnumerable<GameObject>)Utils.insideAINodes, ((Component)this).transform.position, (Func<GameObject, Vector3>)((GameObject x) => x.transform.position), (IEnumerable<GameObject>)null);
			if (Vector3.Distance(((Component)this).transform.position, closestToPosition.transform.position) < Vector3.Distance(((Component)this).transform.position, closestToPosition2.transform.position))
			{
				SetEnemyOutsideClientRpc(value: true);
			}
		}

		public void GetInJar()
		{
			Plugin.logger.LogDebug((object)"GetInJar");
			GetInJarServerRpc(Plugin.localPlayer.actualClientId);
		}

		public bool TargetClosestEntity()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer != (Object)null && followPlayer && ((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true) && (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < playerDetectionRange * 2f || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
			{
				return true;
			}
			if ((Object)(object)targetEnemy != (Object)null && followEnemy && TargetClosestEnemy(5f) && (Vector3.Distance(((Component)this).transform.position, ((Component)targetEnemy).transform.position) < enemyDetectionRange * 2f || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)targetEnemy).transform.position, 45f, 60, -1f, (Transform)null)))
			{
				return true;
			}
			return false;
		}

		public bool TargetClosestEnemy(float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f)
		{
			//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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			EnemyAI val = targetEnemy;
			targetEnemy = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (!spawnedEnemy.isEnemyDead && !(((Object)spawnedEnemy.enemyType).name == "SCP999Enemy") && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)spawnedEnemy).transform.position, false, false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)spawnedEnemy).transform.position, viewWidth, 40, -1f, (Transform)null)))
				{
					base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position);
					if (base.tempDist < base.mostOptimalDistance)
					{
						base.mostOptimalDistance = base.tempDist;
						targetEnemy = spawnedEnemy;
					}
				}
			}
			if ((Object)(object)targetEnemy != (Object)null && bufferDistance > 0f && (Object)(object)val != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position)) < bufferDistance)
			{
				targetEnemy = val;
			}
			return (Object)(object)targetEnemy != (Object)null;
		}

		private void FollowTarget()
		{
			//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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position;
			if (tamed)
			{
				position = ((Component)tamedByPlayer).transform.position;
			}
			else if ((Object)(object)base.targetPlayer != (Object)null)
			{
				position = ((Component)base.targetPlayer).transform.position;
			}
			else
			{
				if (!((Object)(object)targetEnemy != (Object)null))
				{
					return;
				}
				position = ((Component)targetEnemy).transform.position;
			}
			((EnemyAI)this).SetDestinationToPosition(position, false);
		}

		private void SetTarget(PlayerControllerB player)
		{
			base.targetPlayer = player;
			targetEnemy = null;
		}

		private void SetTarget(EnemyAI enemy)
		{
			base.targetPlayer = null;
			targetEnemy = enemy;
		}

		private void SetTargetNull()
		{
			base.targetPlayer = null;
			targetEnemy = null;
		}

		private void MoveToHealTarget()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				if (base.targetPlayer.health >= 100 || base.targetPlayer.isPlayerDead)
				{
					SwitchToBehaviourStateCustom(State.Following);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
			}
			else if ((Object)(object)targetEnemy != (Object)null)
			{
				int enemyHP = targetEnemy.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
				if (targetEnemy.enemyHP >= enemyHP || targetEnemy.isEnemyDead)
				{
					SwitchToBehaviourStateCustom(State.Following);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)targetEnemy).transform.position, false);
				}
			}
		}

		private bool MoveInFrontOfTurret()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)blockedTurret != (Object)null && ((int)blockedTurret.turretMode == 2 || (int)blockedTurret.turretMode == 1))
			{
				Vector3 val = Vector3.Lerp(((Component)base.targetPlayer).transform.position, ((Component)blockedTurret).transform.position, 0.5f);
				((EnemyAI)this).SetDestinationToPosition(val, false);
				if (Vector3.Distance(((Component)this).transform.position, val) < 1f && timeSinceBlockSFX > 0.5f)
				{
					Plugin.logger.LogDebug((object)"Playing hitSFX");
					int index = Random.Range(0, hitSFXList.Count - 1);
					base.creatureSFX.PlayOneShot(hitSFXList[index], 1f);
					timeSinceBlockSFX = 0f;
				}
				return true;
			}
			return false;
		}

		public bool MoveToSweetsIfDroppedByPlayer()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (GameObject item in HoarderBugAI.grabbableObjectsInMap.ToList())
				{
					if ((Object)(object)item == (Object)null)
					{
						HoarderBugAI.grabbableObjectsInMap.Remove(item);
						continue;
					}
					GrabbableObject componentInChildren = item.GetComponentInChildren<GrabbableObject>();
					if ((Object)(object)componentInChildren == (Object)null || !(Vector3.Distance(((Component)this).transform.position, ((Component)componentInChildren).transform.position) <= followingRange) || !Plugin.Sweets.Contains(componentInChildren.itemProperties.itemName) || !componentInChildren.hasBeenHeld || componentInChildren.heldByPlayerOnServer)
					{
						continue;
					}
					Plugin.logger.LogDebug((object)("Moving to item: " + componentInChildren.itemProperties.itemName));
					base.agent.stoppingDistance = 0f;
					((EnemyAI)this).SetDestinationToPosition(((Component)componentInChildren).transform.position, false);
					return true;
				}
				return false;
			}
			catch
			{
				return false;
			}
		}

		public void EatSweetsIfClose()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				foreach (GameObject item in HoarderBugAI.grabbableObjectsInMap.ToList())
				{
					if ((Object)(object)item == (Object)null)
					{
						HoarderBugAI.grabbableObjectsInMap.Remove(item);
						continue;
					}
					GrabbableObject componentInChildren = item.GetComponentInChildren<GrabbableObject>();
					if (!((Object)(object)componentInChildren == (Object)null) && Vector3.Distance(((Component)this).transform.position, ((Component)componentInChildren).transform.position) < 1f && Plugin.Sweets.Contains(componentInChildren.itemProperties.itemName))
					{
						Plugin.logger.LogDebug((object)("Eating item: " + componentInChildren.itemProperties.itemName));
						if (componentInChildren.itemProperties.itemName == "SCP-559")
						{
							ChangeSizeClientRpc(((Component)this).transform.localScale.y / 2f);
						}
						if (componentInChildren.itemProperties.itemName == "Black Candy")
						{
							MakeHyper(60f);
						}
						if (componentInChildren.itemProperties.itemName == "Cake")
						{
							healingBuffTime += 10f;
						}
						((NetworkBehaviour)componentInChildren).NetworkObject.Despawn(true);
						candyEaten++;
						Plugin.logger.LogDebug((object)("Candy eaten: " + candyEaten));
						healingBuffTime += 20f;
						if (candyEaten >= maxCandy)
						{
							MakeHyper(30f);
						}
					}
				}
			}
			catch
			{
			}
		}

		public void MakeHyper(float duration)
		{
			hyperTime += duration;
			SwitchToBehaviourStateCustom(State.Hyper);
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
		}

		public override void ReachedNodeInSearch()
		{
			((EnemyAI)this).ReachedNodeInSearch();
			int index = Random.Range(0, roamSFXList.Count - 1);
			base.creatureVoice.PlayOneShot(roamSFXList[index], 1f);
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = MeetsStandardPlayerCollisionConditions(other);
			if ((Object)(object)val != (Object)null)
			{
				HealPlayer(val);
				Hug();
			}
		}

		public PlayerControllerB MeetsStandardPlayerCollisionConditions(Collider other, bool inKillAnimation = false, bool overrideIsInsideFactoryCheck = false)
		{
			if (base.isEnemyDead)
			{
				return null;
			}
			if (!base.ventAnimationFinished)
			{
				return null;
			}
			if (inKillAnimation)
			{
				return null;
			}
			if (base.stunNormalizedTimer >= 0f)
			{
				return null;
			}
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component == (Object)null)
			{
				return null;
			}
			if (!((EnemyAI)this).PlayerIsTargetable(component, false, overrideIsInsideFactoryCheck, true))
			{
				Debug.Log((object)"Player is not targetable");
				return null;
			}
			return component;
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null)
		{
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			if ((Object)(object)collidedEnemy != (Object)null && ((Object)collidedEnemy.enemyType).name != "SCP999Enemy")
			{
				HealEnemy(collidedEnemy);
				Hug();
			}
		}

		public override void HitEnemy(int force = 0, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			int index = Random.Range(0, hitSFXList.Count - 1);
			base.creatureVoice.PlayOneShot(hurtSFXList[index], 1f);
		}

		public bool IsNearbyPlayerEmoting(float distance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < distance && val.performingEmote)
				{
					return true;
				}
			}
			return false;
		}

		public void Hug()
		{
			if (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 3)
			{
				hugTime = 1f;
				if (timeSinceHugSFX > 5f)
				{
					int index = Random.Range(0, hugSFXList.Count - 1);
					base.creatureVoice.PlayOneShot(hugSFXList[index], 1f);
					timeSinceHugSFX = 0f;
				}
			}
		}

		public void HealPlayer(PlayerControllerB player)
		{
			if (!((Object)(object)player != (Object)null) || !(timeSinceHealing > 1f))
			{
				return;
			}
			timeSinceHealing = 0f;
			if (player.health < 100)
			{
				int num = ((!(healingBuffTime > 0f)) ? (player.health + playerHealAmount) : (player.health + playerHealAmount * 2));
				if (num > 100)
				{
					num = 100;
				}
				player.health = num;
				HUDManager.Instance.UpdateHealthUI(player.health, false);
			}
			player.insanityLevel -= insanityDecreaseRate;
			player.JumpToFearLevel(0f, false);
		}

		public void HealEnemy(EnemyAI enemyToHeal)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (timeSinceHealing > 1f)
			{
				timeSinceHealing = 0f;
				int enemyHP = enemyToHeal.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
				if (enemyToHeal.enemyHP < enemyHP)
				{
					if (healingBuffTime > 0f)
					{
						enemyToHeal.enemyHP += enemyHealAmount * 2;
					}
					else
					{
						enemyToHeal.enemyHP += enemyHealAmount;
					}
				}
			}
			if (!(enemyToHeal is CaveDwellerAI))
			{
				return;
			}
			CaveDwellerAI val = (CaveDwellerAI)enemyToHeal;
			if (val.babyCrying)
			{
				val.rockBabyTimer += Time.deltaTime * 0.4f;
				if (val.rockBabyTimer > 1f)
				{
					val.SetCryingLocalClient(false);
					val.SetBabyCryingServerRpc(false);
				}
			}
		}

		public void EnemyTookDamage(EnemyAI enemy)
		{
			if (!(hyperTime > 0f) && !tamed)
			{
				targetEnemy = enemy;
				SwitchToBehaviourStateCustom(State.Healing);
			}
		}

		[ClientRpc]
		public void SetScanNodeClientRpc(string subText)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3126157941u, val, (RpcDelivery)0);
				bool flag = subText != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(subText, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3126157941u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				ScanNode.subText = subText;
			}
		}

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

		[ServerRpc(RequireOwnership = false)]
		private void DoAnimationServerRpc(int id, bool value)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1961172741u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1961172741u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (Plugin.IsServerOrHost)
				{
					DoAnimationClientRpc(id, value);
				}
			}
		}

		[ClientRpc]
		private void DoAnimationClientRpc(int id, bool value)
		{
			//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)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1169953250u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1169953250u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.creatureAnimator.SetBool(id, value);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void GetInJarServerRpc(ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4103771736u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4103771736u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					PlayerControllerB val3 = Plugin.PlayerFromId(clientId);
					((Component)val3.currentlyHeldObjectServer).GetComponent<ContainmentJarBehavior>().ChangeJarContentsClientRpc(ContainmentJarBehavior.Contents.SCP999);
					RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)this).NetworkObject);
				}
			}
		}

		[ClientRpc]
		private void SetEnemyOutsideClientRpc(bool value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3990597999u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3990597999u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((EnemyAI)this).SetEnemyOutside(value);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayerTookDamageServerRpc(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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(771765929u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 771765929u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			PlayerControllerB val3 = Plugin.PlayerFromId(clientId);
			if ((Object)(object)val3 == (Object)null || (tamed && (Object)(object)val3 != (Object)(object)base.targetPlayer))
			{
				return;
			}
			float num = 2f - (float)val3.health / 100f;
			float num2 = playerDetectionRange * num;
			if (Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) <= num2)
			{
				SetTarget(val3);
				if (!(hyperTime > 0f))
				{
					SwitchToBehaviourStateCustom(State.Healing);
				}
			}
		}

		[ClientRpc]
		private void ChangeSizeClientRpc(float size)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(353376331u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 353376331u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Plugin.logger.LogDebug((object)("Changing size to " + size));
					((Component)this).transform.localScale = new Vector3(size, size, size);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void BlockTurretFireServerRpc(NetworkObjectReference netObjRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1637096969u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1637096969u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkBehaviour)this).IsServer && ((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
				{
					blockedTurret = ((Component)val3).GetComponentInChildren<Turret>();
					SwitchToBehaviourStateCustom(State.Blocking);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3126157941u, new RpcReceiveHandler(__rpc_handler_3126157941), "SetScanNodeClientRpc");
			((NetworkBehaviour)this).__registerRpc(3877894376u, new RpcReceiveHandler(__rpc_handler_3877894376), "SetTamedPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(1961172741u, new RpcReceiveHandler(__rpc_handler_1961172741), "DoAnimationServerRpc");
			((NetworkBehaviour)this).__registerRpc(1169953250u, new RpcReceiveHandler(__rpc_handler_1169953250), "DoAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(4103771736u, new RpcReceiveHandler(__rpc_handler_4103771736), "GetInJarServerRpc");
			((NetworkBehaviour)this).__registerRpc(3990597999u, new RpcReceiveHandler(__rpc_handler_3990597999), "SetEnemyOutsideClientRpc");
			((NetworkBehaviour)this).__registerRpc(771765929u, new RpcReceiveHandler(__rpc_handler_771765929), "PlayerTookDamageServerRpc");
			((NetworkBehaviour)this).__registerRpc(353376331u, new RpcReceiveHandler(__rpc_handler_353376331), "ChangeSizeClientRpc");
			((NetworkBehaviour)this).__registerRpc(1637096969u, new RpcReceiveHandler(__rpc_handler_1637096969), "BlockTurretFireServerRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3126157941(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_0061: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string scanNodeClientRpc = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref scanNodeClientRpc, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).SetScanNodeClientRpc(scanNodeClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3877894376(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 tamedPlayerServerRpc = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref tamedPlayerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).SetTamedPlayerServerRpc(tamedPlayerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1961172741(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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int id = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).DoAnimationServerRpc(id, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1169953250(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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int id = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).DoAnimationClientRpc(id, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4103771736(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;
				((SCP999AI)(object)target).GetInJarServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3990597999(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool enemyOutsideClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enemyOutsideClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).SetEnemyOutsideClientRpc(enemyOutsideClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_771765929(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;
				((SCP999AI)(object)target).PlayerTookDamageServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_353376331(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float num = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref num, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).ChangeSizeClientRpc(num);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1637096969(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP999AI)(object)target).BlockTurretFireServerRpc(netObjRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP999AI";
		}
	}
	[HarmonyPatch]
	public class TESTING : MonoBehaviour
	{
		public static bool localPlayerImmune = false;

		public static string currentAnim = "";

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

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.localPlayer.playerSteamId != 76561198253760639L)
			{
				return;
			}
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			Plugin.logger.LogDebug((object)text);
			switch (array[0])
			{
			case "/spawn999":
			{
				SpawnableEnemyWithRarity item = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SCP999Enemy").FirstOrDefault();
				int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(item);
				RoundManager.Instance.SpawnEnemyOnServer(((Component)Plugin.localPlayer).transform.position + ((Component)Plugin.localPlayer).transform.forward * 2f, Quaternion.identity.y, num);
				break;
			}
			case "/despawn999":
			{
				SCP999AI sCP999AI = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
				if (!((Object)(object)sCP999AI == (Object)null))
				{
					RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)sCP999AI).NetworkObject);
				}
				break;
			}
			case "/tame":
			{
				SCP999AI sCP999AI2 = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
				if (!((Object)(object)sCP999AI2 == (Object)null))
				{
					sCP999AI2.SetTamedPlayerServerRpc(Plugin.localPlayer.actualClientId);
				}
				break;
			}
			case "/refresh":
				if (Plugin.IsServerOrHost)
				{
					RoundManager.Instance.RefreshEnemiesList();
					HoarderBugAI.RefreshGrabbableObjectsInMapList();
				}
				break;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ProjectSCP.SCP999";

		public const string PLUGIN_NAME = "SCP999";

		public const string PLUGIN_VERSION = "2.3.1";
	}
}
namespace SCP999.Patches
{
	[HarmonyPatch(typeof(BlobAI))]
	internal class BlobAIPatch
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch("DoAIInterval")]
		public static void DoAIIntervalPostfix(BlobAI __instance)
		{
			//IL_002d: 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)
			try
			{
				if (!Plugin.IsServerOrHost)
				{
					return;
				}
				foreach (ContainmentJarBehavior item in HoarderBugAI.grabbableObjectsInMap.OfType<ContainmentJarBehavior>())
				{
					if (Vector3.Distance(((Component)__instance).transform.position, ((Component)item).transform.position) < 2f)
					{
						item.ChangeJarContentsClientRpc(ContainmentJarBehavior.Contents.Blob);
						RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)__instance).NetworkObject);
						break;
					}
				}
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyAIPatch
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch("HitEnemy")]
		private static void HitEnemyPostfix(EnemyAI __instance)
		{
			//IL_00c3: 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)
			try
			{
				if (!Plugin.IsServerOrHost || ((Object)__instance.enemyType).name == "SCP999Enemy")
				{
					return;
				}
				int enemyHP = __instance.enemyType.enemyPrefab.GetComponent<EnemyAI>().enemyHP;
				if (enemyHP <= 0 || __instance.isEnemyDead)
				{
					return;
				}
				logger.LogDebug((object)$"Max health of {((Object)__instance.enemyType).name} is {enemyHP}");
				float num = 2 - __instance.enemyHP / enemyHP;
				float num2 = SCP999AI.enemyDetectionRange * num;
				foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
				{
					if (Vector3.Distance(((Component)item).transform.position, ((Component)__instance).transform.position) <= num2)
					{
						logger.LogDebug((object)(__instance.enemyType.enemyName + " took damage"));
						item.EnemyTookDamage(__instance);
						break;
					}
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayer")]
		private static void DamagePlayerPostfix(PlayerControllerB __instance)
		{
			try
			{
				if (StartOfRound.Instance.inShipPhase)
				{
					return;
				}
				foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
				{
					if (((EnemyAI)item).currentBehaviourStateIndex == 2)
					{
						continue;
					}
					item.PlayerTookDamageServerRpc(__instance.actualClientId);
					break;
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("DamagePlayer")]
		private static bool DamagePlayerPrefix(PlayerControllerB __instance, CauseOfDeath causeOfDeath)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			try
			{
				if ((int)causeOfDeath == 7)
				{
					foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
					{
						if ((Object)(object)((EnemyAI)item).targetPlayer != (Object)null && (Object)(object)__instance == (Object)(object)((EnemyAI)item).targetPlayer && ((EnemyAI)item).currentBehaviourStateIndex == 2)
						{
							return false;
						}
					}
				}
				return true;
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
				return true;
			}
		}
	}
	[HarmonyPatch]
	internal class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.logger;

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

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.localPlayer.playerSteamId != 76561198253760639L)
			{
				return;
			}
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			logger.LogDebug((object)text);
			switch (array[0])
			{
			case "/spawn999":
			{
				SpawnableEnemyWithRarity item = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "SCP999Enemy").FirstOrDefault();
				int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(item);
				RoundManager.Instance.SpawnEnemyOnServer(((Component)Plugin.localPlayer).transform.position + ((Component)Plugin.localPlayer).transform.forward * 2f, Quaternion.identity.y, num);
				break;
			}
			case "/despawn999":
			{
				SCP999AI sCP999AI = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
				if (!((Object)(object)sCP999AI == (Object)null))
				{
					RoundManager.Instance.DespawnEnemyOnServer(((NetworkBehaviour)sCP999AI).NetworkObject);
				}
				break;
			}
			case "/tame":
			{
				SCP999AI sCP999AI2 = RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>().FirstOrDefault();
				if (!((Object)(object)sCP999AI2 == (Object)null))
				{
					sCP999AI2.SetTamedPlayerServerRpc(Plugin.localPlayer.actualClientId);
				}
				break;
			}
			case "/refresh":
				if (Plugin.IsServerOrHost)
				{
					RoundManager.Instance.RefreshEnemiesList();
					HoarderBugAI.RefreshGrabbableObjectsInMapList();
				}
				break;
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	internal class TurretPatch
	{
		private static ManualLogSource logger = Plugin.logger;

		[HarmonyPostfix]
		[HarmonyPatch("SwitchTurretMode")]
		private static void SwitchTurretModePostfix(Turret __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) || (int)__instance.turretMode != 1)
				{
					return;
				}
				PlayerControllerB targetPlayerWithRotation = __instance.targetPlayerWithRotation;
				foreach (SCP999AI item in RoundManager.Instance.SpawnedEnemies.OfType<SCP999AI>())
				{
					if ((Object)(object)((EnemyAI)item).targetPlayer != (Object)null && (Object)(object)((EnemyAI)item).targetPlayer == (Object)(object)targetPlayerWithRotation && ((EnemyAI)item).currentBehaviourStateIndex == 1)
					{
						item.BlockTurretFireServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject));
						break;
					}
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace ProjectSCP.SCP999.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}