Decompiled source of HeavyItemSCPs v1.0.1

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

[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.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+f50011e84c009095f296fd26b126fe617ebae5ef")]
[assembly: AssemblyProduct("HeavyItemSCPs")]
[assembly: AssemblyTitle("ProjectSCP.HeavyItemSCPs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedINetworkSerializable<NetworkBehaviourReference>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<NetworkBehaviourReference>();
	}
}
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 NetworkVariable<bool> Spawned1781Instances = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public static NetworkHandlerHeavy Instance { get; private set; }

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

		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)
			{
				NetworkHandlerHeavy instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
				logger.LogDebug((object)"Despawned network object");
			}
			Instance = this;
			logger.LogDebug((object)"set instance to this");
			((NetworkBehaviour)this).OnNetworkSpawn();
			logger.LogDebug((object)"base.OnNetworkSpawn");
		}

		[ServerRpc(RequireOwnership = false)]
		public void 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)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 == localPlayer.actualClientId && 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}");
					localPlayer.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject));
					component.parentObject = 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()
		{
			if (Spawned1781Instances == null)
			{
				throw new Exception("NetworkHandlerHeavy.Spawned1781Instances cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)Spawned1781Instances).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Spawned1781Instances, "Spawned1781Instances");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)Spawned1781Instances);
			((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");
				networkPrefab.AddComponent<NetworkHandlerHeavy>();
				logger.LogDebug((object)"Added component");
				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.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

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

		public static AssetBundle? ModAssets;

		public static ConfigEntry<bool> configEnableSCP427;

		public static ConfigEntry<int> config427MinValue;

		public static ConfigEntry<int> config427MaxValue;

		public static ConfigEntry<string> config427LevelRarities;

		public static ConfigEntry<string> config427CustomLevelRarities;

		public static ConfigEntry<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> configTimeToSpawnSCP4271;

		public static ConfigEntry<bool> configContinueSpawningAfterPickup;

		public static ConfigEntry<int> configMaxSpawns;

		public static ConfigEntry<bool> configIncreaseTimeWhenInInventory;

		public static ConfigEntry<bool> config427_500Compatibility;

		public static ConfigEntry<bool> configEnableSCP4271Transformation;

		public static ConfigEntry<bool> configEnableSCP4271Spawning;

		public static ConfigEntry<string> config4271LevelRarities;

		public static ConfigEntry<string> config4271CustomLevelRarities;

		public static ConfigEntry<bool> configEnableSCP178;

		public static ConfigEntry<int> config178MinValue;

		public static ConfigEntry<int> config178MaxValue;

		public static ConfigEntry<string> config178LevelRarities;

		public static ConfigEntry<string> config178CustomLevelRarities;

		public static ConfigEntry<float> config178LensDistortion;

		public static ConfigEntry<float> config178ChromaticAberration;

		public static ConfigEntry<string> config178ColorTint;

		public static ConfigEntry<int> config1781MaxCount;

		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 PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController;

		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, All:10, Modded:15", "Rarities for each level. See default for formatting.");
			config427CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427 Rarities", "Custom Level Rarities", "", "Rarities for modded levels. Same formatting as level rarities.");
			configEnableOpenNecklace = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Enable open 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", 10, "The health gained per second while holding SCP-427.");
			configHealthPerSecondOpen = ((BaseUnityPlugin)this).Config.Bind<int>("SCP-427", "Health per second open", 15, "The health gained per second while opening SCP-427.");
			configHoarderBugTransformTime = ((BaseUnityPlugin)this).Config.Bind<float>("SCP-427", "Hoarder bug transform time", 20f, "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.");
			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.");
			configContinueSpawningAfterPickup = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427", "Continue spawning after picked up", false, "Whether or not SCP-427 should continue spawning SCP-427-1 instances after being picked up by a player or lootbug. Setting this to true will make SCP-427 keep spawning SCP-427-1 instances if its on the ground, regardless of whether its been picked up or not.");
			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.");
			configEnableSCP4271Transformation = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427-1", "Enable SCP-427-1 transformation", true, "Whether or not players or monsters can turn into SCP-427-1.");
			configEnableSCP4271Spawning = ((BaseUnityPlugin)this).Config.Bind<bool>("SCP-427-1", "Enable SCP-427-1 spawning", false, "Whether or not SCP-427-1 can spawn naturally from vents.");
			config4271LevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Level Rarities", "ExperimentationLevel:40, AssuranceLevel:40, VowLevel:40, OffenseLevel:60, AdamanceLevel:60, MarchLevel:60, RendLevel:25, DineLevel:25, TitanLevel:65, ArtificeLevel:70, EmbrionLevel:75, All:30, Modded:30", "Rarities for each level. See default for formatting.");
			config4271CustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("SCP-427-1 Rarities", "Custom Level Rarities", "", "Rarities for modded levels. Same formatting as level rarities.");
			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("SCP427", ObjectClass.Safe, config427LevelRarities.Value, config427CustomLevelRarities.Value, config427MinValue.Value, config427MaxValue.Value, 1);
				SCPItems.LoadEnemy("SCP4271", "SCP427", configEnableSCP4271Spawning.Value);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.HeavyItemSCPs v1.0.1 has loaded!");
		}

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

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

		public static 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<EnemyType> SCPEnemiesList = new List<EnemyType>();

		public static void Load(string pathName, ObjectClass objClass, string? levelRarities = null, string? customLevelRarities = null, int minValue = 0, int maxValue = 0, int? maxSpawns = null, bool tabletop = false, bool general = false, bool small = false)
		{
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			Item val = Plugin.ModAssets.LoadAsset<Item>("Assets/ModAssets/" + pathName + "/" + pathName + "Item.asset");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get " + pathName + " from assets"));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + pathName + " prefab"));
			if (maxValue > 0 && minValue < maxValue)
			{
				val.minValue = minValue;
				val.maxValue = maxValue;
			}
			SCPItem sCPItem = new SCPItem();
			sCPItem.item = val;
			sCPItem.MaxSpawns = maxSpawns;
			sCPItem.ObjectClass = objClass;
			sCPItem.TabletopItem = tabletop;
			sCPItem.GeneralItem = general;
			sCPItem.SmallItem = small;
			SCPItemsList.Add(sCPItem);
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			if (levelRarities != null)
			{
				string[] array = levelRarities.Split(',');
				string[] array2 = array;
				foreach (string text in array2)
				{
					string[] array3 = text.Split(':');
					if (array3.Length == 2)
					{
						string text2 = array3[0].Trim();
						string text3 = array3[1].Trim();
						if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
						{
							dictionary.Add(result, result2);
						}
						else
						{
							Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
						}
					}
				}
			}
			if (customLevelRarities != null)
			{
				string[] array4 = customLevelRarities.Split(',');
				string[] array5 = array4;
				foreach (string text4 in array5)
				{
					string[] array6 = text4.Split(':');
					if (array6.Length == 2)
					{
						string text5 = array6[0].Trim();
						string text6 = array6[1].Trim();
						if (int.TryParse(text6, out var result3))
						{
							dictionary2.Add(text5, result3);
						}
						else
						{
							Plugin.LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text5 + ":" + text6));
						}
					}
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, dictionary, dictionary2);
		}

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

		public static void LoadEnemy(string enemyPath, string itemPath, bool enableSpawning = true)
		{
			EnemyType val = Plugin.ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/" + itemPath + "/" + enemyPath + "Enemy.asset");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get " + enemyPath + " from assets"));
				return;
			}
			Plugin.LoggerInstance.LogDebug((object)("Got " + enemyPath + " prefab"));
			val.spawningDisabled = !enableSpawning;
			TerminalNode val2 = Plugin.ModAssets.LoadAsset<TerminalNode>("Assets/ModAssets/" + itemPath + "/Bestiary/" + enemyPath + "TN.asset");
			TerminalKeyword val3 = Plugin.ModAssets.LoadAsset<TerminalKeyword>("Assets/ModAssets/" + itemPath + "/Bestiary/" + enemyPath + "TK.asset");
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get " + enemyPath + "TN from assets"));
				return;
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)("Error: Couldnt get " + enemyPath + "TK from assets"));
				return;
			}
			SCPEnemiesList.Add(val);
			Plugin.LoggerInstance.LogDebug((object)("Registering " + enemyPath + " enemy network prefab..."));
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Plugin.LoggerInstance.LogDebug((object)("Registering " + enemyPath + " enemy..."));
			Enemies.RegisterEnemy(val, 0, (LevelTypes)(-1), val2, val3);
		}
	}
	public class SCPItem
	{
		public Item item;

		public int? MaxSpawns;

		public ObjectClass ObjectClass;

		public bool TabletopItem = false;

		public bool GeneralItem = false;

		public bool SmallItem = false;

		public int itemsSpawnedInRound = 0;
	}
	public enum ObjectClass
	{
		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.0.1";
	}
}
namespace HeavyItemSCPs.Patches
{
	[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);
					}
				}
			}
		}
	}
}
namespace HeavyItemSCPs.Items.SCP427
{
	internal class SCP4271AI : EnemyAI
	{
		public enum State
		{
			Roaming,
			Chasing,
			Throwing
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		private readonly float throwForce = 70f;

		public static float SpeedAccelerationEffect = 2.3f;

		public static float BaseAcceleration = 30f;

		public static float SpeedIncreaseRate = 4f;

		public static bool throwingPlayerEnabled = true;

		public static float heldObjectVerticalOffset = 4f;

		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 = 100f;

		private float idlingTimer = 0f;

		private Vector3 forwardDirection;

		private Vector3 upDirection;

		private Vector3 throwDirection;

		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;

		private NetworkVariable<NetworkBehaviourReference> _playerNetVar = new NetworkVariable<NetworkBehaviourReference>(default(NetworkBehaviourReference), (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private PlayerControllerB PlayerBeingThrown
		{
			get
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				return (PlayerControllerB)NetworkBehaviourReference.op_Implicit(_playerNetVar.Value);
			}
			set
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)value == (Object)null)
				{
					_playerNetVar.Value = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)null);
				}
				else
				{
					_playerNetVar.Value = new NetworkBehaviourReference((NetworkBehaviour)(object)value);
				}
			}
		}

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

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

		public override void DoAIInterval()
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 2f;
				if (FoundClosestPlayerInRange(25f, 5f))
				{
					if ((Object)(object)heldObject != (Object)null)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(2);
						AttemptThrowScrapAtTargetPlayer();
						break;
					}
					if (timeSinceSeenPlayer > 30f)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(1);
						Roar(chaseAfterRoar: true);
					}
					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) > 35f && !((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 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];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		private void CalculateAgentSpeed()
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			if (base.stunNormalizedTimer > 0f || base.currentBehaviourStateIndex == 2 || pickingUpScrap || grabbingPlayer || throwingPlayer || (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, 6f));
			Vector3 val = ((Component)this).transform.position - previousPosition;
			float num = ((Vector3)(ref val)).magnitude / (Time.deltaTime / 1.4f);
			if (velocityInterval <= 0f)
			{
				previousVelocity = averageVelocity;
				velocityInterval = 0.5f;
				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.17f, 2f, 100f) && num > 3f && 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);
					averageVelocity = 0f;
				}
				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, -3f, 10f);
				base.agent.acceleration = Mathf.Clamp(BaseAcceleration - averageVelocity * SpeedAccelerationEffect, 4f, 25f);
				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);
		}

		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.transform.position, true))
			{
				logger.LogDebug((object)"Moving to targetObject");
				((EnemyAI)this).StopSearch(base.currentSearch, true);
			}
		}

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

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

		private void PickUpScrapIfClose()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject component = targetObject.GetComponent<GrabbableObject>();
			if ((Object)(object)component == (Object)null || component.isHeldByEnemy || component.isHeld)
			{
				targetObject = null;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				networkAnimator.SetTrigger("startWalk");
			}
			else if (Vector3.Distance(((Component)this).transform.position, targetObject.transform.position) < 1.5f)
			{
				pickingUpScrap = true;
				((MonoBehaviour)this).StartCoroutine(PickUpScrapCoroutine());
			}
		}

		public IEnumerator PickUpScrapCoroutine()
		{
			networkAnimator.SetTrigger("pickup");
			yield return (object)new WaitForSeconds(0.1f);
			GrabbableObject grabbingObject = targetObject.GetComponent<GrabbableObject>();
			targetObject = null;
			grabbingObject.parentObject = RightHandTransform;
			grabbingObject.hasHitGround = false;
			grabbingObject.GrabItemFromEnemy((EnemyAI)(object)this);
			grabbingObject.EnablePhysics(false);
			HoarderBugAI.grabbableObjectsInMap.Remove(((Component)grabbingObject).gameObject);
			heldObject = grabbingObject;
			yield return (object)new WaitForSeconds(0.5f);
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			pickingUpScrap = false;
			networkAnimator.SetTrigger("startWalk");
		}

		public void AttemptThrowScrapAtTargetPlayer()
		{
			logger.LogDebug((object)"Throwing held object at target player");
			((MonoBehaviour)this).StartCoroutine(ThrowScrapCoroutine());
		}

		public IEnumerator ThrowScrapCoroutine()
		{
			Vector3 lastKnownPlayerPosition = ((Component)base.targetPlayer).transform.position;
			networkAnimator.SetTrigger("throw");
			yield return (object)new WaitForSeconds(0.5f);
			DropItem(lastKnownPlayerPosition);
			yield return (object)new WaitForSeconds(0.1f);
			if (Vector3.Distance(lastKnownPlayerPosition, ((Component)base.targetPlayer).transform.position) < 1.5f)
			{
				base.targetPlayer.DamagePlayer(15, true, true, (CauseOfDeath)16, 0, false, default(Vector3));
			}
			if (timeSinceSeenPlayer > 60f)
			{
				Roar(chaseAfterRoar: true);
				yield break;
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			networkAnimator.SetTrigger("startRun");
		}

		private void DropItem(Vector3 targetFloorPosition)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)heldObject == (Object)null))
			{
				GrabbableObject val = heldObject;
				val.parentObject = null;
				((Component)val).transform.SetParent(StartOfRound.Instance.propsContainer, true);
				val.EnablePhysics(true);
				val.fallTime = 0f;
				val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position);
				val.targetFloorPosition = ((Component)val).transform.parent.InverseTransformPoint(targetFloorPosition);
				val.floorYRot = -1;
				val.DiscardItemFromEnemy();
				heldObject = null;
			}
		}

		public void GrabTargetPlayer()
		{
			//IL_0032: 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)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PlayerBeingThrown == (Object)null))
			{
				PlayerControllerB playerBeingThrown = PlayerBeingThrown;
				playerBeingThrown.playerRigidbody.isKinematic = false;
				Vector3 val = ((Component)this).transform.TransformDirection(Vector3.forward);
				forwardDirection = ((Vector3)(ref val)).normalized * 2f;
				val = ((Component)this).transform.TransformDirection(Vector3.up);
				upDirection = ((Vector3)(ref val)).normalized;
				val = forwardDirection + upDirection;
				throwDirection = ((Vector3)(ref val)).normalized;
				logger.LogDebug((object)("Grabbing player: " + playerBeingThrown.playerUsername));
				grabbingPlayer = true;
			}
		}

		public void ThrowTargetPlayer()
		{
			if (!((Object)(object)PlayerBeingThrown == (Object)null))
			{
				((MonoBehaviour)this).StartCoroutine(ThrowPlayerCoroutine());
			}
		}

		public IEnumerator ThrowPlayerCoroutine()
		{
			PlayerControllerB player = PlayerBeingThrown;
			grabbingPlayer = false;
			((Component)player).transform.position = ((Component)this).transform.position;
			ManualLogSource obj = logger;
			Vector3 val = throwDirection * throwForce;
			obj.LogDebug((object)("Applying force: " + ((object)(Vector3)(ref val)).ToString()));
			player.playerRigidbody.velocity = Vector3.zero;
			player.externalForceAutoFade += throwDirection * throwForce;
			yield return (object)new WaitUntil((Func<bool>)(() => Plugin.localPlayer.thisController.isGrounded || Plugin.localPlayer.isPlayerDead || !throwingPlayer));
			player.playerRigidbody.isKinematic = true;
			logger.LogDebug((object)"Grounded");
			val = default(Vector3);
			player.DamagePlayer(40, true, true, (CauseOfDeath)16, 0, false, val);
			if ((Object)(object)Plugin.localPlayer == (Object)(object)PlayerBeingThrown && !Plugin.localPlayer.isPlayerDead)
			{
				PlayerHitGroundServerRpc();
			}
			InjureLocalPlayer();
			throwingPlayer = false;
			logger.LogDebug((object)"Finished throwing player");
			if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
			{
				base.targetPlayer = player;
				logger.LogDebug((object)"Roaring");
				Roar(chaseAfterRoar: true);
			}
		}

		public void InjureLocalPlayer()
		{
			PlayerControllerB localPlayer = Plugin.localPlayer;
			localPlayer.sprintMeter /= 2f;
			Plugin.localPlayer.JumpToFearLevel(0.8f, true);
			Plugin.localPlayer.drunkness = 0.2f;
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
			if ((Object)(object)val != (Object)null && base.currentBehaviourStateIndex != 2 && !throwingPlayer)
			{
				logger.LogDebug((object)(val.playerUsername + " collided with SCP-427-1"));
				logger.LogDebug((object)"Throwing player");
				throwingPlayer = true;
				ThrowPlayerServerRpc((int)val.actualClientId);
			}
		}

		public void Roar(bool chaseAfterRoar = false)
		{
			idlingTimer = 0f;
			((EnemyAI)this).SetEnemyStunned(true, 3.2f, (PlayerControllerB)null);
			((MonoBehaviour)this).StartCoroutine(RoarCoroutine(chaseAfterRoar));
		}

		public IEnumerator RoarCoroutine(bool chaseAfterRoar = false)
		{
			base.creatureVoice.PlayOneShot(roarSFX, 1f);
			networkAnimator.SetTrigger("roar");
			foreach (PlayerControllerB player in StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => Vector3.Distance(((Component)x).transform.position, ((Component)this).transform.position) < 15f))
			{
				player.JumpToFearLevel(1f, true);
			}
			yield return (object)new WaitUntil((Func<bool>)(() => base.stunNormalizedTimer <= 0f));
			if (chaseAfterRoar)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				networkAnimator.SetTrigger("startRun");
			}
		}

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

		public override void ReachedNodeInSearch()
		{
			((EnemyAI)this).ReachedNodeInSearch();
			if (base.currentBehaviourStateIndex == 0)
			{
				int num = Random.Range(0, 100);
				if (num < 10)
				{
					base.creatureVoice.PlayOneShot(warningRoarSFX, 1f);
				}
				idlingTimer = 2f;
				networkAnimator.SetTrigger("stopWalk");
			}
		}

		public override void HitFromExplosion(float distance)
		{
			((EnemyAI)this).HitFromExplosion(distance);
			if (!base.isEnemyDead)
			{
				base.enemyHP--;
				if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
				else if (!throwingPlayer && !pickingUpScrap && !grabbingPlayer)
				{
					Roar(chaseAfterRoar: true);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).CancelSpecialAnimationWithPlayer();
			((MonoBehaviour)this).StopAllCoroutines();
			grabbingPlayer = false;
			throwingPlayer = false;
			pickingUpScrap = false;
			if ((Object)(object)PlayerBeingThrown != (Object)null)
			{
				PlayerBeingThrown.playerRigidbody.isKinematic = true;
			}
			targetObject = null;
			DropItem(((Component)this).transform.position);
			((EnemyAI)this).KillEnemy(false);
		}

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

		[ServerRpc(RequireOwnership = false)]
		private void ThrowPlayerServerRpc(int clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3440528188u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3440528188u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					PlayerBeingThrown = NetworkHandlerHeavy.PlayerFromId((ulong)clientId);
					throwingPlayer = true;
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					networkAnimator.SetTrigger("pickupThrow");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayerHitGroundServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1260705473u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1260705473u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
				{
					PlayerHitGroundClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayerHitGroundClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1426274646u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1426274646u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					throwingPlayer = false;
				}
			}
		}

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

		protected override void __initializeVariables()
		{
			if (_playerNetVar == null)
			{
				throw new Exception("SCP4271AI._playerNetVar cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)_playerNetVar).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_playerNetVar, "_playerNetVar");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_playerNetVar);
			((EnemyAI)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCP4271AI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3440528188u, new RpcReceiveHandler(__rpc_handler_3440528188));
			NetworkManager.__rpc_func_table.Add(1260705473u, new RpcReceiveHandler(__rpc_handler_1260705473));
			NetworkManager.__rpc_func_table.Add(1426274646u, new RpcReceiveHandler(__rpc_handler_1426274646));
			NetworkManager.__rpc_func_table.Add(3998198815u, new RpcReceiveHandler(__rpc_handler_3998198815));
		}

		private static void __rpc_handler_3440528188(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)
			{
				int clientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP4271AI)(object)target).ThrowPlayerServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_3998198815(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool enemyOutsideClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enemyOutsideClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP4271AI)(object)target).SetEnemyOutsideClientRpc(enemyOutsideClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Landmine), "OnTriggerEnter")]
		public static void OnTriggerEnterPostfix(ref Landmine __instance, Collider other, ref float ___pressMineDebounceTimer)
		{
			EnemyAICollisionDetect component = ((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>();
			if ((Object)(object)component != (Object)null && !component.mainScript.isEnemyDead && ((Object)component.mainScript.enemyType).name == "SCP4271Enemy" && !__instance.hasExploded && component.mainScript.currentBehaviourStateIndex != 0)
			{
				__instance.SetOffMineAnimation();
				__instance.sendingExplosionRPC = true;
				__instance.ExplodeMineServerRpc();
			}
		}
	}
	internal class SCP427Behavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static float timeSCP427HeldByLocalPlayer = 0f;

		private NetworkVariable<bool> transformingEntity = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

		public static Dictionary<HoarderBugAI, float> LootBugHoldTimes = new Dictionary<HoarderBugAI, float>();

		public static Dictionary<BaboonBirdAI, float> BirdHoldTimes = new Dictionary<BaboonBirdAI, float>();

		private bool enableOpenNecklace;

		private float timeToTransform;

		private float transformOpenMultiplier;

		private int healthPerSecond;

		private int healthPerSecondOpen;

		private float lootBugTransformTime;

		private float birdTransformTime;

		private float timeToSpawnSCP4271;

		private bool spawnAfterPickup;

		private int maxSpawns;

		private bool inInventoryCounts;

		private float timeOnGround = 0f;

		private float timeSinceLastHeal = 0f;

		private bool playedPassiveTransformationSound = false;

		public AudioSource ItemSFX = null;

		public AudioClip PassiveTransformationSFX = null;

		public AudioClip FullTransformationSFX = null;

		public Animator itemAnimator = null;

		private bool open = false;

		private float multiplier = 1f;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			enableOpenNecklace = Plugin.configEnableOpenNecklace.Value;
			timeToTransform = Plugin.configTimeToTransform.Value;
			transformOpenMultiplier = Plugin.configTransformOpenMultiplier.Value;
			healthPerSecond = Plugin.configHealthPerSecondHolding.Value;
			healthPerSecondOpen = Plugin.configHealthPerSecondOpen.Value;
			lootBugTransformTime = Plugin.configHoarderBugTransformTime.Value;
			birdTransformTime = Plugin.configBaboonHawkTransformTime.Value;
			timeToSpawnSCP4271 = Plugin.configTimeToSpawnSCP4271.Value;
			spawnAfterPickup = Plugin.configContinueSpawningAfterPickup.Value;
			maxSpawns = Plugin.configMaxSpawns.Value;
			inInventoryCounts = Plugin.configIncreaseTimeWhenInInventory.Value;
			if (enableOpenNecklace)
			{
				((GrabbableObject)this).itemProperties.toolTips = new string[1] { "Open [LMB]" };
			}
		}

		public override void Update()
		{
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Updat