Decompiled source of SCP956 v2.0.4

BepInEx/plugins/SCP956/Snowlance.SCP956.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SCP956.Items;
using SCP956.Items.Cake;
using SCP956.Items.CandyBag;
using Snowlance.SCP956.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Snowlance.SCP956")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.0.4.0")]
[assembly: AssemblyInformationalVersion("2.0.4+956d99aa29df543111ebfc1e7a647182ecf67fa6")]
[assembly: AssemblyProduct("SCP956")]
[assembly: AssemblyTitle("Snowlance.SCP956")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 SCP956
{
	public class NetworkHandler : NetworkBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static NetworkHandler Instance { get; private set; }

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]];
		}

		public override void OnNetworkSpawn()
		{
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				NetworkHandler instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
				logger.LogDebug((object)"Despawned network object");
			}
			Instance = this;
			logger.LogDebug((object)"set instance to this");
			((NetworkBehaviour)this).OnNetworkSpawn();
			logger.LogDebug((object)"base.OnNetworkSpawn");
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnPinataServerRpc(Vector3 pos = default(Vector3))
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1532741232u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1532741232u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer) || !Plugin.configEnablePinata.Value)
			{
				return;
			}
			SpawnableEnemyWithRarity val3 = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => ((Object)x.enemyType).name == "Pinata").FirstOrDefault();
			if (val3 == null)
			{
				logger.LogError((object)"Pinata enemy not found");
				return;
			}
			int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(val3);
			Vector3 val4 = pos;
			Vector3 val5 = default(Vector3);
			if (val4 != val5)
			{
				ManualLogSource obj = logger;
				val5 = pos;
				obj.LogDebug((object)("Spawning SCP-956 at: " + ((object)(Vector3)(ref val5)).ToString()));
				RoundManager.Instance.SpawnEnemyOnServer(pos, Quaternion.identity.y, num);
				return;
			}
			List<EnemyVent> list = RoundManager.Instance.allEnemyVents.ToList();
			logger.LogDebug((object)("Found vents: " + list.Count));
			EnemyVent val6 = list[Random.Range(0, list.Count - 1)];
			logger.LogDebug((object)("Selected vent: " + (object)val6));
			val6.enemyTypeIndex = num;
			val6.enemyType = val3.enemyType;
			logger.LogDebug((object)("Updated vent with enemy type index: " + val6.enemyTypeIndex + " and enemy type: " + (object)val6.enemyType));
			RoundManager.Instance.SpawnEnemyFromVent(val6);
			logger.LogDebug((object)"Spawning SCP-956 from vent");
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChangePlayerSizeServerRpc(ulong clientId, 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_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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2418417816u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2418417816u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
			{
				PlayerControllerB item = PlayerFromId(clientId);
				if (size < 1f)
				{
					SCP956AI.YoungPlayers.Add(item);
				}
				else
				{
					SCP956AI.YoungPlayers.Remove(item);
				}
				ChangePlayerSizeClientRpc(clientId, size);
			}
		}

		[ClientRpc]
		private void ChangePlayerSizeClientRpc(ulong clientId, 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_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_00f4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(332580271u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 332580271u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayerControllerB val3 = PlayerFromId(clientId);
				val3.thisPlayerBody.localScale = new Vector3(size, size, size);
				if (size < 1f)
				{
					val3.movementSpeed = 5f;
					val3.sprintTime = 20f;
				}
				else
				{
					val3.movementSpeed = 4.6f;
					val3.sprintTime = 11f;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnItemServerRpc(ulong clientId, string name, int newValue = 0, Vector3 pos = default(Vector3), Quaternion rot = default(Quaternion), bool grabItem = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3438062557u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				BytePacker.WriteValueBitPacked(val2, newValue);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref grabItem, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3438062557u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string name2 = name;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				Item val3 = StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => ((Object)x).name == name2).FirstOrDefault();
				logger.LogDebug((object)"Got item");
				GameObject val4 = Object.Instantiate<GameObject>(val3.spawnPrefab, pos, rot, StartOfRound.Instance.propsContainer);
				val4.GetComponent<GrabbableObject>().fallTime = 0f;
				if (newValue != 0)
				{
					val4.GetComponent<GrabbableObject>().SetScrapValue(newValue);
				}
				val4.GetComponent<NetworkObject>().Spawn(false);
				if (grabItem)
				{
					GrabObjectClientRpc(val4.GetComponent<NetworkObject>().NetworkObjectId, clientId);
				}
			}
		}

		[ClientRpc]
		private void GrabObjectClientRpc(ulong id, 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3281310889u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3281310889u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && clientId == Plugin.localPlayer.actualClientId && Plugin.localPlayer.ItemSlots.Where((GrabbableObject x) => (Object)(object)x == (Object)null).Any())
				{
					GrabbableObject component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[id]).gameObject.GetComponent<GrabbableObject>();
					Plugin.localPlayer.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject));
					component.parentObject = Plugin.localPlayer.localItemHolder;
					component.GrabItemOnClient();
					logger.LogDebug((object)"Grabbed item");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DespawnDeadPlayerServerRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1311259098u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1311259098u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
			{
				PlayerControllerB val3 = PlayerFromId(clientId);
				if (!((Object)(object)val3 == (Object)null))
				{
					Object.Destroy((Object)(object)((Component)val3.deadBody).gameObject);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GetAgeServerRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1689080413u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1689080413u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					int age = Random.Range(Plugin.configMinAge.Value, Plugin.configMaxAge.Value + 1);
					SendAgeClientRpc(clientId, age);
				}
			}
		}

		[ClientRpc]
		private void SendAgeClientRpc(ulong clientId, int age)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3044162909u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					BytePacker.WriteValueBitPacked(val2, age);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3044162909u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && Plugin.localPlayer.actualClientId == clientId)
				{
					Plugin.PlayerOriginalAge = age;
					Plugin.ChangePlayerAge(age);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPlayerArmsVisibleServerRpc(ulong clientId, bool visible)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(502810097u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref visible, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 502810097u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					SetPlayerArmsVisibleClientRpc(clientId, visible);
				}
			}
		}

		[ClientRpc]
		private void SetPlayerArmsVisibleClientRpc(ulong clientId, bool visible)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(125713303u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref visible, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 125713303u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayerControllerB val3 = PlayerFromId(clientId);
					((Renderer)val3.thisPlayerModelArms).enabled = visible;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_NetworkHandler()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1532741232u, new RpcReceiveHandler(__rpc_handler_1532741232));
			NetworkManager.__rpc_func_table.Add(2418417816u, new RpcReceiveHandler(__rpc_handler_2418417816));
			NetworkManager.__rpc_func_table.Add(332580271u, new RpcReceiveHandler(__rpc_handler_332580271));
			NetworkManager.__rpc_func_table.Add(3438062557u, new RpcReceiveHandler(__rpc_handler_3438062557));
			NetworkManager.__rpc_func_table.Add(3281310889u, new RpcReceiveHandler(__rpc_handler_3281310889));
			NetworkManager.__rpc_func_table.Add(1311259098u, new RpcReceiveHandler(__rpc_handler_1311259098));
			NetworkManager.__rpc_func_table.Add(1689080413u, new RpcReceiveHandler(__rpc_handler_1689080413));
			NetworkManager.__rpc_func_table.Add(3044162909u, new RpcReceiveHandler(__rpc_handler_3044162909));
			NetworkManager.__rpc_func_table.Add(502810097u, new RpcReceiveHandler(__rpc_handler_502810097));
			NetworkManager.__rpc_func_table.Add(125713303u, new RpcReceiveHandler(__rpc_handler_125713303));
		}

		private static void __rpc_handler_1532741232(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SpawnPinataServerRpc(pos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2418417816(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).ChangePlayerSizeServerRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_332580271(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				float size = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).ChangePlayerSizeClientRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3438062557(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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				int newValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				Quaternion rot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
				bool grabItem = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref grabItem, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SpawnItemServerRpc(clientId, name, newValue, pos, rot, grabItem);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3281310889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong id = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).GrabObjectClientRpc(id, clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1311259098(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;
				((NetworkHandler)(object)target).DespawnDeadPlayerServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1689080413(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;
				((NetworkHandler)(object)target).GetAgeServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3044162909(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0061: 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);
				int age = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref age);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).SendAgeClientRpc(clientId, age);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_502810097(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool visible = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref visible, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandler)(object)target).SetPlayerArmsVisibleServerRpc(clientId, visible);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_125713303(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool visible = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref visible, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).SetPlayerArmsVisibleClientRpc(clientId, visible);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NetworkHandler";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			logger.LogDebug((object)"Initializing network prefab...");
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)Plugin.ModAssets.LoadAsset("Assets/ModAssets/Pinata/NetworkHandlerSCP956.prefab");
				logger.LogDebug((object)"Got networkPrefab");
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
				logger.LogDebug((object)"Added networkPrefab");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(true);
			}
		}
	}
	[BepInPlugin("Snowlance.SCP956", "SCP956", "2.0.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

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

		public static List<string> CandyNames;

		public static AssetBundle? ModAssets;

		public static AudioClip? CakeDisappearsfx;

		public static bool localPlayerFrozen;

		public static int PlayerAge = 13;

		public static int PlayerOriginalAge;

		public static ConfigEntry<bool> configEnablePinata;

		public static ConfigEntry<string> config956LevelRarities;

		public static ConfigEntry<string> config956CustomLevelRarities;

		public static ConfigEntry<bool> configTargetAllPlayers;

		public static ConfigEntry<float> config956ActivationRadius;

		public static ConfigEntry<float> configWarningSoundVolume;

		public static ConfigEntry<int> configHeadbuttDamage;

		public static ConfigEntry<float> configMaxTimeToKillPlayer;

		public static ConfigEntry<int> config956TeleportTime;

		public static ConfigEntry<int> config956TeleportRange;

		public static ConfigEntry<bool> config956TeleportNearPlayers;

		public static ConfigEntry<int> configMinAge;

		public static ConfigEntry<int> configMaxAge;

		public static ConfigEntry<bool> configRandomizeAgeAfterRound;

		public static ConfigEntry<int> configCandyMinSpawn;

		public static ConfigEntry<int> configCandyMaxSpawn;

		public static ConfigEntry<bool> configEnableCandyBag;

		public static ConfigEntry<bool> configEnable559;

		public static ConfigEntry<string> config559LevelRarities;

		public static ConfigEntry<string> config559CustomLevelRarities;

		public static ConfigEntry<int> config559MinValue;

		public static ConfigEntry<int> config559MaxValue;

		public static ConfigEntry<int> config559HealAmount;

		public static ConfigEntry<bool> config559CakeReversesAge;

		public static ConfigEntry<bool> config559ReversesAgeReblow;

		public static ConfigEntry<bool> configEnable330;

		public static ConfigEntry<string> config330LevelRarities;

		public static ConfigEntry<string> config330CustomLevelRarities;

		public static ConfigEntry<bool> config330ShowNoArmsWhenHandsCut;

		public static ConfigEntry<bool> config330AllowPickingUpWhenCrouched;

		public static ConfigEntry<bool> configEnable458;

		public static ConfigEntry<string> config458LevelRarities;

		public static ConfigEntry<string> config458CustomLevelRarities;

		public static ConfigEntry<int> config458MinValue;

		public static ConfigEntry<int> config458MaxValue;

		public static ConfigEntry<float> config458PizzaFillAmount;

		public static ConfigEntry<float> config458MetabolismRate;

		public static ConfigEntry<int> config458HealAmount;

		public static ConfigEntry<float> config458SprintMultiplier;

		public static ConfigEntry<float> config458CrouchMultiplier;

		public static ConfigEntry<float> config458DrainRate;

		public static ConfigEntry<bool> configEnableCustomStatusEffects;

		public static ConfigEntry<string> configCandyPurpleEffects;

		public static ConfigEntry<string> configCandyRedEffects;

		public static ConfigEntry<string> configCandyYellowEffects;

		public static ConfigEntry<string> configCandyGreenEffects;

		public static ConfigEntry<string> configCandyBlueEffects;

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

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

		public static bool localPlayerIsYoung => PlayerAge < 12;

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			configEnablePinata = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Enable SCP-956", true, "Set to false to disable spawning SCP-956.");
			config956LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-956 Rarities", "Level Rarities", "ExperimentationLevel:10, AssuranceLevel:10, VowLevel:10, OffenseLevel:30, AdamanceLevel:50, MarchLevel:50, RendLevel:50, DineLevel:50, TitanLevel:80, ArtificeLevel:80, EmbrionLevel:100, Modded:30", "Rarities for each level. See default for formatting.");
			config956CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-956 Rarities", "Custom Level Rarities", "Secret LabsLevel:150", "Rarities for modded levels. Same formatting as level rarities.");
			configTargetAllPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Target All Players", false, "Set to true if you want 956 to target all players regardless of conditions.");
			config956ActivationRadius = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-956", "Activation Radius", 10f, "The radius in which SCP-956 will target players that meet the required conditions.");
			configWarningSoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-956", "Warning Sound Volume", 1f, "The volume of SCP-956's warning sound. Range from 0 to 1");
			configHeadbuttDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Headbutt Damage", 50, "The amount of damage SCP-956 will do when using his headbutt attack.");
			configMaxTimeToKillPlayer = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-956", "Max Time To Kill Player", 60f, "If SCP-956 doesnt kill a player in this amount of time, the player will die. (in lore people exposed to SCP-956 and moved away die from candy growing in their guts)");
			config956TeleportTime = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Teleport Time", 60, "Time in seconds it takes for SCP-956 to teleport somewhere else when nobody is looking at it.");
			config956TeleportRange = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-956", "Teleport Range", 300, "Max range around SCP-956 in which he will teleport.");
			config956TeleportNearPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-956", "Teleport Near Players", false, "Should SCP-956 teleport around players?");
			configMinAge = ((BaseUnityPlugin)this).Config.Bind<int>("Player Age", "Min Age", 18, "The minimum age of a player that is decided at the beginning of a game.");
			configMaxAge = ((BaseUnityPlugin)this).Config.Bind<int>("Player Age", "Max Age", 70, "The maximum age of a player that is decided at the beginning of a game.");
			configRandomizeAgeAfterRound = ((BaseUnityPlugin)this).Config.Bind<bool>("Player Age", "Randomize Age After Round", false, "Should the age of players be randomized after each round?");
			configCandyMinSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("Candy", "Min Candy Spawn", 5, "The minimum amount of candy to spawn when player dies to SCP-956");
			configCandyMaxSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("Candy", "Max Candy Spawn", 30, "The maximum amount of candy to spawn when player dies to SCP-956");
			configEnableCandyBag = ((BaseUnityPlugin)this).Config.Bind<bool>("Candy", "Enable Candy Bag", true, "Makes it so you can place candy into a separate bag.");
			configEnable559 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-559", "Enable SCP-559", true, "Set to false to disable spawning SCP-559.");
			config559LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-559 Rarities", "Level Rarities", "ExperimentationLevel:25, AssuranceLevel:30, VowLevel:30, OffenseLevel:40, AdamanceLevel:45, MarchLevel:40, RendLevel:100, DineLevel:100, TitanLevel:50, ArtificeLevel:60, EmbrionLevel:25, Modded:40", "Rarities for each level. See default for formatting.");
			config559CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-559 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			config559MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "SCP-559 Min Value", 50, "The minimum scrap value of SCP-559.");
			config559MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "SCP-559 Max Value", 150, "The maximum scrap value of SCP-559.");
			config559HealAmount = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-559", "Heal Amount", 10, "The amount of health SCP-559 will heal when eaten.");
			config559CakeReversesAge = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-559", "Cake Reverses Age", false, "When the cake is eaten, it will reverse the players age back to their original age.");
			config559ReversesAgeReblow = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-559", "Blowing out Reverses Age", false, "If you find another 559 cake and blow out the candles, it will reverse your age back to your original age.");
			configEnable330 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-330", "Enable SCP-330", true, "Set to false to disable spawning SCP-330.");
			config330LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-330 Rarities", "Level Rarities", "ExperimentationLevel:30, AssuranceLevel:30, VowLevel:30, OffenseLevel:40, AdamanceLevel:45, MarchLevel:40, RendLevel:100, DineLevel:100, TitanLevel:50, ArtificeLevel:80, EmbrionLevel:45, Modded:30", "Rarities for each level. See default for formatting.");
			config330CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-330 Rarities", "Custom Level Rarities", "Secret LabsLevel:100", "Rarities for modded levels. Same formatting as level rarities.");
			config330ShowNoArmsWhenHandsCut = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-330", "Show No Arms When Hands Cut", true, "When the players hands are cut off, should they be able to see their arms? Can cause visual bugs, if so turn this off.");
			config330AllowPickingUpWhenCrouched = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-330", "Allow Picking Up When Crouched", true, "Should players be able to pick up SCP-330 when crouched?");
			configEnable458 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-458", "Enable SCP-458", true, "Set to false to disable spawning SCP-458.");
			config458LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-458 Rarities", "Level Rarities", "ExperimentationLevel:3, AssuranceLevel:4, VowLevel:4, OffenseLevel:7, AdamanceLevel:7, MarchLevel:7, RendLevel:20, DineLevel:25, TitanLevel:10, ArtificeLevel:13, EmbrionLevel:15, Modded:5", "Rarities for each level. See default for formatting.");
			config458CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-458 Rarities", "Custom Level Rarities", "Secret LabsLevel:20", "Rarities for modded levels. Same formatting as level rarities.");
			config458MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-458", "SCP-458 Min Value", 1, "The minimum scrap value of SCP-458.");
			config458MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-458", "SCP-458 Max Value", 750, "The maximum scrap value of SCP-458.");
			config458PizzaFillAmount = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-458 Pizza", "Pizza Fill Amount", 0.1f, "How much of the fill meter eating a slice of pizza will fill up. Range from 0 to 1.");
			config458MetabolismRate = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-458 Pizza", "Metabolism Rate", 0.01f, "How much of the fill meter that will be drained per x seconds. Range from 0 to 1.");
			config458HealAmount = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-458 Pizza", "Heal Amount", 1, "The amount of health you will heal every time the fill meter is drained.");
			config458SprintMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-458 Pizza", "Sprint Multiplier", 2f, "How much the fill meter will be drained while sprinting. The Metabolism Rate will be multiplied by this value when sprinting.");
			config458CrouchMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-458 Pizza", "Crouch Multiplier", 3f, "How much the fill meter will be drained while crouching. The Metabolism Rate will be multiplied by this value when crouching and not moving.");
			config458DrainRate = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-458 Pizza", "Drain Rate", 1.5f, "The Fill Meter will be drained by this many seconds.");
			configEnableCustomStatusEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Status Effects (Experimental)", "Enable Custom Status Effects", false, "Enable custom status effects");
			configCandyPurpleEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Purple Effects", "DamageReduction:15,20,true;HealthRegen:2,10;", "Effects when eating purple candy. See README for more info.");
			configCandyRedEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Red Effects", "HealthRegen:9,5;", "Effects when eating red candy. See README for more info.");
			configCandyYellowEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Yellow Effects", "RestoreStamina:25;InfiniteSprint:8;IncreasedMovementSpeed:8,2,true,true;", "Effects when eating yellow candy. See README for more info.");
			configCandyGreenEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Green Effects", "StatusNegation:30;HealthRegen:1,80;", "Effects when eating green candy. See README for more info.");
			configCandyBlueEffects = ((BaseUnityPlugin)this).Config.Bind<string>("Status Effects (Experimental)", "Candy Blue Effects", "HealPlayer:30,true;", "Effects when eating blue candy. See README for more info.");
			new StatusEffectController();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp956_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "scp956_assets")));
			CakeDisappearsfx = ModAssets.LoadAsset<AudioClip>("Assets/ModAssets/Cake/Audio/cake_disappear.wav");
			if ((Object)(object)CakeDisappearsfx == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"CakeDisappearsfx is null");
			}
			LoggerInstance.LogDebug((object)"Got sounds from assets");
			if (configEnable559.Value)
			{
				Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/Cake/SCP559Item.asset");
				if ((Object)(object)val == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get SCP559 from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got SCP559 prefab");
				SCP559Behavior component = val.spawnPrefab.GetComponent<SCP559Behavior>();
				val.minValue = config559MinValue.Value;
				val.maxValue = config559MaxValue.Value;
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Utilities.FixMixerGroups(val.spawnPrefab);
				Items.RegisterScrap(val, GetLevelRarities(config559LevelRarities.Value), GetCustomLevelRarities(config559CustomLevelRarities.Value));
				Item val2 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Cake/Cake559Item.asset");
				if ((Object)(object)val2 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get cake from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got Cake prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, (Dictionary<LevelTypes, int>)null, (Dictionary<string, int>)null);
			}
			if (configEnable330.Value)
			{
				Item val3 = ModAssets.LoadAsset<Item>("Assets/ModAssets/CandyBowl/CandyBowlItem.asset");
				if ((Object)(object)val3 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get bowl of candy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got bowl of candy prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				Items.RegisterScrap(val3, GetLevelRarities(config330LevelRarities.Value), GetCustomLevelRarities(config330CustomLevelRarities.Value));
				Item val4 = ModAssets.LoadAsset<Item>("Assets/ModAssets/CandyBowl/CandyBowlPItem.asset");
				if ((Object)(object)val4 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get bowl of candy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got bowl of candy P prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
				Utilities.FixMixerGroups(val4.spawnPrefab);
				Items.RegisterScrap(val4, GetLevelRarities(config330LevelRarities.Value), GetCustomLevelRarities(config330CustomLevelRarities.Value));
			}
			Item val5 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/PinkCandyItem.asset");
			if ((Object)(object)val5 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyPink from assets");
				return;
			}
			RegisterCandy(val5);
			LoggerInstance.LogDebug((object)"Got CandyPink");
			Item val6 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/PurpleCandyItem.asset");
			if ((Object)(object)val6 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyPurple from assets");
				return;
			}
			RegisterCandy(val6);
			LoggerInstance.LogDebug((object)"Got CandyPurple");
			Item val7 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/RedCandyItem.asset");
			if ((Object)(object)val7 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyRed from assets");
				return;
			}
			RegisterCandy(val7);
			LoggerInstance.LogDebug((object)"Got CandyRed");
			Item val8 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/YellowCandyItem.asset");
			if ((Object)(object)val8 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyYellow from assets");
				return;
			}
			RegisterCandy(val8);
			LoggerInstance.LogDebug((object)"Got CandyYellow");
			Item val9 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/GreenCandyItem.asset");
			if ((Object)(object)val9 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyGreen from assets");
				return;
			}
			RegisterCandy(val9);
			LoggerInstance.LogDebug((object)"Got CandyGreen");
			Item val10 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/BlueCandyItem.asset");
			if ((Object)(object)val10 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyBlue from assets");
				return;
			}
			RegisterCandy(val10);
			LoggerInstance.LogDebug((object)"Got CandyBlue");
			Item val11 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/RainbowCandyItem.asset");
			if ((Object)(object)val11 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyRainbow from assets");
				return;
			}
			RegisterCandy(val11);
			LoggerInstance.LogDebug((object)"Got CandyRainbow");
			Item val12 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Candy/BlackCandyItem.asset");
			if ((Object)(object)val12 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CandyBlack from assets");
				return;
			}
			RegisterCandy(val12);
			LoggerInstance.LogDebug((object)"Got CandyBlack");
			CandyNames = new List<string>
			{
				((Object)val5).name,
				((Object)val6).name,
				((Object)val7).name,
				((Object)val8).name,
				((Object)val9).name,
				((Object)val10).name,
				((Object)val11).name,
				((Object)val12).name
			};
			if (configEnableCandyBag.Value)
			{
				Item val13 = ModAssets.LoadAsset<Item>("Assets/ModAssets/CandyBag/CandyBagItem.asset");
				if ((Object)(object)val13 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get CandyBag from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got CandyBag prefab");
				NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
				Utilities.FixMixerGroups(val13.spawnPrefab);
				Items.RegisterItem(val13);
			}
			if (configEnable458.Value)
			{
				Item val14 = ModAssets.LoadAsset<Item>("Assets/ModAssets/Pizza/SCP458Item.asset");
				if ((Object)(object)val14 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get pizza from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got pizza prefab");
				val14.minValue = config458MinValue.Value;
				val14.maxValue = config458MaxValue.Value;
				NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab);
				Utilities.FixMixerGroups(val14.spawnPrefab);
				Items.RegisterScrap(val14, GetLevelRarities(config458LevelRarities.Value), GetCustomLevelRarities(config458CustomLevelRarities.Value));
			}
			if (configEnablePinata.Value)
			{
				EnemyType val15 = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/Pinata/Pinata.asset");
				if ((Object)(object)val15 == (Object)null)
				{
					LoggerInstance.LogError((object)"Error: Couldnt get enemy from assets");
					return;
				}
				LoggerInstance.LogDebug((object)"Got SCP-956 prefab");
				TerminalNode val16 = ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/Pinata/Bestiary/PinataTN.asset");
				TerminalKeyword val17 = ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/Pinata/Bestiary/PinataTK.asset");
				LoggerInstance.LogDebug((object)"Setting rarities");
				LoggerInstance.LogDebug((object)"Registering enemy network prefab...");
				NetworkPrefabs.RegisterNetworkPrefab(val15.enemyPrefab);
				LoggerInstance.LogDebug((object)"Registering enemy...");
				Enemies.RegisterEnemy(val15, GetLevelRarities(config956LevelRarities.Value), GetCustomLevelRarities(config956CustomLevelRarities.Value), val16, val17);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.SCP956 v2.0.4 has loaded!");
		}

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

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

		public static bool IsPlayerHoldingCandy(PlayerControllerB player)
		{
			GrabbableObject[] itemSlots = player.ItemSlots;
			foreach (GrabbableObject val in itemSlots)
			{
				if (!((Object)(object)val == (Object)null) && (CandyNames.Contains(((Object)val.itemProperties).name) || ((Object)val.itemProperties).name == "CandyBagItem"))
				{
					return true;
				}
			}
			return false;
		}

		public static void ResetConditions(bool endOfRound = false)
		{
			localPlayerFrozen = false;
			FreezeLocalPlayer(on: false);
			StatusEffectController.Instance.bulletProofMultiplier = 0;
			SCP330Behavior.noHands = false;
			if (!((Renderer)localPlayer.thisPlayerModelArms).enabled && config330ShowNoArmsWhenHandsCut.Value)
			{
				NetworkHandler.Instance.SetPlayerArmsVisibleServerRpc(localPlayer.actualClientId, visible: true);
			}
			if (endOfRound && configRandomizeAgeAfterRound.Value)
			{
				ChangePlayerAge(Random.Range(configMinAge.Value, configMaxAge.Value + 1));
				PlayerOriginalAge = PlayerAge;
			}
			else
			{
				ChangePlayerAge(PlayerOriginalAge);
			}
			if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && endOfRound)
			{
				SCP956AI.FrozenPlayers.Clear();
				SCP956AI.YoungPlayers.Clear();
				SCP956AI.PlayersRecievedWarning.Clear();
			}
		}

		public static void ChangePlayerAge(int ageChange)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			PlayerAge = ageChange;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0.7f, 0.7f, 0.7f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(1f, 1f, 1f);
			if (PlayerAge <= 12 && localPlayer.thisPlayerBody.localScale != val)
			{
				NetworkHandler.Instance.ChangePlayerSizeServerRpc(localPlayer.actualClientId, 0.7f);
			}
			else if (PlayerAge > 12 && localPlayer.thisPlayerBody.localScale != val2)
			{
				HUDManager.Instance.UIAudio.PlayOneShot(CakeDisappearsfx, 1f);
				NetworkHandler.Instance.ChangePlayerSizeServerRpc(localPlayer.actualClientId, 1f);
			}
		}

		public static void FreezeLocalPlayer(bool on)
		{
			localPlayerFrozen = on;
			localPlayer.disableMoveInput = on;
			localPlayer.disableLookInput = on;
			localPlayer.disableInteract = on;
			if (on)
			{
				localPlayer.DropAllHeldItemsAndSync();
			}
		}

		private void RegisterCandy(Item candy)
		{
			if (!configEnableCandyBag.Value)
			{
				candy.toolTips[1] = "";
			}
			NetworkPrefabs.RegisterNetworkPrefab(candy.spawnPrefab);
			Utilities.FixMixerGroups(candy.spawnPrefab);
			Items.RegisterItem(candy);
		}

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

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass = null;

		public AudioClip BoneCrackSFX = null;

		public AudioClip PlayerDeathSFX = null;

		public AudioClip WarningShortSFX = null;

		public AudioClip WarningLongSFX = null;

		private float timeSinceNewPos;

		private float timeSinceRandTeleport;

		private float activationRadius;

		private bool firstTimeTeleport;

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

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

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

		public override void Start()
		{
			((EnemyAI)this).Start();
			logger.LogDebug((object)"SCP-956 Spawned");
			activationRadius = Plugin.config956ActivationRadius.Value;
			SetOutsideOrInside();
			base.currentBehaviourStateIndex = 0;
			RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
		}

		public override void Update()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			timeSinceNewPos += Time.deltaTime;
			timeSinceRandTeleport += Time.deltaTime;
			if (!((Object)(object)base.targetPlayer != (Object)null))
			{
				return;
			}
			if (base.currentBehaviourStateIndex == 1)
			{
				if (Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 60f, 60, -1f))
				{
					Plugin.localPlayer.IncreaseFearLevelOverTime(0.2f, 1f);
				}
			}
			else if (base.currentBehaviourStateIndex == 2)
			{
				base.agent.speed = 0f;
				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);
			}
		}

		public override void DoAIInterval()
		{
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (IsAnyPlayerLookingAtMe())
			{
				timeSinceRandTeleport = 0f;
			}
			FreezeNearbyPlayers();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 0f;
				if (TargetFrozenPlayerInRange(activationRadius))
				{
					logger.LogDebug((object)"Start Killing Player");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				else if (timeSinceRandTeleport > (float)Plugin.config956TeleportTime.Value || (timeSinceRandTeleport > 30f && !firstTimeTeleport))
				{
					logger.LogDebug((object)"Teleporting");
					firstTimeTeleport = true;
					if (Plugin.config956TeleportNearPlayers.Value)
					{
						TeleportToRandomPlayer();
					}
					else
					{
						Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)this).transform.position, (float)Plugin.config956TeleportRange.Value, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
						Teleport(randomNavMeshPositionInBoxPredictable);
					}
					timeSinceRandTeleport = 0f;
				}
				break;
			case 1:
				base.agent.speed = 1f;
				base.agent.stoppingDistance = 3f;
				timeSinceRandTeleport = 0f;
				if (!TargetFrozenPlayerInRange(Plugin.config956ActivationRadius.Value))
				{
					logger.LogDebug((object)"Stop Killing Players");
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					MoveToTargetPlayer();
				}
				break;
			case 2:
				base.agent.speed = 0f;
				timeSinceRandTeleport = 0f;
				break;
			}
		}

		public void SetOutsideOrInside()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			GameObject closestAINode = GetClosestAINode(RoundManager.Instance.outsideAINodes.ToList());
			GameObject closestAINode2 = GetClosestAINode(RoundManager.Instance.insideAINodes.ToList());
			if (Vector3.Distance(((Component)this).transform.position, closestAINode.transform.position) < Vector3.Distance(((Component)this).transform.position, closestAINode2.transform.position))
			{
				SetEnemyOutsideClientRpc(value: true);
			}
		}

		public GameObject GetClosestAINode(List<GameObject> nodes)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			float num = float.PositiveInfinity;
			GameObject result = null;
			foreach (GameObject node in nodes)
			{
				float num2 = Vector3.Distance(((Component)this).transform.position, node.transform.position);
				if (num2 < num)
				{
					num = num2;
					result = node;
				}
			}
			return result;
		}

		public void FreezeNearbyPlayers()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled && !val.isPlayerDead && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < activationRadius && !PlayersRecievedWarning.Contains(val) && !FrozenPlayers.Contains(val))
				{
					bool flag = Plugin.IsPlayerHoldingCandy(val);
					bool flag2 = YoungPlayers.Contains(val);
					if (flag2 || flag)
					{
						logger.LogDebug((object)$"Warning player {val.actualClientId}. Young: {flag2}, Radius: {activationRadius}");
						WarnPlayerClientRpc(val.actualClientId, flag2, activationRadius);
						PlayersRecievedWarning.Add(val);
					}
				}
			}
		}

		public void TeleportToRandomPlayer()
		{
			//IL_0079: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (YoungPlayers.Contains(val) || Plugin.IsPlayerHoldingCandy(val))
				{
					list.Add(val);
				}
			}
			int index = Random.Range(0, list.Count);
			PlayerControllerB val2 = list[index];
			Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)val2).transform.position, (float)Plugin.config956TeleportRange.Value, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1);
			Teleport(randomNavMeshPositionInBoxPredictable);
		}

		public IEnumerator HeadbuttAttack()
		{
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			PlayerControllerB player = base.targetPlayer;
			Vector3 playerPos = ((Component)player).transform.position;
			yield return (object)new WaitForSeconds(3f);
			logger.LogDebug((object)"Headbutting");
			DoAnimationClientRpc("headButt");
			yield return (object)new WaitForSeconds(0.5f);
			logger.LogDebug((object)("Damaging player: " + base.targetPlayer.playerUsername));
			DamagePlayerServerRpc(player.actualClientId);
			base.creatureSFX.PlayOneShot(BoneCrackSFX, 1f);
			yield return (object)new WaitForSeconds(0.5f);
			if (player.isPlayerDead)
			{
				base.creatureVoice.PlayOneShot(PlayerDeathSFX, 1f);
				logger.LogDebug((object)"Player died, spawning candy");
				int candiesCount = Random.Range(Plugin.configCandyMinSpawn.Value, Plugin.configCandyMaxSpawn.Value);
				for (int i = 0; i < candiesCount; i++)
				{
					Vector3 pos = RoundManager.Instance.GetRandomNavMeshPositionInRadius(playerPos, 1.5f, RoundManager.Instance.navHit);
					NetworkHandler.Instance.SpawnItemServerRpc(0uL, Plugin.CandyNames[Random.Range(0, Plugin.CandyNames.Count)], 0, pos, Quaternion.Euler(0f, Random.Range(0f, 361f), 0f));
				}
				FrozenPlayers.Remove(player);
				base.targetPlayer = null;
			}
			if (base.currentBehaviourStateIndex == 2)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			}
		}

		private bool TargetFrozenPlayerInRange(float range)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = null;
			if (FrozenPlayers == null)
			{
				return false;
			}
			if (FrozenPlayers.Count > 0)
			{
				foreach (PlayerControllerB frozenPlayer in FrozenPlayers)
				{
					if ((Object)(object)frozenPlayer == (Object)null || frozenPlayer.disconnectedMidGame || frozenPlayer.isPlayerDead || !frozenPlayer.isPlayerControlled)
					{
						FrozenPlayers.Remove(frozenPlayer);
					}
					else if (Vector3.Distance(((Component)this).transform.position, ((Component)frozenPlayer).transform.position) < range && ((EnemyAI)this).PlayerIsTargetable(frozenPlayer, false, false))
					{
						base.targetPlayer = frozenPlayer;
					}
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private void MoveToTargetPlayer()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)base.targetPlayer == (Object)null))
			{
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 3f)
				{
					logger.LogDebug((object)"Headbutt Attack");
					((MonoBehaviour)this).StartCoroutine(HeadbuttAttack());
				}
				else if (timeSinceNewPos > 1.5f)
				{
					timeSinceNewPos = 0f;
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
		}

		public override void HitFromExplosion(float distance)
		{
			((EnemyAI)this).HitFromExplosion(distance);
			((EnemyAI)this).KillEnemy(true);
		}

		public override void HitEnemy(int force = 0, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(0, playerWhoHit, playHitSFX, hitID);
		}

		public void Teleport(Vector3 teleportPos)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			base.serverPosition = teleportPos;
			((Component)this).transform.position = teleportPos;
			base.agent.Warp(teleportPos);
			((EnemyAI)this).SyncPositionToClients();
		}

		public bool IsAnyPlayerLookingAtMe()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled && val.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, activationRadius * 2.5f))
				{
					return true;
				}
			}
			return false;
		}

		public IEnumerator PlayWarningCoroutine(bool young, float radius)
		{
			bool outOfRange = false;
			bool wasHoldingCandy = false;
			logger.LogDebug((object)$"Starting PlayWarningCoroutine. Young: {young}, Radius: {radius}");
			if (young)
			{
				base.creatureVoice.clip = WarningShortSFX;
				logger.LogDebug((object)"Set creature voice to WarningShortSFX.");
			}
			else
			{
				base.creatureVoice.clip = WarningLongSFX;
				wasHoldingCandy = true;
				logger.LogDebug((object)"Set creature voice to WarningLongSFX.");
			}
			base.creatureVoice.volume = Plugin.configWarningSoundVolume.Value;
			logger.LogDebug((object)$"Set creature voice volume to {base.creatureVoice.volume}.");
			base.creatureVoice.Play();
			logger.LogDebug((object)"Playing creature voice sound.");
			while (base.creatureVoice.isPlaying)
			{
				float distance = Vector3.Distance(((Component)this).transform.position, ((Component)Plugin.localPlayer).transform.position);
				if (distance > radius || (wasHoldingCandy && !Plugin.IsPlayerHoldingCandy(Plugin.localPlayer)))
				{
					outOfRange = true;
					base.creatureVoice.Stop();
					logger.LogDebug((object)"Player out of range. Stopping creature voice.");
					break;
				}
				yield return null;
			}
			if (outOfRange)
			{
				logger.LogDebug((object)$"Player is out of range. Removing player with ID {Plugin.localPlayer.actualClientId} from being warned.");
				RemoveFromPlayersBeingWarnedServerRpc(Plugin.localPlayer.actualClientId);
				yield break;
			}
			logger.LogDebug((object)"Player is in range. Freezing local player and initiating kill after delay.");
			Plugin.FreezeLocalPlayer(on: true);
			StatusEffectController.Instance.KillLocalPlayerAfterDelay(Plugin.configMaxTimeToKillPlayer.Value);
			AddPlayerToFrozenPlayersServerRpc(Plugin.localPlayer.actualClientId);
		}

		[ServerRpc(RequireOwnership = false)]
		private void DamagePlayerServerRpc(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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2503562424u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2503562424u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.localPlayer.actualClientId == clientId)
				{
					Plugin.localPlayer.DamagePlayer(Plugin.configHeadbuttDamage.Value, true, true, (CauseOfDeath)1, 7, false, default(Vector3));
				}
			}
		}

		[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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1784724156u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1784724156u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((EnemyAI)this).SetEnemyOutside(value);
				}
			}
		}

		[ClientRpc]
		private void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_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_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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1248612115u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1248612115u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				logger.LogDebug((object)("Doing animation: " + animationName));
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		private void WarnPlayerClientRpc(ulong clientId, bool young, float radius)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3205206449u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref young, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref radius, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3205206449u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && Plugin.localPlayer.actualClientId == clientId)
				{
					((MonoBehaviour)this).StartCoroutine(PlayWarningCoroutine(young, radius));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RemoveFromPlayersBeingWarnedServerRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(366435559u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 366435559u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					PlayerControllerB item = NetworkHandler.PlayerFromId(clientId);
					PlayersRecievedWarning.Remove(item);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void AddPlayerToFrozenPlayersServerRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3991229795u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3991229795u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					PlayerControllerB item = NetworkHandler.PlayerFromId(clientId);
					FrozenPlayers.Add(item);
					PlayersRecievedWarning.Remove(item);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCP956AI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2503562424u, new RpcReceiveHandler(__rpc_handler_2503562424));
			NetworkManager.__rpc_func_table.Add(1784724156u, new RpcReceiveHandler(__rpc_handler_1784724156));
			NetworkManager.__rpc_func_table.Add(1248612115u, new RpcReceiveHandler(__rpc_handler_1248612115));
			NetworkManager.__rpc_func_table.Add(3205206449u, new RpcReceiveHandler(__rpc_handler_3205206449));
			NetworkManager.__rpc_func_table.Add(366435559u, new RpcReceiveHandler(__rpc_handler_366435559));
			NetworkManager.__rpc_func_table.Add(3991229795u, new RpcReceiveHandler(__rpc_handler_3991229795));
		}

		private static void __rpc_handler_2503562424(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;
				((SCP956AI)(object)target).DamagePlayerServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1784724156(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)2;
				((SCP956AI)(object)target).SetEnemyOutsideClientRpc(enemyOutsideClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1248612115(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 animationName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP956AI)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3205206449(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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool young = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref young, default(ForPrimitives));
				float radius = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref radius, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP956AI)(object)target).WarnPlayerClientRpc(clientId, young, radius);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_366435559(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;
				((SCP956AI)(object)target).RemoveFromPlayersBeingWarnedServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3991229795(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;
				((SCP956AI)(object)target).AddPlayerToFrozenPlayersServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP956AI";
		}
	}
	public class StatusEffectController : MonoBehaviour
	{
		private static StatusEffectController _instance;

		private static ManualLogSource logger = Plugin.LoggerInstance;

		private Coroutine statusNegationCoroutine;

		private Coroutine damageReductionCoroutine;

		private Coroutine infiniteSprintCoroutine;

		private Coroutine increasedMovementSpeedCoroutine;

		public int statusNegationSeconds = 0;

		public int damageReductionSeconds = 0;

		public int infiniteSprintSeconds = 0;

		public int increasedMovementSpeedSeconds = 0;

		public int damageReductionPercent = 0;

		public int increasedMovementSpeedPercent = 0;

		public float freezeSprintMeter;

		public float baseMovementSpeed = 4.6f;

		public int bulletProofMultiplier = 0;

		private readonly string[] effectNames = new string[8] { "HealPlayer", "RestoreStamina", "HealthRegen", "StatusNegation", "DamageReduction", "InfiniteSprint", "IncreasedMovementSpeed", "PizzaHealing" };

		private Dictionary<string, MethodInfo> effectMethods = null;

		private Coroutine pizzaHealingCoroutine = null;

		public static float PlayerFullness = 0f;

		public static float pizzaFillAmount = 0.1f;

		private static float pizzaMetabolismRate = 0.01f;

		private static int pizzaHealAmount = 1;

		private