Decompiled source of LCTarotCard v1.2.0

LCTarrotCard.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using JetBrains.Annotations;
using LCTarrotCard.Cards;
using LCTarrotCard.Config;
using LCTarrotCard.Event;
using LCTarrotCard.Items;
using LCTarrotCard.NetcodePatcher;
using LCTarrotCard.Patches;
using LCTarrotCard.Ressource;
using LCTarrotCard.Util;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LCTarrotCard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCTarrotCard")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9457633A-7E87-4BDB-8892-B9C127F9C677")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.3.0")]
[module: NetcodePatchedAssembly]
namespace LCTarrotCard
{
	[HarmonyPatch]
	public class Networker : NetworkBehaviour
	{
		public static bool AllowExtraLife;

		private static GameObject _networkPrefab;

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

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

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

		public static Networker Instance { get; private set; }

		[ServerRpc(RequireOwnership = false)]
		public void KillPlayerServerRpc(int playerId, Vector3 velocity, CauseOfDeath causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3834687756u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref velocity);
					((FastBufferWriter)(ref val)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3834687756u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					KillPlayerClientRpc(playerId, velocity, causeOfDeath);
				}
			}
		}

		[ClientRpc]
		public void KillPlayerClientRpc(int playerId, Vector3 velocity, CauseOfDeath causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(458956284u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref velocity);
				((FastBufferWriter)(ref val)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 458956284u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB obj = StartOfRound.Instance.allPlayerScripts[playerId];
				if (obj != null)
				{
					obj.KillPlayer(velocity, true, causeOfDeath, 0, default(Vector3), false);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetShipDoorStateServerRpc(bool opened)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2570383561u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref opened, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2570383561u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SetShipDoorStateClientRpc(opened);
				}
			}
		}

		[ClientRpc]
		public void SetShipDoorStateClientRpc(bool opened)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3853642043u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref opened, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3853642043u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			HangarShipDoor[] array = Object.FindObjectsOfType<HangarShipDoor>();
			foreach (HangarShipDoor val3 in array)
			{
				if (opened)
				{
					val3.SetDoorOpen();
					val3.doorPower = 0f;
				}
				else
				{
					val3.SetDoorClosed();
					val3.doorPower = 100f;
				}
				val3.shipDoorsAnimator.SetBool(Closed, !opened);
			}
		}

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

		[ClientRpc]
		public void OpenOrCloseRandomDoorClientRpc(int playerId, int rngSeed)
		{
			//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_00db: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4244542400u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, rngSeed);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4244542400u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Random random = new Random(rngSeed);
			DoorLock[] array = Object.FindObjectsOfType<DoorLock>();
			foreach (DoorLock val3 in array)
			{
				if (random.Next(0, 2) == 0)
				{
					val3.OpenOrCloseDoor(StartOfRound.Instance.allPlayerScripts[playerId]);
				}
			}
		}

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

		[ClientRpc]
		public void BreakerOffClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3070260538u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3070260538u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				RoundManager.Instance.SwitchPower(false);
				BreakerBox[] array = Object.FindObjectsOfType<BreakerBox>();
				BreakerBox[] array2 = array;
				foreach (BreakerBox val3 in array2)
				{
					val3.SetSwitchesOff();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AgroCoilheadOrSpawnServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3486020106u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3486020106u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			SpringManAI[] array = Object.FindObjectsOfType<SpringManAI>();
			int num = 0;
			SpringManAI[] array2 = array;
			foreach (SpringManAI val3 in array2)
			{
				if (!((EnemyAI)val3).isEnemyDead && ((NetworkBehaviour)val3).IsSpawned)
				{
					num++;
					((EnemyAI)val3).SwitchToBehaviourState(1);
					if (!SpringManAIPatch.ChasingSprings.Contains(((NetworkBehaviour)val3).NetworkObjectId))
					{
						SpringManAIPatch.ChasingSprings.Add(((NetworkBehaviour)val3).NetworkObjectId);
					}
				}
				if (num >= 2)
				{
					return;
				}
			}
			SpawnCoilheadServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnCoilheadServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(866308243u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 866308243u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Transform randomSpawnLocation = Helper.GetRandomSpawnLocation();
			if ((Object)(object)randomSpawnLocation == (Object)null)
			{
				PluginLogger.Error("No spawn location found");
				return;
			}
			Vector3 position = randomSpawnLocation.position;
			GameObject val3 = Object.Instantiate<GameObject>(Helper.Enemies.SpringMan.enemyPrefab, position, Quaternion.identity);
			val3.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val3.GetComponent<SpringManAI>());
			((EnemyAI)val3.GetComponent<SpringManAI>()).SetEnemyOutside(false);
			((EnemyAI)val3.GetComponent<SpringManAI>()).SwitchToBehaviourState(1);
			if (!SpringManAIPatch.ChasingSprings.Contains(((NetworkBehaviour)val3.GetComponent<SpringManAI>()).NetworkObjectId))
			{
				SpringManAIPatch.ChasingSprings.Add(((NetworkBehaviour)val3.GetComponent<SpringManAI>()).NetworkObjectId);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PopOrSpawnJesterServerRpc(float popDelay)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(900698346u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref popDelay, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 900698346u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			bool flag = false;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				JesterAI val3 = (JesterAI)(object)((spawnedEnemy is JesterAI) ? spawnedEnemy : null);
				if (val3 != null && !((EnemyAI)val3).isEnemyDead)
				{
					if (((EnemyAI)val3).currentBehaviourStateIndex == 2)
					{
						return;
					}
					flag = true;
				}
			}
			if (!flag)
			{
				Transform randomSpawnLocation = Helper.GetRandomSpawnLocation();
				if ((Object)(object)randomSpawnLocation == (Object)null)
				{
					PluginLogger.Error("No spawn location found");
					return;
				}
				Vector3 position = randomSpawnLocation.position;
				GameObject val4 = Object.Instantiate<GameObject>(Helper.Enemies.Jester.enemyPrefab, position, Quaternion.identity);
				val4.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val4.GetComponent<JesterAI>());
				((EnemyAI)val4.GetComponent<JesterAI>()).SetEnemyOutside(false);
				((EnemyAI)val4.GetComponent<JesterAI>()).SwitchToBehaviourState(1);
			}
			((MonoBehaviour)this).StartCoroutine(PopDelay(popDelay));
		}

		private static IEnumerator PopDelay(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			PluginLogger.Debug("Popping jesters");
			foreach (EnemyAI enemy in RoundManager.Instance.SpawnedEnemies)
			{
				JesterAI jester = (JesterAI)(object)((enemy is JesterAI) ? enemy : null);
				if (jester != null && !((EnemyAI)jester).isEnemyDead)
				{
					((EnemyAI)jester).SwitchToBehaviourState(2);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnGiantOrDogServerRpc(int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(6427069u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, amount);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 6427069u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			for (int i = 0; i < amount; i++)
			{
				Transform randomSpawnLocation = Helper.GetRandomSpawnLocation(inside: false);
				if (!((Object)(object)randomSpawnLocation == (Object)null))
				{
					Vector3 position = randomSpawnLocation.position;
					if (Random.Range(0, 2) == 0)
					{
						PluginLogger.Debug("Spawn giant");
						GameObject val3 = Object.Instantiate<GameObject>(Helper.Enemies.ForestGiant.enemyPrefab, position, Quaternion.identity);
						val3.GetComponentInChildren<NetworkObject>().Spawn(true);
						RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val3.GetComponent<ForestGiantAI>());
						((EnemyAI)val3.GetComponent<ForestGiantAI>()).SetEnemyOutside(true);
					}
					else
					{
						PluginLogger.Debug("Spawn dog");
						GameObject val4 = Object.Instantiate<GameObject>(Helper.Enemies.MouthDog.enemyPrefab, position, Quaternion.identity);
						val4.GetComponentInChildren<NetworkObject>().Spawn(true);
						RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val4.GetComponent<MouthDogAI>());
						((EnemyAI)val4.GetComponent<MouthDogAI>()).SetEnemyOutside(true);
					}
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public unsafe void TeleportRandomEntityServerRpc(Vector3 position, bool inside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1980060841u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1980060841u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			bool inside2 = inside;
			List<EnemyAI> spawnedEnemies = RoundManager.Instance.SpawnedEnemies;
			Helper.Shuffle(spawnedEnemies);
			using IEnumerator<EnemyAI> enumerator = spawnedEnemies.Where((EnemyAI enemy) => !enemy.isEnemyDead && enemy.isOutside == !inside2 && ((NetworkBehaviour)enemy).IsSpawned).GetEnumerator();
			if (enumerator.MoveNext())
			{
				EnemyAI current = enumerator.Current;
				PluginLogger.Debug("Enemy is outside ? " + current.isOutside + " player inside ? " + inside2);
				string enemyName = current.enemyType.enemyName;
				Vector3 val3 = position;
				PluginLogger.Debug("Tp " + enemyName + " to " + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString());
				TeleportEnemy(current, position);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GhostBreatheServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3054328150u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3054328150u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					GhostBreatheClientRpc(position);
				}
			}
		}

		[ClientRpc]
		public void GhostBreatheClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1597565073u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1597565073u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					AudioSource.PlayClipAtPoint(Assets.GhostBreathe, position, 4f);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TeleportEnemyAwayServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3427511879u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3427511879u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			List<EnemyAI> spawnedEnemies = RoundManager.Instance.SpawnedEnemies;
			foreach (EnemyAI item in spawnedEnemies)
			{
				Vector3 position = item.ChooseFarthestNodeFromPosition(((Component)item).transform.position, false, 0, false, 50, -1).position;
				TeleportEnemy(item, position);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TeleportPlayerServerRpc(int playerId, Vector3 position, bool inside = true, bool insideShip = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1409835055u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inside, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref insideShip, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1409835055u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					TeleportPlayerClientRpc(playerId, position, inside, insideShip);
				}
			}
		}

		[ClientRpc]
		public void TeleportPlayerClientRpc(int playerId, Vector3 position, bool inside = true, bool insideShip = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3340935527u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref inside, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref insideShip, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3340935527u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			val3.StopSinkingServerRpc();
			if (Object.op_Implicit((Object)(object)val3.currentTriggerInAnimationWith))
			{
				val3.currentTriggerInAnimationWith.CancelAnimationExternally();
			}
			val3.inSpecialInteractAnimation = false;
			val3.isClimbingLadder = false;
			val3.isInElevator = insideShip;
			val3.isInHangarShipRoom = insideShip;
			val3.isInsideFactory = inside;
			val3.averageVelocity = 0f;
			val3.velocityLastFrame = Vector3.zero;
			val3.TeleportPlayer(position, false, 0f, false, true);
			val3.beamOutParticle.Play();
			if (playerId == (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				if (val3.isInsideFactory)
				{
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val3);
				}
				else
				{
					Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(val3);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPlayerHealthServerRpc(int playerId, int health)
		{
			//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_00db: 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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2066064276u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					BytePacker.WriteValueBitPacked(val, health);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2066064276u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SetPlayerHealthClientRpc(playerId, health);
				}
			}
		}

		[ClientRpc]
		public void SetPlayerHealthClientRpc(int playerId, int health)
		{
			//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_00db: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3250666723u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, health);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3250666723u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (health <= 0)
			{
				health = 1;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			int health2 = val3.health;
			val3.health = health;
			if (((NetworkBehaviour)val3).IsOwner)
			{
				HUDManager.Instance.UpdateHealthUI(health, health2 > health);
				if (health <= 20 && !val3.criticallyInjured)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
					val3.MakeCriticallyInjured(true);
				}
				else if (val3.criticallyInjured && health > 20)
				{
					val3.MakeCriticallyInjured(false);
				}
			}
			if (health2 > health)
			{
				return;
			}
			if (((NetworkBehaviour)val3).IsOwner)
			{
				((MonoBehaviour)this).StartCoroutine(SetPlayerUI(val3, health <= 20));
				((UnityEvent)StartOfRound.Instance.LocalPlayerDamagedEvent).Invoke();
				val3.takingFallDamage = false;
				if (val3.inSpecialInteractAnimation && !val3.twoHandedAnimation)
				{
					val3.playerBodyAnimator.SetTrigger(Damage);
				}
				val3.specialAnimationWeight = 1f;
				val3.PlayQuickSpecialAnimation(0.7f);
			}
			PlayerStats obj = val3.playersManager.gameStats.allPlayerStats[val3.playerClientId];
			obj.damageTaken += health2 - health;
			val3.timeSinceTakingDamage = Time.realtimeSinceStartup;
		}

		[ServerRpc(RequireOwnership = false)]
		public void DamagePlayerServerRpc(int playerId, int damage, Vector3 velocity, CauseOfDeath causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3843812035u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					BytePacker.WriteValueBitPacked(val, damage);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref velocity);
					((FastBufferWriter)(ref val)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3843812035u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					DamagePlayerClientRpc(playerId, damage, velocity, causeOfDeath);
				}
			}
		}

		[ClientRpc]
		public void DamagePlayerClientRpc(int playerId, int damage, Vector3 velocity, CauseOfDeath causeOfDeath)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2442547416u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					BytePacker.WriteValueBitPacked(val, damage);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref velocity);
					((FastBufferWriter)(ref val)).WriteValueSafe<CauseOfDeath>(ref causeOfDeath, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2442547416u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
					val3.DamagePlayer(damage, true, true, causeOfDeath, 0, false, velocity);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MultiplyInventoryValueServerRpc(int playerId, float multiplier)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2278377068u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref multiplier, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2278377068u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					MultiplyInventoryValueClientRpc(playerId, multiplier);
				}
			}
		}

		[ClientRpc]
		public void MultiplyInventoryValueClientRpc(int playerId, float multiplier)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1897849939u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref multiplier, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1897849939u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (StartOfRound.Instance.allPlayerScripts.Length <= playerId || !StartOfRound.Instance.allPlayerScripts[playerId].isPlayerControlled)
			{
				return;
			}
			GrabbableObject[] itemSlots = StartOfRound.Instance.allPlayerScripts[playerId].ItemSlots;
			foreach (GrabbableObject val3 in itemSlots)
			{
				if ((Object)(object)val3 != (Object)null && ((Behaviour)val3).enabled && val3.itemProperties.isScrap && val3.scrapValue > 0)
				{
					val3.SetScrapValue((int)((float)val3.scrapValue * multiplier));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MultiplyRandomScrapValueServerRpc(float multiplier)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2149202328u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref multiplier, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2149202328u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					MultiplyRandomScrapValueClientRpc(multiplier, new Random().Next());
				}
			}
		}

		[ClientRpc]
		public void MultiplyRandomScrapValueClientRpc(float multiplier, int randomSeed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1951809462u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref multiplier, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val, randomSeed);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1951809462u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Random random = new Random(randomSeed);
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			GrabbableObject[] array2 = array;
			foreach (GrabbableObject val3 in array2)
			{
				if ((Object)(object)val3 != (Object)null && ((Behaviour)val3).enabled && val3.itemProperties.isScrap && val3.scrapValue > 0 && random.Next(0, 5) == 0)
				{
					val3.SetScrapValue((int)((float)val3.scrapValue * multiplier));
				}
			}
		}

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

		[ClientRpc]
		public void RevivePlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_050d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2685453368u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2685453368u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			if (!val3.isPlayerDead && !val3.isPlayerControlled)
			{
				return;
			}
			val3.ResetPlayerBloodObjects(true);
			val3.isClimbingLadder = false;
			val3.clampLooking = false;
			val3.inVehicleAnimation = false;
			val3.disableMoveInput = false;
			val3.ResetZAndXRotation();
			((Collider)val3.thisController).enabled = true;
			val3.health = 100;
			val3.hasBeenCriticallyInjured = false;
			val3.disableLookInput = false;
			val3.disableInteract = false;
			if (val3.isPlayerDead)
			{
				val3.isPlayerDead = false;
				val3.isPlayerControlled = true;
				val3.isInElevator = true;
				val3.isInHangarShipRoom = true;
				val3.isInsideFactory = false;
				val3.parentedToElevatorLastFrame = false;
				val3.overrideGameOverSpectatePivot = null;
				StartOfRound.Instance.SetPlayerObjectExtrapolate(false);
				val3.TeleportPlayer(StartOfRound.Instance.playerSpawnPositions[0].position, false, 0f, false, true);
				val3.setPositionOfDeadPlayer = false;
				val3.DisablePlayerModel(StartOfRound.Instance.allPlayerObjects[playerId], true, true);
				((Behaviour)val3.helmetLight).enabled = false;
				val3.Crouch(false);
				val3.criticallyInjured = false;
				if (Object.op_Implicit((Object)(object)val3.playerBodyAnimator))
				{
					val3.playerBodyAnimator.SetBool(Limp, false);
				}
				val3.bleedingHeavily = false;
				val3.activatingItem = false;
				val3.twoHanded = false;
				val3.inShockingMinigame = false;
				val3.inSpecialInteractAnimation = false;
				val3.freeRotationInInteractAnimation = false;
				val3.disableSyncInAnimation = false;
				val3.inAnimationWithEnemy = null;
				val3.holdingWalkieTalkie = false;
				val3.speakingToWalkieTalkie = false;
				val3.isSinking = false;
				val3.isUnderwater = false;
				val3.sinkingValue = 0f;
				val3.statusEffectAudio.Stop();
				val3.DisableJetpackControlsLocally();
				val3.health = 100;
				val3.mapRadarDotAnimator.SetBool("dead", false);
				val3.externalForceAutoFade = Vector3.zero;
				if (((NetworkBehaviour)val3).IsOwner)
				{
					HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
					val3.hasBegunSpectating = false;
					HUDManager.Instance.RemoveSpectateUI();
					HUDManager.Instance.gameOverAnimator.SetTrigger("revive");
					val3.hinderedMultiplier = 1f;
					val3.isMovementHindered = 0;
					val3.sourcesCausingSinking = 0;
					val3.reverbPreset = StartOfRound.Instance.shipReverb;
				}
			}
			if (((NetworkBehaviour)val3).IsOwner)
			{
				SoundManager.Instance.earsRingingTimer = 0f;
				val3.bleedingHeavily = false;
				val3.criticallyInjured = false;
				val3.playerBodyAnimator.SetBool(Limp, false);
				val3.health = 100;
				HUDManager.Instance.UpdateHealthUI(100, false);
				val3.spectatedPlayerScript = null;
				((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false;
				StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val3);
				((MonoBehaviour)this).StartCoroutine(SetPlayerUI(val3));
			}
			val3.voiceMuffledByEnemy = false;
			SoundManager.Instance.playerVoicePitchTargets[playerId] = 1f;
			SoundManager.Instance.SetPlayerPitch(1f, playerId);
			if (Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings))
			{
				if (!Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio))
				{
					val3.currentVoiceChatIngameSettings.InitializeComponents();
				}
				if (!Object.op_Implicit((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio))
				{
					return;
				}
				((Component)val3.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false;
			}
			RagdollGrabbableObject[] array = Object.FindObjectsOfType<RagdollGrabbableObject>();
			RagdollGrabbableObject[] array2 = array;
			foreach (RagdollGrabbableObject val4 in array2)
			{
				if (val4.ragdoll.playerObjectId != playerId)
				{
					continue;
				}
				if (!((GrabbableObject)val4).isHeld)
				{
					if (((NetworkBehaviour)this).IsServer)
					{
						if (((NetworkBehaviour)val4).NetworkObject.IsSpawned)
						{
							((NetworkBehaviour)val4).NetworkObject.Despawn(true);
						}
						else
						{
							Object.Destroy((Object)(object)((Component)val4).gameObject);
						}
					}
				}
				else if (Object.op_Implicit((Object)(object)((GrabbableObject)val4).playerHeldBy))
				{
					((GrabbableObject)val4).playerHeldBy.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3));
				}
			}
			DeadBodyInfo[] array3 = Object.FindObjectsOfType<DeadBodyInfo>();
			DeadBodyInfo[] array4 = array3;
			foreach (DeadBodyInfo val5 in array4)
			{
				if (val5.playerObjectId == playerId)
				{
					Object.Destroy((Object)(object)((Component)val5).gameObject);
				}
			}
			StartOfRound instance = StartOfRound.Instance;
			instance.livingPlayers++;
			StartOfRound.Instance.allPlayersDead = false;
			StartOfRound.Instance.UpdatePlayerVoiceEffects();
		}

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

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

		[ServerRpc(RequireOwnership = false)]
		public void ExtraLifeServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2363699914u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2363699914u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (AllowExtraLife)
				{
					PluginLogger.Debug("extra life " + StartOfRound.Instance.allPlayerScripts[playerId].playerUsername);
					AllowExtraLifeClientRpc(allow: false);
					TeleportPlayerServerRpc(playerId, StartOfRound.Instance.playerSpawnPositions[0].position, inside: false, insideShip: true);
					ExtraLifeClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void ExtraLifeClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3667127957u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3667127957u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
				val3.health = 100;
				val3.isPlayerDead = false;
				val3.MakeCriticallyInjured(false);
				if (((NetworkBehaviour)val3).IsOwner)
				{
					((MonoBehaviour)this).StartCoroutine(SetPlayerUI(val3));
					HUDManager.Instance.UpdateHealthUI(100, false);
				}
				if (((NetworkBehaviour)StartOfRound.Instance.allPlayerScripts[playerId]).IsOwner)
				{
					HUDManager.Instance.DisplayTip("Extra life", "Thanks to the high priestess card, you are given an extra chance to live", false, false, "LC_Tip1");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LittleGirlChaseServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2042389035u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2042389035u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			DressGirlAI val3 = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				DressGirlAI val4 = (DressGirlAI)(object)((spawnedEnemy is DressGirlAI) ? spawnedEnemy : null);
				if (val4 == null || ((EnemyAI)val4).isEnemyDead || !((NetworkBehaviour)val4).IsSpawned)
				{
					continue;
				}
				val3 = val4;
				break;
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Transform randomSpawnLocation = Helper.GetRandomSpawnLocation();
				if ((Object)(object)randomSpawnLocation == (Object)null)
				{
					PluginLogger.Error("No spawn location found");
					return;
				}
				Vector3 position = randomSpawnLocation.position;
				GameObject val5 = Object.Instantiate<GameObject>(Helper.Enemies.DressGirl.enemyPrefab, position, Quaternion.identity);
				val5.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val5.GetComponent<DressGirlAI>());
				((EnemyAI)val5.GetComponent<DressGirlAI>()).SetEnemyOutside(false);
				val3 = val5.GetComponent<DressGirlAI>();
			}
			val3.hauntingPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
			((MonoBehaviour)this).StartCoroutine(DelaySetGirlProperties(playerId, val3));
		}

		private IEnumerator DelaySetGirlProperties(int playerId, DressGirlAI dressGirl)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((EnemyAI)dressGirl).agent != (Object)null));
			LittleGirlChaseClientRpc(playerId, ((NetworkBehaviour)dressGirl).NetworkObjectId);
		}

		[ClientRpc]
		public void LittleGirlChaseClientRpc(int playerId, ulong networkId)
		{
			//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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2969223326u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, networkId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2969223326u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong networkId2 = networkId;
			if (playerId != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				return;
			}
			EnemyAI? obj = ((IEnumerable<EnemyAI>)RoundManager.Instance.SpawnedEnemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI enemy) => ((NetworkBehaviour)enemy).NetworkObjectId == networkId2));
			DressGirlAI val3 = (DressGirlAI)(object)((obj is DressGirlAI) ? obj : null);
			if ((Object)(object)val3 == (Object)null)
			{
				return;
			}
			PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerId];
			if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerId)
			{
				Vector3 position = ((Component)val4).transform.position + ((Component)val4).transform.forward * 5f;
				if (((NetworkBehaviour)val3).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
				{
					((EnemyAI)val3).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId);
				}
				TeleportEnemy((EnemyAI)(object)val3, position);
				((EnemyAI)val3).EnableEnemyMesh(true, true, false);
				((EnemyAI)val3).SwitchToBehaviourStateOnLocalClient(1);
				val3.staringInHaunt = false;
				val3.disappearingFromStare = false;
				((EnemyAI)val3).agent.speed = 5.25f;
				((EnemyAI)val3).creatureAnimator.SetBool("Walk", true);
				val3.timer = 0f;
				((EnemyAI)val3).SetMovingTowardsTargetPlayer(val4);
				((EnemyAI)val3).moveTowardsDestination = true;
				((EnemyAI)val3).creatureVoice.volume = 1f;
				((EnemyAI)val3).creatureVoice.clip = val3.breathingSFX;
				((EnemyAI)val3).creatureVoice.Play();
				val3.SFXVolumeLerpTo = 1f;
				((EnemyAI)val3).creatureSFX.volume = 1f;
				if (!DressGirlAIPatch.ChaseTimes.ContainsKey(((NetworkBehaviour)val3).NetworkObjectId))
				{
					DressGirlAIPatch.ChaseTimes.Add(((NetworkBehaviour)val3).NetworkObjectId, Time.time);
				}
			}
			val3.hauntingPlayer = val4;
			if (!DressGirlAIPatch.ChasingGirls.ContainsKey(((NetworkBehaviour)val3).NetworkObjectId))
			{
				DressGirlAIPatch.ChasingGirls.Add(((NetworkBehaviour)val3).NetworkObjectId, playerId);
			}
		}

		private static IEnumerator SetPlayerUI(PlayerControllerB player, bool critical = false)
		{
			yield return (object)new WaitForSeconds(0.3f);
			HUDManager.Instance.HideHUD(false);
			HUDManager.Instance.UpdateHealthUI(player.health, false);
			player.MakeCriticallyInjured(critical);
			yield return (object)new WaitForSeconds(3f);
			HUDManager.Instance.HideHUD(false);
			HUDManager.Instance.UpdateHealthUI(player.health, false);
			player.MakeCriticallyInjured(critical);
		}

		[ServerRpc(RequireOwnership = false)]
		public void AgroBrackenOrSpawnServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(587640117u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 587640117u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!StartOfRound.Instance.allPlayerScripts[playerId].isPlayerControlled)
			{
				return;
			}
			FlowermanAI val3 = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				FlowermanAI val4 = (FlowermanAI)(object)((spawnedEnemy is FlowermanAI) ? spawnedEnemy : null);
				if (val4 == null || ((EnemyAI)val4).isEnemyDead || !((NetworkBehaviour)val4).IsSpawned)
				{
					continue;
				}
				val3 = val4;
				break;
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Transform randomSpawnLocation = Helper.GetRandomSpawnLocation();
				if ((Object)(object)randomSpawnLocation == (Object)null)
				{
					PluginLogger.Error("No spawn location found");
					return;
				}
				Vector3 position = randomSpawnLocation.position;
				GameObject val5 = Object.Instantiate<GameObject>(Helper.Enemies.FlowerMan.enemyPrefab, position, Quaternion.identity);
				val5.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val5.GetComponent<FlowermanAI>());
				((EnemyAI)val5.GetComponent<FlowermanAI>()).SetEnemyOutside(false);
				val3 = val5.GetComponent<FlowermanAI>();
				((EnemyAI)val3).SyncPositionToClients();
			}
			SyncBrackenPropertiesClientRpc(playerId, ((NetworkBehaviour)val3).NetworkObjectId);
		}

		[ClientRpc]
		public void SyncBrackenPropertiesClientRpc(int playerId, ulong networkId)
		{
			//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_00db: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(997310661u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, networkId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 997310661u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong networkId2 = networkId;
			EnemyAI? obj = ((IEnumerable<EnemyAI>)RoundManager.Instance.SpawnedEnemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI enemy) => ((NetworkBehaviour)enemy).NetworkObjectId == networkId2));
			FlowermanAI val3 = (FlowermanAI)(object)((obj is FlowermanAI) ? obj : null);
			if (!((Object)(object)val3 == (Object)null))
			{
				if (!FlowermanAIPatch.AngryBrackens.ContainsKey(((NetworkBehaviour)val3).NetworkObjectId))
				{
					FlowermanAIPatch.AngryBrackens.Add(((NetworkBehaviour)val3).NetworkObjectId, new KeyValuePair<int, float>(playerId, Time.time));
				}
				((MonoBehaviour)this).StartCoroutine(SetBrackenProperties(val3, playerId));
			}
		}

		private IEnumerator SetBrackenProperties(FlowermanAI bracken, int playerId)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((EnemyAI)bracken).agent != (Object)null));
			((EnemyAI)bracken).SwitchToBehaviourState(2);
			((EnemyAI)bracken).targetPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
			bracken.angerMeter = 2.5f;
		}

		[ServerRpc(RequireOwnership = false)]
		public void DogChaseOrSpawnServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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 val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(619641325u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 619641325u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!StartOfRound.Instance.allPlayerScripts[playerId].isPlayerControlled)
			{
				return;
			}
			MouthDogAI val3 = null;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				MouthDogAI val4 = (MouthDogAI)(object)((spawnedEnemy is MouthDogAI) ? spawnedEnemy : null);
				if (val4 == null || ((EnemyAI)val4).isEnemyDead || !((NetworkBehaviour)val4).IsSpawned)
				{
					continue;
				}
				val3 = val4;
				break;
			}
			if ((Object)(object)val3 == (Object)null)
			{
				Transform randomSpawnLocation = Helper.GetRandomSpawnLocation(inside: false);
				if ((Object)(object)randomSpawnLocation == (Object)null)
				{
					PluginLogger.Error("No spawn location found");
					return;
				}
				Vector3 position = randomSpawnLocation.position;
				GameObject val5 = Object.Instantiate<GameObject>(Helper.Enemies.MouthDog.enemyPrefab, position, Quaternion.identity);
				val5.GetComponentInChildren<NetworkObject>().Spawn(true);
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)val5.GetComponent<MouthDogAI>());
				((EnemyAI)val5.GetComponent<MouthDogAI>()).SetEnemyOutside(false);
				val3 = val5.GetComponent<MouthDogAI>();
				((EnemyAI)val3).SyncPositionToClients();
			}
			SyncDogPropertiesClientRpc(playerId, ((NetworkBehaviour)val3).NetworkObjectId);
		}

		[ClientRpc]
		public void SyncDogPropertiesClientRpc(int playerId, ulong networkId)
		{
			//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_00db: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1416483757u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, networkId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1416483757u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong networkId2 = networkId;
			EnemyAI? obj = ((IEnumerable<EnemyAI>)RoundManager.Instance.SpawnedEnemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI enemy) => ((NetworkBehaviour)enemy).NetworkObjectId == networkId2));
			MouthDogAI val3 = (MouthDogAI)(object)((obj is MouthDogAI) ? obj : null);
			if (!((Object)(object)val3 == (Object)null))
			{
				if (!MouthDogAIPatch.ChasingDogs.ContainsKey(((NetworkBehaviour)val3).NetworkObjectId))
				{
					MouthDogAIPatch.ChasingDogs.Add(((NetworkBehaviour)val3).NetworkObjectId, playerId);
				}
				((MonoBehaviour)this).StartCoroutine(SetDogProperties(val3, StartOfRound.Instance.allPlayerScripts[playerId]));
			}
		}

		private IEnumerator SetDogProperties(MouthDogAI dog, PlayerControllerB player)
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)((EnemyAI)dog).agent != (Object)null));
			dog.ReactToOtherDogHowl(((Component)player).transform.position);
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetDogPathServerRpc(ulong dogId, int targetedPlayer)
		{
			//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_00db: 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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(153040076u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, dogId);
					BytePacker.WriteValueBitPacked(val, targetedPlayer);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 153040076u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					SetDogPathClientRpc(dogId, targetedPlayer);
				}
			}
		}

		[ClientRpc]
		public void SetDogPathClientRpc(ulong dogId, int targetedPlayer)
		{
			//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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3082485029u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, dogId);
				BytePacker.WriteValueBitPacked(val, targetedPlay