Decompiled source of NightTerror v1.0.0

plugins/Reiko888.NightTerror.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reiko888.NightTerror.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Reiko888.NightTerror")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3593673ec22a1ab6967b10837e5d3aa1a575b0e4")]
[assembly: AssemblyProduct("NightTerror")]
[assembly: AssemblyTitle("Reiko888.NightTerror")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NightTerror
{
	internal class ModContentHandler : ContentHandler<ModContentHandler>
	{
		public class NightTerrorEnemyAssets : AssetBundleLoader<NightTerrorEnemyAssets>
		{
			public NightTerrorEnemyAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		internal NightTerrorEnemyAssets? nightTerrorEnemyAssets;

		public ModContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<NightTerrorEnemyAssets>("nightterrordef", ref nightTerrorEnemyAssets, false);
		}
	}
	public class NightTerrorAI : EnemyAI
	{
		public GameObject dollPrefab;

		public GameObject monsterContainer;

		public GameObject dollContainer;

		private GameObject FakeDoll;

		public Animator dollAnimator;

		public Animator monsterAnimator;

		public GameObject EnemyCollider;

		public AudioSource monsterDistant;

		public AudioClip[] askHideSeekVoiceLines;

		public AudioClip[] foundVoiceLines;

		public AudioClip[] countVoiceLines;

		public AudioClip[] chaseWindChimes;

		public AudioClip[] distantRoars;

		public AudioClip[] roamingYapping;

		public AudioClip[] huntingTaunts;

		public AudioClip[] doorSlam;

		public AudioClip[] readytoFind;

		private DoorLock[] cachedDoors;

		public Material monsterMat;

		private bool isInDollForm = true;

		private bool targetHasFled = false;

		private bool isCounting = false;

		private float foundPlayerTimer = 5f;

		private float countDuration;

		private bool isSeeking = false;

		private bool isFoundPhaseStarted = false;

		private bool hasSummonedMonster = false;

		private float manifestTimer;

		private bool hasRoared;

		private float randomRoamTimer;

		private float yapCooldown;

		private Quaternion currentRot;

		private float chompCooldown;

		private float breakDoorTimer;

		private float roamingSearchWidth;

		private float seekingSearchWidth;

		private float roamingSpeed;

		private float seekingSpeed;

		private float chaseSpeed;

		private Random enemyRandom;

		public AISearchRoutine wanderFacility;

		public AISearchRoutine seeking;

		private Coroutine FoundPhase;

		private PlayerControllerB previousTarget;

		private Vector3 currentPos;

		public override void Start()
		{
			((EnemyAI)this).Start();
			roamingSpeed = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Roaming speed").Value;
			seekingSpeed = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Seeking speed").Value;
			chaseSpeed = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Hunting speed").Value;
			countDuration = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Counting duration").Value;
			roamingSearchWidth = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Roaming search width").Value;
			seekingSearchWidth = ((AssetBundleLoader<ModContentHandler.NightTerrorEnemyAssets>)(object)ContentHandler<ModContentHandler>.Instance.nightTerrorEnemyAssets).GetConfig<float>("Seeking search width").Value;
			if (wanderFacility != null)
			{
				wanderFacility.searchWidth = roamingSearchWidth;
			}
			if (seeking != null)
			{
				seeking.searchWidth = seekingSearchWidth;
			}
			cachedDoors = Object.FindObjectsOfType<DoorLock>();
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			monsterMat.SetFloat("_AlphaCutoff", 1f);
		}

		public override void Update()
		{
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (breakDoorTimer > 0f)
				{
					breakDoorTimer -= Time.deltaTime;
				}
				chompCooldown += Time.deltaTime;
				if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isInsideFactory && base.currentBehaviourStateIndex == 3 && !targetHasFled && ((NetworkBehaviour)this).IsOwner)
				{
					manifestTimer += Time.deltaTime;
					if (manifestTimer > 4f)
					{
						Plugin.Logger.LogInfo((object)"Target has fled!");
						targetHasFled = true;
					}
				}
				if (base.currentBehaviourStateIndex == 3 && (Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerControlled && !targetHasFled && ((NetworkBehaviour)this).IsOwner)
				{
					manifestTimer += Time.deltaTime;
					if (manifestTimer > 4f)
					{
						Plugin.Logger.LogInfo((object)"Target has died/dc'd!");
						targetHasFled = true;
					}
				}
			}
			if (base.currentBehaviourStateIndex != 1 && base.currentBehaviourStateIndex != 3)
			{
				yapCooldown += Time.deltaTime;
				randomRoamTimer += Time.deltaTime;
				if (randomRoamTimer > 5f && yapCooldown > 10f)
				{
					randomRoamTimer = 0f;
					float num = Random.Range(1, 10);
					if (num > 5f)
					{
						Plugin.Logger.LogDebug((object)"Playing random roam/hunt SFX");
						if (base.currentBehaviourStateIndex == 0)
						{
							base.creatureSFX.Stop();
							base.creatureSFX.PlayOneShot(roamingYapping[enemyRandom.Next(0, roamingYapping.Length)]);
							yapCooldown = 0f;
						}
						else if (base.currentBehaviourStateIndex == 2)
						{
							base.creatureSFX.Stop();
							base.creatureSFX.PlayOneShot(huntingTaunts[enemyRandom.Next(0, huntingTaunts.Length)]);
							yapCooldown = 0f;
						}
					}
				}
			}
			bool flag = base.currentBehaviourStateIndex == 3;
			dollContainer.SetActive(!flag);
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && !GameNetworkManager.Instance.localPlayerController.isPlayerDead && base.currentBehaviourStateIndex == 3)
			{
				if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 50f, 25, 10f, -1))
				{
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
				}
				else if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 50f, 30, 5f, -1))
				{
					GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.25f, 0.3f);
				}
			}
		}

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

		[ClientRpc]
		private void SetMonsterVisibleClientRpc(float phaseLength)
		{
			//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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2369500510u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref phaseLength, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2369500510u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(SetMonsterVisibility(phaseLength));
				}
			}
		}

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

		[ClientRpc]
		private void SetMonsterInvisibleClientRpc(float phaseLength)
		{
			//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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(448581547u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref phaseLength, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 448581547u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(SetMonsterInvisibility(phaseLength));
				}
			}
		}

		private IEnumerator SetMonsterVisibility(float phaseLength)
		{
			monsterContainer.SetActive(true);
			float elapsed = 0f;
			while (elapsed < phaseLength)
			{
				elapsed += Time.deltaTime;
				float progress = Mathf.Clamp01(elapsed / phaseLength);
				float cutoff = Mathf.Lerp(1f, 0.01f, progress);
				monsterMat.SetFloat("_AlphaCutoff", cutoff);
				yield return null;
			}
			monsterMat.SetFloat("_AlphaCutoff", 0.01f);
			_ = GameNetworkManager.Instance.localPlayerController;
		}

		private IEnumerator SetMonsterInvisibility(float phaseLength)
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)previousTarget)
			{
				HUDManager.Instance.UIAudio.PlayOneShot(chaseWindChimes[enemyRandom.Next(0, chaseWindChimes.Length)], 0.4f);
			}
			float elapsed = 0f;
			while (elapsed < phaseLength)
			{
				elapsed += Time.deltaTime;
				float progress = Mathf.Clamp01(elapsed / phaseLength);
				float cutoff = Mathf.Lerp(0.01f, 1f, progress);
				monsterMat.SetFloat("_AlphaCutoff", cutoff);
				yield return null;
			}
			monsterMat.SetFloat("_AlphaCutoff", 1f);
			monsterContainer.SetActive(false);
			if (((NetworkBehaviour)this).IsOwner)
			{
				AfterChaseCleanUpServerRpc();
			}
		}

		public override void DoAIInterval()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = roamingSpeed;
				hasRoared = false;
				if (!wanderFacility.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, wanderFacility);
				}
				if (((EnemyAI)this).TargetClosestPlayer(4f, true, 70f, false, false, true))
				{
					Plugin.Logger.LogInfo((object)"Found player.");
					((EnemyAI)this).StopSearch(wanderFacility, true);
					PlayerControllerB targetPlayer = base.targetPlayer;
					((EnemyAI)this).SwitchToBehaviourState(1);
				}
				break;
			case 1:
				if (!isCounting)
				{
					Plugin.Logger.LogInfo((object)"Counting");
					isCounting = true;
					StartCountingServerRpc();
				}
				break;
			case 2:
				if (isFoundPhaseStarted)
				{
					break;
				}
				if (((EnemyAI)this).TargetClosestPlayer(4f, true, 70f, false, false, true))
				{
					Plugin.Logger.LogInfo((object)"Player found after seek!");
					isFoundPhaseStarted = true;
					if (seeking != null && seeking.inProgress)
					{
						((EnemyAI)this).StopSearch(seeking, true);
					}
					foundPlayerTimer = 5f;
					isSeeking = false;
					FoundPlayerServerRpc();
				}
				else
				{
					if (seeking != null && !seeking.inProgress)
					{
						isSeeking = true;
						Plugin.Logger.LogInfo((object)"Starting to seek!");
						((EnemyAI)this).StartSearch(((Component)this).transform.position, seeking);
					}
					base.agent.speed = seekingSpeed;
				}
				break;
			case 3:
				if (!hasRoared)
				{
					hasRoared = true;
					SetMonsterVisibleServerRpc(5f);
					playDistantRoarServerRpc();
				}
				base.agent.speed = chaseSpeed;
				isCounting = false;
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				if (breakDoorTimer <= 0f && cachedDoors != null && base.currentBehaviourStateIndex == 3)
				{
					DoorLock[] array = cachedDoors;
					foreach (DoorLock val in array)
					{
						if ((Object)(object)val == (Object)null)
						{
							continue;
						}
						AnimatedObjectTrigger component = ((Component)val).GetComponent<AnimatedObjectTrigger>();
						if ((Object)(object)component != (Object)null && component.boolValue && !val.isLocked)
						{
							continue;
						}
						Transform val2 = ((Component)val).transform;
						for (int j = 0; j < 3; j++)
						{
							if (!((Object)(object)val2.parent != (Object)null))
							{
								break;
							}
							val2 = val2.parent;
						}
						GameObject gameObject = ((Component)val2).gameObject;
						if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Rigidbody>()) && Vector3.Distance(((Component)this).transform.position, gameObject.transform.position) <= 4f)
						{
							breakDoorTimer = 1f;
							Vector3 val3 = gameObject.transform.position - ((Component)this).transform.position;
							Vector3 force = ((Vector3)(ref val3)).normalized * 20f;
							BreakDoorServerRpc(NetworkObjectReference.op_Implicit(gameObject), force);
							break;
						}
					}
				}
				if ((Object)(object)base.targetPlayer != (Object)null && targetHasFled)
				{
					base.targetPlayer = null;
					hasSummonedMonster = false;
					targetHasFled = false;
					manifestTimer = 0f;
					isSeeking = false;
					isFoundPhaseStarted = false;
					base.creatureAnimator.SetBool("isSummoning", false);
					((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
					Plugin.Logger.LogInfo((object)"Ownership changed to host.");
					SetMonsterInvisibleServerRpc(2f);
				}
				break;
			}
		}

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

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

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

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

		[ServerRpc(RequireOwnership = false)]
		public void BreakDoorServerRpc(NetworkObjectReference netObjRef, Vector3 force)
		{
			//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_00f0: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3786389952u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val)).WriteValueSafe(ref force);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 3786389952u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					BreakDoorClientRpc(netObjRef, force);
				}
			}
		}

		[ClientRpc]
		public void BreakDoorClientRpc(NetworkObjectReference netObjRef, Vector3 force)
		{
			//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_017e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2274292696u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val)).WriteValueSafe(ref force);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2274292696u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				if (((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null))
				{
					GameObject gameObject = ((Component)val3).gameObject;
					Rigidbody val4 = gameObject.AddComponent<Rigidbody>();
					AudioSource val5 = gameObject.AddComponent<AudioSource>();
					val5.PlayOneShot(doorSlam[enemyRandom.Next(0, doorSlam.Length)]);
					val5.spatialBlend = 1f;
					val5.maxDistance = 60f;
					val5.rolloffMode = (AudioRolloffMode)1;
					val5.volume = 3f;
					((MonoBehaviour)this).StartCoroutine(TurnOffC(val4, 0.12f));
					val4.AddForce(force, (ForceMode)1);
				}
			}
		}

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

		[ServerRpc(RequireOwnership = false)]
		private void BeginChaseServerRpc(int targetPlayerId, Vector3 dollPos, Quaternion dollRot, Vector3 monsterSpawnPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1997046419u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, targetPlayerId);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref dollPos);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref dollRot);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref monsterSpawnPos);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1997046419u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					BeginChaseClientRpc(targetPlayerId, dollPos, dollRot, monsterSpawnPos);
				}
			}
		}

		[ClientRpc]
		private void BeginChaseClientRpc(int targetPlayerId, Vector3 dollPos, Quaternion dollRot, Vector3 monsterSpawnPos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(789783955u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, targetPlayerId);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref dollPos);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref dollRot);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref monsterSpawnPos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 789783955u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Plugin.Logger.LogDebug((object)"BeginChaseClientRpc called.");
				currentPos = dollPos;
				if ((Object)(object)FakeDoll != (Object)null)
				{
					Object.Destroy((Object)(object)FakeDoll);
				}
				FakeDoll = Object.Instantiate<GameObject>(dollPrefab);
				FakeDoll.transform.position = dollPos;
				FakeDoll.transform.rotation = dollRot;
				((Component)this).transform.position = monsterSpawnPos;
				base.serverPosition = monsterSpawnPos;
				base.agent.Warp(monsterSpawnPos);
				isInDollForm = false;
				hasSummonedMonster = true;
				if (targetPlayerId >= 0 && targetPlayerId < StartOfRound.Instance.allPlayerScripts.Length)
				{
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[targetPlayerId];
					previousTarget = base.targetPlayer;
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(3);
			}
		}

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

		[ClientRpc]
		private void AfterChaseCleanUpClientRpc()
		{
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2064715386u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2064715386u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				base.agent.Warp(currentPos);
				((Component)this).transform.position = currentPos;
				base.serverPosition = currentPos;
				Plugin.Logger.LogDebug((object)$" Warped: {currentPos}, transform.pos {((Component)this).transform.position}, server pos: {base.serverPosition}");
				hasRoared = false;
				previousTarget = null;
				if ((Object)(object)FakeDoll != (Object)null)
				{
					Object.Destroy((Object)(object)FakeDoll);
					FakeDoll = null;
					Plugin.Logger.LogDebug((object)"Doll destroyed.");
				}
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(0);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			if (chompCooldown < 2f || !Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) || base.currentBehaviourStateIndex != 3)
			{
				return;
			}
			Plugin.Logger.LogDebug((object)("Monster collided with player: " + ((Object)((Component)other).gameObject).name));
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!base.isEnemyDead && base.currentBehaviourStateIndex == 3)
			{
				Plugin.Logger.LogDebug((object)"Night terror collided in monster form");
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					KillPlayerServerRpc((int)val.playerClientId);
					chompCooldown = 0f;
				}
			}
		}

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

		[ClientRpc]
		public void KillPlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(711825364u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 711825364u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					KillPlayer(playerId);
				}
			}
		}

		private void KillPlayer(int playerId)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Logger.LogDebug((object)$"Killing: {playerId}");
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
			val.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0, default(Vector3), false);
			monsterAnimator.SetTrigger("attack");
			isFoundPhaseStarted = false;
			hasSummonedMonster = false;
			base.targetPlayer = null;
			base.creatureAnimator.SetBool("isSummoning", false);
			if (((NetworkBehaviour)this).IsOwner)
			{
				SetMonsterInvisibleServerRpc(2f);
				((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
				Plugin.Logger.LogInfo((object)"Returned ownership back to host.");
			}
		}

		private IEnumerator CountingPhase()
		{
			if (((NetworkBehaviour)this).IsOwner && wanderFacility != null)
			{
				((EnemyAI)this).StopSearch(wanderFacility, true);
				base.agent.speed = 0f;
			}
			base.creatureSFX.Stop();
			base.creatureSFX.PlayOneShot(askHideSeekVoiceLines[enemyRandom.Next(0, askHideSeekVoiceLines.Length)]);
			Plugin.Logger.LogDebug((object)"Sitting down.");
			base.creatureAnimator.SetBool("isCounting", true);
			yield return (object)new WaitForSeconds(3f);
			base.creatureSFX.Stop();
			base.creatureSFX.pitch = 1f;
			Plugin.Logger.LogDebug((object)$"Pitch: {base.creatureSFX.pitch}");
			base.creatureSFX.PlayOneShot(countVoiceLines[enemyRandom.Next(0, countVoiceLines.Length)]);
			Plugin.Logger.LogDebug((object)$"Counting down from {countDuration}...");
			yield return (object)new WaitForSeconds(countDuration);
			base.creatureSFX.pitch = 1.3f;
			Plugin.Logger.LogDebug((object)$"Pitch: {base.creatureSFX.pitch}");
			base.creatureAnimator.SetBool("isCounting", false);
			base.creatureSFX.Stop();
			base.creatureSFX.PlayOneShot(readytoFind[enemyRandom.Next(0, readytoFind.Length)]);
			base.targetPlayer = null;
			if (((NetworkBehaviour)this).IsOwner)
			{
				isFoundPhaseStarted = false;
			}
			Plugin.Logger.LogDebug((object)"Ready or not, here I come!! xd");
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
		}

		private IEnumerator foundPhase()
		{
			if (((NetworkBehaviour)this).IsOwner && seeking != null && seeking.inProgress)
			{
				((EnemyAI)this).StopSearch(seeking, true);
			}
			base.creatureAnimator.SetBool("isSummoning", true);
			base.agent.speed = 0f;
			Plugin.Logger.LogDebug((object)"Found you");
			base.creatureSFX.Stop();
			base.creatureSFX.PlayOneShot(foundVoiceLines[enemyRandom.Next(0, foundVoiceLines.Length)]);
			yield return (object)new WaitForSeconds(foundPlayerTimer);
			Plugin.Logger.LogDebug((object)"Commencing chase.");
			currentPos = ((Component)this).transform.position;
			currentRot = ((Component)this).transform.rotation;
			if (((NetworkBehaviour)this).IsOwner)
			{
				Transform farthestNode = ((EnemyAI)this).ChooseFarthestNodeFromPosition(currentPos, true, 0, false, 50, -1);
				Vector3 spawnMonsterPos = farthestNode.position;
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					BeginChaseServerRpc((int)base.targetPlayer.playerClientId, currentPos, currentRot, spawnMonsterPos);
					((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
				}
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)(object)base.targetPlayer)
			{
				HUDManager.Instance.UIAudio.PlayOneShot(chaseWindChimes[enemyRandom.Next(0, chaseWindChimes.Length)], 0.4f);
			}
		}

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

		[ClientRpc]
		private void PlayDistantRoarClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3568470614u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3568470614u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
				{
					monsterDistant.PlayOneShot(distantRoars[enemyRandom.Next(0, distantRoars.Length)]);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((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(77647838u, new RpcReceiveHandler(__rpc_handler_77647838), "SetMonsterVisibleServerRpc");
			((NetworkBehaviour)this).__registerRpc(2369500510u, new RpcReceiveHandler(__rpc_handler_2369500510), "SetMonsterVisibleClientRpc");
			((NetworkBehaviour)this).__registerRpc(3546916486u, new RpcReceiveHandler(__rpc_handler_3546916486), "SetMonsterInvisibleServerRpc");
			((NetworkBehaviour)this).__registerRpc(448581547u, new RpcReceiveHandler(__rpc_handler_448581547), "SetMonsterInvisibleClientRpc");
			((NetworkBehaviour)this).__registerRpc(2071639083u, new RpcReceiveHandler(__rpc_handler_2071639083), "StartCountingServerRpc");
			((NetworkBehaviour)this).__registerRpc(402421422u, new RpcReceiveHandler(__rpc_handler_402421422), "StartCountingClientRpc");
			((NetworkBehaviour)this).__registerRpc(1150018081u, new RpcReceiveHandler(__rpc_handler_1150018081), "FoundPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(2074217550u, new RpcReceiveHandler(__rpc_handler_2074217550), "FoundPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(3786389952u, new RpcReceiveHandler(__rpc_handler_3786389952), "BreakDoorServerRpc");
			((NetworkBehaviour)this).__registerRpc(2274292696u, new RpcReceiveHandler(__rpc_handler_2274292696), "BreakDoorClientRpc");
			((NetworkBehaviour)this).__registerRpc(1997046419u, new RpcReceiveHandler(__rpc_handler_1997046419), "BeginChaseServerRpc");
			((NetworkBehaviour)this).__registerRpc(789783955u, new RpcReceiveHandler(__rpc_handler_789783955), "BeginChaseClientRpc");
			((NetworkBehaviour)this).__registerRpc(3970673722u, new RpcReceiveHandler(__rpc_handler_3970673722), "AfterChaseCleanUpServerRpc");
			((NetworkBehaviour)this).__registerRpc(2064715386u, new RpcReceiveHandler(__rpc_handler_2064715386), "AfterChaseCleanUpClientRpc");
			((NetworkBehaviour)this).__registerRpc(649193459u, new RpcReceiveHandler(__rpc_handler_649193459), "KillPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(711825364u, new RpcReceiveHandler(__rpc_handler_711825364), "KillPlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(2648408779u, new RpcReceiveHandler(__rpc_handler_2648408779), "playDistantRoarServerRpc");
			((NetworkBehaviour)this).__registerRpc(3568470614u, new RpcReceiveHandler(__rpc_handler_3568470614), "PlayDistantRoarClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_77647838(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 monsterVisibleServerRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref monsterVisibleServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).SetMonsterVisibleServerRpc(monsterVisibleServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2369500510(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 monsterVisibleClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref monsterVisibleClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).SetMonsterVisibleClientRpc(monsterVisibleClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3546916486(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 monsterInvisibleServerRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref monsterInvisibleServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).SetMonsterInvisibleServerRpc(monsterInvisibleServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_448581547(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 monsterInvisibleClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref monsterInvisibleClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).SetMonsterInvisibleClientRpc(monsterInvisibleClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2071639083(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;
				((NightTerrorAI)(object)target).StartCountingServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_402421422(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;
				((NightTerrorAI)(object)target).StartCountingClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1150018081(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;
				((NightTerrorAI)(object)target).FoundPlayerServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2074217550(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;
				((NightTerrorAI)(object)target).FoundPlayerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3786389952(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 force = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref force);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).BreakDoorServerRpc(netObjRef, force);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2274292696(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 force = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref force);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).BreakDoorClientRpc(netObjRef, force);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1997046419(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				Vector3 dollPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref dollPos);
				Quaternion dollRot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref dollRot);
				Vector3 monsterSpawnPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref monsterSpawnPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).BeginChaseServerRpc(targetPlayerId, dollPos, dollRot, monsterSpawnPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_789783955(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetPlayerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				Vector3 dollPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref dollPos);
				Quaternion dollRot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref dollRot);
				Vector3 monsterSpawnPos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref monsterSpawnPos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((NightTerrorAI)(object)target).BeginChaseClientRpc(targetPlayerId, dollPos, dollRot, monsterSpawnPos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3970673722(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;
				((NightTerrorAI)(object)target).AfterChaseCleanUpServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2064715386(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;
				((NightTerrorAI)(object)target).AfterChaseCleanUpClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_2648408779(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;
				((NightTerrorAI)(object)target).playDistantRoarServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3568470614(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;
				((NightTerrorAI)(object)target).PlayDistantRoarClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "NightTerrorAI";
		}
	}
	[BepInPlugin("reiko888.NightTerror", "NightTerror", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "reiko888.NightTerror";

		public const string modName = "NightTerror";

		public const string modVersion = "1.0.0";

		public static Plugin Instance = null;

		internal static ManualLogSource Logger = null;

		internal static readonly Harmony harmony = new Harmony("reiko888.NightTerror");

		internal static DuskMod mod = null;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "nthandler");
			mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			mod.RegisterContentHandlers();
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin NightTerror is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Reiko888.NightTerror";

		public const string PLUGIN_NAME = "NightTerror";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Reiko888.NightTerror.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}