Decompiled source of JohnPaularatus v1.3.0

plugins/JohnPaularatus/JohnPaularatus.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FacilityMeltdown.API;
using GameNetcodeStuff;
using HarmonyLib;
using JohnPaularatus.Configs;
using JohnPaularatus.Intergrations;
using JohnPaularatus.NetcodePatcher;
using JohnPaularatusEnemy.Util.Extensions;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JohnPaularatus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("JohnPaularatus for Lethal Company.")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+b655090b70df059cc39edc7032511c7893b58b22")]
[assembly: AssemblyProduct("JohnPaularatus")]
[assembly: AssemblyTitle("JohnPaularatus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JohnPaularatusEnemy
{
	public abstract class JohnPaularatusEnemyEnemyAI : EnemyAI
	{
		public EnemyAI targetEnemy;

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

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

		[ClientRpc]
		public void SetFloatAnimationClientRpc(string name, float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3306963802u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3306963802u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				SetFloatAnimationOnLocalClient(name, value);
			}
		}

		public void SetFloatAnimationOnLocalClient(string name, float value)
		{
			base.creatureAnimator.SetFloat(name, value);
		}

		[ClientRpc]
		public void SetBoolAnimationClientRpc(string name, bool active)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(175126614u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 175126614u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				SetBoolAnimationOnLocalClient(name, active);
			}
		}

		public void SetBoolAnimationOnLocalClient(string name, bool active)
		{
			base.creatureAnimator.SetBool(name, active);
		}

		[ServerRpc(RequireOwnership = false)]
		public void TriggerAnimationServerRpc(string triggerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(790391139u, val, (RpcDelivery)0);
				bool flag = triggerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(triggerName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 790391139u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				TriggerAnimationClientRpc(triggerName);
			}
		}

		[ClientRpc]
		public void TriggerAnimationClientRpc(string triggerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2898210140u, val, (RpcDelivery)0);
				bool flag = triggerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(triggerName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2898210140u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				TriggerAnimationOnLocalClient(triggerName);
			}
		}

		public void TriggerAnimationOnLocalClient(string triggerName)
		{
			base.creatureAnimator.SetTrigger(triggerName);
		}

		public void ToggleEnemySounds(bool toggle)
		{
			((Behaviour)base.creatureSFX).enabled = toggle;
			((Behaviour)base.creatureVoice).enabled = toggle;
		}

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

		public void ChangeSpeedOnLocalClient(float speed)
		{
			base.agent.speed = speed;
		}

		public bool FindClosestPlayerInRange(float range)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = null;
			float num = float.MaxValue;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val2).IsSpawned && val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom && EnemyHasLineOfSightToPosition(((Component)val2).transform.position, 60f, range))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			base.targetPlayer = val;
			return true;
		}

		public bool EnemyHasLineOfSightToPosition(Vector3 pos, float width = 60f, float range = 20f, float proximityAwareness = 5f)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.eye == (Object)null)
			{
				_ = ((Component)this).transform;
			}
			else
			{
				_ = base.eye;
			}
			if (Vector3.Distance(base.eye.position, pos) >= range || Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
			{
				return false;
			}
			Vector3 val = pos - base.eye.position;
			if (!(Vector3.Angle(base.eye.forward, val) < width))
			{
				return Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness;
			}
			return true;
		}

		public bool IsPlayerReachable(PlayerControllerB PlayerToCheck)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)PlayerToCheck).transform.position, RoundManager.Instance.navHit, 2.7f, -1);
			if (!RoundManager.Instance.GotNavMeshPositionResult)
			{
				return false;
			}
			base.agent.CalculatePath(navMeshPosition, base.agent.path);
			return (int)base.agent.path.status == 0;
		}

		public float PlayerDistanceFromShip(PlayerControllerB PlayerToCheck)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)PlayerToCheck == (Object)null)
			{
				return -1f;
			}
			return Vector3.Distance(((Component)PlayerToCheck).transform.position, ((Component)StartOfRound.Instance.shipBounds).transform.position);
		}

		private float DistanceFromPlayer(PlayerControllerB player, bool IncludeYAxis)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return -1f;
			}
			if (IncludeYAxis)
			{
				return Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position);
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(((Component)player).transform.position.x, ((Component)player).transform.position.z);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.z);
			return Vector2.Distance(val, val2);
		}

		public bool AnimationIsFinished(string AnimName)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(AnimName))
			{
				return true;
			}
			currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetTargetServerRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4081938159u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, PlayerID);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4081938159u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetTargetClientRpc(PlayerID);
				}
			}
		}

		[ClientRpc]
		public void SetTargetClientRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2466207016u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, PlayerID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2466207016u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (PlayerID == -1)
				{
					base.targetPlayer = null;
				}
				else if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[PlayerID] == (Object)null))
				{
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[PlayerID];
				}
			}
		}

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

		[ClientRpc]
		public void SetEnemyTargetClientRpc(int enemyID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(721644891u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, enemyID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 721644891u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (enemyID == -1)
				{
					targetEnemy = null;
				}
				else if (!((Object)(object)RoundManager.Instance.SpawnedEnemies[enemyID] == (Object)null))
				{
					targetEnemy = RoundManager.Instance.SpawnedEnemies[enemyID];
				}
			}
		}

		public void GoThroughEntrance()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			Vector3 val = RoundManager.FindMainEntrancePosition(true, false);
			Vector3 val2 = RoundManager.FindMainEntrancePosition(true, true);
			if (base.isOutside)
			{
				((EnemyAI)this).SetDestinationToPosition(val2, false);
				if (Vector3.Distance(((Component)this).transform.position, val2) < 1f)
				{
					base.agent.Warp(val);
					SetEnemyOutsideServerRpc(setOutside: false);
				}
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(val, false);
				if (Vector3.Distance(((Component)this).transform.position, val) < 1f)
				{
					base.agent.Warp(val2);
					SetEnemyOutsideServerRpc(setOutside: true);
				}
			}
		}

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

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

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JohnPaularatusEnemyEnemyAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3306963802u, new RpcReceiveHandler(__rpc_handler_3306963802));
			NetworkManager.__rpc_func_table.Add(175126614u, new RpcReceiveHandler(__rpc_handler_175126614));
			NetworkManager.__rpc_func_table.Add(790391139u, new RpcReceiveHandler(__rpc_handler_790391139));
			NetworkManager.__rpc_func_table.Add(2898210140u, new RpcReceiveHandler(__rpc_handler_2898210140));
			NetworkManager.__rpc_func_table.Add(3223694318u, new RpcReceiveHandler(__rpc_handler_3223694318));
			NetworkManager.__rpc_func_table.Add(4081938159u, new RpcReceiveHandler(__rpc_handler_4081938159));
			NetworkManager.__rpc_func_table.Add(2466207016u, new RpcReceiveHandler(__rpc_handler_2466207016));
			NetworkManager.__rpc_func_table.Add(1859908134u, new RpcReceiveHandler(__rpc_handler_1859908134));
			NetworkManager.__rpc_func_table.Add(721644891u, new RpcReceiveHandler(__rpc_handler_721644891));
			NetworkManager.__rpc_func_table.Add(2454907994u, new RpcReceiveHandler(__rpc_handler_2454907994));
			NetworkManager.__rpc_func_table.Add(1321688020u, new RpcReceiveHandler(__rpc_handler_1321688020));
		}

		private static void __rpc_handler_3306963802(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				float value = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusEnemyEnemyAI)(object)target).SetFloatAnimationClientRpc(name, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_175126614(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusEnemyEnemyAI)(object)target).SetBoolAnimationClientRpc(name, active);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_790391139(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string triggerName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref triggerName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JohnPaularatusEnemyEnemyAI)(object)target).TriggerAnimationServerRpc(triggerName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2898210140(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string triggerName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref triggerName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusEnemyEnemyAI)(object)target).TriggerAnimationClientRpc(triggerName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_4081938159(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JohnPaularatusEnemyEnemyAI)(object)target).SetTargetServerRpc(targetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2466207016(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusEnemyEnemyAI)(object)target).SetTargetClientRpc(targetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_721644891(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int enemyTargetClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref enemyTargetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusEnemyEnemyAI)(object)target).SetEnemyTargetClientRpc(enemyTargetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "JohnPaularatusEnemyEnemyAI";
		}
	}
	internal class JohnPaularatusUtils : NetworkBehaviour
	{
		private static Random random = null;

		public static Dictionary<string, GameObject> Objects = new Dictionary<string, GameObject>();

		internal static JohnPaularatusUtils Instance { get; private set; } = null;


		private void Awake()
		{
			Instance = this;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SpawnScrapServerRpc(string itemName, Vector3 position, bool isQuest = false, bool defaultRotation = true, int valueIncrease = 0)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00e3: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(502886431u, val, (RpcDelivery)0);
				bool flag = itemName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(itemName, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isQuest, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref defaultRotation, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, valueIncrease);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 502886431u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !(itemName == string.Empty))
			{
				Plugin.samplePrefabs.TryGetValue(itemName, out var value);
				if ((Object)(object)value == (Object)null)
				{
					throw new NullReferenceException("'" + itemName + "' either isn't a JohnPaularatus scrap or not registered! This method only handles JohnPaularatus scrap!");
				}
				SpawnScrap(value, position, isQuest, defaultRotation, valueIncrease);
			}
		}

		public NetworkObjectReference SpawnScrap(Item item, Vector3 position, bool isQuest, bool defaultRotation, int valueIncrease)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return default(NetworkObjectReference);
			}
			if (random == null)
			{
				random = new Random(StartOfRound.Instance.randomMapSeed + 85);
			}
			Transform val = null;
			if ((Object)(object)val == (Object)null)
			{
				val = StartOfRound.Instance.propsContainer;
			}
			GameObject val2 = Object.Instantiate<GameObject>(item.spawnPrefab, position + Vector3.up * 0.2f, defaultRotation ? Quaternion.Euler(item.restingRotation) : Quaternion.identity, val);
			val2.GetComponent<NetworkObject>().Spawn(false);
			int num = random.Next(item.minValue + valueIncrease, item.maxValue + valueIncrease);
			ScanNodeProperties componentInChildren = val2.GetComponentInChildren<ScanNodeProperties>();
			componentInChildren.scrapValue = num;
			componentInChildren.subText = $"Value: ${num}";
			val2.GetComponent<GrabbableObject>().scrapValue = num;
			UpdateScanNodeClientRpc(new NetworkObjectReference(val2), num);
			return new NetworkObjectReference(val2);
		}

		[ClientRpc]
		public void UpdateScanNodeClientRpc(NetworkObjectReference go, int value)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3004317084u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, value);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3004317084u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject val3 = default(NetworkObject);
				((NetworkObjectReference)(ref go)).TryGet(ref val3, (NetworkManager)null);
				GrabbableObject val4 = default(GrabbableObject);
				if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.TryGetComponent<GrabbableObject>(ref val4))
				{
					val4.SetScrapValue(value);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_JohnPaularatusUtils()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(502886431u, new RpcReceiveHandler(__rpc_handler_502886431));
			NetworkManager.__rpc_func_table.Add(3004317084u, new RpcReceiveHandler(__rpc_handler_3004317084));
		}

		private static void __rpc_handler_502886431(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00c0: 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 = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string itemName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, false);
				}
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				bool isQuest = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isQuest, default(ForPrimitives));
				bool defaultRotation = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref defaultRotation, default(ForPrimitives));
				int valueIncrease = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref valueIncrease);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((JohnPaularatusUtils)(object)target).SpawnScrapServerRpc(itemName, position, isQuest, defaultRotation, valueIncrease);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3004317084(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference go = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref go, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((JohnPaularatusUtils)(object)target).UpdateScanNodeClientRpc(go, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "JohnPaularatusUtils";
		}
	}
	[BepInPlugin("JohnPaularatus", "JohnPaularatus", "1.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static EnemyType JohnPaularatusEnemyType;

		public static UnlockableItemDef JohnPaularatusUnlockableItem;

		public static GameObject UtilsPrefab;

		public static Dictionary<string, Item> samplePrefabs = new Dictionary<string, Item>();

		private readonly Harmony _harmony = new Harmony("JohnPaularatus");

		public static JohnPaularatusConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new JohnPaularatusConfig(((BaseUnityPlugin)this).Config);
			Assets.PopulateAssets();
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			UtilsPrefab = Assets.MainAssetBundle.LoadAsset<GameObject>("JohnPaularatusUtils");
			JohnPaularatusEnemyType = Assets.MainAssetBundle.LoadAsset<EnemyType>("ReadyJPObj");
			Utilities.FixMixerGroups(JohnPaularatusEnemyType.enemyPrefab);
			TerminalNode terminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("ReadyJPTN");
			TerminalKeyword terminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("ReadyJPTK");
			NetworkPrefabs.RegisterNetworkPrefab(JohnPaularatusEnemyType.enemyPrefab);
			RegisterEnemyWithConfig(BoundConfig.ConfigJohnPaularatusSpawnWeights.Value, JohnPaularatusEnemyType, terminalNode, terminalKeyword, BoundConfig.ConfigJohnPaularatusPowerLevel.Value, BoundConfig.ConfigJohnPaularatusMaxCount.Value);
			JohnPaularatusUnlockableItem = Assets.SecondaryMainAssetBundle.LoadAsset<UnlockableItemDef>("ReadyJPUnlockableItem");
			Utilities.FixMixerGroups(JohnPaularatusUnlockableItem.unlockable.prefabObject);
			NetworkPrefabs.RegisterNetworkPrefab(JohnPaularatusUnlockableItem.unlockable.prefabObject);
			Unlockables.RegisterUnlockable(JohnPaularatusUnlockableItem, 3999, (StoreType)2);
			InitializeNetworkBehaviours();
			Logger.LogInfo((object)"Plugin JohnPaularatus is loaded!");
		}

		protected void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		protected (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}

		private void InitializeNetworkBehaviours()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class Assets
	{
		public static AssetBundle MainAssetBundle;

		public static AssetBundle SecondaryMainAssetBundle;

		public static void PopulateAssets()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "readyjpassets"));
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Plugin.Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			SecondaryMainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "secondaryreadyjpassets"));
			if ((Object)(object)SecondaryMainAssetBundle == (Object)null)
			{
				Plugin.Logger.LogError((object)"Failed to load secondary custom assets.");
			}
		}
	}
	public class ReadyJP : JohnPaularatusEnemyEnemyAI
	{
		public enum State
		{
			Spawn,
			IdleAction,
			Walking,
			SearchingForApparatus,
			AttackMode,
			Death
		}

		public enum RandomActions
		{
			IdleDance,
			AdmireSelf,
			JumpingJacks,
			PushUps,
			ArmCurl,
			WalkDialogue,
			Death1,
			Death2
		}

		public NetworkAnimator networkAnimator;

		public AudioClip AttackSound;

		public AudioClip BigWalkingSound;

		public AudioClip IdleDanceSound;

		public AudioClip PushUpSound;

		public AudioClip AdmireSelfSound;

		public AudioClip JumpingJacksSound;

		public AudioClip ArmCurlSound;

		public AudioClip Death1Sound;

		public AudioClip Death2Sound;

		public AudioClip BegForApparatusSound;

		public List<AudioClip> RandomDialogueSounds = new List<AudioClip>();

		public List<AudioClip> DamageSounds = new List<AudioClip>();

		public AnimationClip SmashDoorAnimation;

		public AnimationClip MeleeAnimation;

		public GameObject LungPropPrefab;

		public GameObject Collisions;

		public GameObject DeathColliders;

		public AudioClip[] FootstepSounds;

		[NonSerialized]
		public bool meleeAttack;

		private static bool vanillaApparatus;

		private LungProp? targetLungProp;

		private bool holdingLungProp;

		private List<DoorLock> doorLocks = new List<DoorLock>();

		private readonly float idleCooldownTimer = 15f;

		private float afterSpeed;

		private float randomSoundsTimer = 10f;

		private float idleTimer = 5f;

		private float timeSinceSpinAttack = 3f;

		private float begTimer = 10f;

		private const float WALKING_SPEED = 1.5f;

		private const float SPRINTING_SPEED = 2f;

		private Coroutine? delayRoutine;

		private Coroutine? grabLungPropRoutine;

		private Coroutine? doorLockRoutine;

		private readonly List<RandomActions> randomActions = new List<RandomActions>(6)
		{
			RandomActions.IdleDance,
			RandomActions.AdmireSelf,
			RandomActions.JumpingJacks,
			RandomActions.PushUps,
			RandomActions.ArmCurl,
			RandomActions.WalkDialogue
		};

		private Random JPRandom = new Random();

		public override void Start()
		{
			base.Start();
			JPRandom = new Random(StartOfRound.Instance.randomMapSeed + 223);
		}

		public override void Update()
		{
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (((EnemyAI)this).isEnemyDead || !((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			randomSoundsTimer -= Time.deltaTime;
			timeSinceSpinAttack += Time.deltaTime;
			begTimer -= Time.deltaTime;
			if (randomSoundsTimer <= 0f && doorLockRoutine == null && grabLungPropRoutine == null && ((EnemyAI)this).currentBehaviourStateIndex == 2)
			{
				PlayRandomSoundsServerRpc();
				randomSoundsTimer = 10f;
			}
			if (doorLockRoutine == null && !holdingLungProp && grabLungPropRoutine == null)
			{
				foreach (DoorLock doorLock in doorLocks)
				{
					if (!((Object)(object)doorLock == (Object)null) && !doorLock.isDoorOpened && Vector3.Distance(((Component)doorLock).transform.position, ((Component)this).transform.position) <= 3f)
					{
						doorLockRoutine = ((MonoBehaviour)this).StartCoroutine(DoOpenDoor(doorLock));
					}
				}
			}
			if (idleTimer > 0f && doorLockRoutine == null && (((EnemyAI)this).currentBehaviourStateIndex == 2 || ((EnemyAI)this).currentBehaviourStateIndex == 3) && !((EnemyAI)this).creatureAnimator.GetBool("GrabbingAppy"))
			{
				idleTimer -= Time.deltaTime;
				if (idleTimer <= 0f)
				{
					idleTimer = idleCooldownTimer;
					((EnemyAI)this).previousBehaviourStateIndex = ((EnemyAI)this).currentBehaviourStateIndex;
					((EnemyAI)this).SwitchToBehaviourServerRpc(1);
					PerformRandomIdleAction(randomActions[JPRandom.Next(0, randomActions.Count)]);
				}
			}
			if (!((Object)(object)targetLungProp == (Object)null) && !holdingLungProp && Vector3.Distance(((Component)targetLungProp).transform.position, ((Component)this).transform.position) <= 2.5f && grabLungPropRoutine == null)
			{
				SetTargetApparatusStatusServerRpc(value: false);
				if (((GrabbableObject)targetLungProp).isHeld)
				{
					((GrabbableObject)targetLungProp).playerHeldBy.DropAllHeldItemsServerRpc();
				}
				grabLungPropRoutine = ((MonoBehaviour)this).StartCoroutine(GrabLungAnimation());
			}
		}

		private IEnumerator GrabLungAnimation()
		{
			((EnemyAI)this).creatureAnimator.SetBool("GrabbingAppy", true);
			((EnemyAI)this).agent.speed = 0f;
			yield return (object)new WaitForSeconds(10f);
			holdingLungProp = true;
			if (((NetworkBehaviour)this).IsHost && (Object)(object)targetLungProp != (Object)null)
			{
				((Component)targetLungProp).GetComponent<NetworkObject>().Despawn(true);
			}
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			((EnemyAI)this).SwitchToBehaviourServerRpc(2);
			HideOrUnhideHeldLungPropServerRpc(hide: false);
			((EnemyAI)this).creatureAnimator.SetFloat("HasAppy", 1f);
			targetLungProp = null;
			((EnemyAI)this).agent.speed = 2f;
			((EnemyAI)this).creatureAnimator.SetBool("GrabbingAppy", false);
			grabLungPropRoutine = null;
			MeltdownIntegration.TryCauseMeltdown();
		}

		private IEnumerator DoOpenDoor(DoorLock doorLock)
		{
			networkAnimator.SetTrigger("DoDoorKick");
			float previousSpeed = ((EnemyAI)this).agent.speed;
			((EnemyAI)this).agent.speed = 0f;
			yield return (object)new WaitForSeconds(SmashDoorAnimation.length);
			((EnemyAI)this).agent.speed = previousSpeed;
			if (doorLock.isLocked)
			{
				doorLock.UnlockDoorServerRpc();
			}
			doorLock.OpenDoorAsEnemyServerRpc();
			doorLockRoutine = null;
		}

		private void PerformRandomIdleAction(RandomActions randomAction)
		{
			float speed = ((EnemyAI)this).agent.speed;
			if (randomAction != RandomActions.WalkDialogue)
			{
				((EnemyAI)this).agent.speed = 0f;
			}
			if (holdingLungProp && randomAction != RandomActions.WalkDialogue)
			{
				HideOrUnhideHeldLungPropServerRpc(hide: true);
			}
			switch (randomAction)
			{
			case RandomActions.IdleDance:
				delayRoutine = ((MonoBehaviour)this).StartCoroutine(DelayGoingBackToPreviousState(IdleDanceSound.length, speed));
				PlaySpecificSoundServerRpc(0);
				break;
			case RandomActions.AdmireSelf:
				((EnemyAI)this).creatureAnimator.SetBool("AdmiringSelf", true);
				delayRoutine = ((MonoBehaviour)this).StartCoroutine(DelayGoingBackToPreviousState(AdmireSelfSound.length, speed));
				PlaySpecificSoundServerRpc(1);
				break;
			case RandomActions.JumpingJacks:
				networkAnimator.SetTrigger("DoJumpJacks");
				delayRoutine = ((MonoBehaviour)this).StartCoroutine(DelayGoingBackToPreviousState(JumpingJacksSound.length, speed));
				PlaySpecificSoundServerRpc(2);
				break;
			case RandomActions.PushUps:
				networkAnimator.SetTrigger("DoPushUp");
				delayRoutine = ((MonoBehaviour)this).StartCoroutine(DelayGoingBackToPreviousState(PushUpSound.length, speed));
				PlaySpecificSoundServerRpc(3);
				break;
			case RandomActions.ArmCurl:
				networkAnimator.SetTrigger("DoArmCurl");
				delayRoutine = ((MonoBehaviour)this).StartCoroutine(DelayGoingBackToPreviousState(ArmCurlSound.length, speed));
				PlaySpecificSoundServerRpc(4);
				break;
			case RandomActions.WalkDialogue:
				PlaySpecificSoundServerRpc(5);
				((EnemyAI)this).SwitchToBehaviourServerRpc(((EnemyAI)this).previousBehaviourStateIndex);
				break;
			}
		}

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

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

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

		[ClientRpc]
		private void PlaySpecificSoundClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(756704864u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 756704864u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				AudioClip val3 = (AudioClip)(index switch
				{
					0 => IdleDanceSound, 
					1 => AdmireSelfSound, 
					2 => JumpingJacksSound, 
					3 => PushUpSound, 
					4 => ArmCurlSound, 
					5 => BigWalkingSound, 
					6 => Death1Sound, 
					7 => Death2Sound, 
					8 => AttackSound, 
					9 => BegForApparatusSound, 
					_ => null, 
				});
				((EnemyAI)this).creatureVoice.PlayOneShot(val3);
				if (index == 8)
				{
					meleeAttack = true;
					((MonoBehaviour)this).StartCoroutine(ResetMeleeAttack());
				}
			}
		}

		private IEnumerator ResetMeleeAttack()
		{
			yield return (object)new WaitForSeconds(MeleeAnimation.length);
			meleeAttack = false;
		}

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

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

		private IEnumerator DelayGoingBackToPreviousState(float delay, float speed)
		{
			yield return (object)new WaitForSeconds(delay);
			((EnemyAI)this).agent.speed = speed;
			((EnemyAI)this).creatureAnimator.SetBool("AdmiringSelf", false);
			if (holdingLungProp)
			{
				HideOrUnhideHeldLungPropServerRpc(hide: false);
			}
			((EnemyAI)this).SwitchToBehaviourServerRpc(((EnemyAI)this).previousBehaviourStateIndex);
			NavMeshAgent agent = ((EnemyAI)this).agent;
			agent.speed += afterSpeed;
			afterSpeed = 0f;
			delayRoutine = null;
		}

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

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

		public override void DoAIInterval()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (!((EnemyAI)this).isEnemyDead)
			{
				if (((EnemyAI)this).currentBehaviourStateIndex != 1)
				{
					Animator creatureAnimator = ((EnemyAI)this).creatureAnimator;
					Vector3 velocity = ((EnemyAI)this).agent.velocity;
					creatureAnimator.SetFloat("RunSpeed", ((Vector3)(ref velocity)).magnitude / 2f);
				}
				else
				{
					((EnemyAI)this).creatureAnimator.SetFloat("RunSpeed", 0f);
				}
				switch (((EnemyAI)this).currentBehaviourStateIndex)
				{
				case 2:
					DoWalking();
					break;
				case 3:
					DoSearchingForApparatus();
					break;
				case 4:
					DoAttackMode();
					break;
				case 0:
				case 1:
				case 5:
					break;
				}
			}
		}

		private void DoWalking()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!holdingLungProp)
			{
				return;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !val.isInHangarShipRoom && !val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 10f)
				{
					SetTargetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val));
					((EnemyAI)this).StopSearch(((EnemyAI)this).currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourServerRpc(4);
				}
			}
		}

		private void DoSearchingForApparatus()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)targetLungProp != (Object)null))
			{
				return;
			}
			if ((((EnemyAI)this).isOutside && !((GrabbableObject)targetLungProp).isInFactory) || (!((EnemyAI)this).isOutside && ((GrabbableObject)targetLungProp).isInFactory))
			{
				((EnemyAI)this).agent.SetDestination(((Component)targetLungProp).transform.position);
			}
			else if ((((EnemyAI)this).isOutside && ((GrabbableObject)targetLungProp).isInFactory) || (!((EnemyAI)this).isOutside && !((GrabbableObject)targetLungProp).isInFactory))
			{
				GoThroughEntrance();
				return;
			}
			if (!((GrabbableObject)targetLungProp).isHeld)
			{
				return;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !val.isInHangarShipRoom && !val.isPlayerDead && val.isPlayerControlled && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) <= 10f && (Object)(object)val.currentlyHeldObjectServer != (Object)null && (Object)(object)val.currentlyHeldObjectServer == (Object)(object)targetLungProp && begTimer <= 0f)
				{
					begTimer = 5f;
					PlaySpecificSoundServerRpc(9);
				}
			}
		}

		private void DoAttackMode()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			if ((Object)(object)((EnemyAI)this).targetPlayer != (Object)null)
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)((EnemyAI)this).targetPlayer).transform.position, false);
			}
			if (timeSinceSpinAttack >= MeleeAnimation.length + 0.5f && holdingLungProp && (Object)(object)((EnemyAI)this).targetPlayer != (Object)null)
			{
				if (Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) <= 3f)
				{
					timeSinceSpinAttack = 0f;
					networkAnimator.SetTrigger("DoMelee");
					PlaySpecificSoundServerRpc(8);
				}
				if (Vector3.Distance(((Component)this).transform.position, ((Component)((EnemyAI)this).targetPlayer).transform.position) > 15f)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourServerRpc(2);
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (((EnemyAI)this).isEnemyDead)
			{
				return;
			}
			((EnemyAI)this).creatureVoice.PlayOneShot(DamageSounds[JPRandom.Next(0, DamageSounds.Count)]);
			if (grabLungPropRoutine == null)
			{
				((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force;
				if (delayRoutine == null)
				{
					NavMeshAgent agent = ((EnemyAI)this).agent;
					agent.speed += 0.5f;
				}
				else
				{
					afterSpeed += 0.25f;
				}
			}
			if (((EnemyAI)this).enemyHP <= 0 && !((EnemyAI)this).isEnemyDead && ((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).KillEnemy(destroy);
			((MonoBehaviour)this).StopAllCoroutines();
			Collisions.SetActive(false);
			DeathColliders.SetActive(true);
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(5);
			((EnemyAI)this).agent.speed = 0f;
			if (((NetworkBehaviour)this).IsServer)
			{
				((EnemyAI)this).creatureAnimator.SetBool("isDead", true);
				((EnemyAI)this).creatureAnimator.SetBool("GrabbingAppy", false);
				((EnemyAI)this).creatureAnimator.SetBool("AdmiringSelf", false);
				((EnemyAI)this).creatureAnimator.SetFloat("HasAppy", 0f);
				int num = JPRandom.Next(1, 3);
				string text = num.ToString();
				networkAnimator.SetTrigger("DoDeath" + text);
				if (num == 1)
				{
					PlaySpecificSoundServerRpc(6);
				}
				else
				{
					PlaySpecificSoundServerRpc(7);
				}
				if ((Object)(object)targetLungProp == (Object)null)
				{
					NetworkObjectReference val = JohnPaularatusUtils.Instance.SpawnScrap(StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == "Apparatus").First(), RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(((Component)this).transform.position, 4f, default(NavMeshHit), JPRandom, -1), isQuest: false, defaultRotation: true, 100);
				}
			}
			if (holdingLungProp)
			{
				holdingLungProp = false;
				LungPropPrefab.SetActive(false);
			}
			if ((Object)(object)targetLungProp != (Object)null)
			{
				SetTargetApparatusStatusServerRpc(value: true);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetTargetLungPropServerRpc()
		{
			//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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1120500845u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1120500845u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GameObject[] insideAINodes = RoundManager.Instance.insideAINodes;
				NetworkObjectReference val3 = JohnPaularatusUtils.Instance.SpawnScrap(StartOfRound.Instance.allItemsList.itemsList.Where((Item x) => x.itemName == "Apparatus").First(), RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(insideAINodes[JPRandom.Next(0, insideAINodes.Length)].transform.position, 4f, default(NavMeshHit), JPRandom, -1), isQuest: false, defaultRotation: true, 0);
				GameObject val4 = NetworkObjectReference.op_Implicit(val3);
				SetTargetLungPropClientRpc(new NetworkObjectReference(val4));
			}
		}

		[ClientRpc]
		private void SetTargetLungPropClientRpc(NetworkObjectReference targetLungPropRef)
		{
			//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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(694142487u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetLungPropRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 694142487u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				GameObject val3 = NetworkObjectReference.op_Implicit(targetLungPropRef);
				targetLungProp = val3.GetComponent<LungProp>();
				((GrabbableObject)targetLungProp).SetScrapValue(40);
				((EnemyAI)this).SetDestinationToPosition(((Component)targetLungProp).transform.position, false);
				if ((Object)(object)targetLungProp != (Object)null)
				{
					((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
				}
				else
				{
					Plugin.Logger.LogError((object)"targetLungProp is null");
				}
			}
		}

		public void WanderAroundForApparatusAnimEvent()
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			doorLocks = Object.FindObjectsOfType<DoorLock>().ToList();
			foreach (DoorLock doorLock in doorLocks)
			{
				if (doorLock.isLocked)
				{
					((Component)doorLock).GetComponent<NavMeshObstacle>().carving = false;
				}
			}
			List<LungProp> list = new List<LungProp>();
			list.AddRange(Object.FindObjectsByType<LungProp>((FindObjectsSortMode)1));
			list = list.Where((LungProp x) => x.isLungDocked && ((GrabbableObject)x).isInFactory).ToList();
			if (list.Count > 0 && !vanillaApparatus)
			{
				vanillaApparatus = true;
				targetLungProp = list[JPRandom.Next(0, list.Count)];
			}
			if ((Object)(object)targetLungProp == (Object)null && ((NetworkBehaviour)this).IsServer)
			{
				SetTargetLungPropServerRpc();
			}
			else if ((Object)(object)targetLungProp != (Object)null)
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)targetLungProp).transform.position, false);
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
			}
			((EnemyAI)this).agent.speed = 1.5f;
		}

		public void TriggerFootstepSoundAnimEvent()
		{
			((EnemyAI)this).creatureSFX.PlayOneShot(FootstepSounds[JPRandom.Next(0, FootstepSounds.Length)]);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ReadyJP()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1959886299u, new RpcReceiveHandler(__rpc_handler_1959886299));
			NetworkManager.__rpc_func_table.Add(4138367467u, new RpcReceiveHandler(__rpc_handler_4138367467));
			NetworkManager.__rpc_func_table.Add(1878811421u, new RpcReceiveHandler(__rpc_handler_1878811421));
			NetworkManager.__rpc_func_table.Add(756704864u, new RpcReceiveHandler(__rpc_handler_756704864));
			NetworkManager.__rpc_func_table.Add(4044406967u, new RpcReceiveHandler(__rpc_handler_4044406967));
			NetworkManager.__rpc_func_table.Add(2029294294u, new RpcReceiveHandler(__rpc_handler_2029294294));
			NetworkManager.__rpc_func_table.Add(2130081848u, new RpcReceiveHandler(__rpc_handler_2130081848));
			NetworkManager.__rpc_func_table.Add(115474244u, new RpcReceiveHandler(__rpc_handler_115474244));
			NetworkManager.__rpc_func_table.Add(1120500845u, new RpcReceiveHandler(__rpc_handler_1120500845));
			NetworkManager.__rpc_func_table.Add(694142487u, new RpcReceiveHandler(__rpc_handler_694142487));
		}

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

		private static void __rpc_handler_4138367467(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown resul