Decompiled source of The Fiend v1.1.2

BepInEx/plugins/TheFiend.dll

Decompiled 7 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TheFiend;
using TheFiend.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TheFiend")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+48bb7e81db3b5d88499ed1a9ba69919da3752c19")]
[assembly: AssemblyProduct("TheFiend")]
[assembly: AssemblyTitle("TheFiend")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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;
		}
	}
}
public class TheFiendAI : EnemyAI
{
	public NetworkVariable<int> StateOfMind;

	public NetworkVariable<int> Funky = new NetworkVariable<int>(1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	private Animator animator;

	public GameObject Main;

	public GameObject Neck;

	public GameObject Spine;

	public GameObject LeftHand;

	public GameObject RightHand;

	public MeshRenderer MapDot;

	public SkinnedMeshRenderer skinnedMesh;

	private float OldYScale;

	public Random enemyRandom;

	public AudioClip[] audioClips;

	public AudioClip StepClip;

	private AudioSource AS;

	private AudioSource AS2;

	private Vector3 FavSpot;

	private bool ResetNode;

	private bool EatingPlayer;

	public NetworkVariable<bool> Seeking;

	public NetworkVariable<bool> Invis;

	public NetworkVariable<bool> RageMode;

	public NetworkVariable<bool> GlobalCD;

	public NetworkVariable<bool> StandingMode;

	public NetworkVariable<bool> IsDying = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	public NetworkVariable<bool> LungApparatusWillRage = new NetworkVariable<bool>(Config.WillRageAfterApparatusConfig, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	private Coroutine rotateCoroutine;

	public Quaternion OldR;

	public bool Step;

	private Vector3 LastPos;

	private Vector3 Node;

	private int LightTriggerTimes;

	private NavMeshPath path;

	private GameObject Head;

	private GameObject breakerBox;

	private RoundManager roundManager;

	public TimeOfDay timeOfDay;

	private LungProp LungApparatus;

	private Vector3 LungApparatusPosition;

	public GameObject TargetLook;

	public override void OnNetworkSpawn()
	{
		((NetworkBehaviour)this).OnNetworkSpawn();
		if (((NetworkBehaviour)this).IsServer)
		{
			LungApparatusWillRage.Value = Config.WillRageAfterApparatusConfig;
		}
	}

	public void Awake()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//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_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		path = new NavMeshPath();
		FavSpot = ((Component)this).transform.position;
		Head = ((Component)Neck.transform.Find("mixamorig:Head")).gameObject;
		OldR = Neck.transform.localRotation;
		animator = ((Component)this).GetComponent<Animator>();
		animator.Play("Idle");
		AS = ((Component)this).GetComponent<AudioSource>();
		AS2 = Spine.GetComponent<AudioSource>();
		try
		{
			breakerBox = ((Component)Object.FindObjectOfType<BreakerBox>()).gameObject;
		}
		catch
		{
			breakerBox = null;
		}
		((EnemyAI)this).GetAINodes();
		roundManager = Object.FindObjectOfType<RoundManager>();
		timeOfDay = Object.FindObjectOfType<TimeOfDay>();
		((Renderer)MapDot).material.color = Color.red;
		if ((Object)(object)LungApparatus == (Object)null)
		{
			LungProp[] array = Object.FindObjectsOfType<LungProp>();
			LungProp[] array2 = array;
			foreach (LungProp val in array2)
			{
				if (val.isLungDocked)
				{
					LungApparatus = val;
				}
			}
		}
		AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
		AS.outputAudioMixerGroup = outputAudioMixerGroup;
	}

	public override void Start()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).Start();
		OldYScale = Main.transform.position.y;
		enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
		AS.clip = audioClips[0];
		AS.loop = true;
		AS.Play();
		if ((Object)(object)LungApparatus != (Object)null)
		{
			if (LungApparatus.isLungDocked)
			{
				TheFiendPlugin.logger.LogInfo((object)"Lung Apparatus Found");
				LungApparatusPosition = ((Component)LungApparatus).transform.position;
			}
		}
		else if ((Object)(object)LungApparatus == (Object)null)
		{
			TheFiendPlugin.logger.LogInfo((object)"Failed to find an Apparatus?");
		}
	}

	public void FixedUpdate()
	{
		if (Step && !Invis.Value)
		{
			AS2.pitch = Random.Range(0.6f, 1f);
			AS2.PlayOneShot(StepClip);
		}
	}

	public void LateUpdate()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)TargetLook != (Object)null)
		{
			Neck.transform.LookAt(TargetLook.transform, Vector3.up);
		}
		else
		{
			Neck.transform.localRotation = OldR;
		}
	}

	public override void DoAIInterval()
	{
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_0440: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0791: Unknown result type (might be due to invalid IL or missing references)
		//IL_0796: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0717: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).DoAIInterval();
		if ((Object)(object)base.stunnedByPlayer != (Object)null)
		{
			AS.clip = audioClips[2];
			AS.loop = false;
			AS.Play();
			IsDying.Value = true;
			((Renderer)skinnedMesh).enabled = false;
			Object.Destroy((Object)(object)((Component)this).gameObject, 4f);
			base.stunnedByPlayer = null;
		}
		if (IsDying.Value)
		{
			((EnemyAI)this).SyncPositionToClients();
			return;
		}
		if (timeOfDay.hour >= 15)
		{
			Funky.Value = 2;
		}
		AS.volume = ((Seeking.Value || StateOfMind.Value == 3) ? 0f : Config.VolumeConfig);
		((Renderer)skinnedMesh).enabled = !Invis.Value;
		int num = Mathf.Max(1, Funky.Value);
		if (Random.Range(1, 10000) == 1)
		{
			TeleportServerRpc();
		}
		if (StateOfMind.Value == 3 && Random.Range(1, 10000 / num) == 1)
		{
			HideOnCellingServerRpc();
		}
		if (!Seeking.Value && Random.Range(1, 10000 / num) == 1)
		{
			ToggleSeekingServerRpc();
		}
		if (GlobalCD.Value)
		{
			((EnemyAI)this).SyncPositionToClients();
			return;
		}
		if (StateOfMind.Value < 3)
		{
			StateOfMind.Value = 0;
		}
		if (Object.op_Implicit((Object)(object)breakerBox) && !Seeking.Value)
		{
			Transform val = breakerBox.transform.Find("Mesh");
			if ((Object)(object)val != (Object)null)
			{
				float num2 = Vector3.Distance(Main.transform.position, val.position);
				if (num2 <= 5f)
				{
					RaycastHit val2 = default(RaycastHit);
					if (Physics.Raycast(Neck.transform.position, val.position - Neck.transform.position, ref val2, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enemies" })) && Vector3.Distance(((RaycastHit)(ref val2)).point, val.position) < 2f)
					{
						StateOfMind.Value = 4;
						TargetLook = ((Component)val).gameObject;
						if (num2 <= 2f)
						{
							BreakerBoxBreakServerRpc();
						}
					}
					else
					{
						StateOfMind.Value = 0;
					}
				}
			}
		}
		bool flag = ((EnemyAI)this).TargetClosestPlayer(100f, false, 70f, false, false, true);
		if (flag)
		{
			TargetLook = ((Component)base.targetPlayer).gameObject;
		}
		if (flag && Object.op_Implicit((Object)(object)base.targetPlayer.currentlyHeldObject) && ((Object)((Component)base.targetPlayer.currentlyHeldObject).gameObject).name.Contains("FlashlightItem"))
		{
			Transform val3 = ((Component)base.targetPlayer.currentlyHeldObject).transform.Find("Light");
			if ((Object)(object)val3 != (Object)null)
			{
				Light component = ((Component)val3).GetComponent<Light>();
				if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled && Vector3.Distance(Head.transform.position, val3.position) <= 2.5f)
				{
					FearedServerRpc(TempRage: false, uselight: true);
					LightTriggerTimes++;
				}
			}
		}
		if (flag && StateOfMind.Value == 3 && !Seeking.Value && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 4f)
		{
			HideOnCellingServerRpc();
		}
		if (Object.op_Implicit((Object)(object)LungApparatus) && (LungApparatusWillRage.Value || Config.WillRageAfterApparatusConfig) && !Invis.Value && !LungApparatus.isLungDocked)
		{
			SetLungLightServerRpc();
		}
		if (!EatingPlayer && StateOfMind.Value <= 2 && !StandingMode.Value)
		{
			if (flag)
			{
				ResetNode = true;
				if (base.agent.remainingDistance > 10f && !RageMode.Value)
				{
					OldYScale = Main.transform.position.y;
					if (!Seeking.Value)
					{
						StateOfMind.Value = 1;
						base.agent.speed = 3 + (num - 1);
						animator.Play("Walk");
						if ((CheckDoor() && Random.Range(1, 100) == 1 && StateOfMind.Value != 3) || (!CheckDoor() && Random.Range(1, 1000) == 1 && StateOfMind.Value != 3))
						{
							HideOnCellingServerRpc();
						}
					}
					else
					{
						base.agent.speed = 1f;
						animator.Play("Seeking");
						BreakDoorServerRpc();
					}
					if (Random.Range(1, Config.FlickerRngConfig) == 1)
					{
						roundManager.FlickerLights(true, true);
					}
				}
				else if (!Seeking.Value)
				{
					StateOfMind.Value = 2;
					if ((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(45f, 60, -1) != (Object)null)
					{
						base.targetPlayer.JumpToFearLevel(0.9f, true);
					}
					base.agent.speed = (RageMode.Value ? (20 * num) : (9 * num));
					animator.Play("Run");
					BreakDoorServerRpc();
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				if (Seeking.Value)
				{
					PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
					PlayerControllerB[] array2 = array;
					foreach (PlayerControllerB val4 in array2)
					{
						if (val4.HasLineOfSightToPosition(Neck.transform.position, 45f, 60, -1f, -1))
						{
							ToggleSeekingServerRpc();
							FearedServerRpc(TempRage: true);
							break;
						}
					}
				}
			}
			else
			{
				base.agent.speed = 3f;
				if (ResetNode)
				{
					WonderVectorServerRpc(60f);
					ResetNode = false;
				}
				if (Node != Vector3.zero)
				{
					((EnemyAI)this).SetDestinationToPosition(Node, false);
				}
				else
				{
					ResetNode = true;
				}
				if (base.agent.remainingDistance <= 0.5f || Random.Range(1, 100) == 1)
				{
					ResetNode = true;
				}
				TargetLook = null;
			}
			if (base.agent.remainingDistance == 0f && StateOfMind.Value == 0 && !RageMode.Value)
			{
				animator.Play("Idle");
			}
			else if (!Seeking.Value && StateOfMind.Value == 1)
			{
				animator.Play("Walk");
			}
		}
		if (StateOfMind.Value == 4 && (Object)(object)TargetLook != (Object)null)
		{
			animator.Play("Walk");
			((EnemyAI)this).SetDestinationToPosition(TargetLook.transform.position, false);
		}
		((EnemyAI)this).SyncPositionToClients();
	}

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

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

	public void SetLungLightOnLocalClient()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		Transform val = ((Component)LungApparatus).transform.Find("Point Light");
		if ((Object)(object)val != (Object)null)
		{
			Light component = ((Component)val).GetComponent<Light>();
			if (component != null)
			{
				component.color = Color.red;
			}
		}
		((GrabbableObject)LungApparatus).scrapValue = 300;
		((MonoBehaviour)this).StartCoroutine(Rage());
	}

	[ServerRpc]
	public void ToggleSeekingServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		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 val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2185458962u, val2, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 2185458962u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			Seeking.Value = !Seeking.Value;
		}
	}

	private void OnTriggerStay(Collider collision)
	{
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: 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)
		if (Object.op_Implicit((Object)(object)((Component)collision).gameObject.GetComponent<PlayerControllerB>()) && StateOfMind.Value != 3 && !GlobalCD.Value && !Invis.Value && !IsDying.Value && !EatingPlayer && Vector3.Distance(((Component)this).transform.position, ((Component)collision).gameObject.transform.position) < 4f)
		{
			GrabServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)((Component)collision).gameObject.GetComponent<PlayerControllerB>()));
		}
	}

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

	[ClientRpc]
	public void SceamClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3334696286u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3334696286u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				AS.Stop();
				AS.clip = audioClips[Random.Range(1, 2)];
				AS.loop = false;
				AS.Play();
			}
		}
	}

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

	[ClientRpc]
	public void IdleSoundClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(469331619u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 469331619u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				AS.Stop();
				AS.clip = audioClips[0];
				AS.loop = true;
				AS.Play();
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void GrabServerRpc(NetworkBehaviourReference PlayerControllerBRef)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: 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 val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2819942690u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<NetworkBehaviourReference>(ref PlayerControllerBRef, default(ForNetworkSerializable));
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 2819942690u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = default(PlayerControllerB);
			if (((NetworkBehaviourReference)(ref PlayerControllerBRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null))
			{
				GrabClientRpc(NetworkObjectReference.op_Implicit(((Component)val3).gameObject));
			}
		}
	}

	[ClientRpc]
	public void GrabClientRpc(NetworkObjectReference networkObject)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2797167683u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable));
			((NetworkBehaviour)this).__endSendClientRpc(ref val, 2797167683u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref networkObject)).TryGet(ref val3, (NetworkManager)null))
			{
				((MonoBehaviour)this).StartCoroutine(Grabbing(((Component)val3).gameObject));
			}
		}
	}

	public IEnumerator Grabbing(GameObject Player)
	{
		if (EatingPlayer || !Object.op_Implicit((Object)(object)Player))
		{
			yield break;
		}
		PlayerControllerB PCB = Player.GetComponent<PlayerControllerB>();
		if (PCB.health <= 50)
		{
			EatingPlayer = true;
			TargetLook = null;
			base.agent.speed = 0f;
			((EnemyAI)this).SetDestinationToPosition(((Component)base.agent).transform.position, false);
			float oldspeed = PCB.movementSpeed;
			PCB.movementSpeed = 0f;
			animator.Play("Grab");
			((Component)this).transform.LookAt(Player.transform.position, Vector3.up);
			rotateCoroutine = ((MonoBehaviour)this).StartCoroutine(RotatePlayerToMe(PCB));
			SceamServerRpc();
			yield return (object)new WaitForSeconds(1.7f);
			AS.clip = audioClips[7];
			AS.loop = true;
			AS.Play();
			PCB.KillPlayer(Main.transform.forward * 30f, true, (CauseOfDeath)6, 1, default(Vector3), false);
			PCB.movementSpeed = oldspeed;
			GameObject tempHead = null;
			foreach (Transform item in RoundManager.Instance.mapPropsContainer.transform)
			{
				Transform Stuffs = item;
				if (((Object)((Component)Stuffs).gameObject).name.ToLower().Contains("head") && Vector3.Distance(((Component)this).transform.position, Stuffs.position) < 10f)
				{
					tempHead = ((Component)Stuffs).gameObject;
					Object.Destroy((Object)(object)tempHead.GetComponent<Rigidbody>());
					yield return (object)new WaitForSeconds(0.1f);
					tempHead.transform.position = LeftHand.transform.position;
					yield return (object)new WaitForSeconds(0.1f);
					tempHead.transform.SetParent(LeftHand.transform, true);
					yield return (object)new WaitForSeconds(0.1f);
					break;
				}
			}
			yield return (object)new WaitForSeconds(1f);
			if (rotateCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(rotateCoroutine);
				rotateCoroutine = null;
			}
			IdleSoundServerRpc();
			animator.Play("Idle");
			yield return (object)new WaitForSeconds(3f);
			if ((Object)(object)tempHead != (Object)null)
			{
				tempHead.transform.SetParent(RoundManager.Instance.mapPropsContainer.transform, true);
				yield return (object)new WaitForSeconds(0.1f);
				tempHead.AddComponent<Rigidbody>();
			}
			yield return (object)new WaitForSeconds(3f);
			RageMode.Value = false;
			if (Random.Range(1, 30) == 1)
			{
				HideOnCellingServerRpc();
			}
			EatingPlayer = false;
		}
		else
		{
			PCB.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
			PCB.externalForceAutoFade += Main.transform.forward * 30f;
			animator.Play("Crawl");
			if (((NetworkBehaviour)this).IsServer)
			{
				GlobalCD.Value = true;
			}
			PCB.movementAudio.PlayOneShot(audioClips[6], 1f);
			StartCooldown(1f);
		}
	}

	private IEnumerator RotatePlayerToMe(PlayerControllerB PCB)
	{
		if (Object.op_Implicit((Object)(object)PCB))
		{
			Vector3 direction = ((Component)this).transform.position - ((Component)PCB).transform.position;
			while ((Object)(object)PCB != (Object)null && PCB.health > 0)
			{
				PlayerSmoothLookAt(direction, PCB);
				yield return null;
			}
		}
	}

	private void PlayerSmoothLookAt(Vector3 newDirection, PlayerControllerB PCB)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		((Component)PCB).gameObject.transform.rotation = Quaternion.Lerp(((Component)PCB).gameObject.transform.rotation, Quaternion.LookRotation(newDirection), Time.deltaTime * 5f);
	}

	[ServerRpc(RequireOwnership = false)]
	public void HideOnCellingServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: 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)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: 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 val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(862535042u, val2, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 862535042u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		if (StateOfMind.Value != 3)
		{
			if (StateOfMind.Value <= 3)
			{
				StateOfMind.Value = 3;
				LastPos = Main.transform.position;
				OldYScale = Main.transform.position.y;
				RaycastHit val3 = default(RaycastHit);
				Physics.Raycast(Main.transform.position, ((Component)this).transform.TransformDirection(Vector3.up), ref val3, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enmies" }));
				animator.Play("Hide");
				AS.Stop();
				base.agent.speed = 0f;
				SetYLevelClientRpc(((RaycastHit)(ref val3)).point.y);
				((Renderer)MapDot).enabled = false;
			}
		}
		else if (!StandingMode.Value)
		{
			((MonoBehaviour)this).StartCoroutine(Stand());
		}
	}

	[ClientRpc]
	public void SetYLevelClientRpc(float y)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3597756483u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref y, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3597756483u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Main.transform.position = new Vector3(Main.transform.position.x, y, Main.transform.position.z);
			}
		}
	}

	public IEnumerator Stand()
	{
		StandingMode.Value = true;
		((Renderer)MapDot).enabled = true;
		Rigidbody rig = Main.AddComponent<Rigidbody>();
		rig.detectCollisions = false;
		while (Vector3.Distance(Main.transform.position, LastPos) > 1.5f)
		{
			yield return null;
		}
		Object.Destroy((Object)(object)rig);
		animator.Play("UnHide");
		yield return (object)new WaitForSeconds(0.2f);
		SetYLevelClientRpc(OldYScale);
		animator.Play("Idle");
		SceamServerRpc();
		yield return (object)new WaitForSeconds(2f);
		IdleSoundServerRpc();
		BreakDoorServerRpc();
		StateOfMind.Value = 1;
		StandingMode.Value = false;
	}

	[ServerRpc]
	public void BreakDoorServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		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 val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2228961150u, val2, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 2228961150u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		try
		{
			DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[];
			DoorLock[] array2 = array;
			foreach (DoorLock val3 in array2)
			{
				GameObject gameObject = ((Component)((Component)((Component)((Component)val3).transform.parent).transform.parent).transform.parent).gameObject;
				if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()) && Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f)
				{
					NetworkObjectReference netObjRef = NetworkObjectReference.op_Implicit(gameObject);
					Vector3 position = ((Component)base.targetPlayer).transform.position;
					Vector3 position2 = ((Component)this).transform.position;
					BashDoorClientRpc(netObjRef, position - ((Vector3)(ref position2)).normalized * 20f);
				}
			}
		}
		catch
		{
		}
	}

	[ClientRpc]
	public void BashDoorClientRpc(NetworkObjectReference netObjRef, Vector3 Position)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_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_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: 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.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2581177773u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
			((FastBufferWriter)(ref val)).WriteValueSafe(ref Position);
			((NetworkBehaviour)this).__endSendClientRpc(ref val, 2581177773u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
			{
				GameObject gameObject = ((Component)val3).gameObject;
				Rigidbody val4 = gameObject.AddComponent<Rigidbody>();
				AudioSource val5 = gameObject.AddComponent<AudioSource>();
				val5.spatialBlend = 1f;
				val5.maxDistance = 60f;
				val5.rolloffMode = (AudioRolloffMode)1;
				val5.volume = 3f;
				((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.12f));
				val4.AddForce(Position, (ForceMode)1);
				val5.PlayOneShot(audioClips[3]);
			}
		}
	}

	public bool CheckDoor()
	{
		//IL_0044: 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)
		DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[];
		DoorLock[] array2 = array;
		foreach (DoorLock val in array2)
		{
			GameObject gameObject = ((Component)((Component)((Component)val).transform.parent).transform.parent).gameObject;
			if (Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f)
			{
				return true;
			}
		}
		return false;
	}

	private IEnumerator TurnOffC(Rigidbody rigidbody, float time)
	{
		rigidbody.detectCollisions = false;
		yield return (object)new WaitForSeconds(time);
		rigidbody.detectCollisions = true;
		Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 5f);
	}

	[ServerRpc(RequireOwnership = false)]
	public void FearedServerRpc(bool TempRage, bool uselight = false)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: 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 val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3886079065u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref TempRage, default(ForPrimitives));
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref uselight, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 3886079065u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsServer)
			{
				GlobalCD.Value = true;
			}
			FearedClientRpc();
			((MonoBehaviour)this).StartCoroutine(CD(5f));
			float tempRage = 3f;
			if (uselight)
			{
				tempRage = LightTriggerTimes * 2;
			}
			if (TempRage)
			{
				((MonoBehaviour)this).StartCoroutine(SetTempRage(tempRage));
			}
		}
	}

	public IEnumerator Rage()
	{
		if (((NetworkBehaviour)this).IsServer)
		{
			GlobalCD.Value = true;
		}
		yield return (object)new WaitForSeconds(0.2f);
		animator.Play("Rage");
		PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
		PlayerControllerB[] array2 = array;
		foreach (PlayerControllerB player in array2)
		{
			player.JumpToFearLevel(0.9f, true);
		}
		AS.maxDistance = 500f;
		AS.Stop();
		AS.clip = audioClips[5];
		AS.loop = false;
		AS.Play();
		TheFiendPlugin.logger.LogInfo((object)"We should be raging");
		yield return (object)new WaitForSeconds(9f);
		ToggleRageServerRpc(TheRageValue: true);
		AS.maxDistance = 30f;
		if (((NetworkBehaviour)this).IsServer)
		{
			GlobalCD.Value = false;
		}
		yield return (object)new WaitForSeconds(20f);
		ToggleRageServerRpc(TheRageValue: false);
	}

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

	[ServerRpc(RequireOwnership = false)]
	public void TeleportServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1623300671u, val2, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 1623300671u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		Invis.Value = true;
		List<PlayerControllerB> list = new List<PlayerControllerB>();
		PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
		PlayerControllerB[] array2 = array;
		foreach (PlayerControllerB val3 in array2)
		{
			if (val3.isInsideFactory)
			{
				list.Add(val3);
			}
		}
		if (list.Count > 0)
		{
			((Component)this).transform.position = ((Component)list[Random.Range(1, list.Count)]).gameObject.transform.position;
		}
		if (((NetworkBehaviour)this).IsServer)
		{
			GlobalCD.Value = true;
		}
		((MonoBehaviour)this).StartCoroutine(CD(25f, UnInvis: true));
	}

	[ClientRpc]
	public void FearedClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3221369379u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3221369379u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				animator.Play("CoverFace");
				base.agent.speed = 0f;
				AS.Stop();
				AS.clip = audioClips[4];
				AS.loop = false;
				AS.Play();
			}
		}
	}

	public void StartCooldown(float time, bool UnInvis = false)
	{
		((MonoBehaviour)this).StartCoroutine(CD(time, UnInvis));
	}

	private IEnumerator CD(float time, bool UnInvis = false)
	{
		base.agent.speed = 0f;
		yield return (object)new WaitForSeconds(time);
		if (((NetworkBehaviour)this).IsServer)
		{
			GlobalCD.Value = false;
		}
		if (UnInvis)
		{
			Invis.Value = false;
		}
	}

	private IEnumerator StateMindCD(float time, int typenow)
	{
		yield return (object)new WaitForSeconds(time);
		StateOfMind.Value = typenow;
	}

	private IEnumerator SetTempRage(float time)
	{
		ToggleRageServerRpc(TheRageValue: true);
		yield return (object)new WaitForSeconds(time);
		ToggleRageServerRpc(TheRageValue: false);
	}

	[ServerRpc(RequireOwnership = false)]
	public void WonderVectorServerRpc(float Range)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: 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_012f: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2540260648u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref Range, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 2540260648u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			Vector3 val3 = ((Component)this).transform.position + new Vector3(Random.Range(0f - Range, Range), 0f, Random.Range(0f - Range, Range));
			if (base.agent.CalculatePath(val3, path))
			{
				Node = val3;
			}
			else
			{
				Node = Vector3.zero;
			}
		}
	}

	[ServerRpc]
	public void BreakerBoxBreakServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(180009697u, val2, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 180009697u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!Object.op_Implicit((Object)(object)breakerBox.GetComponent<Rigidbody>()))
			{
				BreakerBoxBreakClientRpc(NetworkObjectReference.op_Implicit(breakerBox));
			}
		}
	}

	[ClientRpc]
	public void BreakerBoxBreakClientRpc(NetworkObjectReference networkObjectReference)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4033774285u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable));
			((NetworkBehaviour)this).__endSendClientRpc(ref val, 4033774285u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null))
			{
				GameObject gameObject = ((Component)val3).gameObject;
				((Component)((Component)gameObject.transform.Find("Mesh")).transform.Find("PowerBoxDoor")).gameObject.AddComponent<Rigidbody>();
				Rigidbody val4 = gameObject.AddComponent<Rigidbody>();
				((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.1f));
				Vector3 val5 = Neck.transform.position - ((Component)this).transform.position;
				val4.AddForce(((Vector3)(ref val5)).normalized * 15f, (ForceMode)1);
				gameObject.GetComponent<AudioSource>().PlayOneShot(audioClips[3]);
				Object.Destroy((Object)(object)gameObject, 5f);
				gameObject = null;
				roundManager.PowerSwitchOffClientRpc();
				((MonoBehaviour)this).StartCoroutine(StateMindCD(1f, 0));
				animator.Play("Grab");
			}
		}
	}

	protected override void __initializeVariables()
	{
		if (StateOfMind == null)
		{
			throw new Exception("TheFiendAI.StateOfMind cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)StateOfMind).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StateOfMind, "StateOfMind");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)StateOfMind);
		if (Funky == null)
		{
			throw new Exception("TheFiendAI.Funky cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)Funky).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Funky, "Funky");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Funky);
		if (Seeking == null)
		{
			throw new Exception("TheFiendAI.Seeking cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)Seeking).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Seeking, "Seeking");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Seeking);
		if (Invis == null)
		{
			throw new Exception("TheFiendAI.Invis cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)Invis).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)Invis, "Invis");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)Invis);
		if (RageMode == null)
		{
			throw new Exception("TheFiendAI.RageMode cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)RageMode).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RageMode, "RageMode");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)RageMode);
		if (GlobalCD == null)
		{
			throw new Exception("TheFiendAI.GlobalCD cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)GlobalCD).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)GlobalCD, "GlobalCD");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)GlobalCD);
		if (StandingMode == null)
		{
			throw new Exception("TheFiendAI.StandingMode cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)StandingMode).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StandingMode, "StandingMode");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)StandingMode);
		if (IsDying == null)
		{
			throw new Exception("TheFiendAI.IsDying cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)IsDying).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsDying, "IsDying");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)IsDying);
		if (LungApparatusWillRage == null)
		{
			throw new Exception("TheFiendAI.LungApparatusWillRage cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)LungApparatusWillRage).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)LungApparatusWillRage, "LungApparatusWillRage");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)LungApparatusWillRage);
		((EnemyAI)this).__initializeVariables();
	}

	protected override void __initializeRpcs()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Expected O, but got Unknown
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Expected O, but got Unknown
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Expected O, but got Unknown
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Expected O, but got Unknown
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Expected O, but got Unknown
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Expected O, but got Unknown
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Expected O, but got Unknown
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Expected O, but got Unknown
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Expected O, but got Unknown
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Expected O, but got Unknown
		((NetworkBehaviour)this).__registerRpc(273572821u, new RpcReceiveHandler(__rpc_handler_273572821), "SetLungLightServerRpc");
		((NetworkBehaviour)this).__registerRpc(1681782550u, new RpcReceiveHandler(__rpc_handler_1681782550), "SetLungLightClientRpc");
		((NetworkBehaviour)this).__registerRpc(2185458962u, new RpcReceiveHandler(__rpc_handler_2185458962), "ToggleSeekingServerRpc");
		((NetworkBehaviour)this).__registerRpc(2166844155u, new RpcReceiveHandler(__rpc_handler_2166844155), "SceamServerRpc");
		((NetworkBehaviour)this).__registerRpc(3334696286u, new RpcReceiveHandler(__rpc_handler_3334696286), "SceamClientRpc");
		((NetworkBehaviour)this).__registerRpc(579005519u, new RpcReceiveHandler(__rpc_handler_579005519), "IdleSoundServerRpc");
		((NetworkBehaviour)this).__registerRpc(469331619u, new RpcReceiveHandler(__rpc_handler_469331619), "IdleSoundClientRpc");
		((NetworkBehaviour)this).__registerRpc(2819942690u, new RpcReceiveHandler(__rpc_handler_2819942690), "GrabServerRpc");
		((NetworkBehaviour)this).__registerRpc(2797167683u, new RpcReceiveHandler(__rpc_handler_2797167683), "GrabClientRpc");
		((NetworkBehaviour)this).__registerRpc(862535042u, new RpcReceiveHandler(__rpc_handler_862535042), "HideOnCellingServerRpc");
		((NetworkBehaviour)this).__registerRpc(3597756483u, new RpcReceiveHandler(__rpc_handler_3597756483), "SetYLevelClientRpc");
		((NetworkBehaviour)this).__registerRpc(2228961150u, new RpcReceiveHandler(__rpc_handler_2228961150), "BreakDoorServerRpc");
		((NetworkBehaviour)this).__registerRpc(2581177773u, new RpcReceiveHandler(__rpc_handler_2581177773), "BashDoorClientRpc");
		((NetworkBehaviour)this).__registerRpc(3886079065u, new RpcReceiveHandler(__rpc_handler_3886079065), "FearedServerRpc");
		((NetworkBehaviour)this).__registerRpc(1019923705u, new RpcReceiveHandler(__rpc_handler_1019923705), "ToggleRageServerRpc");
		((NetworkBehaviour)this).__registerRpc(1623300671u, new RpcReceiveHandler(__rpc_handler_1623300671), "TeleportServerRpc");
		((NetworkBehaviour)this).__registerRpc(3221369379u, new RpcReceiveHandler(__rpc_handler_3221369379), "FearedClientRpc");
		((NetworkBehaviour)this).__registerRpc(2540260648u, new RpcReceiveHandler(__rpc_handler_2540260648), "WonderVectorServerRpc");
		((NetworkBehaviour)this).__registerRpc(180009697u, new RpcReceiveHandler(__rpc_handler_180009697), "BreakerBoxBreakServerRpc");
		((NetworkBehaviour)this).__registerRpc(4033774285u, new RpcReceiveHandler(__rpc_handler_4033774285), "BreakerBoxBreakClientRpc");
		((EnemyAI)this).__initializeRpcs();
	}

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

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

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

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

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

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

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

	private static void __rpc_handler_2819942690(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_004f: 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)
		{
			NetworkBehaviourReference playerControllerBRef = default(NetworkBehaviourReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerControllerBRef, default(ForNetworkSerializable));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).GrabServerRpc(playerControllerBRef);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2797167683(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_004f: 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)
		{
			NetworkObjectReference networkObject = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObject, default(ForNetworkSerializable));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).GrabClientRpc(networkObject);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_3597756483(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 yLevelClientRpc = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref yLevelClientRpc, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).SetYLevelClientRpc(yLevelClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_2581177773(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_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_0060: 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 netObjRef = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
			Vector3 position = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).BashDoorClientRpc(netObjRef, position);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3886079065(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool tempRage = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref tempRage, default(ForPrimitives));
			bool uselight = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref uselight, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).FearedServerRpc(tempRage, uselight);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1019923705(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 theRageValue = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref theRageValue, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).ToggleRageServerRpc(theRageValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

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

	private static void __rpc_handler_2540260648(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 range = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref range, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).WonderVectorServerRpc(range);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_4033774285(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_004f: 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)
		{
			NetworkObjectReference networkObjectReference = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).BreakerBoxBreakClientRpc(networkObjectReference);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	protected internal override string __getTypeName()
	{
		return "TheFiendAI";
	}
}
[Serializable]
public class SyncedInstance<T>
{
	[NonSerialized]
	protected static int IntSize = 4;

	internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

	internal static bool IsClient => NetworkManager.Singleton.IsClient;

	internal static bool IsHost => NetworkManager.Singleton.IsHost;

	public static T Default { get; private set; }

	public static T Instance { get; private set; }

	public static bool Synced { get; internal set; }

	protected void InitInstance(T instance)
	{
		Default = instance;
		Instance = instance;
		IntSize = 4;
	}

	internal static void SyncInstance(byte[] data)
	{
		Instance = DeserializeFromBytes(data);
		Synced = true;
	}

	internal static void RevertSync()
	{
		Instance = Default;
		Synced = false;
	}

	public static byte[] SerializeToBytes(T val)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream memoryStream = new MemoryStream();
		try
		{
			binaryFormatter.Serialize(memoryStream, val);
			return memoryStream.ToArray();
		}
		catch (Exception arg)
		{
			TheFiendPlugin.logger.LogError((object)$"Error serializing instance: {arg}");
			return null;
		}
	}

	public static T DeserializeFromBytes(byte[] data)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream serializationStream = new MemoryStream(data);
		try
		{
			return (T)binaryFormatter.Deserialize(serializationStream);
		}
		catch (Exception arg)
		{
			TheFiendPlugin.logger.LogError((object)$"Error deserializing instance: {arg}");
			return default(T);
		}
	}
}
namespace TheFiend
{
	[Serializable]
	public class Config : SyncedInstance<Config>
	{
		public static ConfigEntry<int> SpawnChance;

		public static ConfigEntry<LevelTypes> Moon;

		public static ConfigEntry<int> FlickerRngChance;

		public static ConfigEntry<bool> WillRageAfterApparatus;

		public static ConfigEntry<float> Volume;

		public static int spawnChanceConfig;

		public static int FlickerRngConfig;

		public static bool WillRageAfterApparatusConfig;

		public static float VolumeConfig;

		public Config(ConfigFile cfg)
		{
			InitInstance(this);
			BindConfigs(cfg);
		}

		public void BindConfigs(ConfigFile cfg)
		{
			SpawnChance = cfg.Bind<int>("Fiend", "Spawn Weight", 30, "The Chance for the Fiend to Spawn indoors");
			Moon = cfg.Bind<LevelTypes>("Fiend", "Moon", (LevelTypes)(-1), "What Moon can the Fiend Spawn On?");
			FlickerRngChance = cfg.Bind<int>("Fiend", "Flicker Chance", 1000, "This is a Random Chance out of 1/1000 happening to a random Player");
			WillRageAfterApparatus = cfg.Bind<bool>("Fiend", "Rage After Apparatus", true, "Trigger his rage mode if you remove the Apparatus.");
			Volume = cfg.Bind<float>("Fiend", "Volume", 1f, "Sounds as scream and idle sound, not step sounds");
			spawnChanceConfig = SpawnChance.Value;
			FlickerRngConfig = FlickerRngChance.Value;
			WillRageAfterApparatusConfig = WillRageAfterApparatus.Value;
			VolumeConfig = Volume.Value;
		}
	}
	[BepInPlugin("com.TheFiend", "The Fiend", "1.1.2")]
	public class TheFiendPlugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("TheFiend");

		public static TheFiendPlugin instance;

		public static string RoleCompanyFolder = "Assets/TheFiend/";

		public static AssetBundle bundle;

		public static ManualLogSource logger;

		public static AssetBundle Assets;

		public static Config MyConfig { get; internal set; }

		internal Assembly assembly => Assembly.GetExecutingAssembly();

		internal string GetFilePath(string path)
		{
			return assembly.Location.Replace(assembly.GetName().Name + ".dll", path);
		}

		private void LoadAssets()
		{
			try
			{
				Assets = AssetBundle.LoadFromFile(GetFilePath("thefiend"));
			}
			catch (Exception arg)
			{
				logger.LogError((object)$"Failed to load asset bundle! {arg}");
			}
		}

		private void Awake()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			NetcodePatchAwake();
			LoadAssets();
			logger = ((BaseUnityPlugin)this).Logger;
			MyConfig = new Config(((BaseUnityPlugin)this).Config);
			EnemyType val = Assets.LoadAsset<EnemyType>("TheFiend.asset");
			TerminalNode val2 = Assets.LoadAsset<TerminalNode>("TheFiendNode.asset");
			TerminalKeyword val3 = Assets.LoadAsset<TerminalKeyword>("TheFiendKey.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Utilities.FixMixerGroups(val.enemyPrefab);
			Enemies.RegisterEnemy(val, Config.spawnChanceConfig, Config.Moon.Value, val2, val3);
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(TheFiendPlugin));
			harmony.PatchAll();
		}

		private static void NetcodePatchAwake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public void AddScrap(string Name, int Rare)
		{
			Item val = Assets.LoadAsset<Item>(Name + ".asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, Rare, (LevelTypes)(-1));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TheFiend";

		public const string PLUGIN_NAME = "TheFiend";

		public const string PLUGIN_VERSION = "1.1.2";
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
			NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
			NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
		}
	}
}
namespace TheFiend.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}