Decompiled source of The Fiend Fork v1.0.9

BepInEx/plugins/TheFiend.dll

Decompiled 6 days 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.0.9.0")]
[assembly: AssemblyInformationalVersion("1.0.9+9498e39b9f1b248f9a115ce3b8f97f2443a9a149")]
[assembly: AssemblyProduct("TheFiend")]
[assembly: AssemblyTitle("TheFiend")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class TheFiendAI : EnemyAI
{
	[CompilerGenerated]
	private sealed class <CD>d__70 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float time;

		public bool UnInvis;

		public TheFiendAI <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CD>d__70(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				((EnemyAI)<>4__this).agent.speed = 0f;
				<>2__current = (object)new WaitForSeconds(time);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.GlobalCD.Value = false;
				if (UnInvis)
				{
					<>4__this.Invis.Value = false;
				}
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <Grabbing>d__54 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public GameObject Player;

		public TheFiendAI <>4__this;

		private PlayerControllerB <PCB>5__1;

		private float <oldspeed>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Grabbing>d__54(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<PCB>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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_01c3: 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_028d: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
			{
				<>1__state = -1;
				if (<>4__this.EatingPlayer || !Object.op_Implicit((Object)(object)Player))
				{
					return false;
				}
				<PCB>5__1 = Player.GetComponent<PlayerControllerB>();
				if (<PCB>5__1.health <= 50)
				{
					<>4__this.EatingPlayer = true;
					<>4__this.TargetLook = null;
					((EnemyAI)<>4__this).agent.speed = 0f;
					((EnemyAI)<>4__this).SetDestinationToPosition(((Component)((EnemyAI)<>4__this).agent).transform.position, false);
					<oldspeed>5__2 = <PCB>5__1.movementSpeed;
					<PCB>5__1.movementSpeed = 0f;
					<>4__this.animator.Play("Grab");
					((Component)<>4__this).transform.LookAt(Player.transform.position, Vector3.up);
					<>4__this.rotateCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.RotatePlayerToMe(<PCB>5__1));
					<>4__this.SceamServerRpc();
					<>2__current = (object)new WaitForSeconds(1.7f);
					<>1__state = 1;
					return true;
				}
				<PCB>5__1.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				PlayerControllerB obj = <PCB>5__1;
				obj.externalForceAutoFade += <>4__this.Main.transform.forward * 30f;
				<>4__this.animator.Play("Craw");
				<>4__this.GlobalCD.Value = true;
				<PCB>5__1.movementAudio.PlayOneShot(<>4__this.audioClips[6], 1f);
				<>4__this.StartCooldown(1f);
				break;
			}
			case 1:
				<>1__state = -1;
				<PCB>5__1.KillPlayer(<>4__this.Main.transform.forward * 30f, true, (CauseOfDeath)6, 1, default(Vector3));
				if (((NetworkBehaviour)<>4__this).IsOwner)
				{
					<PCB>5__1.movementSpeed = <oldspeed>5__2;
				}
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				if (<>4__this.rotateCoroutine != null)
				{
					((MonoBehaviour)<>4__this).StopCoroutine(<>4__this.rotateCoroutine);
				}
				<>4__this.IdleSoundServerRpc();
				<>4__this.animator.Play("Idle");
				<>2__current = (object)new WaitForSeconds(3f);
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 4;
				return true;
			case 4:
				<>1__state = -1;
				<>4__this.RageMode.Value = false;
				if (Random.Range(1, 30) == 1)
				{
					<>4__this.HideOnCellingServerRpc();
				}
				<>4__this.EatingPlayer = false;
				break;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <Rage>d__65 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public TheFiendAI <>4__this;

		private PlayerControllerB[] <array>5__1;

		private PlayerControllerB[] <>s__2;

		private int <>s__3;

		private PlayerControllerB <player>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Rage>d__65(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<array>5__1 = null;
			<>s__2 = null;
			<player>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.GlobalCD.Value = true;
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.animator.Play("Rage");
				<array>5__1 = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
				<>s__2 = <array>5__1;
				for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
				{
					<player>5__4 = <>s__2[<>s__3];
					<player>5__4.JumpToFearLevel(0.9f, true);
					<player>5__4 = null;
				}
				<>s__2 = null;
				<>4__this.AS.maxDistance = 500f;
				<>4__this.AS.Stop();
				<>4__this.AS.clip = <>4__this.audioClips[5];
				<>4__this.AS.loop = false;
				<>4__this.AS.Play();
				TheFiendPlugin.logger.LogInfo((object)"We should be raging");
				<>2__current = (object)new WaitForSeconds(9f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				<>4__this.ToggleRageServerRpc(TheRageValue: true);
				<>4__this.AS.maxDistance = 30f;
				<>4__this.GlobalCD.Value = false;
				<>2__current = (object)new WaitForSeconds(20f);
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				<>4__this.ToggleRageServerRpc(TheRageValue: false);
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <RotatePlayerToMe>d__55 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public PlayerControllerB PCB;

		public TheFiendAI <>4__this;

		private Vector3 <direction>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <RotatePlayerToMe>d__55(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_003f: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)PCB != (Object)null && !PCB.isPlayerDead && PCB.health > 0)
			{
				if (((NetworkBehaviour)PCB).IsOwner)
				{
					<direction>5__1 = ((Component)<>4__this).transform.position - ((Component)PCB).transform.position;
					<>4__this.PlayerSmoothLookAt(<direction>5__1, PCB);
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SetTempRage>d__72 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float time;

		public TheFiendAI <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SetTempRage>d__72(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.ToggleRageServerRpc(TheRageValue: true);
				<>2__current = (object)new WaitForSeconds(time);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.ToggleRageServerRpc(TheRageValue: false);
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <Stand>d__59 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public TheFiendAI <>4__this;

		private Rigidbody <rig>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Stand>d__59(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<rig>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.StandingMode.Value = true;
				((Renderer)<>4__this.MapDot).enabled = true;
				<rig>5__1 = <>4__this.Main.AddComponent<Rigidbody>();
				<rig>5__1.detectCollisions = false;
				goto IL_0099;
			case 1:
				<>1__state = -1;
				goto IL_0099;
			case 2:
				<>1__state = -1;
				<>4__this.SetYLevelClientRpc(<>4__this.OldYScale);
				<>4__this.animator.Play("Idle");
				<>4__this.SceamServerRpc();
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 3;
				return true;
			case 3:
				{
					<>1__state = -1;
					<>4__this.IdleSoundServerRpc();
					<>4__this.BreakDoorServerRpc();
					<>4__this.StateOfMind.Value = 1;
					<>4__this.StandingMode.Value = false;
					return false;
				}
				IL_0099:
				if (Vector3.Distance(<>4__this.Main.transform.position, <>4__this.LastPos) > 1.5f)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				Object.Destroy((Object)(object)<rig>5__1);
				<>4__this.animator.Play("UnHide");
				<>2__current = (object)new WaitForSeconds(0.2f);
				<>1__state = 2;
				return true;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <StateMindCD>d__71 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float time;

		public int typenow;

		public TheFiendAI <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <StateMindCD>d__71(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(time);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.StateOfMind.Value = typenow;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <TurnOffC>d__63 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Rigidbody rigidbody;

		public float time;

		public TheFiendAI <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <TurnOffC>d__63(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				rigidbody.detectCollisions = false;
				<>2__current = (object)new WaitForSeconds(time);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				rigidbody.detectCollisions = true;
				Object.Destroy((Object)(object)((Component)rigidbody).gameObject, 5f);
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public NetworkVariable<int> StateOfMind;

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

	private Animator animator;

	public GameObject Main;

	public GameObject Neck;

	public GameObject Spine;

	public GameObject LeftHand;

	public GameObject RightHand;

	public MeshRenderer MapDot;

	public SkinnedMeshRenderer skinnedMesh;

	private float OldYScale;

	public Random enemyRandom;

	public AudioClip[] audioClips;

	public AudioClip StepClip;

	private AudioSource AS;

	private AudioSource AS2;

	private Vector3 FavSpot;

	private bool ResetNode;

	private bool EatingPlayer;

	public NetworkVariable<bool> Seeking;

	public NetworkVariable<bool> Invis;

	public NetworkVariable<bool> RageMode;

	public NetworkVariable<bool> GlobalCD;

	public NetworkVariable<bool> StandingMode;

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

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

	private Coroutine rotateCoroutine;

	public Quaternion OldR;

	public bool Step;

	private Vector3 LastPos;

	private Vector3 Node;

	private int LightTriggerTimes;

	private NavMeshPath path;

	private GameObject Head;

	private GameObject breakerBox;

	private RoundManager roundManager;

	public TimeOfDay timeOfDay;

	private LungProp LungApparatus;

	private Vector3 LungApparatusPosition;

	public GameObject TargetLook;

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

	public void Awake()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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;
		if ((Object)(object)LungApparatus == (Object)null)
		{
			LungApparatus = Object.FindObjectOfType<LungProp>();
		}
		AudioMixerGroup outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX")[0];
		AS.outputAudioMixerGroup = outputAudioMixerGroup;
	}

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

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

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

	public override void DoAIInterval()
	{
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0914: Unknown result type (might be due to invalid IL or missing references)
		//IL_0804: Unknown result type (might be due to invalid IL or missing references)
		//IL_058d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0730: Unknown result type (might be due to invalid IL or missing references)
		//IL_0774: Unknown result type (might be due to invalid IL or missing references)
		((EnemyAI)this).DoAIInterval();
		if ((Object)(object)base.stunnedByPlayer != (Object)null)
		{
			AS.clip = audioClips[2];
			AS.loop = false;
			AS.Play();
			IsDying.Value = true;
			((Renderer)skinnedMesh).enabled = false;
			Object.Destroy((Object)(object)((Component)this).gameObject, 4f);
			base.stunnedByPlayer = null;
		}
		if (IsDying.Value)
		{
			((EnemyAI)this).SyncPositionToClients();
			return;
		}
		if (timeOfDay.hour >= 15)
		{
			Funky.Value = 2;
		}
		AS.volume = ((Seeking.Value || StateOfMind.Value == 3) ? 0f : Config.VolumeConfig);
		((Renderer)skinnedMesh).enabled = !Invis.Value;
		int num = Mathf.Max(1, Funky.Value);
		if (Random.Range(1, 10000) == 1)
		{
			TeleportServerRpc();
		}
		if (StateOfMind.Value == 3 && Random.Range(1, 10000 / num) == 1)
		{
			HideOnCellingServerRpc();
		}
		if (!Seeking.Value && Random.Range(1, 10000 / num) == 1)
		{
			ToggleSeekingServerRpc();
		}
		if (GlobalCD.Value)
		{
			((EnemyAI)this).SyncPositionToClients();
			return;
		}
		if (StateOfMind.Value < 3)
		{
			StateOfMind.Value = 0;
		}
		if (Object.op_Implicit((Object)(object)breakerBox) && !Seeking.Value)
		{
			Transform val = breakerBox.transform.Find("Mesh");
			if ((Object)(object)val != (Object)null)
			{
				float num2 = Vector3.Distance(Main.transform.position, val.position);
				if (num2 <= 5f)
				{
					RaycastHit val2 = default(RaycastHit);
					if (Physics.Raycast(Neck.transform.position, val.position - Neck.transform.position, ref val2, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enemies" })) && Vector3.Distance(((RaycastHit)(ref val2)).point, val.position) < 2f)
					{
						StateOfMind.Value = 4;
						TargetLook = ((Component)val).gameObject;
						if (num2 <= 2f)
						{
							BreakerBoxBreakServerRpc();
						}
					}
					else
					{
						StateOfMind.Value = 0;
					}
				}
			}
		}
		bool flag = ((EnemyAI)this).TargetClosestPlayer(100f, false, 70f);
		if (flag)
		{
			TargetLook = ((Component)base.targetPlayer).gameObject;
		}
		if (flag && Object.op_Implicit((Object)(object)base.targetPlayer.currentlyHeldObject) && ((Object)((Component)base.targetPlayer.currentlyHeldObject).gameObject).name.Contains("FlashlightItem"))
		{
			Transform val3 = ((Component)base.targetPlayer.currentlyHeldObject).transform.Find("Light");
			if ((Object)(object)val3 != (Object)null)
			{
				Light component = ((Component)val3).GetComponent<Light>();
				if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled && Vector3.Distance(Head.transform.position, val3.position) <= 2.5f)
				{
					FearedServerRpc(TempRage: false, uselight: true);
					LightTriggerTimes++;
				}
			}
		}
		if (flag && StateOfMind.Value == 3 && !Seeking.Value && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) <= 4f)
		{
			HideOnCellingServerRpc();
		}
		if (Object.op_Implicit((Object)(object)LungApparatus) && (LungApparatusWillRage.Value || Config.WillRageAfterApparatusConfig) && !Invis.Value && !LungApparatus.isLungDocked)
		{
			Transform val4 = ((Component)LungApparatus).transform.Find("Point Light");
			if ((Object)(object)val4 != (Object)null)
			{
				Light component2 = ((Component)val4).GetComponent<Light>();
				if (component2 != null)
				{
					component2.color = Color.red;
				}
			}
			((GrabbableObject)LungApparatus).scrapValue = 300;
			LungApparatus = null;
			((MonoBehaviour)this).StartCoroutine(Rage());
		}
		if (!EatingPlayer && StateOfMind.Value <= 2 && !StandingMode.Value)
		{
			if (flag)
			{
				ResetNode = true;
				if (base.agent.remainingDistance > 10f && !RageMode.Value)
				{
					OldYScale = Main.transform.position.y;
					if (!Seeking.Value)
					{
						StateOfMind.Value = 1;
						base.agent.speed = 3 + (num - 1);
						animator.Play("Walk");
						if ((CheckDoor() && Random.Range(1, 100) == 1 && StateOfMind.Value != 3) || (!CheckDoor() && Random.Range(1, 1000) == 1 && StateOfMind.Value != 3))
						{
							HideOnCellingServerRpc();
						}
					}
					else
					{
						base.agent.speed = 1f;
						animator.Play("Seeking");
						BreakDoorServerRpc();
					}
					if (Random.Range(1, Config.FlickerRngConfig) == 1)
					{
						roundManager.FlickerLights(true, true);
					}
				}
				else if (!Seeking.Value)
				{
					StateOfMind.Value = 2;
					if ((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(45f, 60, -1) != (Object)null)
					{
						base.targetPlayer.JumpToFearLevel(0.9f, true);
					}
					base.agent.speed = (RageMode.Value ? (20 * num) : (9 * num));
					animator.Play("Run");
					BreakDoorServerRpc();
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				if (Seeking.Value)
				{
					PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
					PlayerControllerB[] array2 = array;
					foreach (PlayerControllerB val5 in array2)
					{
						if (val5.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 <= 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 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 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))
		{
			((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 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))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				AS.Stop();
				AS.clip = audioClips[Random.Range(1, 2)];
				AS.loop = false;
				AS.Play();
				SceamClientRpc();
			}
		}
	}

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

	[ServerRpc(RequireOwnership = false)]
	public void IdleSoundServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams 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))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				AS.Stop();
				AS.clip = audioClips[0];
				AS.loop = true;
				AS.Play();
				IdleSoundClientRpc();
			}
		}
	}

	[ClientRpc]
	public void IdleSoundClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams 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 == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				AS.Stop();
				AS.clip = audioClips[0];
				AS.loop = true;
				AS.Play();
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void GrabServerRpc(NetworkBehaviourReference PlayerControllerBRef)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams 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);
		}
		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 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);
		}
		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));
			}
		}
	}

	[IteratorStateMachine(typeof(<Grabbing>d__54))]
	public IEnumerator Grabbing(GameObject Player)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Grabbing>d__54(0)
		{
			<>4__this = this,
			Player = Player
		};
	}

	[IteratorStateMachine(typeof(<RotatePlayerToMe>d__55))]
	private IEnumerator RotatePlayerToMe(PlayerControllerB PCB)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <RotatePlayerToMe>d__55(0)
		{
			<>4__this = this,
			PCB = PCB
		};
	}

	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 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;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		if (StateOfMind.Value != 3)
		{
			if (StateOfMind.Value <= 3)
			{
				StateOfMind.Value = 3;
				LastPos = Main.transform.position;
				OldYScale = Main.transform.position.y;
				RaycastHit val3 = default(RaycastHit);
				Physics.Raycast(Main.transform.position, ((Component)this).transform.TransformDirection(Vector3.up), ref val3, float.PositiveInfinity, ~LayerMask.GetMask(new string[1] { "Enmies" }));
				animator.Play("Hide");
				AS.Stop();
				base.agent.speed = 0f;
				SetYLevelClientRpc(((RaycastHit)(ref val3)).point.y);
				((Renderer)MapDot).enabled = false;
			}
		}
		else if (!StandingMode.Value)
		{
			((MonoBehaviour)this).StartCoroutine(Stand());
		}
	}

	[ClientRpc]
	public void SetYLevelClientRpc(float y)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams 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 == 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);
			}
		}
	}

	[IteratorStateMachine(typeof(<Stand>d__59))]
	public IEnumerator Stand()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Stand>d__59(0)
		{
			<>4__this = this
		};
	}

	[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 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;
		}
		((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 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);
		}
		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;
	}

	[IteratorStateMachine(typeof(<TurnOffC>d__63))]
	private IEnumerator TurnOffC(Rigidbody rigidbody, float time)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <TurnOffC>d__63(0)
		{
			<>4__this = this,
			rigidbody = rigidbody,
			time = time
		};
	}

	[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 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))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			GlobalCD.Value = true;
			FearedClientRpc();
			((MonoBehaviour)this).StartCoroutine(CD(5f));
			float tempRage = 3f;
			if (uselight)
			{
				tempRage = LightTriggerTimes * 2;
			}
			if (TempRage)
			{
				((MonoBehaviour)this).StartCoroutine(SetTempRage(tempRage));
			}
		}
	}

	[IteratorStateMachine(typeof(<Rage>d__65))]
	public IEnumerator Rage()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Rage>d__65(0)
		{
			<>4__this = this
		};
	}

	[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 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))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				RageMode.Value = TheRageValue;
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void TeleportServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams 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))
		{
			return;
		}
		((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
		Invis.Value = true;
		List<PlayerControllerB> list = new List<PlayerControllerB>();
		PlayerControllerB[] array = Object.FindObjectsOfType(typeof(PlayerControllerB)) as PlayerControllerB[];
		PlayerControllerB[] array2 = array;
		foreach (PlayerControllerB val3 in array2)
		{
			if (val3.isInsideFactory)
			{
				list.Add(val3);
			}
		}
		if (list.Count > 0)
		{
			((Component)this).transform.position = ((Component)list[Random.Range(1, list.Count)]).gameObject.transform.position;
		}
		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 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 == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				animator.Play("CoverFace");
				base.agent.speed = 0f;
				AS.Stop();
				AS.clip = audioClips[4];
				AS.loop = false;
				AS.Play();
			}
		}
	}

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

	[IteratorStateMachine(typeof(<CD>d__70))]
	private IEnumerator CD(float time, bool UnInvis = false)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CD>d__70(0)
		{
			<>4__this = this,
			time = time,
			UnInvis = UnInvis
		};
	}

	[IteratorStateMachine(typeof(<StateMindCD>d__71))]
	private IEnumerator StateMindCD(float time, int typenow)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <StateMindCD>d__71(0)
		{
			<>4__this = this,
			time = time,
			typenow = typenow
		};
	}

	[IteratorStateMachine(typeof(<SetTempRage>d__72))]
	private IEnumerator SetTempRage(float time)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SetTempRage>d__72(0)
		{
			<>4__this = this,
			time = time
		};
	}

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

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

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

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

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

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

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

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

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

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

	private static void __rpc_handler_2581177773(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			NetworkObjectReference netObjRef = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
			Vector3 position = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((TheFiendAI)(object)target).BashDoorClientRpc(netObjRef, position);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

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

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

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

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

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

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

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

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

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

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

	public static T Default { get; private set; }

	public static T Instance { get; private set; }

	public static bool Synced { get; internal set; }

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

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

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

	public st