Decompiled source of The Fiend v1.1.6

BepInEx/plugins/TheFiend.dll

Decompiled a month 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.6.0")]
[assembly: AssemblyInformationalVersion("1.1.6+5b2be21f4cdffd91dd9482374fb724346911a796")]
[assembly: AssemblyProduct("TheFiend")]
[assembly: AssemblyTitle("TheFiend")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.6.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;

	public AudioSource footstepSource;

	public AudioSource FiendVoice;

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

	private LungProp LungApparatus;

	public bool enableLegacy;

	private Vector3 LungApparatusPosition;

	public GameObject TargetLook;

	public ParticleSystem PS;

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

	public void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		enableLegacy = Config.EnableLegacyBehaviourConfig;
		if (enableLegacy)
		{
			TheFiendPlugin.logger.LogInfo((object)"Loaded with Legacy Behaviour, there may be bugs");
		}
		path = new NavMeshPath();
		FavSpot = ((Component)this).transform.position;
		Head = ((Component)Neck.transform.Find("mixamorig:Head")).gameObject;
		OldR = Neck.transform.localRotation;
		if ((Object)(object)animator == (Object)null)
		{
			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();
		footstepSource = ((Component)((Component)this).transform.Find("footstepSource")).GetComponent<AudioSource>();
		FiendVoice = ((Component)((Component)this).transform.Find("FiendVoice")).GetComponent<AudioSource>();
		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)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Invalid comparison between Unknown and I4
		((EnemyAI)this).Start();
		OldYScale = Main.transform.position.y;
		enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
		FiendVoice.clip = audioClips[0];
		FiendVoice.loop = true;
		FiendVoice.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?");
		}
		if (enableLegacy && (int)roundManager.currentLevel.currentWeather == 5)
		{
			PS.Play();
			((Component)PS).gameObject.GetComponent<AudioSource>().Play();
			Funky.Value = 3;
		}
	}

	public void FixedUpdate()
	{
		if (Step && !Invis.Value)
		{
			footstepSource.pitch = Random.Range(0.6f, 1f);
			footstepSource.volume = 0.7f;
			footstepSource.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_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c2a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3f: 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_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c68: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0945: Unknown result type (might be due to invalid IL or missing references)
		//IL_080e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		//IL_0729: Unknown result type (might be due to invalid IL or missing references)
		//IL_11ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_11b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_12d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f48: Unknown result type (might be due to invalid IL or missing references)
		//IL_077c: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_1132: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).DoAIInterval();
		if (enableLegacy)
		{
			((EnemyAI)this).DoAIInterval();
			if (timeOfDay.hour >= 15)
			{
				Funky.Value = 2;
			}
			if (Seeking.Value)
			{
				FiendVoice.volume = 0f;
			}
			else if (StateOfMind.Value != 3)
			{
				FiendVoice.volume = Config.Volume.Value;
			}
			if (Invis.Value)
			{
				((Renderer)skinnedMesh).enabled = false;
			}
			else
			{
				((Renderer)skinnedMesh).enabled = true;
			}
			if (Random.Range(1, 10000) == 1)
			{
				TeleportServerRpc();
			}
			if (Random.Range(1, 10000 / Funky.Value) == 1 && StateOfMind.Value == 3)
			{
				HideOnCellingServerRpc();
			}
			if (Random.Range(1, 10000 / Funky.Value) == 1 && !Seeking.Value)
			{
				ToggleSeekingServerRpc();
			}
			if (!GlobalCD.Value)
			{
				if (StateOfMind.Value < 3)
				{
					StateOfMind.Value = 0;
				}
				if (Object.op_Implicit((Object)(object)breakerBox) && !Seeking.Value)
				{
					GameObject gameObject = ((Component)breakerBox.transform.Find("Mesh")).gameObject;
					if (Vector3.Distance(Main.transform.position, gameObject.transform.position) <= 5f)
					{
						RaycastHit val = default(RaycastHit);
						if (Physics.Raycast(Neck.transform.position, gameObject.transform.position - Neck.transform.position, ref val, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enemies" })) && Vector3.Distance(((RaycastHit)(ref val)).point, gameObject.transform.position) < 2f)
						{
							StateOfMind.Value = 4;
							TargetLook = gameObject;
							if (Vector3.Distance(Main.transform.position, gameObject.transform.position) <= 2f)
							{
								BreakerBoxBreakServerRpc();
							}
						}
						else
						{
							StateOfMind.Value = 0;
						}
					}
				}
				if (((EnemyAI)this).TargetClosestPlayer(100f, false, 70f, false, false, true))
				{
					TargetLook = ((Component)base.targetPlayer).gameObject;
					if (Object.op_Implicit((Object)(object)base.targetPlayer.currentlyGrabbingObject) && ((Object)((Component)base.targetPlayer.currentlyGrabbingObject).gameObject).name.ToLower().Contains("flashlight"))
					{
						GameObject gameObject2 = ((Component)((Component)base.targetPlayer.currentlyGrabbingObject).gameObject.transform.Find("Light")).gameObject;
						Light component = gameObject2.GetComponent<Light>();
						if (((Behaviour)component).enabled && Vector3.Distance(Head.transform.position, gameObject2.transform.position) <= 2.5f)
						{
							TheFiendPlugin.logger.LogInfo((object)"Flashing The Fiend");
							FearedServerRpc(TempRage: false, uselight: true);
							LightTriggerTimes++;
						}
					}
				}
				if (StateOfMind.Value == 3 && !GlobalCD.Value && !Seeking.Value && ((EnemyAI)this).TargetClosestPlayer(100f, false, 70f, false, false, true))
				{
					TargetLook = ((Component)base.targetPlayer).gameObject;
					if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).gameObject.transform.position) <= 4f)
					{
						HideOnCellingServerRpc();
					}
				}
				if (!EatingPlayer && StateOfMind.Value <= 2 && !GlobalCD.Value && !StandingMode.Value)
				{
					if (((EnemyAI)this).TargetClosestPlayer(100f, false, 70f, false, false, true))
					{
						TargetLook = ((Component)base.targetPlayer).gameObject;
						ResetNode = true;
						if (base.agent.remainingDistance > 10f && !RageMode.Value)
						{
							OldYScale = Main.transform.position.y;
							if (!Seeking.Value)
							{
								StateOfMind.Value = 1;
								base.agent.speed = 3 + (Funky.Value - 1);
								animator.Play("Walk");
								if (CheckDoor())
								{
									if (Random.Range(1, 100) == 1 && StateOfMind.Value != 3)
									{
										HideOnCellingServerRpc();
									}
								}
								else if (Random.Range(1, 1000) == 1 && StateOfMind.Value != 3)
								{
									HideOnCellingServerRpc();
								}
							}
							else
							{
								base.agent.speed = 1f;
								animator.Play("Seeking");
								BreakDoorServerRpc();
							}
							if (Random.Range(1, Config.FlickerRngChance.Value) == 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);
							}
							if (!RageMode.Value)
							{
								base.agent.speed = 9 * Funky.Value;
							}
							else
							{
								base.agent.speed = 20 * Funky.Value;
							}
							animator.Play("Run");
							BreakDoorServerRpc();
						}
						((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
						if (Seeking.Value)
						{
							PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
							PlayerControllerB[] array2 = array;
							foreach (PlayerControllerB val2 in array2)
							{
								if (val2.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 == 0f)
						{
							ResetNode = true;
						}
						if (Random.Range(1, 100) == 1)
						{
							ResetNode = true;
						}
						TargetLook = null;
					}
					if (!GlobalCD.Value)
					{
						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.op_Implicit((Object)(object)TargetLook))
				{
					animator.Play("Walk");
					((EnemyAI)this).SetDestinationToPosition(TargetLook.transform.position, false);
				}
				if (Object.op_Implicit((Object)(object)LungApparatus) && (LungApparatusWillRage.Value || Config.WillRageAfterApparatusConfig) && !Invis.Value && !LungApparatus.isLungDocked && !hasSetRage)
				{
					SetLungLightServerRpc();
					hasSetRage = true;
				}
			}
			((EnemyAI)this).SyncPositionToClients();
			return;
		}
		if ((Object)(object)base.stunnedByPlayer != (Object)null)
		{
			FiendVoice.clip = audioClips[2];
			FiendVoice.loop = false;
			FiendVoice.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;
		}
		FiendVoice.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 val3 = breakerBox.transform.Find("Mesh");
			if ((Object)(object)val3 != (Object)null)
			{
				float num2 = Vector3.Distance(Main.transform.position, val3.position);
				if (num2 <= 5f)
				{
					RaycastHit val4 = default(RaycastHit);
					if (Physics.Raycast(Neck.transform.position, val3.position - Neck.transform.position, ref val4, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enemies" })) && Vector3.Distance(((RaycastHit)(ref val4)).point, val3.position) < 2f)
					{
						StateOfMind.Value = 4;
						TargetLook = ((Component)val3).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 (((EnemyAI)this).TargetClosestPlayer(100f, false, 70f, false, false, true))
		{
			TargetLook = ((Component)base.targetPlayer).gameObject;
			if (Object.op_Implicit((Object)(object)base.targetPlayer.currentlyGrabbingObject) && ((Object)((Component)base.targetPlayer.currentlyGrabbingObject).gameObject).name.ToLower().Contains("flashlight"))
			{
				GameObject gameObject3 = ((Component)((Component)base.targetPlayer.currentlyGrabbingObject).gameObject.transform.Find("Light")).gameObject;
				Light component2 = gameObject3.GetComponent<Light>();
				if (((Behaviour)component2).enabled && Vector3.Distance(Head.transform.position, gameObject3.transform.position) <= 2.5f)
				{
					TheFiendPlugin.logger.LogInfo((object)"Flashing The Fiend");
					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 && !hasSetRage)
		{
			SetLungLightServerRpc();
			hasSetRage = true;
		}
		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[] array3 = Object.FindObjectsOfType<PlayerControllerB>();
					PlayerControllerB[] array4 = array3;
					foreach (PlayerControllerB val5 in array4)
					{
						if (val5.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]
	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_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(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;
			((MonoBehaviour)this).StartCoroutine(Rage());
			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)
		//IL_00f6: 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(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))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		Transform val3 = ((Component)LungApparatus).transform.Find("Point Light");
		if ((Object)(object)val3 != (Object)null)
		{
			Light component = ((Component)val3).GetComponent<Light>();
			if (component != null)
			{
				component.color = Color.red;
			}
		}
		((GrabbableObject)LungApparatus).scrapValue = 300;
	}

	[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;
				FiendVoice.Stop();
				FiendVoice.clip = audioClips[Random.Range(1, 2)];
				FiendVoice.loop = false;
				FiendVoice.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;
				FiendVoice.Stop();
				FiendVoice.clip = audioClips[Random.Range(1, 2)];
				FiendVoice.loop = false;
				FiendVoice.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;
				FiendVoice.Stop();
				FiendVoice.clip = audioClips[0];
				FiendVoice.loop = true;
				FiendVoice.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;
				FiendVoice.Stop();
				FiendVoice.clip = audioClips[0];
				FiendVoice.loop = true;
				FiendVoice.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 (enableLegacy)
		{
			if (!EatingPlayer && Object.op_Implicit((Object)(object)Player))
			{
				EatingPlayer = true;
				TargetLook = null;
				base.agent.speed = 0f;
				((EnemyAI)this).SetDestinationToPosition(((Component)base.agent).transform.position, false);
				PlayerControllerB PCB = Player.GetComponent<PlayerControllerB>();
				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);
				PCB.KillPlayer(Main.transform.forward * 15f, true, (CauseOfDeath)5, 1, default(Vector3), false);
				if (((NetworkBehaviour)PCB).IsOwner)
				{
					PCB.movementSpeed = oldspeed;
				}
				yield return (object)new WaitForSeconds(1f);
				IdleSoundServerRpc();
				animator.Play("Idle");
				yield return (object)new WaitForSeconds(3f);
				yield return (object)new WaitForSeconds(2f);
				RageMode.Value = false;
				if (rotateCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(rotateCoroutine);
					rotateCoroutine = null;
				}
				if (Random.Range(1, 30) == 1)
				{
					HideOnCellingServerRpc();
				}
				EatingPlayer = false;
			}
		}
		else
		{
			if (EatingPlayer || !Object.op_Implicit((Object)(object)Player))
			{
				yield break;
			}
			PlayerControllerB PCB2 = Player.GetComponent<PlayerControllerB>();
			if (PCB2.health <= 50)
			{
				EatingPlayer = true;
				TargetLook = null;
				base.agent.speed = 0f;
				((EnemyAI)this).SetDestinationToPosition(((Component)base.agent).transform.position, false);
				float oldspeed2 = PCB2.movementSpeed;
				PCB2.movementSpeed = 0f;
				animator.Play("Grab");
				((Component)this).transform.LookAt(Player.transform.position, Vector3.up);
				rotateCoroutine = ((MonoBehaviour)this).StartCoroutine(RotatePlayerToMe(PCB2));
				SceamServerRpc();
				yield return (object)new WaitForSeconds(1.7f);
				FiendVoice.clip = audioClips[7];
				FiendVoice.loop = true;
				FiendVoice.Play();
				PCB2.KillPlayer(Main.transform.forward * 30f, true, (CauseOfDeath)6, 1, default(Vector3), false);
				PCB2.movementSpeed = oldspeed2;
				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
			{
				PCB2.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				PCB2.externalForceAutoFade += Main.transform.forward * 30f;
				animator.Play("Crawl");
				if (((NetworkBehaviour)this).IsServer)
				{
					GlobalCD.Value = true;
				}
				PCB2.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] { "Enemies" }));
				animator.Play("Hide");
				FiendVoice.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))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		if (!EatingPlayer && !StandingMode.Value)
		{
			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);
		}
		FiendVoice.maxDistance = 500f;
		FiendVoice.Stop();
		FiendVoice.clip = audioClips[5];
		FiendVoice.loop = false;
		FiendVoice.Play();
		TheFiendPlugin.logger.LogInfo((object)"We should be raging");
		yield return (object)new WaitForSeconds(9f);
		ToggleRageServerRpc(TheRageValue: true);
		FiendVoice.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_016a: 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;
		if (Invis.Value)
		{
			return;
		}
		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;
				FiendVoice.Stop();
				FiendVoice.clip = audioClips[4];
				FiendVoice.loop = false;
				FiendVoice.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_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).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.NetworkManage