Decompiled source of The Fiend v1.0.7

TheFiend.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
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: AssemblyDescription("Your mod description.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TheFiend")]
[assembly: AssemblyTitle("TheFiend")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class TheFiendAI : EnemyAI
{
	public NetworkVariable<int> StateOfMind;

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

	private Animator animator;

	public GameObject Main;

	public GameObject Neck;

	public GameObject Spine;

	public GameObject LeftHand;

	public GameObject RightHand;

	public MeshRenderer MapDot;

	public SkinnedMeshRenderer skinnedMesh;

	private float OldYScale;

	public Random enemyRandom;

	public AudioClip[] audioClips;

	public AudioClip StepClip;

	private AudioSource AS;

	private AudioSource AS2;

	private Vector3 FavSpot;

	private bool ResetNode;

	private bool EatingPlayer;

	public NetworkVariable<bool> Seeking;

	public NetworkVariable<bool> Invis;

	public NetworkVariable<bool> RageMode;

	public NetworkVariable<bool> GlobalCD;

	public NetworkVariable<bool> StandingMode;

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

	public NetworkVariable<bool> LungApparatusWillRage = new NetworkVariable<bool>(global::TheFiend.TheFiend.WillRageAfterApparatus.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

	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 GameObject LungApparatus;

	private Vector3 LungApparatusPosition;

	public GameObject TargetLook;

	public void Awake()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		path = new NavMeshPath();
		FavSpot = ((Component)this).transform.position;
		Head = ((Component)Neck.transform.Find("mixamorig:Head")).gameObject;
		OldR = Neck.transform.localRotation;
		animator = ((Component)this).GetComponent<Animator>();
		animator.Play("Idle");
		AS = ((Component)this).GetComponent<AudioSource>();
		AS2 = Spine.GetComponent<AudioSource>();
		try
		{
			breakerBox = ((Component)Object.FindObjectOfType<BreakerBox>()).gameObject;
		}
		catch
		{
			breakerBox = null;
		}
		roundManager = Object.FindObjectOfType<RoundManager>();
		timeOfDay = Object.FindObjectOfType<TimeOfDay>();
		((Renderer)MapDot).material.color = Color.red;
		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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).Start();
		OldYScale = Main.transform.position.y;
		enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
		AS.clip = audioClips[0];
		AS.loop = true;
		AS.Play();
		LungApparatus = GameObject.Find("LungApparatus(Clone)");
		if (Object.op_Implicit((Object)(object)LungApparatus))
		{
			LungApparatusPosition = LungApparatus.transform.position;
		}
	}

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

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

	public override void DoAIInterval()
	{
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0860: Unknown result type (might be due to invalid IL or missing references)
		//IL_0865: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0877: Unknown result type (might be due to invalid IL or missing references)
		//IL_059b: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_079a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a28: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).DoAIInterval();
		if ((Object)(object)base.stunnedByPlayer != (Object)null)
		{
			AS.clip = audioClips[2];
			AS.loop = false;
			AS.Play();
			IsDying.Value = true;
			Object.Destroy((Object)(object)((Component)this).gameObject, 4f);
			base.stunnedByPlayer = null;
			((Renderer)skinnedMesh).enabled = false;
		}
		if (!IsDying.Value)
		{
			if (timeOfDay.hour >= 15)
			{
				Funky.Value = 2;
			}
			if (Seeking.Value)
			{
				AS.volume = 0f;
			}
			else if (StateOfMind.Value != 3)
			{
				AS.volume = global::TheFiend.TheFiend.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] { "Enmies" })) && 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))
				{
					TargetLook = ((Component)base.targetPlayer).gameObject;
					if (Object.op_Implicit((Object)(object)base.targetPlayer.currentlyHeldObject) && ((Object)((Component)base.targetPlayer.currentlyHeldObject).gameObject).name.Contains("FlashlightItem"))
					{
						GameObject gameObject2 = ((Component)((Component)base.targetPlayer.currentlyHeldObject).gameObject.transform.Find("Light")).gameObject;
						Light component = gameObject2.GetComponent<Light>();
						if (((Behaviour)component).enabled && Vector3.Distance(Head.transform.position, gameObject2.transform.position) <= 2.5f)
						{
							FearedServerRpc(TempRage: false, uselight: true);
							LightTriggerTimes++;
						}
					}
				}
				if (StateOfMind.Value == 3 && !GlobalCD.Value && !Seeking.Value && ((EnemyAI)this).TargetClosestPlayer(100f, false, 70f))
				{
					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))
					{
						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, global::TheFiend.TheFiend.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[];
							foreach (PlayerControllerB val2 in array)
							{
								if (val2.HasLineOfSightToPosition(Neck.transform.position, 45f, 60, -1f))
								{
									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)(object)LungApparatus != (Object)null && LungApparatusWillRage.Value && !Invis.Value && LungApparatus.transform.position != LungApparatusPosition)
				{
					((Component)LungApparatus.transform.Find("Point Light")).gameObject.GetComponent<Light>().color = Color.red;
					((GrabbableObject)LungApparatus.GetComponent<LungProp>()).scrapValue = 300;
					LungApparatus = null;
					((MonoBehaviour)this).StartCoroutine(Rage());
				}
			}
		}
		((EnemyAI)this).SyncPositionToClients();
	}

	[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_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 val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2185458962u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2185458962u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			Seeking.Value = !Seeking.Value;
		}
	}

	private void OnTriggerStay(Collider collision)
	{
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2166844155u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2166844155u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				AS.Stop();
				AS.clip = audioClips[Random.Range(1, 2)];
				AS.loop = false;
				AS.Play();
				SceamClientRpc();
			}
		}
	}

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

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

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

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

	public IEnumerator Grabbing(GameObject Player)
	{
		if (EatingPlayer || !Object.op_Implicit((Object)(object)Player))
		{
			yield break;
		}
		PlayerControllerB PCB = Player.GetComponent<PlayerControllerB>();
		if (PCB.health <= 50)
		{
			EatingPlayer = true;
			TargetLook = null;
			base.agent.speed = 0f;
			((EnemyAI)this).SetDestinationToPosition(((Component)base.agent).transform.position, false);
			float oldspeed = PCB.movementSpeed;
			PCB.movementSpeed = 0f;
			animator.Play("Grab");
			((Component)this).transform.LookAt(Player.transform.position, Vector3.up);
			((MonoBehaviour)this).StartCoroutine(RotatePlayerToMe(PCB));
			SceamServerRpc();
			yield return (object)new WaitForSeconds(1.7f);
			PCB.KillPlayer(Main.transform.forward * 30f, true, (CauseOfDeath)6, 1, default(Vector3));
			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 (Random.Range(1, 30) == 1)
			{
				HideOnCellingServerRpc();
			}
			EatingPlayer = false;
		}
		else
		{
			PCB.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
			PCB.externalForceAutoFade += Main.transform.forward * 30f;
			animator.Play("Craw");
			GlobalCD.Value = true;
			PCB.movementAudio.PlayOneShot(audioClips[6], 1f);
			StartCooldown(1f);
		}
	}

	private IEnumerator RotatePlayerToMe(PlayerControllerB PCB)
	{
		if (Object.op_Implicit((Object)(object)PCB))
		{
			Vector3 Position = ((Component)this).transform.position - ((Component)PCB).gameObject.transform.position;
			while (PCB.health != 0)
			{
				PlayerSmoothLookAt(Position, 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_0107: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(862535042u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 862535042u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		if (StateOfMind.Value != 3)
		{
			if (StateOfMind.Value <= 3)
			{
				StateOfMind.Value = 3;
				LastPos = Main.transform.position;
				OldYScale = Main.transform.position.y;
				RaycastHit val3 = default(RaycastHit);
				Physics.Raycast(Main.transform.position, ((Component)this).transform.TransformDirection(Vector3.up), ref val3, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enmies" }));
				animator.Play("Hide");
				AS.Stop();
				base.agent.speed = 0f;
				SetYLevelClientRpc(((RaycastHit)(ref val3)).point.y);
				((Renderer)MapDot).enabled = false;
			}
		}
		else if (!StandingMode.Value)
		{
			((MonoBehaviour)this).StartCoroutine(Stand());
		}
	}

	[ClientRpc]
	public void SetYLevelClientRpc(float y)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3597756483u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref y, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3597756483u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				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_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_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2228961150u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2228961150u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
		{
			return;
		}
		try
		{
			DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[];
			foreach (DoorLock val3 in array)
			{
				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 val4 = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
					BashDoorClientRpc(netObjRef, ((Vector3)(ref val4)).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_014d: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2581177773u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref Position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2581177773u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		DoorLock[] array = Object.FindObjectsOfType(typeof(DoorLock)) as DoorLock[];
		foreach (DoorLock val in array)
		{
			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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3886079065u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref TempRage, default(ForPrimitives));
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref uselight, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3886079065u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !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()
	{
		GlobalCD.Value = true;
		yield return (object)new WaitForSeconds(0.2f);
		animator.Play("Rage");
		PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
		foreach (PlayerControllerB player in array)
		{
			player.JumpToFearLevel(0.9f, true);
		}
		AS.maxDistance = 500f;
		AS.Stop();
		AS.clip = audioClips[5];
		AS.loop = false;
		AS.Play();
		yield return (object)new WaitForSeconds(9f);
		ToggleRageServerRpc(TheRageValue: true);
		AS.maxDistance = 30f;
		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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1019923705u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref TheRageValue, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1019923705u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				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_015a: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1623300671u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1623300671u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || Invis.Value)
		{
			return;
		}
		Invis.Value = true;
		List<PlayerControllerB> list = new List<PlayerControllerB>();
		PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
		foreach (PlayerControllerB val3 in array)
		{
			if (val3.isInsideFactory)
			{
				list.Add(val3);
			}
		}
		if (list.Count > 0)
		{
			((Component)this).transform.position = ((Component)list[Random.Range(1, list.Count)]).gameObject.transform.position;
		}
		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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3221369379u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3221369379u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				animator.Play("CoverFace");
				base.agent.speed = 0f;
				AS.Stop();
				AS.clip = audioClips[4];
				AS.loop = false;
				AS.Play();
			}
		}
	}

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

	private IEnumerator CD(float time, bool UnInvis = false)
	{
		base.agent.speed = 0f;
		yield return (object)new WaitForSeconds(time);
		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_00dd: 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)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2540260648u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref Range, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2540260648u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			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_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_0121: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(180009697u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 180009697u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !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_0140: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4033774285u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref networkObjectReference, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4033774285u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((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();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_TheFiendAI()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Expected O, but got Unknown
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Expected O, but got Unknown
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Expected O, but got Unknown
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Expected O, but got Unknown
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Expected O, but got Unknown
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Expected O, but got Unknown
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(2185458962u, new RpcReceiveHandler(__rpc_handler_2185458962));
		NetworkManager.__rpc_func_table.Add(2166844155u, new RpcReceiveHandler(__rpc_handler_2166844155));
		NetworkManager.__rpc_func_table.Add(3334696286u, new RpcReceiveHandler(__rpc_handler_3334696286));
		NetworkManager.__rpc_func_table.Add(579005519u, new RpcReceiveHandler(__rpc_handler_579005519));
		NetworkManager.__rpc_func_table.Add(469331619u, new RpcReceiveHandler(__rpc_handler_469331619));
		NetworkManager.__rpc_func_table.Add(2819942690u, new RpcReceiveHandler(__rpc_handler_2819942690));
		NetworkManager.__rpc_func_table.Add(2797167683u, new RpcReceiveHandler(__rpc_handler_2797167683));
		NetworkManager.__rpc_func_table.Add(862535042u, new RpcReceiveHandler(__rpc_handler_862535042));
		NetworkManager.__rpc_func_table.Add(3597756483u, new RpcReceiveHandler(__rpc_handler_3597756483));
		NetworkManager.__rpc_func_table.Add(2228961150u, new RpcReceiveHandler(__rpc_handler_2228961150));
		NetworkManager.__rpc_func_table.Add(2581177773u, new RpcReceiveHandler(__rpc_handler_2581177773));
		NetworkManager.__rpc_func_table.Add(3886079065u, new RpcReceiveHandler(__rpc_handler_3886079065));
		NetworkManager.__rpc_func_table.Add(1019923705u, new RpcReceiveHandler(__rpc_handler_1019923705));
		NetworkManager.__rpc_func_table.Add(1623300671u, new RpcReceiveHandler(__rpc_handler_1623300671));
		NetworkManager.__rpc_func_table.Add(3221369379u, new RpcReceiveHandler(__rpc_handler_3221369379));
		NetworkManager.__rpc_func_table.Add(2540260648u, new RpcReceiveHandler(__rpc_handler_2540260648));
		NetworkManager.__rpc_func_table.Add(180009697u, new RpcReceiveHandler(__rpc_handler_180009697));
		NetworkManager.__rpc_func_table.Add(4033774285u, new RpcReceiveHandler(__rpc_handler_4033774285));
	}

	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)2;
			((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)2;
			((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)2;
			((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)2;
			((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)2;
			((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)2;
			((TheFiendAI)(object)target).FearedClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

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

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

	protected internal override string __getTypeName()
	{
		return "TheFiendAI";
	}
}
namespace TheFiend
{
	[BepInPlugin("com.TheFiend", "The Fiend", "0.0.0")]
	public class TheFiend : BaseUnityPlugin
	{
		public static TheFiend instance;

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

		public static AssetBundle bundle;

		public static ConfigEntry<int> SpawnChance;

		public static ConfigEntry<LevelTypes> Moon;

		public static ConfigEntry<int> FlickerRngChance;

		public static ConfigEntry<bool> WillRageAfterApparatus;

		public static ConfigEntry<float> Volume;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "Fiend.cfg"), true);
			SpawnChance = val.Bind<int>("Fiend", "Spawn Weight", 30, new ConfigDescription("The Chance to spawn the fiend inside of the building", (AcceptableValueBase)null, Array.Empty<object>()));
			Moon = val.Bind<LevelTypes>("Fiend", "Moon", (LevelTypes)(-1), new ConfigDescription("What is the only moon it can spawn on. Only one VALUE at a time.", (AcceptableValueBase)null, Array.Empty<object>()));
			FlickerRngChance = val.Bind<int>("Fiend", "Flicker Chance", 1000, new ConfigDescription("This is a Random chance out of 1/1000 happening to a random player", (AcceptableValueBase)null, Array.Empty<object>()));
			WillRageAfterApparatus = val.Bind<bool>("Fiend", "Rage After Apparatus", true, new ConfigDescription("Trigger his rage mode if you remove the Apparatus.", (AcceptableValueBase)null, Array.Empty<object>()));
			Volume = val.Bind<float>("Fiend", "Volume", 1f, new ConfigDescription("Sounds as scream and idle sound, not step sounds", (AcceptableValueBase)null, Array.Empty<object>()));
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			instance = this;
			bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "thefiend"));
			EnemyType val2 = bundle.LoadAsset<EnemyType>(RoleCompanyFolder + "TheFiend.asset");
			Enemies.RegisterEnemy(val2, SpawnChance.Value, Moon.Value, bundle.LoadAsset<TerminalNode>(RoleCompanyFolder + "TheFiendNode.asset"), bundle.LoadAsset<TerminalKeyword>(RoleCompanyFolder + "TheFiendKey.asset"));
			NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab);
			Utilities.FixMixerGroups(val2.enemyPrefab);
		}

		public void AddScrap(string Name, int Rare, LevelTypes level)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Item val = bundle.LoadAsset<Item>(RoleCompanyFolder + Name + ".asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, Rare, level);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TheFiend";

		public const string PLUGIN_NAME = "TheFiend";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace TheFiend.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}