Decompiled source of SCP106 v3.0.1

SCP106.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SCP106.Configuration;
using SCP106.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SCP106")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("SCP-106 has breached containment.")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyInformationalVersion("3.0.1+5bebda81cec882b977232626099a5b778cfbba86")]
[assembly: AssemblyProduct("SCP106")]
[assembly: AssemblyTitle("SCP106")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SCP106
{
	[BepInPlugin("Dackie.SCP106", "SCP106", "3.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(OutOfBoundsTrigger))]
		[HarmonyPatch("OnTriggerEnter")]
		internal class OutOfBoundsTriggersPatch
		{
			private static bool Prefix(Collider other)
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				PocketDimController pocketDimController = Object.FindObjectOfType<PocketDimController>();
				if ((Object)(object)pocketDimController != (Object)null && (Object)(object)component != (Object)null && pocketDimController.playerIsInPD[(uint)component.playerClientId])
				{
					return false;
				}
				return true;
			}
		}

		public const string ModGUID = "Dackie.SCP106";

		internal static ManualLogSource Logger;

		public static AssetBundle ModAssets;

		private readonly Harmony harmony = new Harmony("Dackie.SCP106");

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this);
			InitializeNetworkBehaviours();
			string path = "scp106";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("SCP106");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SCP106TN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SCP106TK");
			GameObject val4 = (GameObject)ModAssets.LoadAsset("pocketdimension");
			GameObject val5 = (GameObject)ModAssets.LoadAsset("pdPersonalAudio");
			GameObject val6 = (GameObject)ModAssets.LoadAsset("corrosionDecalProjector");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val4);
			NetworkPrefabs.RegisterNetworkPrefab(val5);
			NetworkPrefabs.RegisterNetworkPrefab(val6);
			harmony.PatchAll();
			var (dictionary, dictionary2) = GetSpawnRarities(BoundConfig.SpawnWeight.Value);
			if (dictionary != null && dictionary2 != null)
			{
				Enemies.RegisterEnemy(val, dictionary, dictionary2, val2, val3);
			}
			else
			{
				Logger.LogInfo((object)"Failed to parse Spawn Rate Configuration. Defaulted to Global Spawn Rate of 25 for SCP-106.");
				Enemies.RegisterEnemy(val, 25, (LevelTypes)(-1), (SpawnType)0, val2, val3);
			}
			Logger.LogInfo((object)"Plugin SCP106 is loaded!");
		}

		private (Dictionary<LevelTypes, int> levelRarities, Dictionary<string, int> customLevelRarities) GetSpawnRarities(string config)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			string[] array = config.Split(';');
			foreach (string text in array)
			{
				try
				{
					string[] array2 = text.Split(':');
					string text2 = array2[0];
					string s = array2[1];
					if (Enum.TryParse<LevelTypes>(text2, ignoreCase: true, out LevelTypes result))
					{
						dictionary[result] = (int.TryParse(s, out var result2) ? result2 : 25);
					}
					else
					{
						dictionary2[text2] = (int.TryParse(s, out var result3) ? result3 : 25);
					}
				}
				catch
				{
					return (null, null);
				}
			}
			return (dictionary, dictionary2);
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal class PocketDimController : NetworkBehaviour
	{
		public enum ExitStyle
		{
			RESET,
			ESCAPED
		}

		public enum DeathStyle
		{
			SLAM,
			BLEED,
			KNEEL
		}

		public enum RoomType
		{
			MAIN,
			CORRIDOR,
			THRONE
		}

		private enum AudioGroup
		{
			BREATHING,
			DEATH,
			ENTER,
			EXIT,
			MISC
		}

		[Header("Personal Audio Clips / Prefab")]
		public AudioClip[] personalAudioBreathing;

		public AudioClip[] personalAudioDeath;

		public AudioClip[] personalAudioEnter;

		public AudioClip[] personalAudioExit;

		public AudioClip[] personalAudioMisc;

		public GameObject personalAudioPrefab;

		[Header("Pocket Dimension Main Room")]
		public Transform mainRoomSpawn;

		[Header("Pocket Dimension Throne Room")]
		public Transform throneRoomSpawn;

		public AudioSource throneRoomAudioSource;

		public AudioClip personalAudioKneel;

		[Header("Pocket Dimension Corridor")]
		public Transform corridorSpawn;

		private SCPAI scpReference;

		private Vector3 pocketDimensionPosition;

		public bool[] playerIsInPD;

		private bool[] playerIsInThroneRoom;

		private bool[] playerIsInCorridor;

		private Coroutine localPlayerCoroutine;

		private Vector3 localPlayerExitLocation;

		private AudioSource[] personalAudios;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public void Awake()
		{
		}

		public void Start()
		{
		}

		public override void OnDestroy()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (localPlayerCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(localPlayerCoroutine);
				((Component)localPlayerController.gameplayCamera).transform.position = localPlayerController.cameraContainerTransform.position;
			}
			localPlayerController.drunkness = 0f;
			localPlayerController.drunknessInertia = 0f;
			((NetworkBehaviour)this).OnDestroy();
		}

		[ServerRpc]
		public void RegisterSCPServerRpc(Vector3 pocketPosition, ulong SCPNetworkId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_014c: 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)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1500670558u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pocketPosition);
				BytePacker.WriteValueBitPacked(val2, SCPNetworkId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1500670558u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				int num = StartOfRound.Instance.allPlayerScripts.Length;
				ulong[] array = new ulong[num];
				for (int i = 0; i < num; i++)
				{
					PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[i];
					NetworkObject component = Object.Instantiate<GameObject>(personalAudioPrefab, val3.cameraContainerTransform.position, Quaternion.identity, ((Component)val3).gameObject.transform).GetComponent<NetworkObject>();
					component.Spawn(false);
					component.DestroyWithScene = true;
					array[i] = component.NetworkObjectId;
				}
				RegisterSCPClientRpc(num, pocketPosition, array, SCPNetworkId);
			}
		}

		[ClientRpc]
		public void RegisterSCPClientRpc(int numberOfPlayers, Vector3 pocketPosition, ulong[] networkObjects, ulong SCPNetworkId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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(2268078427u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, numberOfPlayers);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pocketPosition);
				bool flag = networkObjects != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(networkObjects, default(ForPrimitives));
				}
				BytePacker.WriteValueBitPacked(val2, SCPNetworkId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2268078427u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				scpReference = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[SCPNetworkId]).GetComponent<SCPAI>();
				pocketDimensionPosition = pocketPosition;
				playerIsInPD = new bool[numberOfPlayers];
				playerIsInThroneRoom = new bool[numberOfPlayers];
				playerIsInCorridor = new bool[numberOfPlayers];
				personalAudios = (AudioSource[])(object)new AudioSource[numberOfPlayers];
				for (int i = 0; i < personalAudios.Length; i++)
				{
					NetworkObject val3 = NetworkManager.Singleton.SpawnManager.SpawnedObjects[networkObjects[i]];
					val3.TrySetParent(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform, true);
					personalAudios[i] = ((Component)val3).GetComponent<AudioSource>();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void StopPersonalSoundServerRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2593932004u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2593932004u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					StopPersonalSoundClientRpc(playerClientId);
				}
			}
		}

		[ClientRpc]
		private void StopPersonalSoundClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1643445409u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1643445409u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					personalAudios[playerClientId].Stop(true);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayPersonalSoundServerRpc(int playerClientId, int roomType, int audioGroup, int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_008b: 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_00b0: 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(1615960182u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					BytePacker.WriteValueBitPacked(val2, roomType);
					BytePacker.WriteValueBitPacked(val2, audioGroup);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1615960182u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayPersonalSoundClientRpc(playerClientId, roomType, audioGroup, index);
				}
			}
		}

		[ClientRpc]
		private void PlayPersonalSoundClientRpc(int playerClientId, int roomType, int audioGroup, int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_008b: 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_00b0: 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(1378219553u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerClientId);
				BytePacker.WriteValueBitPacked(val2, roomType);
				BytePacker.WriteValueBitPacked(val2, audioGroup);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1378219553u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			switch (roomType)
			{
			case 0:
				switch (audioGroup)
				{
				case 0:
					personalAudios[playerClientId].PlayOneShot(personalAudioBreathing[index]);
					break;
				case 1:
					personalAudios[playerClientId].PlayOneShot(personalAudioDeath[index]);
					break;
				case 2:
					personalAudios[playerClientId].PlayOneShot(personalAudioEnter[index]);
					break;
				case 3:
					personalAudios[playerClientId].PlayOneShot(personalAudioExit[index]);
					break;
				}
				break;
			case 2:
				switch (audioGroup)
				{
				case 0:
					personalAudios[playerClientId].PlayOneShot(scpReference.killingSounds[index]);
					break;
				case 1:
					personalAudios[playerClientId].PlayOneShot(scpReference.playerKilledSounds[index]);
					break;
				case 2:
					throneRoomAudioSource.PlayOneShot(personalAudioKneel);
					break;
				case 4:
					personalAudios[playerClientId].PlayOneShot(personalAudioMisc[index]);
					break;
				case 3:
					break;
				}
				break;
			}
		}

		[ServerRpc]
		public void PlayerEnterPocketDimensionServerRpc(int playerClientId, Vector3 playerLocation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1669676425u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerClientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerLocation);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1669676425u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !playerIsInPD[playerClientId])
			{
				PlayerEnterPocketDimensionClientRpc(playerClientId, playerLocation);
			}
		}

		[ClientRpc]
		private void PlayerEnterPocketDimensionClientRpc(int playerClientId, Vector3 playerLocation)
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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(3263984778u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerClientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerLocation);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3263984778u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				playerIsInPD[playerClientId] = true;
				Animator playerBodyAnimator = StartOfRound.Instance.allPlayerScripts[playerClientId].playerBodyAnimator;
				playerBodyAnimator.speed /= 2f;
				if (playerClientId == (int)NetworkManager.Singleton.LocalClientId)
				{
					localPlayerExitLocation = playerLocation;
					localPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(PocketDimensionEffect(playerClientId));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayerExitServerRpc(int playerClientId, int exitStyle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3044267319u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					BytePacker.WriteValueBitPacked(val2, exitStyle);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3044267319u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerExitClientRpc(playerClientId, exitStyle);
				}
			}
		}

		[ClientRpc]
		private void PlayerExitClientRpc(int playerClientId, int exitStyle)
		{
			//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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			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(1578820683u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerClientId);
				BytePacker.WriteValueBitPacked(val2, exitStyle);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1578820683u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerClientId];
			playerIsInPD[playerClientId] = false;
			val3.playerBodyAnimator.speed = 1f;
			if (playerClientId == (int)NetworkManager.Singleton.LocalClientId)
			{
				if (localPlayerCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(localPlayerCoroutine);
				}
				if (exitStyle != 0 && exitStyle == 1)
				{
					val3.drunkness = 0.2f;
					val3.drunknessInertia = 0.2f;
					val3.playerBodyAnimator.speed = 1f;
					val3.movementSpeed *= 3f;
					val3.SpawnPlayerAnimation();
					PlayPersonalSoundServerRpc(playerClientId, 0, 3, 0);
					Vector3 val4 = ((Random.Range(0, 3) == 0) ? scpReference.ReturnFromPDRandomLocation(localPlayerExitLocation) : localPlayerExitLocation);
					scpReference.PlaceCorrosionServerRpc(playerClientId + 2, val4);
					val3.TeleportPlayer(val4, false, 0f, false, true);
				}
			}
		}

		private IEnumerator PocketDimensionEffect(int playerClientId)
		{
			float bleedoutTimer = 45f;
			float timeSinceEntered = Time.realtimeSinceStartup;
			PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerClientId];
			PlayPersonalSoundServerRpc(playerClientId, 0, 2, 0);
			player.drunkness = 20f;
			player.movementSpeed /= 3f;
			Animator playerBodyAnimator = player.playerBodyAnimator;
			playerBodyAnimator.speed /= 2f;
			player.TeleportPlayer(mainRoomSpawn.position, false, 0f, false, true);
			player.SpawnPlayerAnimation();
			player.DropBlood(default(Vector3), true, true);
			while (!player.isPlayerDead && Time.realtimeSinceStartup - timeSinceEntered < bleedoutTimer - 4f)
			{
				yield return null;
			}
			PlayPersonalSoundServerRpc(playerClientId, 0, 0, 0);
			player.DropBlood(default(Vector3), true, true);
			player.MakeCriticallyInjured(true);
			while (!player.isPlayerDead && Time.realtimeSinceStartup - timeSinceEntered < bleedoutTimer)
			{
				player.movementSpeed -= 0.1f * Time.deltaTime;
				player.drunknessInertia += 1f * Time.deltaTime;
				yield return null;
			}
			if (player.isPlayerDead)
			{
				player.movementSpeed = 4.6f;
				player.drunkness = 0f;
				player.drunknessInertia = 0f;
			}
			else if (playerClientId == (int)((NetworkBehaviour)this).NetworkManager.LocalClientId)
			{
				int index = Random.Range(0, 2);
				PlayPersonalSoundServerRpc(playerClientId, 0, 1, index);
				PlayerDeathServerRpc(playerClientId, 1);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayerDeathServerRpc(int playerClientId, int deathStyle, Vector3 optionalExtraInfo = default(Vector3))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00a3: 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(1739410417u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerClientId);
				BytePacker.WriteValueBitPacked(val2, deathStyle);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref optionalExtraInfo);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1739410417u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerClientId];
			if (!val3.inSpecialInteractAnimation)
			{
				val3.UpdateSpecialAnimationValue(true, (short)0, 4f, false);
				switch (deathStyle)
				{
				case 1:
					DeathStyleBleedClientRpc(playerClientId);
					break;
				case 2:
					DeathStyleKneelClientRpc(playerClientId);
					break;
				case 0:
					break;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayerValueResetServerRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2197408769u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2197408769u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerValueResetClientRpc(playerClientId);
				}
			}
		}

		[ClientRpc]
		private void PlayerValueResetClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1362661378u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1362661378u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayerControllerB obj = StartOfRound.Instance.allPlayerScripts[playerClientId];
					obj.drunkness = 0f;
					obj.drunknessInertia = 0f;
					obj.playerBodyAnimator.speed = 1f;
				}
			}
		}

		public void RollForExit(int playerClientId, int roomType, Vector3 optionalVector = default(Vector3))
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			int num = Random.Range(0, 10);
			switch (roomType)
			{
			case 0:
				if (num <= 0)
				{
					DeathStyleSlam(playerClientId, optionalVector);
				}
				else if (num <= 1)
				{
					PlayerExitServerRpc(playerClientId, 1);
				}
				else if (num <= 3)
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].TeleportPlayer(mainRoomSpawn.position, false, 0f, false, true);
					personalAudios[playerClientId].PlayOneShot(personalAudioMisc[0]);
				}
				else
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].TeleportPlayer(corridorSpawn.position, false, 0f, false, true);
				}
				break;
			case 1:
				if (num <= 1)
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].TeleportPlayer(corridorSpawn.position, false, 0f, false, true);
				}
				else if (num <= 3)
				{
					PlayerExitServerRpc(playerClientId, 1);
				}
				else
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].TeleportPlayer(throneRoomSpawn.position, false, 0f, false, true);
				}
				break;
			case 2:
				if (localPlayerCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(localPlayerCoroutine);
				}
				localPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(ThroneRoomEffect(playerClientId));
				break;
			}
		}

		private IEnumerator ThroneRoomEffect(int playerClientId)
		{
			PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerClientId];
			player.drunkness = 0f;
			player.drunknessInertia = 0f;
			float timeToKneel = 10f;
			yield return (object)new WaitForSeconds(3f);
			float startTime = Time.realtimeSinceStartup;
			PlayPersonalSoundServerRpc(playerClientId, 2, 2, 0);
			bool warningMusic = false;
			while (!player.isCrouching && Time.realtimeSinceStartup - startTime < timeToKneel)
			{
				if (!warningMusic && Time.realtimeSinceStartup - startTime > timeToKneel - 4f)
				{
					warningMusic = true;
					PlayPersonalSoundServerRpc(playerClientId, 0, 1, 0);
				}
				yield return (object)new WaitForSeconds(0.1f);
			}
			if (player.isCrouching)
			{
				StopPersonalSoundServerRpc(playerClientId);
				((Component)player.gameplayCamera).transform.position = player.cameraContainerTransform.position;
				PlayerExitServerRpc(playerClientId, 1);
				yield break;
			}
			Coroutine cameraShake = ((MonoBehaviour)this).StartCoroutine(ShakePlayerCamera(player));
			yield return (object)new WaitForSeconds(4f);
			PlayPersonalSoundServerRpc(playerClientId, 0, 1, 4);
			if (cameraShake != null)
			{
				((MonoBehaviour)this).StopCoroutine(cameraShake);
			}
			((Component)player.gameplayCamera).transform.position = player.cameraContainerTransform.position;
			player.KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)8, 1, default(Vector3));
		}

		private IEnumerator ShakePlayerCamera(PlayerControllerB player)
		{
			float intensityOverTime = 0f;
			while (!player.isPlayerDead)
			{
				((Component)player.gameplayCamera).transform.position = player.cameraContainerTransform.position + Random.insideUnitSphere * intensityOverTime;
				if (intensityOverTime < 0.15f)
				{
					intensityOverTime += Time.deltaTime * 0.04f;
				}
				yield return null;
			}
			((Component)player.gameplayCamera).transform.position = player.cameraContainerTransform.position;
		}

		public void DeathStyleSlam(int playerClientId, Vector3 crushColliderPosition)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)this).StartCoroutine(SlamToWall(playerClientId, crushColliderPosition));
		}

		private IEnumerator SlamToWall(int playerClientId, Vector3 crushColliderPosition)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (playerClientId == (int)NetworkManager.Singleton.LocalClientId)
			{
				((MonoBehaviour)this).StopCoroutine(localPlayerCoroutine);
			}
			float timeSinceStart = Time.realtimeSinceStartup;
			float timeToDie = 1f;
			PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerClientId];
			Vector3 turnDirection = crushColliderPosition - ((Component)player).gameObject.transform.position;
			PlayPersonalSoundServerRpc(playerClientId, 0, 1, 3);
			while (Time.realtimeSinceStartup - timeSinceStart < timeToDie)
			{
				((Component)player).gameObject.transform.rotation = Quaternion.Lerp(((Component)player).gameObject.transform.rotation, Quaternion.LookRotation(turnDirection), Time.deltaTime * 2f);
				((Component)player).gameObject.transform.position = Vector3.Lerp(((Component)player).gameObject.transform.position, crushColliderPosition, Time.deltaTime * 2f);
				yield return null;
			}
			PlayPersonalSoundServerRpc(playerClientId, 0, 1, 5);
			yield return (object)new WaitForSeconds(0.2f);
			player.KillPlayer(new Vector3(5f, 0f, 5f), true, (CauseOfDeath)8, 1, default(Vector3));
			PlayerValueResetServerRpc(playerClientId);
		}

		[ClientRpc]
		private void DeathStyleBleedClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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(2275859956u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2275859956u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].KillPlayer(Vector3.zero, true, (CauseOfDeath)14, 0, default(Vector3));
					PlayerValueResetClientRpc(playerClientId);
				}
			}
		}

		[ClientRpc]
		private void DeathStyleKneelClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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(3024243794u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3024243794u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					StartOfRound.Instance.allPlayerScripts[playerClientId].KillPlayer(new Vector3(0f, 0f, 0f), true, (CauseOfDeath)8, 1, default(Vector3));
					PlayerValueResetClientRpc(playerClientId);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PocketDimController()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1500670558u, new RpcReceiveHandler(__rpc_handler_1500670558));
			NetworkManager.__rpc_func_table.Add(2268078427u, new RpcReceiveHandler(__rpc_handler_2268078427));
			NetworkManager.__rpc_func_table.Add(2593932004u, new RpcReceiveHandler(__rpc_handler_2593932004));
			NetworkManager.__rpc_func_table.Add(1643445409u, new RpcReceiveHandler(__rpc_handler_1643445409));
			NetworkManager.__rpc_func_table.Add(1615960182u, new RpcReceiveHandler(__rpc_handler_1615960182));
			NetworkManager.__rpc_func_table.Add(1378219553u, new RpcReceiveHandler(__rpc_handler_1378219553));
			NetworkManager.__rpc_func_table.Add(1669676425u, new RpcReceiveHandler(__rpc_handler_1669676425));
			NetworkManager.__rpc_func_table.Add(3263984778u, new RpcReceiveHandler(__rpc_handler_3263984778));
			NetworkManager.__rpc_func_table.Add(3044267319u, new RpcReceiveHandler(__rpc_handler_3044267319));
			NetworkManager.__rpc_func_table.Add(1578820683u, new RpcReceiveHandler(__rpc_handler_1578820683));
			NetworkManager.__rpc_func_table.Add(1739410417u, new RpcReceiveHandler(__rpc_handler_1739410417));
			NetworkManager.__rpc_func_table.Add(2197408769u, new RpcReceiveHandler(__rpc_handler_2197408769));
			NetworkManager.__rpc_func_table.Add(1362661378u, new RpcReceiveHandler(__rpc_handler_1362661378));
			NetworkManager.__rpc_func_table.Add(2275859956u, new RpcReceiveHandler(__rpc_handler_2275859956));
			NetworkManager.__rpc_func_table.Add(3024243794u, new RpcReceiveHandler(__rpc_handler_3024243794));
		}

		private static void __rpc_handler_1500670558(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 pocketPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pocketPosition);
				ulong sCPNetworkId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref sCPNetworkId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).RegisterSCPServerRpc(pocketPosition, sCPNetworkId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2268078427(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_004f: 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)
			//IL_0095: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int numberOfPlayers = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref numberOfPlayers);
				Vector3 pocketPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pocketPosition);
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				ulong[] networkObjects = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref networkObjects, default(ForPrimitives));
				}
				ulong sCPNetworkId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref sCPNetworkId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).RegisterSCPClientRpc(numberOfPlayers, pocketPosition, networkObjects, sCPNetworkId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2593932004(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).StopPersonalSoundServerRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1643445409(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).StopPersonalSoundClientRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1615960182(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_003d: 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_005d: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				int roomType = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref roomType);
				int audioGroup = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioGroup);
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).PlayPersonalSoundServerRpc(playerClientId, roomType, audioGroup, index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1378219553(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_003d: 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_005d: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				int roomType = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref roomType);
				int audioGroup = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioGroup);
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).PlayPersonalSoundClientRpc(playerClientId, roomType, audioGroup, index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1669676425(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				Vector3 playerLocation = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).PlayerEnterPocketDimensionServerRpc(playerClientId, playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3263984778(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0052: 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)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				Vector3 playerLocation = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).PlayerEnterPocketDimensionClientRpc(playerClientId, playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3044267319(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)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				int exitStyle = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref exitStyle);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).PlayerExitServerRpc(playerClientId, exitStyle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1578820683(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)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				int exitStyle = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref exitStyle);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).PlayerExitClientRpc(playerClientId, exitStyle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1739410417(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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				int deathStyle = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref deathStyle);
				Vector3 optionalExtraInfo = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref optionalExtraInfo);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).PlayerDeathServerRpc(playerClientId, deathStyle, optionalExtraInfo);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2197408769(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimController)(object)target).PlayerValueResetServerRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1362661378(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).PlayerValueResetClientRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2275859956(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).DeathStyleBleedClientRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3024243794(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 playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimController)(object)target).DeathStyleKneelClientRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PocketDimController";
		}
	}
	internal class pocketDimEnter : EnemyAICollisionDetect
	{
		private PlayerControllerB[] playersInsidePocketDimension;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public void Start()
		{
			playersInsidePocketDimension = (PlayerControllerB[])(object)new PlayerControllerB[RoundManager.Instance.playersManager.allPlayerObjects.Length];
		}

		public void Update()
		{
		}

		private void OnTriggerEnter(Collider other)
		{
			if (((Component)other).tag == "Player")
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				if ((Object)(object)playersInsidePocketDimension[(uint)component.playerClientId] == (Object)null)
				{
					playersInsidePocketDimension[(uint)component.playerClientId] = component;
				}
			}
		}
	}
	internal class PocketDimExit : NetworkBehaviour
	{
		[Header("Pocket Dimension")]
		public Transform pocketDimCentre;

		public PocketDimController pdController;

		[Header("This Exit's Wall")]
		public Transform crushCollider;

		[Header("This Trigger's Room Type")]
		public PocketDimController.RoomType type;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public void Awake()
		{
		}

		public void Start()
		{
		}

		private void OnTriggerEnter(Collider other)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!(((Component)other).tag == "Player"))
			{
				return;
			}
			PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
			if (component.playerClientId == NetworkManager.Singleton.LocalClientId)
			{
				if (type == PocketDimController.RoomType.MAIN)
				{
					pdController.RollForExit((int)component.playerClientId, (int)type, crushCollider.position);
				}
				else
				{
					pdController.RollForExit((int)component.playerClientId, (int)type);
				}
			}
		}

		private void OnTriggerStay(Collider other)
		{
		}

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

		protected internal override string __getTypeName()
		{
			return "PocketDimExit";
		}
	}
	internal class PocketDimSounds : NetworkBehaviour
	{
		public AudioSource soundSource;

		public AudioClip[] sounds;

		public Transform[] soundPositions;

		private float soundTimeLimit = 15f;

		private int previousSound;

		private int soundLength;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public void Awake()
		{
			soundSource.dopplerLevel = 4f;
		}

		public void Start()
		{
			soundLength = sounds.Length;
			if (((NetworkBehaviour)this).IsHost && ((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).InvokeRepeating("PlaySoundServerRpc", 0f, soundTimeLimit);
			}
		}

		public void Update()
		{
		}

		[ServerRpc]
		public void PlaySoundServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2911123905u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2911123905u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				int num = Random.Range(0, soundLength);
				if (num == previousSound)
				{
					num += 1 % soundLength;
				}
				int positionIndex = Random.Range(0, soundPositions.Length);
				PlaySoundClientRpc(num, positionIndex);
			}
		}

		[ClientRpc]
		public void PlaySoundClientRpc(int clipIndex, int positionIndex)
		{
			//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_00e3: 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(4073091247u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clipIndex);
					BytePacker.WriteValueBitPacked(val2, positionIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4073091247u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((Component)this).transform.position = soundPositions[positionIndex].position;
					soundSource.PlayOneShot(sounds[clipIndex]);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PocketDimSounds()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2911123905u, new RpcReceiveHandler(__rpc_handler_2911123905));
			NetworkManager.__rpc_func_table.Add(4073091247u, new RpcReceiveHandler(__rpc_handler_4073091247));
		}

		private static void __rpc_handler_2911123905(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PocketDimSounds)(object)target).PlaySoundServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4073091247(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)
			{
				int clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				int positionIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref positionIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PocketDimSounds)(object)target).PlaySoundClientRpc(clipIndex, positionIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PocketDimSounds";
		}
	}
	internal class SCPAI : EnemyAI, IVisibleThreat, INoiseListener
	{
		private enum State
		{
			IDLE,
			SEARCHING,
			SPOTTED,
			HUNTING,
			KILLING,
			EMERGING,
			SINKING
		}

		public enum HeadState
		{
			StartLookingAtPlayer,
			FinishedLookingAtPlayer
		}

		private enum SFX
		{
			Breathing,
			Laughing,
			Spotted,
			Chasing,
			Neck,
			Killing,
			PlayerKilled,
			Sinking,
			Emerging
		}

		private enum KillState
		{
			StaringAtPlayer,
			NeckSnap,
			DragDownIntoCorrosion
		}

		[Header("Pocket Dimension")]
		public GameObject pocketdimension;

		private GameObject pocketd;

		private PocketDimController pdController;

		[Header("Corrosion Decal")]
		public GameObject corrosion;

		private GameObject[] corrosionSpawned;

		[Header("SCP-106 Model")]
		public Transform boneHead;

		public Transform boneNeck;

		public Transform turnReference;

		public GameObject scanNode;

		public MeshRenderer mapNode;

		public SkinnedMeshRenderer scpRenderer;

		[Header("Audio Sources / Clips")]
		public AudioSource creatureStep;

		public AudioSource chaseSource;

		public AudioClip[] footstepSounds;

		public AudioClip[] spottedSounds;

		public AudioClip[] neckSounds;

		public AudioClip[] killingSounds;

		public AudioClip[] playerKilledSounds;

		public AudioClip[] corrosionSounds;

		public AudioClip sinkSFX;

		public AudioClip emergeSFX;

		public ParticleSystem creatureVFX;

		private Coroutine killCoroutine;

		private Coroutine faceCoroutine;

		private bool lookAtPlayer;

		private bool killingPlayer;

		private bool sneaking;

		private float timeAtHittingPlayer;

		private float timeAtHitByPlayer;

		private float timeAtLastSpotted;

		private float timeAtLastNoiseHeard;

		private float timeAtHuntStart;

		private float timeAtLastExit;

		private readonly float spottedSFXCooldown = 60f;

		private readonly float chaseMusicLimit = 60f;

		private readonly float emergeCooldown = 120f;

		private readonly float emergeCooldownOutside = 240f;

		private int nonDeadlyInteractions = 15;

		private int chanceForPocketDimension = 20;

		private bool stunnable = true;

		private bool canGoOutside;

		private bool canGoInsideShip;

		public ThreatType type
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
			{
				InitSCPValuesServerRpc();
			}
		}

		public override void OnDestroy()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			((Component)localPlayerController.gameplayCamera).transform.position = localPlayerController.cameraContainerTransform.position;
			((EnemyAI)this).OnDestroy();
		}

		[ServerRpc]
		public void InitSCPValuesServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3778657094u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3778657094u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				int deadly = Math.Clamp(Plugin.BoundConfig.NonDeadlyInteractions.Value, 0, 100);
				int pdChance = Math.Clamp(Plugin.BoundConfig.ChanceForPocketDimension.Value, 0, 100);
				bool value = Plugin.BoundConfig.Stunnable.Value;
				bool value2 = Plugin.BoundConfig.CanGoOutside.Value;
				bool value3 = Plugin.BoundConfig.CanGoInsideShip.Value;
				Transform closestNode = RoundManager.Instance.GetClosestNode(((Component)this).transform.position - new Vector3(0f, 400f, 0f), false);
				pocketd = Object.Instantiate<GameObject>(pocketdimension, closestNode.position - new Vector3(0f, 100f, 0f), Quaternion.identity, ((Component)this).transform);
				pocketd.GetComponent<NetworkObject>().Spawn(false);
				pdController = pocketd.GetComponentInChildren<PocketDimController>();
				ulong networkObjectId = ((Component)this).GetComponent<NetworkObject>().NetworkObjectId;
				pdController.RegisterSCPServerRpc(pocketd.transform.position, networkObjectId);
				ulong[] array = new ulong[StartOfRound.Instance.allPlayerScripts.Length + 2];
				for (int i = 0; i < array.Length; i++)
				{
					NetworkObject component = Object.Instantiate<GameObject>(corrosion, new Vector3(0f, 0f, 0f), Quaternion.Euler(90f, 0f, 0f), ((Component)this).transform).GetComponent<NetworkObject>();
					component.Spawn(false);
					component.DestroyWithScene = true;
					array[i] = component.NetworkObjectId;
				}
				InitSCPValuesClientRpc(deadly, pdChance, value, value2, value3, array);
			}
		}

		[ClientRpc]
		public void InitSCPValuesClientRpc(int deadly, int pdChance, bool stun, bool outside, bool ship, ulong[] corrosionObjects)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4285114836u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, deadly);
				BytePacker.WriteValueBitPacked(val2, pdChance);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref stun, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref outside, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref ship, default(ForPrimitives));
				bool flag = corrosionObjects != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<ulong>(corrosionObjects, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4285114836u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				nonDeadlyInteractions = deadly;
				chanceForPocketDimension = pdChance;
				stunnable = stun;
				base.enemyType.canBeStunned = stun;
				canGoOutside = false;
				canGoInsideShip = false;
				timeAtHitByPlayer = Time.realtimeSinceStartup;
				timeAtLastExit = Time.realtimeSinceStartup;
				timeAtHuntStart = Time.realtimeSinceStartup;
				timeAtLastSpotted = Time.realtimeSinceStartup - 60f;
				timeAtLastNoiseHeard = Time.realtimeSinceStartup - 15f;
				timeAtHittingPlayer = Time.realtimeSinceStartup;
				base.agent.areaMask = -1;
				NavMeshAgent agent = base.agent;
				agent.areaMask &= ~(1 << NavMesh.GetAreaFromName("Not Walkable"));
				NavMeshAgent agent2 = base.agent;
				agent2.areaMask &= ~(1 << NavMesh.GetAreaFromName("SmallSpace"));
				corrosionSpawned = (GameObject[])(object)new GameObject[corrosionObjects.Length];
				for (int i = 0; i < corrosionObjects.Length; i++)
				{
					corrosionSpawned[i] = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[corrosionObjects[i]]).gameObject;
					corrosionSpawned[i].SetActive(false);
				}
				base.creatureAnimator.SetTrigger("startStill");
				((MonoBehaviour)this).StartCoroutine(DelayAndStateClient(3f, 1));
			}
		}

		private IEnumerator DelayAndStateClient(float timeToWait, int newStateInt)
		{
			yield return (object)new WaitForSeconds(timeToWait);
			((EnemyAI)this).SwitchToBehaviourClientRpc(newStateInt);
			DoAnimationClientRpc(newStateInt);
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
		}

		public void LateUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (lookAtPlayer)
			{
				boneHead.LookAt(((Component)base.targetPlayer).transform.position);
				boneHead.Rotate(0f, 180f, -90f);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LookServerRpc(bool look)
		{
			//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 != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(186904637u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref look, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 186904637u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					LookClientRpc(look);
				}
			}
		}

		[ClientRpc]
		public void LookClientRpc(bool look)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1799032168u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref look, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1799032168u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				lookAtPlayer = look;
				if (look)
				{
					base.eye.LookAt(((Component)base.targetPlayer).gameObject.transform);
					AudioClip val3 = spottedSounds[Random.Range(0, spottedSounds.Length)];
					AudioClip val4 = neckSounds[Random.Range(0, neckSounds.Length)];
					base.creatureSFX.PlayOneShot(val3);
					base.creatureSFX.PlayOneShot(val4);
				}
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 1:
				HuntIfPlayerIsInSight();
				StopChaseMusicIfNoOneNearbyAndLimitReached();
				HuntLoneliestPlayer();
				break;
			case 3:
				if (sneaking)
				{
					SneakCheck();
				}
				SearchIfPlayerIsTooFarAway();
				break;
			}
			((EnemyAI)this).SyncPositionToClients();
		}

		private void StopChaseMusicIfNoOneNearbyAndLimitReached()
		{
			if (chaseSource.isPlaying && !(Time.realtimeSinceStartup - timeAtHuntStart < chaseMusicLimit) && !FoundClosestPlayerInRange(30f, 30f))
			{
				PlaySFXServerRpc(3, play: false);
				PlaySFXServerRpc(0, play: false);
			}
		}

		private void HuntIfPlayerIsInSight()
		{
			if (base.currentBehaviourStateIndex != 1)
			{
				return;
			}
			PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(true, true, true);
			if (!((Object)(object)closestPlayer == (Object)null))
			{
				bool num = PlayerLookingAtMe(closestPlayer);
				base.targetPlayer = closestPlayer;
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				ChangeTargetPlayerServerRpc((int)closestPlayer.playerClientId);
				if (num)
				{
					sneaking = false;
					ToStateHunting();
				}
				else
				{
					SneakOnPlayerServerRpc(changeState: true);
				}
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007a: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex == 1 && !(Time.realtimeSinceStartup - timeAtLastNoiseHeard < 15f))
			{
				((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
				float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
				float num2 = 30f * noiseLoudness;
				if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
				{
					noiseLoudness /= 2f;
					num2 /= 2f;
				}
				if (!(noiseLoudness < 0.25f) && num < num2)
				{
					((EnemyAI)this).SetDestinationToPosition(noisePosition, false);
					PlaySFXServerRpc(0);
					timeAtLastNoiseHeard = Time.realtimeSinceStartup;
				}
			}
		}

		private void SearchIfPlayerIsTooFarAway()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position);
			float num2 = 30f;
			bool flag = ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null);
			if (!TargetClosestPlayerInAnyCase() || (num > num2 && !flag))
			{
				if (Random.Range(0, 10) < 2)
				{
					FastEmergeServerRpc();
				}
				else
				{
					ToStateSearching();
				}
			}
			else if ((!base.targetPlayer.isInsideFactory && !base.isOutside) || (base.targetPlayer.isInsideFactory && base.isOutside) || (base.targetPlayer.isInHangarShipRoom && !canGoInsideShip))
			{
				ToStateSearching();
			}
			else if (((EnemyAI)this).GetPathDistance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) && base.pathDistance > 50f)
			{
				ToStateSearching();
			}
			else if (!((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true))
			{
				ToStateSearching();
			}
		}

		private void SneakCheck()
		{
			if (sneaking && PlayerLookingAtMe(base.targetPlayer))
			{
				SneakCheckServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SneakCheckServerRpc()
		{
			//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(214643892u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 214643892u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && sneaking)
				{
					SneakCheckClientRpc();
				}
			}
		}

		[ClientRpc]
		private void SneakCheckClientRpc()
		{
			//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(1193701754u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1193701754u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					sneaking = false;
					creatureStep.volume = 0.9f;
					PlaySFXClientRpc(2);
					PlaySFXClientRpc(3);
				}
			}
		}

		private void ExitEnterFacility()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if (!canGoOutside || Time.realtimeSinceStartup - timeAtLastExit < 3f || Object