Decompiled source of HeavyItemSCPs v1.3.0

HeavyItemSCPs/ProjectSCP.HeavyItemSCPs.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("ProjectSCP.HeavyItemSCPs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+bc43d1bc582841b7906d4eee25254387a03983b9")]
[assembly: AssemblyProduct("HeavyItemSCPs")]
[assembly: AssemblyTitle("ProjectSCP.HeavyItemSCPs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.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 SCPItems
{
	internal class SCP500Compatibility
	{
		private static readonly ManualLogSource logger = Plugin.LoggerInstance;

		private static bool? _enabled;

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

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

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static bool LocalPlayerAffectedBySCP500()
		{
			return SCP500Controller.LocalPlayerAffectedBySCP500;
		}
	}
}
namespace HeavyItemSCPs
{
	public class NetworkHandlerHeavy : NetworkBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Material OverlayMaterial = null;

		public static NetworkHandlerHeavy 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) && (Object)(object)Instance != (Object)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 ShakePlayerCamerasServerRpc(ScreenShakeType type, float distance, Vector3 position)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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(1415843425u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<ScreenShakeType>(ref type, default(ForEnums));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1415843425u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost))
				{
					ShakePlayerCamerasClientRpc(type, distance, position);
				}
			}
		}

		[ClientRpc]
		private void ShakePlayerCamerasClientRpc(ScreenShakeType type, float distance, Vector3 position)
		{
			//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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Invalid comparison between Unknown and I4
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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(1861719679u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<ScreenShakeType>(ref type, default(ForEnums));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1861719679u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				float num = Vector3.Distance(((Component)Plugin.localPlayer).transform.position, position);
				if (num < distance)
				{
					HUDManager.Instance.ShakeCamera(type);
				}
				else if (num < distance * 2f && type - 1 >= 0)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)(type - 1));
				}
			}
		}

		[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_0173: 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(1468826189u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, id);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1468826189u, 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>();
					logger.LogDebug((object)$"Grabbing item with weight: {component.itemProperties.weight}");
					Plugin.localPlayer.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject));
					component.parentObject = Plugin.localPlayer.localItemHolder;
					component.GrabItemOnClient();
				}
			}
		}

		[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_0109: 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(1830337413u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1830337413u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[clientId]];
					val3.thisPlayerBody.localScale = new Vector3(size, size, size);
				}
			}
		}

		[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)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4004502649u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4004502649u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					ChangePlayerSizeClientRpc(clientId, size);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnEnemyServerRpc(string enemyName, Vector3 pos = default(Vector3), int yRot = 0, bool outsideEnemy = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: 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(2896122965u, val, (RpcDelivery)0);
				bool flag = enemyName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enemyName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				BytePacker.WriteValueBitPacked(val2, yRot);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref outsideEnemy, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2896122965u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string enemyName2 = enemyName;
			if (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer)
			{
				return;
			}
			SpawnableEnemyWithRarity val3 = RoundManager.Instance.currentLevel.Enemies.Where((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == enemyName2).FirstOrDefault();
			if (val3 == null)
			{
				logger.LogError((object)("Error: Couldnt get " + enemyName2 + " to spawn"));
				return;
			}
			int num = RoundManager.Instance.currentLevel.Enemies.IndexOf(val3);
			if (pos != default(Vector3))
			{
				RoundManager.Instance.SpawnEnemyOnServer(pos, (float)yRot, num);
				if (outsideEnemy)
				{
					EnemyAI val4 = RoundManager.Instance.SpawnedEnemies.Last();
					val4.SetEnemyOutside(true);
				}
			}
			else if (outsideEnemy)
			{
				GameObject[] outsideAINodes = RoundManager.Instance.outsideAINodes;
				int num2 = Random.Range(0, outsideAINodes.Length - 1);
				RoundManager.Instance.SpawnEnemyOnServer(outsideAINodes[num2].transform.position, (float)yRot, num);
			}
			else
			{
				List<EnemyVent> list = RoundManager.Instance.allEnemyVents.ToList();
				logger.LogDebug((object)("Found vents: " + list.Count));
				EnemyVent val5 = list[Random.Range(0, list.Count - 1)];
				logger.LogDebug((object)("Selected vent: " + (object)val5));
				val5.enemyTypeIndex = num;
				val5.enemyType = val3.enemyType;
				logger.LogDebug((object)("Updated vent with enemy type index: " + val5.enemyTypeIndex + " and enemy type: " + (object)val5.enemyType));
				RoundManager.Instance.SpawnEnemyFromVent(val5);
				logger.LogDebug((object)"Spawning SCP-956 from vent");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnItemServerRpc(ulong clientId, string _itemName, int newValue, Vector3 pos, Quaternion rot, 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(1846456409u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				bool flag = _itemName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(_itemName, 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, 1846456409u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string _itemName2 = _itemName;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				Item val3 = StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == _itemName2).FirstOrDefault();
				logger.LogDebug((object)"Got item");
				GameObject val4 = Object.Instantiate<GameObject>(val3.spawnPrefab, pos, rot, StartOfRound.Instance.propsContainer);
				if (newValue != 0)
				{
					val4.GetComponent<GrabbableObject>().SetScrapValue(newValue);
				}
				logger.LogDebug((object)$"Spawning item with weight: {val4.GetComponent<GrabbableObject>().itemProperties.weight}");
				val4.GetComponent<NetworkObject>().Spawn(false);
				if (grabItem)
				{
					GrabObjectClientRpc(val4.GetComponent<NetworkObject>().NetworkObjectId, clientId);
					logger.LogDebug((object)"Grabbed obj");
				}
			}
		}

		[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(1723845470u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1723845470u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			ulong clientId2 = clientId;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == clientId2).FirstOrDefault();
				if (!((Object)(object)val3 == (Object)null))
				{
					Object.Destroy((Object)(object)((Component)val3.deadBody).gameObject);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_NetworkHandlerHeavy()
		{
			//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
			NetworkManager.__rpc_func_table.Add(1415843425u, new RpcReceiveHandler(__rpc_handler_1415843425));
			NetworkManager.__rpc_func_table.Add(1861719679u, new RpcReceiveHandler(__rpc_handler_1861719679));
			NetworkManager.__rpc_func_table.Add(1468826189u, new RpcReceiveHandler(__rpc_handler_1468826189));
			NetworkManager.__rpc_func_table.Add(1830337413u, new RpcReceiveHandler(__rpc_handler_1830337413));
			NetworkManager.__rpc_func_table.Add(4004502649u, new RpcReceiveHandler(__rpc_handler_4004502649));
			NetworkManager.__rpc_func_table.Add(2896122965u, new RpcReceiveHandler(__rpc_handler_2896122965));
			NetworkManager.__rpc_func_table.Add(1846456409u, new RpcReceiveHandler(__rpc_handler_1846456409));
			NetworkManager.__rpc_func_table.Add(1723845470u, new RpcReceiveHandler(__rpc_handler_1723845470));
		}

		private static void __rpc_handler_1415843425(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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)
			{
				ScreenShakeType type = default(ScreenShakeType);
				((FastBufferReader)(ref reader)).ReadValueSafe<ScreenShakeType>(ref type, default(ForEnums));
				float distance = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref distance, default(ForPrimitives));
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavy)(object)target).ShakePlayerCamerasServerRpc(type, distance, position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1861719679(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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)
			{
				ScreenShakeType type = default(ScreenShakeType);
				((FastBufferReader)(ref reader)).ReadValueSafe<ScreenShakeType>(ref type, default(ForEnums));
				float distance = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref distance, default(ForPrimitives));
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandlerHeavy)(object)target).ShakePlayerCamerasClientRpc(type, distance, position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1468826189(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;
				((NetworkHandlerHeavy)(object)target).GrabObjectClientRpc(id, clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1830337413(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;
				((NetworkHandlerHeavy)(object)target).ChangePlayerSizeClientRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4004502649(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;
				((NetworkHandlerHeavy)(object)target).ChangePlayerSizeServerRpc(clientId, size);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2896122965(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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00a5: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string enemyName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyName, false);
				}
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				int yRot = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref yRot);
				bool outsideEnemy = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref outsideEnemy, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NetworkHandlerHeavy)(object)target).SpawnEnemyServerRpc(enemyName, pos, yRot, outsideEnemy);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1846456409(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 itemName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, 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;
				((NetworkHandlerHeavy)(object)target).SpawnItemServerRpc(clientId, itemName, newValue, pos, rot, grabItem);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NetworkHandlerHeavy";
		}
	}
	[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/SharedAssets/NetworkHandlerHeavyItemSCPs.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);
				logger.LogDebug((object)"Instantiated networkHandlerHost");
				val.GetComponent<NetworkObject>().Spawn(false);
				logger.LogDebug((object)"Spawned network object");
			}
		}
	}
	[BepInPlugin("ProjectSCP.HeavyItemSCPs", "HeavyItemSCPs", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public enum DropMethod
		{
			DropNothing,
			DropHeldItem,
			DropTwoHandedItem,
			DropAllItems
		}

		private const string PLUGIN_GUID = "ProjectSCP.HeavyItemSCPs";

		private const string PLUGIN_NAME = "HeavyItemSCPs";

		private const string PLUGIN_VERSION = "1.3.0";

		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

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

		public static AssetBundle? ModAssets;

		public static ConfigEntry<bool> configEnableSCP427;

		public static ConfigEntry<int> config427MinValue;

		public static ConfigEntry<int> config427MaxValue;

		public static ConfigEntry<string> config427LevelRarities;

		public static ConfigEntry<string> config427CustomLevelRarities;

		public static ConfigEntry<int> config427SCPDungeonRarity;

		public static ConfigEntry<bool> configEnableOpenNecklace;

		public static ConfigEntry<float> configTimeToTransform;

		public static ConfigEntry<float> configTransformOpenMultiplier;

		public static ConfigEntry<int> configHealthPerSecondHolding;

		public static ConfigEntry<int> configHealthPerSecondOpen;

		public static ConfigEntry<float> configHoarderBugTransformTime;

		public static ConfigEntry<float> configBaboonHawkTransformTime;

		public static ConfigEntry<float> configOtherEnemyTransformTime;

		public static ConfigEntry<float> configTimeToSpawnSCP4271;

		public static ConfigEntry<int> configMaxSpawns;

		public static ConfigEntry<bool> configIncreaseTimeWhenInInventory;

		public static ConfigEntry<bool> config427_500Compatibility;

		public static ConfigEntry<bool> config427ResetTransformTimeAtOrbit;

		public static ConfigEntry<string> config4271LevelRarities;

		public static ConfigEntry<string> config4271CustomLevelRarities;

		public static ConfigEntry<int> config4271SCPDungeonRarity;

		public static ConfigEntry<DropMethod> config4271DropMethod;

		public static ConfigEntry<bool> configEnableSCP178;

		public static ConfigEntry<int> config178MinValue;

		public static ConfigEntry<int> config178MaxValue;

		public static ConfigEntry<string> config178LevelRarities;

		public static ConfigEntry<string> config178CustomLevelRarities;

		public static ConfigEntry<int> config178SCPDungeonRarity;

		public static ConfigEntry<float> config178LensDistortion;

		public static ConfigEntry<float> config178ChromaticAberration;

		public static ConfigEntry<string> config178ColorTint;

		public static ConfigEntry<int> config1781MaxCountInside;

		public static ConfigEntry<int> config1781MaxCountOutside;

		public static ConfigEntry<float> config1781RenderDistance;

		public static ConfigEntry<float> config1781DespawnTime;

		public static ConfigEntry<float> config1781WanderingWaitTime;

		public static ConfigEntry<float> config1781WanderingRadius;

		public static ConfigEntry<float> config1781PostObservationTime;

		public static ConfigEntry<float> config1781DistanceToAddAnger;

		public static ConfigEntry<float> config1781ObservationGracePeriod;

		public static ConfigEntry<bool> configEnableSCP323;

		public static ConfigEntry<int> config323MinValue;

		public static ConfigEntry<int> config323MaxValue;

		public static ConfigEntry<string> config323LevelRarities;

		public static ConfigEntry<string> config323CustomLevelRarities;

		public static ConfigEntry<int> config323SCPDungeonRarity;

		public static ConfigEntry<float> config323DistanceToIncreaseInsanity;

		public static ConfigEntry<int> config323InsanityNearby;

		public static ConfigEntry<int> config323InsanityHolding;

		public static ConfigEntry<int> config323InsanityWearing;

		public static ConfigEntry<int> config323InsanityToTransform;

		public static ConfigEntry<bool> config323ShowInsanity;

		public static ConfigEntry<bool> config323BlurVisionWhenAddingInsanity;

		public static ConfigEntry<string> config3231LevelRarities;

		public static ConfigEntry<string> config3231CustomLevelRarities;

		public static ConfigEntry<int> config3231SCPDungeonRarity;

		public static ConfigEntry<float> config3231PlayerBloodSenseRange;

		public static ConfigEntry<float> config3231MaskedBloodSenseRange;

		public static ConfigEntry<float> config3231DoorBashForce;

		public static ConfigEntry<int> config3231DoorBashDamage;

		public static ConfigEntry<int> config3231DoorBashAOEDamage;

		public static ConfigEntry<float> config3231DoorBashAOERange;

		public static ConfigEntry<bool> config3231DespawnDoorAfterBash;

		public static ConfigEntry<float> config3231DespawnDoorAfterBashTime;

		public static ConfigEntry<int> config3231MaxHP;

		public static ConfigEntry<int> config3231MaxDamage;

		public static ConfigEntry<int> config3231MinDamage;

		public static ConfigEntry<bool> config3231ReverseDamage;

		public static ConfigEntry<float> config3231ChaseMaxSpeed;

		public static ConfigEntry<float> config3231RoamMaxSpeed;

		public static ConfigEntry<float> config3231RoamMinSpeed;

		public static ConfigEntry<float> config3231TimeToLosePlayer;

		public static ConfigEntry<float> config3231SearchAfterLosePlayerTime;

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

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

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			configEnableSCP427 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Enable SCP-427", true, "Whether or not SCP-427 can spawn as scrap.");
			config427MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Minimum value", 100, "The minimum value of SCP-427.");
			config427MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Maximum value", 150, "The maximum value of SCP-427.");
			config427LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427 Rarities", "Level Rarities", "ExperimentationLevel:5, AssuranceLevel:7, VowLevel:10, OffenseLevel:15, AdamanceLevel:25, MarchLevel:15, RendLevel:30, DineLevel:35, TitanLevel:45, ArtificeLevel:25, EmbrionLevel:50, Modded:15", "Rarities for each level. See default for formatting.");
			config427CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427 Rarities", "Custom Level Rarities", "Secret LabsLevel:50", "Rarities for modded levels. Same formatting as level rarities.");
			config427SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427 Rarities", "SCP Dungeon Rarity", 100, "The rarity of SCP-427 in the SCP Dungeon. Set to -1 to use level rarities.");
			configEnableOpenNecklace = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Enable opening necklace", true, "Whether or not players can open the necklace.");
			configTimeToTransform = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Time to transform", 120f, "How long a player can hold the necklace before they transform into SCP-427-1. Set to -1 to disable transforming.");
			configTransformOpenMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Transform open multiplier", 3f, "The multiplier applied to the time it takes to transform when the necklace is opened. configTimeToTransform will be multiplied by this value.");
			configHealthPerSecondHolding = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Health per second holding", 2, "The health gained per second while holding SCP-427.");
			configHealthPerSecondOpen = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Health per second open", 7, "The health gained per second while opening SCP-427.");
			configHoarderBugTransformTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Hoarder bug transform time", 5f, "The time it takes for the hoarder bug to transform into SCP-427-1. Set to -1 to disable transforming.");
			configBaboonHawkTransformTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Baboon hawk transform time", 10f, "The time it takes for the baboon hawk to transform into SCP-427-1. Set to -1 to disable transforming.");
			configOtherEnemyTransformTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Other enemy transform time", 10f, "The time it takes for the other enemies to transform into SCP-427-1. Set to -1 to disable transforming.");
			configTimeToSpawnSCP4271 = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Time to spawn SCP-427-1", 300f, "The time it takes for SCP-427 to spawn SCP-427-1 when on the ground. Set to -1 to disable spawning from necklace.");
			configMaxSpawns = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Max spawns", 1, "The maximum number of SCP-427-1 instances that can be spawned when SCP-427 is on the ground.");
			configIncreaseTimeWhenInInventory = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Increase time when in inventory", true, "Whether or not timeHoldingSCP427 should increase when SCP-427 is on hotbar but not being held.");
			config427_500Compatibility = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "SCP-500 compatibility", true, "Whether or not SCP-427 should be compatible with the SCP-500 mod. This will only work if you have the SCP-500 mod installed. If enabled, it will temporarily halt the transformation timer when holding or using SCP-427 when you take SCP-500.");
			config427ResetTransformTimeAtOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Reset transform time at orbit", false, "Whether or not SCP-427 should reset its transformation timer when orbiting.");
			config4271LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Level Rarities", "ExperimentationLevel:0, AssuranceLevel:0, VowLevel:0, OffenseLevel:0, AdamanceLevel:0, MarchLevel:0, RendLevel:0, DineLevel:0, TitanLevel:0, ArtificeLevel:0, EmbrionLevel:0, Modded:0", "Rarities for each level. See default for formatting.");
			config4271CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Custom Level Rarities", "Secret LabsLevel:0", "Rarities for modded levels. Same formatting as level rarities.");
			config4271SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427-1 Rarities", "SCP Dungeon Rarity", -1, "The rarity of SCP-427-1 in the SCP Dungeon. Set to -1 to use level rarities.");
			config4271DropMethod = ((BaseUnityPlugin)this).Config.Bind<DropMethod>("SCP-427-1", "Drop method", DropMethod.DropNothing, "When the player is grabbed by SCP-427-1, they should drop: 0 = Drop nothing, 1 = Drop held item, 2 = Drop two-handed item, 3 = Drop all items.");
			configEnableSCP178 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-178", "Enable SCP-178", true, "Whether or not SCP-178 can spawn as scrap.");
			config178MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Minimum value", 100, "The minimum value of SCP-178.");
			config178MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178", "Maximum value", 150, "The maximum value of SCP-178.");
			config178LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Rarities", "Level Rarities", "ExperimentationLevel:10, AssuranceLevel:15, VowLevel:15, OffenseLevel:20, AdamanceLevel:30, MarchLevel:20, RendLevel:50, DineLevel:55, TitanLevel:60, ArtificeLevel:60, EmbrionLevel:65, Modded:20", "Rarities for each level. See default for formatting.");
			config178CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 Rarities", "Custom Level Rarities", "Secret LabsLevel:75", "Rarities for modded levels. Same formatting as level rarities.");
			config178SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-178 Rarities", "SCP Dungeon Rarity", 100, "The rarity of SCP-178 in the SCP Dungeon. Set to -1 to use level rarities.");
			config178LensDistortion = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-178 3D Effects", "Lens Distortion", -0.2f, "Changes the lens distortion effect of the 3D glasses.");
			config178ChromaticAberration = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-178 3D Effects", "Chromatic Aberration", 3f, "Changes the chromatic aberration effect of the 3D glasses.");
			config178ColorTint = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-178 3D Effects", "Color Tint", "500,0,500", "Changes the RGB color tint effect of the 3D glasses.");
			config1781MaxCountOutside = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-1781", "Max count outside", 50, "The maximum number of SCP-178-1 instances that can be spawned outside. -1 spawns on all ai nodes.");
			config1781MaxCountInside = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-1781", "Max count inside", 50, "The maximum number of SCP-178-1 instances that can be spawned inside. -1 spawns on all ai nodes.");
			config1781RenderDistance = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Render distance", 30f, "The distance at which SCP-178-1 instances will run their AI. Any instances outside this distance will be disabled, still showing the model but not moving around. Lower values can help with performance. -1 disables this feature.");
			config1781DespawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Despawn time", 30f, "The time it takes for SCP-178-1 instances to despawn when not wearing the glasses.");
			config1781PostObservationTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Post observation time", 5f, "The time it takes for SCP-178-1 instances to return to their roaming phase after being stared at.");
			config1781WanderingRadius = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Wandering radius", 5f, "The radius around SCP-178-1 spawn position that they will roam around in.");
			config1781WanderingWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Wandering wait time", 5f, "When spawned, SCP-178-1 will pick a random position in their wandering radius and walk to it. This determines how long they will wait until picking another position to walk to.");
			config1781DistanceToAddAnger = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Distance to add anger", 10f, "The distance you need to be from SCP-178-1 to increase their anger meter when looking at them.");
			config1781ObservationGracePeriod = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-1781", "Observation grace period", 5f, "The time it takes for SCP-178-1 instances to start getting angry after staring at them.");
			configEnableSCP323 = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323", "Enable SCP-323", true, "Whether or not SCP-323 can spawn as scrap.");
			config323MinValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Minimum value", 100, "The minimum value of SCP-323.");
			config323MaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Maximum value", 150, "The maximum value of SCP-323.");
			config323LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323 Rarities", "Level Rarities", "ExperimentationLevel:5, AssuranceLevel:7, VowLevel:10, OffenseLevel:15, AdamanceLevel:25, MarchLevel:15, RendLevel:30, DineLevel:35, TitanLevel:45, ArtificeLevel:25, EmbrionLevel:50, Modded:15", "Rarities for each level. See default for formatting.");
			config323CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323 Rarities", "Custom Level Rarities", "Secret LabsLevel:50", "Rarities for modded levels. Same formatting as level rarities.");
			config323SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323 Rarities", "SCP Dungeon Rarity", 100, "The rarity in the SCP Dungeon. Set to -1 to use level rarities.");
			config323DistanceToIncreaseInsanity = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323", "Distance to increase insanity", 10f, "The distance you need to be from SCP-323 for it to start decreasing your insanity.");
			config323InsanityNearby = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Insanity nearby", 5, "The amount of insanity you will gain every 10 seconds of being near SCP-323.");
			config323InsanityHolding = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Insanity holding", 10, "The amount of insanity you will gain every 10 seconds when you are holding SCP-323.");
			config323InsanityWearing = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Insanity wearing", 10, "The amount of insanity you will gain every 10 seconds when you are wearing SCP-323.");
			config323InsanityToTransform = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323", "Insanity to transform", 50, "You will be forced to transform when you reach this insanity value. It cannot be stopped.");
			config323ShowInsanity = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323", "Show insanity", false, "Blur the players vision when they are near SCP-323 based on their insanity.");
			config323BlurVisionWhenAddingInsanity = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323", "Blur vision when adding insanity", true, "When adding sanity, the players vision will blur.");
			config3231LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323-1 Rarities", "Level Rarities", "ExperimentationLevel:0, AssuranceLevel:0, VowLevel:0, OffenseLevel:0, AdamanceLevel:0, MarchLevel:0, RendLevel:0, DineLevel:0, TitanLevel:0, ArtificeLevel:0, EmbrionLevel:0, Modded:0", "Rarities for each level. See default for formatting.");
			config3231CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-323-1 Rarities", "Custom Level Rarities", "Secret LabsLevel:0", "Rarities for modded levels. Same formatting as level rarities.");
			config3231SCPDungeonRarity = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1 Rarities", "SCP Dungeon Rarity", -1, "The rarity in the SCP Dungeon. Set to -1 to use level rarities.");
			config3231PlayerBloodSenseRange = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Player blood sense range", 75f, "When the player takes damage, SCP-323-1 will enter BloodSearch phase if the player is in this range.");
			config3231MaskedBloodSenseRange = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Masked blood sense range", 75f, "When a masked enemy takes damage, SCP-323-1 will enter BloodSearch phase if a masked is in this range.");
			config3231DoorBashForce = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Door bash force", 35f, "The amount of force to apply to the door when SCP-323-1 bashes it.");
			config3231DoorBashDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1", "Door bash damage", 30, "The amount of damage the player will take if the door hits them.");
			config3231DoorBashAOEDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1", "Door bash AoE damage", 10, "The amount of damage the player will take if they are within range of the door when it is being bashed.");
			config3231DoorBashAOERange = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Door bash AoE range", 5f, "The range of the AoE damage.");
			config3231DespawnDoorAfterBash = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323-1", "Despawn door after bash", true, "Whether the door should despawn after its been bashed.");
			config3231DespawnDoorAfterBashTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Despawn door after bash time", 3f, "The time it takes for the door to despawn after being bashed.");
			config3231MaxHP = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1", "Max HP", 20, "The maximum amount of health SCP-323-1 can have.");
			config3231MaxDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1", "Max damage", 50, "The maximum amount of damage SCP-323-1 can deal.");
			config3231MinDamage = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-323-1", "Min damage", 10, "The minimum amount of damage SCP-323-1 can deal.");
			config3231ReverseDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-323-1", "Reverse damage", true, "When false, SCP-323-1 will do more damage the more health it has. When true, it will do more damage the less health it has.");
			config3231ChaseMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Chase max speed", 8.5f, "The maximum speed at which SCP-323-1 will chase the player based on health.");
			config3231RoamMaxSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Roam max speed", 5f, "The maximum speed at which SCP-323-1 will roam based on health. This is also the min speed SCP-323-1 will roam at.");
			config3231RoamMinSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Roam min speed", 3f, "The minimum speed at which SCP-323-1 will roam based on health.");
			config3231TimeToLosePlayer = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Time to lose player", 5f, "The time the player needs to be out of LOS to lose SCP-323-1.");
			config3231SearchAfterLosePlayerTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-323-1", "Search after lose player time", 25f, "The time it takes for SCP-323-1 to search after losing the player.");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "heavy_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "heavy_assets")));
			if (configEnableSCP427.Value)
			{
				SCPItems.Load("Assets/ModAssets/SCP427/SCP427Item.asset", ObjectClass.Safe, config427LevelRarities.Value, config427CustomLevelRarities.Value, config427SCPDungeonRarity.Value, config427MinValue.Value, config427MaxValue.Value, tabletop: true, general: true, small: true);
				SCPItems.LoadEnemy("Assets/ModAssets/SCP427/SCP4271Enemy.asset", "Assets/ModAssets/SCP427/Bestiary/SCP4271TN.asset", "Assets/ModAssets/SCP427/Bestiary/SCP4271TK.asset", config4271LevelRarities.Value, config4271CustomLevelRarities.Value, config4271SCPDungeonRarity.Value);
			}
			if (configEnableSCP178.Value)
			{
				SCPItems.Load("Assets/ModAssets/SCP178/SCP178Item.asset", ObjectClass.Safe, config178LevelRarities.Value, config178CustomLevelRarities.Value, config178SCPDungeonRarity.Value, config178MinValue.Value, config178MaxValue.Value, tabletop: true, general: true);
				SCPItems.LoadEnemy("Assets/ModAssets/SCP178/SCP1781Enemy.asset", "Assets/ModAssets/SCP178/Bestiary/SCP1781TN.asset", "Assets/ModAssets/SCP178/Bestiary/SCP1781TK.asset", null, null, -1);
				SCP1783DVision.Load();
			}
			if (configEnableSCP323.Value)
			{
				SCPItems.Load("Assets/ModAssets/SCP323/SCP323Item.asset", ObjectClass.Safe, config323LevelRarities.Value, config323CustomLevelRarities.Value, config323SCPDungeonRarity.Value, config323MinValue.Value, config323MaxValue.Value);
				SCPItems.LoadEnemy("Assets/ModAssets/SCP323/SCP323_1Enemy.asset", "Assets/ModAssets/SCP323/Bestiary/SCP323_1TN.asset", "Assets/ModAssets/SCP323/Bestiary/SCP323_1TK.asset", config3231LevelRarities.Value, config3231CustomLevelRarities.Value, config3231SCPDungeonRarity.Value);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.HeavyItemSCPs v1.3.0 has loaded!");
		}

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

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

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

		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");
		}
	}
	public static class SCPItems
	{
		public static List<SCPItem> SCPItemsList = new List<SCPItem>();

		public static List<SCPEnemy> SCPEnemiesList = new List<SCPEnemy>();

		public static void Load(string path, ObjectClass objClass, string? levelRarities = null, string? customLevelRarities = null, int scpDungeonRarity = 100, int minValue = 0, int maxValue = 0, bool tabletop = false, bool general = false, bool small = false)
		{
			Item val = Plugin.ModAssets.LoadAsset<Item>(path);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get item with path " + path + " in assets"));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
			val.minValue = minValue;
			val.maxValue = Mathf.Max(minValue, maxValue);
			SCPItem sCPItem = new SCPItem();
			sCPItem.item = val;
			sCPItem.scpDungeonRarity = scpDungeonRarity;
			sCPItem.ObjectClass = objClass;
			sCPItem.TabletopItem = tabletop;
			sCPItem.GeneralItem = general;
			sCPItem.SmallItem = small;
			SCPItemsList.Add(sCPItem);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, Plugin.GetLevelRarities(levelRarities), Plugin.GetCustomLevelRarities(customLevelRarities));
		}

		public static void LoadShopItem(string path, ObjectClass objClass, int price)
		{
			Item val = Plugin.ModAssets.LoadAsset<Item>(path);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get item with path " + path + " from assets"));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
			SCPItem sCPItem = new SCPItem();
			sCPItem.item = val;
			sCPItem.ObjectClass = objClass;
			sCPItem.price = price;
			SCPItemsList.Add(sCPItem);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterShopItem(val, price);
		}

		public static void LoadEnemy(string path, string TNPath, string TKPath, string? levelRarities = null, string? customLevelRarities = null, int scpDungeonRarity = 100, ObjectClass objClass = ObjectClass.Unknown)
		{
			EnemyType val = Plugin.ModAssets.LoadAsset<EnemyType>(path);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get enemy with path " + path + " from assets"));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + ((Object)val).name + " prefab"));
			if (levelRarities == null && customLevelRarities == null)
			{
				val.spawningDisabled = true;
			}
			TerminalNode val2 = Plugin.ModAssets.LoadAsset<TerminalNode>(TNPath);
			TerminalKeyword val3 = Plugin.ModAssets.LoadAsset<TerminalKeyword>(TKPath);
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get terminal node from path " + TNPath + " in assets"));
				return;
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get terminal keyword from path " + TKPath + " in assets"));
				return;
			}
			SCPEnemy sCPEnemy = new SCPEnemy();
			sCPEnemy.ObjectClass = objClass;
			sCPEnemy.enemyType = val;
			sCPEnemy.SCPDungeonRarity = scpDungeonRarity;
			SCPEnemiesList.Add(sCPEnemy);
			Plugin.LoggerInstance.LogDebug((object)("Registering " + ((Object)val).name + " enemy network prefab..."));
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Plugin.LoggerInstance.LogDebug((object)("Registering " + ((Object)val).name + " enemy..."));
			Enemies.RegisterEnemy(val, Plugin.GetLevelRarities(levelRarities), Plugin.GetCustomLevelRarities(customLevelRarities), val2, val3);
		}

		public static SCPItem? GetSCPItem(Item item)
		{
			foreach (SCPItem sCPItems in SCPItemsList)
			{
				if ((Object)(object)sCPItems.item.spawnPrefab == (Object)(object)item.spawnPrefab)
				{
					return sCPItems;
				}
			}
			return null;
		}
	}
	public class SCPEnemy
	{
		public ObjectClass ObjectClass;

		public EnemyType enemyType = null;

		public int SCPDungeonRarity;

		public int currentLevelRarity;

		public string enemyName => enemyType.enemyName;
	}
	public class SCPItem
	{
		public Item item = null;

		public ObjectClass ObjectClass;

		public bool TabletopItem = false;

		public bool GeneralItem = false;

		public bool SmallItem = false;

		public int scpDungeonRarity = 100;

		public int currentLevelRarity;

		public int price;
	}
	public enum ObjectClass
	{
		Unknown,
		Safe,
		Euclid,
		Keter
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ProjectSCP.HeavyItemSCPs";

		public const string PLUGIN_NAME = "HeavyItemSCPs";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
namespace HeavyItemSCPs.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		private static bool isSCPDungeon = false;

		[HarmonyPrefix]
		[HarmonyPatch("SpawnScrapInLevel")]
		public static void SpawnScrapInLevelPrefix(RoundManager __instance)
		{
			string name = ((Object)__instance.dungeonGenerator.Generator.DungeonFlow).name;
			if (!(name == "SCPFlow"))
			{
				return;
			}
			logger.LogDebug((object)"SCPFlow detected");
			foreach (SCPItem scpItem in SCPItems.SCPItemsList)
			{
				if (scpItem.scpDungeonRarity != -1)
				{
					SpawnableItemWithRarity val = __instance.currentLevel.spawnableScrap.Where((SpawnableItemWithRarity x) => ((Object)x.spawnableItem).name == ((Object)scpItem.item).name).FirstOrDefault();
					if (val != null)
					{
						scpItem.currentLevelRarity = val.rarity;
						val.rarity = scpItem.scpDungeonRarity;
						logger.LogDebug((object)$"Rarity for {((Object)scpItem.item).name} set to {val.rarity} from {scpItem.currentLevelRarity}");
					}
				}
			}
			isSCPDungeon = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnScrapInLevel")]
		public static void SpawnScrapInLevelPostfix(RoundManager __instance)
		{
			if (!isSCPDungeon)
			{
				return;
			}
			logger.LogDebug((object)"Resetting rarities");
			isSCPDungeon = false;
			foreach (SCPItem scpItem in SCPItems.SCPItemsList)
			{
				if (scpItem.scpDungeonRarity != -1)
				{
					SpawnableItemWithRarity val = __instance.currentLevel.spawnableScrap.Where((SpawnableItemWithRarity x) => ((Object)x.spawnableItem).name == ((Object)scpItem.item).name).FirstOrDefault();
					if (val != null)
					{
						val.rarity = scpItem.currentLevelRarity;
						logger.LogDebug((object)$"Rarity for {((Object)scpItem.item).name} reset to {val.rarity} from {scpItem.scpDungeonRarity}");
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch("firstDayAnimation")]
		public static void firstDayAnimationPostfix()
		{
			logger.LogDebug((object)"First day started");
			if (!NetworkManager.Singleton.IsHost && !NetworkManager.Singleton.IsServer)
			{
				return;
			}
			ItemGroup item = (from x in Resources.FindObjectsOfTypeAll<ItemGroup>()
				where ((Object)x).name == "TabletopItems"
				select x).First();
			ItemGroup item2 = (from x in Resources.FindObjectsOfTypeAll<ItemGroup>()
				where ((Object)x).name == "GeneralItemClass"
				select x).First();
			ItemGroup item3 = (from x in Resources.FindObjectsOfTypeAll<ItemGroup>()
				where ((Object)x).name == "SmallItems"
				select x).First();
			logger.LogDebug((object)"Got itemgroups");
			foreach (SCPItem scpItem in SCPItems.SCPItemsList)
			{
				if (!scpItem.TabletopItem && !scpItem.GeneralItem && !scpItem.SmallItem)
				{
					continue;
				}
				Item val = Items.LethalLibItemList.Where((Item x) => ((Object)x).name == ((Object)scpItem.item).name).First();
				val.spawnPositionTypes.Clear();
				if ((Object)(object)val != (Object)null)
				{
					if (scpItem.TabletopItem)
					{
						val.spawnPositionTypes.Add(item);
					}
					if (scpItem.GeneralItem)
					{
						val.spawnPositionTypes.Add(item2);
					}
					if (scpItem.SmallItem)
					{
						val.spawnPositionTypes.Add(item3);
					}
				}
			}
		}
	}
	internal class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static float drunkness = 0f;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
			logger.LogDebug((object)("Insanity: " + Plugin.localPlayer.insanityLevel));
			if ((Object)(object)SCP323_1AI.Instance != (Object)null)
			{
				logger.LogDebug((object)("Speed: " + ((EnemyAI)SCP323_1AI.Instance).agent.speed));
				logger.LogDebug((object)("HP: " + ((EnemyAI)SCP323_1AI.Instance).enemyHP));
				logger.LogDebug((object)("Decay: " + SCP323_1AI.Instance.decayMultiplier));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			logger.LogDebug((object)text);
			switch (array[0])
			{
			case "/door":
				((EnemyAI)SCP323_1AI.Instance).openDoorSpeedMultiplier = float.Parse(array[1]);
				break;
			case "/drunk":
				drunkness = float.Parse(array[1]);
				break;
			case "/destroy":
			{
				GameObject val2 = (from x in Object.FindObjectsOfType<GameObject>()
					where Vector3.Distance(x.transform.position, ((Component)Plugin.localPlayer).transform.position) < 5f
					select x).FirstOrDefault();
				if ((Object)(object)val2 != (Object)null)
				{
					NetworkObject component = val2.GetComponent<NetworkObject>();
					if ((Object)(object)component != (Object)null && component.IsSpawned)
					{
						component.Despawn(true);
					}
					else
					{
						Object.Destroy((Object)(object)val2);
					}
				}
				break;
			}
			case "/state":
				SCP323Behavior.isTesting = true;
				SCP323Behavior.testState = (SCP323Behavior.AttachState)int.Parse(array[1]);
				SCP323Behavior.Instance?.ChangeAttachStateServerRpc(SCP323Behavior.testState);
				break;
			case "/enemies":
			{
				foreach (SpawnableEnemyWithRarity enemy in GetEnemies())
				{
					logger.LogDebug((object)((Object)enemy.enemyType).name);
				}
				break;
			}
			case "/outside":
				break;
			case "/refresh":
				RoundManager.Instance.RefreshEnemiesList();
				HoarderBugAI.RefreshGrabbableObjectsInMapList();
				break;
			case "/levels":
			{
				SelectableLevel[] levels = StartOfRound.Instance.levels;
				foreach (SelectableLevel val3 in levels)
				{
					logger.LogDebug((object)((Object)val3).name);
				}
				break;
			}
			case "/dungeon":
				logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
				break;
			case "/dungeons":
			{
				IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
				foreach (IndoorMapType val in dungeonFlowTypes)
				{
					logger.LogDebug((object)((Object)val.dungeonFlow).name);
				}
				break;
			}
			}
		}

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

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

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

		public enum MaterialVariants
		{
			Player,
			Hoarderbug,
			BaboonHawk,
			None
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Transform turnCompass = null;

		public Transform RightHandTransform = null;

		public AudioClip[] stompSFXList = null;

		public AudioClip roarSFX = null;

		public AudioClip warningRoarSFX = null;

		public AudioClip hitWallSFX = null;

		public NetworkAnimator networkAnimator = null;

		public Material[] materials = null;

		private readonly float throwForce = 70f;

		public static float SpeedAccelerationEffect = 2.3f;

		public static float BaseAcceleration = 30f;

		public static float SpeedIncreaseRate = 4f;

		public static float heldObjectVerticalOffset = 6f;

		private GameObject targetObject = null;

		private GrabbableObject heldObject = null;

		private float averageVelocity;

		private Vector3 previousPosition;

		private float previousVelocity;

		private float velocityInterval;

		private float velocityAverageCount;

		private float wallCollisionSFXDebounce;

		private float agentSpeedWithNegative;

		private bool hasEnteredChaseMode;

		private bool throwingPlayer;

		private bool grabbingPlayer;

		private bool pickingUpScrap;

		private float timeSinceSeenPlayer;

		private float idlingTimer;

		private float timeSpawned;

		private Vector3 forwardDirection;

		private Vector3 upDirection;

		private Vector3 throwDirection;

		private EnemyAI targetEnemy = null;

		private Plugin.DropMethod dropMethod;

		public ThreatType type => (ThreatType)4;

		public override void Start()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			logger.LogDebug((object)"SCP-427-1 Spawned");
			dropMethod = Plugin.config4271DropMethod.Value;
			SetOutsideOrInside();
			base.currentBehaviourStateIndex = 0;
			RoundManager.Instance.RefreshEnemiesList();
			HoarderBugAI.RefreshGrabbableObjectsInMapList();
			timeSinceSeenPlayer = float.PositiveInfinity;
			networkAnimator.SetTrigger("startWalk");
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			logger.LogDebug((object)"Finished spawning SCP-427-1");
		}

		public override void Update()
		{
			//IL_0067: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			timeSpawned += Time.deltaTime;
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			if (grabbingPlayer && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
			{
				((Component)base.inSpecialAnimationWithPlayer).transform.position = RightHandTransform.position;
			}
			if ((Object)(object)heldObject != (Object)null)
			{
				((Component)heldObject).transform.position = RightHandTransform.position + new Vector3(0f, heldObjectVerticalOffset, 0f);
			}
			if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)
			{
				return;
			}
			if (base.currentBehaviourStateIndex == 0)
			{
				timeSinceSeenPlayer += Time.deltaTime;
			}
			if (idlingTimer > 0f)
			{
				idlingTimer -= Time.deltaTime;
				if (idlingTimer <= 0f && base.currentBehaviourStateIndex == 0)
				{
					networkAnimator.SetTrigger("startWalk");
					idlingTimer = 0f;
				}
			}
			CalculateAgentSpeed();
		}

		public override void DoAIInterval()
		{
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead || base.stunNormalizedTimer > 0f || timeSpawned < 1f)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (FoundClosestPlayerInRange(25f, 5f))
				{
					if ((Object)(object)heldObject != (Object)null)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(2);
						AttemptThrowScrapAtTargetPlayer();
						break;
					}
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					if (timeSinceSeenPlayer > 30f)
					{
						Roar();
					}
					else
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(1);
						networkAnimator.SetTrigger("startRun");
					}
					idlingTimer = 0f;
					timeSinceSeenPlayer = 0f;
				}
				else
				{
					MoveTowardsScrapInLineOfSight();
				}
				break;
			case 1:
				if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 30f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
				{
					logger.LogDebug((object)"Stop Targeting");
					base.targetPlayer = null;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					networkAnimator.SetTrigger("startWalk");
				}
				else
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				break;
			case 2:
				base.agent.speed = 0f;
				break;
			default:
				logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
				break;
			}
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_004e: 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)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		private bool FoundClosestPlayerInRange(float range)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001f: 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)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private void CalculateAgentSpeed()
		{
			//IL_009f: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			if (base.stunNormalizedTimer >= 0f || base.currentBehaviourStateIndex == 2 || base.inSpecialAnimation || (idlingTimer > 0f && base.currentBehaviourStateIndex == 0))
			{
				base.agent.speed = 0f;
				base.agent.acceleration = 200f;
				return;
			}
			base.creatureAnimator.SetFloat("speedMultiplier", Mathf.Clamp(averageVelocity / 12f * 1.5f, 0.5f, 3f));
			Vector3 val = ((Component)this).transform.position - previousPosition;
			float num = ((Vector3)(ref val)).magnitude / (Time.deltaTime / 1.4f);
			if (velocityInterval <= 0f)
			{
				previousVelocity = averageVelocity;
				velocityInterval = 0.05f;
				velocityAverageCount += 1f;
				if (velocityAverageCount > 5f)
				{
					averageVelocity += (num - averageVelocity) / 3f;
				}
				else
				{
					averageVelocity += num;
					if (velocityAverageCount == 2f)
					{
						averageVelocity /= velocityAverageCount;
					}
				}
			}
			else
			{
				velocityInterval -= Time.deltaTime;
			}
			if (((NetworkBehaviour)this).IsOwner && averageVelocity - num > Mathf.Clamp(num * 0.5f, 5f, 100f) && num < 5f && base.currentBehaviourStateIndex == 1)
			{
				if (wallCollisionSFXDebounce > 0.5f)
				{
					base.creatureSFX.PlayOneShot(hitWallSFX, 0.7f);
					((EnemyAI)this).SetEnemyStunned(true, 0.5f, (PlayerControllerB)null);
					NetworkHandlerHeavy.Instance.ShakePlayerCamerasServerRpc((ScreenShakeType)1, 15f, ((Component)this).transform.position);
				}
				agentSpeedWithNegative *= 0.2f;
				wallCollisionSFXDebounce = 0f;
			}
			wallCollisionSFXDebounce += Time.deltaTime;
			previousPosition = ((Component)this).transform.position;
			if (base.currentBehaviourStateIndex == 0)
			{
				base.agent.speed = 2f;
				base.agent.acceleration = 26f;
			}
			else if (base.currentBehaviourStateIndex == 1)
			{
				agentSpeedWithNegative += Time.deltaTime * SpeedIncreaseRate;
				base.agent.speed = Mathf.Clamp(agentSpeedWithNegative, 0f, 11f);
				base.agent.acceleration = Mathf.Clamp(BaseAcceleration - averageVelocity * SpeedAccelerationEffect, 4f, 30f);
				if (base.agent.acceleration > 15f)
				{
					base.agent.angularSpeed = 500f;
					NavMeshAgent agent = base.agent;
					agent.acceleration += 25f;
				}
				else
				{
					base.agent.angularSpeed = 230f;
				}
			}
		}

		public void PlayStompSFX()
		{
			int num = Random.Range(0, stompSFXList.Count() - 1);
			float num2 = ((base.currentBehaviourStateIndex != 1) ? 0.7f : 1f);
			base.creatureSFX.PlayOneShot(stompSFXList[num], num2);
		}

		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(GameObject.FindGameObjectsWithTag("OutsideAINode").ToList());
			GameObject closestAINode2 = GetClosestAINode(GameObject.FindGameObjectsWithTag("AINode").ToList());
			if (Vector3.Distance(((Component)this).transform.position, closestAINode.transform.position) < Vector3.Distance(((Component)this).transform.position, closestAINode2.transform.position))
			{
				logger.LogDebug((object)"Setting enemy outside");
				SetEnemyOutsideClientRpc(value: true);
			}
			else
			{
				logger.LogDebug((object)"Setting enemy inside");
			}
		}

		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;
		}

		private void MoveTowardsScrapInLineOfSight()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)heldObject != (Object)null)
			{
				return;
			}
			if ((Object)(object)targetObject != (Object)null)
			{
				logger.LogDebug((object)"Trying to pick up scrap when close");
				PickUpScrapIfClose();
				return;
			}
			targetObject = ((EnemyAI)this).CheckLineOfSight(HoarderBugAI.grabbableObjectsInMap, 45f, 60, -1f, (Transform)null, (int[])null);
			if ((Object)(object)targetObject != (Object)null && ((EnemyAI)this).SetDestinationToPosition(targetObject.tran