Decompiled source of Observer v2.1.0

plugins/Reiko888.Observers.dll

Decompiled a day ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
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 Observers.src;
using Reiko888.Observers.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Video;

[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("Reiko888.Observers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0+3e000ac2281245e50bc6737211b0752c8a0fecc9")]
[assembly: AssemblyProduct("Observers")]
[assembly: AssemblyTitle("Reiko888.Observers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.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 Observers
{
	internal class ObserverContentHandler : ContentHandler<ObserverContentHandler>
	{
		public class ObserverAssets : AssetBundleLoader<ObserverAssets>
		{
			[LoadFromBundle("ObserverChaser.prefab")]
			public GameObject ObserverChaser { get; private set; } = null;

			public ObserverAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		internal ObserverAssets? observerAssets;

		public ObserverContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<ObserverAssets>("observers", ref observerAssets, false);
		}
	}
	internal class ObserversAI : EnemyAI
	{
		[Serializable]
		public struct WeaponSoundSet
		{
			public AudioClip[] sounds;
		}

		public static List<ObserversAI> allChasers = new List<ObserversAI>();

		public ObserversAI master;

		public bool isMaster;

		private bool choseMasterObserver;

		public GameObject ObserverPrefab;

		public GameObject activeObserver;

		public GameObject activeChaserModel;

		public int SirenAudioSourceIndex = 0;

		public int AtmosphereAudioSourceIndex = 1;

		public AudioClip[] AtmosphereClips;

		private float atmosphereTimer = 0f;

		public Vector3 SpectreRotationOffset = new Vector3(0f, -90f, 0f);

		public float SirenDelay = 6.5f;

		public ScreenShakeType SirenShakeType = (ScreenShakeType)0;

		public float AirRaidLength = 60f;

		private Dictionary<int, Color> originalEmissions = new Dictionary<int, Color>();

		public HangarShipDoor shipDoor;

		public bool isPryingDoor;

		private bool inSpecialAnimation;

		private float pryingDoorAnimTime;

		private AudioSource spectreVoice;

		[Header("Door Prying")]
		public float pryOpenDoorAnimLength = 3f;

		public AudioClip breakAndEnter;

		public AudioClip shipAlarm;

		public AudioSource breakDownDoorAudio;

		private int queuedState = -1;

		private Animator chaserAnimator;

		private Random enemyRandom = null;

		private bool hasSpawnedSpectre = false;

		private Vector3 mainEntrancePosition;

		private bool isPlayingMarkAnimation = false;

		private float chaseTimer = 0f;

		private bool isStartingCooldown = false;

		private float attackCooldown = 0f;

		public WeaponSoundSet[] weaponStabSounds;

		public int activeWeaponIndex = 0;

		private DoorLock[] cachedDoors;

		private Dictionary<DoorLock, float> doorCooldowns = new Dictionary<DoorLock, float>();

		private MineshaftElevatorController elevatorScript;

		private bool isInElevatorStartRoom = false;

		public AudioClip markedLineClip;

		public GameObject[] meshVariants;

		public GameObject[] knifeModels;

		private EntranceTeleport[] allTeleports;

		public GameObject possessionSwarmParticles;

		public Transform handBone;

		private ScanNodeProperties cachedScanNode;

		private bool isStunned = false;

		private float slowDownTimer = 0f;

		private float currentChaseDuration = 0f;

		private bool isBlasting = false;

		private float cameraShakeTimer = 0f;

		private float baseSpeed;

		private float raidVolume;

		private float observerCooldown;

		private float detectRange;

		private bool itemDrop;

		private float chaseTime;

		private int chaserDamage;

		private int scrapAnger;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			detectRange = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<float>("Observer Detection Range").Value;
			raidVolume = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<float>("Observer Air Raid volume").Value;
			observerCooldown = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<float>("Observer Cooldown").Value;
			baseSpeed = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<float>("Chaser run speed").Value;
			itemDrop = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<bool>("Chaser item drop").Value;
			chaseTime = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<float>("Chaser chase time").Value;
			base.enemyHP = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<int>("Chaser health").Value;
			chaserDamage = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<int>("Chaser attack damage").Value;
			scrapAnger = ((AssetBundleLoader<ObserverContentHandler.ObserverAssets>)(object)ContentHandler<ObserverContentHandler>.Instance.observerAssets).GetConfig<int>("Base scrap anger").Value;
			LogIfDebugBuild("Observer Spawned");
			shipDoor = Object.FindObjectOfType<HangarShipDoor>();
			chaserAnimator = ((Component)this).GetComponentInChildren<Animator>();
			cachedDoors = Object.FindObjectsOfType<DoorLock>();
			SetupChaserMesh();
			((EnemyAI)this).GetAINodes();
			mainEntrancePosition = RoundManager.FindMainEntrancePosition(true, base.isOutside);
			if (!base.isOutside && base.allAINodes != null && base.allAINodes.Length != 0)
			{
				Transform transform = base.allAINodes[enemyRandom.Next(0, base.allAINodes.Length)].transform;
				base.agent.Warp(transform.position);
				((EnemyAI)this).SyncPositionToClients();
				Plugin.Logger.LogInfo((object)"Warped Chaser to a random internal AI node");
			}
		}

		private void SetupChaserMesh()
		{
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			if (meshVariants == null || meshVariants.Length == 0)
			{
				return;
			}
			GameObject[] array = meshVariants;
			foreach (GameObject val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
				}
			}
			int num = (activeWeaponIndex = enemyRandom.Next(0, meshVariants.Length));
			activeChaserModel = meshVariants[num];
			if ((Object)(object)activeChaserModel != (Object)null)
			{
				activeChaserModel.SetActive(true);
			}
			Plugin.Logger.LogInfo((object)$"Variant {num} active.");
		}

		private void BeginPryOpenDoor()
		{
			DoAnimationServerRpc("isPryingDoor", isBool: true, state: true);
			SetPryingDoorServerRpc(state: true);
		}

		private void FinishPryOpenDoor()
		{
			DoAnimationServerRpc("isPryingDoor", isBool: true);
			SetPryingDoorServerRpc(state: false);
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPryingDoorServerRpc(bool state)
		{
			//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(1053520595u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1053520595u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SetPryingDoorClientRpc(state);
				}
			}
		}

		[ClientRpc]
		public void SetPryingDoorClientRpc(bool state)
		{
			//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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: 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(2040238424u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2040238424u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			isPryingDoor = state;
			inSpecialAnimation = state;
			((Behaviour)base.agent).enabled = !state;
			if (state)
			{
				pryingDoorAnimTime = 0f;
				if ((Object)(object)shipDoor != (Object)null)
				{
					shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", true);
					shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", 0f);
				}
				breakDownDoorAudio.PlayOneShot(breakAndEnter);
				WalkieTalkie.TransmitOneShotAudio(breakDownDoorAudio, breakAndEnter, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.9f, 0, false, 0);
				StartOfRound.Instance.speakerAudioSource.PlayOneShot(shipAlarm);
				WalkieTalkie.TransmitOneShotAudio(StartOfRound.Instance.speakerAudioSource, shipAlarm, 1f);
				if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)this).transform.position) < 18f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
				}
				return;
			}
			if ((Object)(object)shipDoor != (Object)null)
			{
				shipDoor.shipDoorsAnimator.SetBool("Closed", false);
				shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", false);
				StartOfRound.Instance.SetShipDoorsClosed(false);
				StartOfRound.Instance.SetShipDoorsOverheatLocalClient();
				shipDoor.doorPower = 0f;
			}
			if (queuedState != -1)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					((EnemyAI)this).SwitchToBehaviourState(queuedState);
					ulong num = ((queuedState == 2 && (Object)(object)base.targetPlayer != (Object)null) ? base.targetPlayer.actualClientId : StartOfRound.Instance.allPlayerScripts[0].actualClientId);
					((EnemyAI)this).ChangeOwnershipOfEnemy(num);
				}
				queuedState = -1;
			}
		}

		public bool BreakIntoShip()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)shipDoor == (Object)null)
			{
				return false;
			}
			if (isPryingDoor)
			{
				if (pryingDoorAnimTime >= 1f)
				{
					FinishPryOpenDoor();
				}
				return true;
			}
			if (StartOfRound.Instance.hangarDoorsClosed && (Object)(object)base.targetPlayer != (Object)null && base.targetPlayer.isInHangarShipRoom && Vector3.Distance(((Component)this).transform.position, shipDoor.outsideDoorPoint.position) < 4f)
			{
				foreach (ObserversAI allChaser in allChasers)
				{
					if ((Object)(object)allChaser != (Object)null && (Object)(object)allChaser != (Object)(object)this && allChaser.isPryingDoor)
					{
						return false;
					}
				}
				BeginPryOpenDoor();
				return true;
			}
			return false;
		}

		private bool AreOtherChasersAlive()
		{
			if (allChasers == null)
			{
				return false;
			}
			foreach (ObserversAI allChaser in allChasers)
			{
				if ((Object)(object)allChaser != (Object)null && (Object)(object)allChaser != (Object)(object)this && !((EnemyAI)allChaser).isEnemyDead)
				{
					return true;
				}
			}
			return false;
		}

		public override void OnDestroy()
		{
			((EnemyAI)this).OnDestroy();
			if (allChasers.Contains(this))
			{
				allChasers.Remove(this);
			}
			if (!AreOtherChasersAlive() && (Object)(object)activeObserver != (Object)null)
			{
				Object.Destroy((Object)(object)activeObserver);
			}
			ObserverScrapListener.ClearData();
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoAnimationServerRpc(string animationTrigger, bool isBool = false, bool state = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00bb: 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_00d6: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1525562837u, val2, (RpcDelivery)0);
				bool flag = animationTrigger != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(animationTrigger, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isBool, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1525562837u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				DoAnimationClientRpc(animationTrigger, isBool, state);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationTrigger, bool isBool = false, bool state = false)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00bb: 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_00d6: 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_00f0: 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(1295253700u, val2, (RpcDelivery)0);
				bool flag = animationTrigger != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(animationTrigger, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isBool, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1295253700u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>();
				if (isBool)
				{
					componentInChildren.SetBool(animationTrigger, state);
				}
				else
				{
					componentInChildren.SetTrigger(animationTrigger);
				}
			}
		}

		[ClientRpc]
		public void PlayVictimWhisperClientRpc()
		{
			//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(3498312188u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3498312188u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)base.targetPlayer)
				{
					HUDManager.Instance.UIAudio.PlayOneShot(markedLineClip, 1f);
				}
			}
		}

		[ClientRpc]
		public void PlayChaserSFXClientRpc(string sfxType)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			//IL_00ba: 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(3962993773u, val2, (RpcDelivery)0);
				bool flag = sfxType != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(sfxType, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3962993773u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (sfxType == "reanimate")
				{
					base.creatureSFX.Play();
				}
				else if (sfxType == "death")
				{
					base.creatureVoice.PlayOneShot(base.dieSFX);
				}
			}
		}

		[ClientRpc]
		public void PlayClientFXClientRpc(int fxType)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(549905190u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, fxType);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 549905190u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			switch (fxType)
			{
			case 0:
				((MonoBehaviour)this).StartCoroutine(FlickerLightsDuringRise(7f));
				break;
			case 1:
				if (!base.creatureVoice.isPlaying)
				{
					base.creatureVoice.Play();
				}
				break;
			}
		}

		public void SpawnObserverSpectre()
		{
			//IL_0060: 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)
			//IL_0067: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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)
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
			EntranceTeleport val = null;
			EntranceTeleport[] array2 = array;
			foreach (EntranceTeleport val2 in array2)
			{
				if (val2.entranceId == 0 && val2.isEntranceToBuilding)
				{
					val = val2;
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Vector3 val3 = (mainEntrancePosition = ((Component)val).transform.position);
			GameObject[] array3 = GameObject.FindGameObjectsWithTag("OutsideAINode");
			Vector3 val4 = val3;
			float num = float.MaxValue;
			if (array3 != null)
			{
				GameObject[] array4 = array3;
				foreach (GameObject val5 in array4)
				{
					float num2 = Vector3.Distance(val3, val5.transform.position);
					if (num2 > 12f && num2 < 40f && num2 < num)
					{
						num = num2;
						val4 = val5.transform.position;
					}
				}
				if (num == float.MaxValue && array3.Length != 0)
				{
					val4 = array3[0].transform.position;
					GameObject[] array5 = array3;
					foreach (GameObject val6 in array5)
					{
						if (Vector3.Distance(val3, val6.transform.position) < Vector3.Distance(val3, val4))
						{
							val4 = val6.transform.position;
						}
					}
				}
			}
			val4.y += 15f;
			if (val4.y < val3.y)
			{
				val4.y = val3.y + 5f;
			}
			Vector3 val7 = val3 - val4;
			val7.y = 0f;
			Quaternion spawnRot = Quaternion.LookRotation(val7);
			Plugin.Logger.LogInfo((object)$"Spawning Spectre at {val4} to watch the door.");
			hasSpawnedSpectre = true;
			SpawnSpectreClientRpc(val4, spawnRot);
		}

		[ClientRpc]
		public void SpawnSpectreClientRpc(Vector3 spawnPos, Quaternion spawnRot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			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(1365692926u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPos);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnRot);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1365692926u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)activeObserver == (Object)null)
			{
				GameObject val3 = (activeObserver = Object.Instantiate<GameObject>(ObserverPrefab, spawnPos, spawnRot));
				spectreVoice = activeObserver.GetComponentsInChildren<AudioSource>()[AtmosphereAudioSourceIndex];
				foreach (ObserversAI allChaser in allChasers)
				{
					if ((Object)(object)allChaser != (Object)null)
					{
						allChaser.activeObserver = val3;
						allChaser.hasSpawnedSpectre = true;
					}
				}
				Terminal val4 = Object.FindObjectOfType<Terminal>();
				foreach (TerminalNode enemyFile in val4.enemyFiles)
				{
					if (!((Object)(object)enemyFile != (Object)null) || !enemyFile.creatureName.Contains("Observer"))
					{
						continue;
					}
					ScanNodeProperties[] componentsInChildren = ((Component)this).GetComponentsInChildren<ScanNodeProperties>(true);
					foreach (ScanNodeProperties val5 in componentsInChildren)
					{
						if (val5.nodeType == 1)
						{
							val5.creatureScanID = enemyFile.creatureFileID;
						}
					}
					break;
				}
			}
			ToggleAndMoveScanNode(enable: true, spawnPos);
		}

		[ClientRpc]
		public void SyncTargetClientRpc(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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4289629946u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4289629946u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (playerId < 0 || playerId >= StartOfRound.Instance.allPlayerScripts.Length)
			{
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			foreach (ObserversAI allChaser in allChasers)
			{
				if ((Object)(object)allChaser != (Object)null)
				{
					((EnemyAI)allChaser).targetPlayer = val3;
				}
			}
			Plugin.Logger.LogInfo((object)("Target synced to all chasers: " + val3.playerUsername));
		}

		public void DespawnObserverSpectre()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				DespawnSpectreClientRpc();
				hasSpawnedSpectre = false;
			}
		}

		[ClientRpc]
		public void DespawnSpectreClientRpc()
		{
			//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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			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(272201980u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 272201980u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)activeObserver != (Object)null)
				{
					Object.Destroy((Object)(object)activeObserver);
				}
				ToggleAndMoveScanNode(enable: false);
			}
		}

		private void ChooseMasterObserver()
		{
			ObserversAI[] array = Object.FindObjectsByType<ObserversAI>((FindObjectsSortMode)0);
			int num = int.MaxValue;
			int num2 = -1;
			for (int i = 0; i < array.Length; i++)
			{
				if (!((EnemyAI)array[i]).isEnemyDead && ((EnemyAI)array[i]).thisEnemyIndex < num)
				{
					num = ((EnemyAI)array[i]).thisEnemyIndex;
					num2 = i;
				}
			}
			if (num2 == -1)
			{
				return;
			}
			master = array[num2];
			if (((NetworkBehaviour)this).IsServer)
			{
				allChasers = new List<ObserversAI>(array);
				foreach (ObserversAI allChaser in allChasers)
				{
					if ((Object)(object)allChaser != (Object)(object)master)
					{
						allChaser.isMaster = false;
						allChaser.master = master;
						allChaser.activeObserver = master.activeObserver;
						allChaser.hasSpawnedSpectre = master.hasSpawnedSpectre;
					}
				}
			}
			if ((Object)(object)master == (Object)(object)this)
			{
				isMaster = true;
				SyncMasterObserverClientRpc();
			}
			else if (((NetworkBehaviour)this).IsServer)
			{
				master.SyncMasterObserverClientRpc();
			}
		}

		[ClientRpc]
		public void SyncMasterObserverClientRpc()
		{
			//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(1018360634u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1018360634u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			master = this;
			isMaster = true;
			allChasers = new List<ObserversAI>(Object.FindObjectsByType<ObserversAI>((FindObjectsSortMode)0));
			foreach (ObserversAI allChaser in allChasers)
			{
				if ((Object)(object)allChaser != (Object)(object)this)
				{
					allChaser.isMaster = false;
					allChaser.master = this;
					allChaser.activeObserver = activeObserver;
					allChaser.hasSpawnedSpectre = hasSpawnedSpectre;
				}
			}
		}

		public override void Update()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_0640: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (((NetworkBehaviour)this).IsServer)
			{
				if (!choseMasterObserver)
				{
					choseMasterObserver = true;
					ChooseMasterObserver();
				}
				else if ((Object)(object)master == (Object)null || ((EnemyAI)master).isEnemyDead)
				{
					ChooseMasterObserver();
				}
			}
			if (isPryingDoor && inSpecialAnimation && (Object)(object)shipDoor != (Object)null)
			{
				((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, shipDoor.outsideDoorPoint.position, 7f * Time.deltaTime);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, shipDoor.outsideDoorPoint.rotation, 7f * Time.deltaTime);
				pryingDoorAnimTime = Mathf.Min(pryingDoorAnimTime + Time.deltaTime / pryOpenDoorAnimLength, 1f);
				if ((Object)(object)chaserAnimator != (Object)null)
				{
					chaserAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime);
				}
				shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime);
				BreakIntoShip();
				return;
			}
			if (((NetworkBehaviour)this).IsServer && isMaster && !base.isEnemyDead && base.currentBehaviourStateIndex == 0)
			{
				atmosphereTimer += Time.deltaTime;
				if (atmosphereTimer >= 10f)
				{
					atmosphereTimer = 0f;
					if (Random.value <= 0.3f)
					{
						int clipIndex = Random.Range(0, AtmosphereClips.Length);
						PlayAtmosphereClientRpc(clipIndex);
					}
				}
			}
			if (isBlasting && (Object)(object)activeObserver != (Object)null)
			{
				cameraShakeTimer -= Time.deltaTime;
				if (cameraShakeTimer <= 0f)
				{
					cameraShakeTimer = 0.3f;
					PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
					if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead)
					{
						float num = Vector3.Distance(((Component)localPlayerController).transform.position, activeObserver.transform.position);
						if (num < 35f)
						{
							HUDManager.Instance.ShakeCamera(SirenShakeType);
						}
					}
				}
			}
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
				if (!isStunned)
				{
					isStunned = true;
					DoAnimationClientRpc("hasBeenStunned");
					Plugin.Logger.LogInfo((object)"Chaser has been stunned");
				}
			}
			else
			{
				isStunned = false;
			}
			if (attackCooldown > 0f)
			{
				attackCooldown -= Time.deltaTime;
			}
			if (!base.isEnemyDead && base.enemyHP > 0 && base.currentBehaviourStateIndex == 2 && base.stunNormalizedTimer <= 0f)
			{
				if (((NetworkBehaviour)this).IsOwner)
				{
					BustOpenDoorsInRadius();
					float num2 = 1f;
					if ((Object)(object)base.targetPlayer != (Object)null && base.isOutside != !base.targetPlayer.isInsideFactory)
					{
						num2 = 0.5f;
					}
					currentChaseDuration += Time.deltaTime * num2;
					if (currentChaseDuration >= chaseTime)
					{
						currentChaseDuration = -9999f;
						Plugin.Logger.LogInfo((object)"Chase time expired");
						if (isMaster)
						{
							TriggerChaseEndServerRpc();
						}
						return;
					}
				}
			}
			else if (base.currentBehaviourStateIndex == 3)
			{
				chaseTimer += Time.deltaTime;
				if (chaseTimer > observerCooldown)
				{
					chaseTimer = 0f;
					base.targetPlayer = null;
					if (((NetworkBehaviour)this).IsServer && isMaster)
					{
						SpectreAnimationClientRpc("cooldownOver");
						SpectreSetEmissionClientRpc(12f);
						ToggleSpotlightClientRpc(enable: true);
						foreach (ObserversAI allChaser in allChasers)
						{
							if ((Object)(object)allChaser != (Object)null)
							{
								((EnemyAI)allChaser).targetPlayer = null;
								((EnemyAI)allChaser).SwitchToBehaviourState(0);
								((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
							}
						}
					}
				}
			}
			if (((NetworkBehaviour)this).IsServer && isMaster)
			{
				if (base.currentBehaviourStateIndex == 0)
				{
					if (!hasSpawnedSpectre)
					{
						SpawnObserverSpectre();
					}
					int threshold = scrapAnger;
					PlayerControllerB val = ObserverScrapListener.CheckForGreedyPlayer(threshold);
					if ((Object)(object)val != (Object)null)
					{
						base.targetPlayer = val;
						Plugin.Logger.LogInfo((object)"Scrap anger threshold met");
						SyncTargetClientRpc((int)val.playerClientId);
						((EnemyAI)this).SwitchToBehaviourState(1);
					}
				}
				else if (base.currentBehaviourStateIndex == 1 && (Object)(object)base.targetPlayer != (Object)null && !isPlayingMarkAnimation)
				{
					Vector3 val2 = (((Object)(object)activeObserver != (Object)null) ? activeObserver.transform.position : RoundManager.FindMainEntrancePosition(true, base.isOutside));
					if (Vector3.Distance(((Component)base.targetPlayer).transform.position, val2) < detectRange)
					{
						isPlayingMarkAnimation = true;
						((MonoBehaviour)this).StartCoroutine(MarkAndChaseSequence());
					}
				}
			}
			if (slowDownTimer > 0f)
			{
				slowDownTimer -= Time.deltaTime;
			}
			if (((NetworkBehaviour)this).IsServer && !base.isEnemyDead && (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 1) && (Object)(object)base.targetPlayer != (Object)null && (base.targetPlayer.isPlayerDead || !base.targetPlayer.isPlayerControlled))
			{
				Plugin.Logger.LogInfo((object)"Victim died/DC'd. Chaser is ending the chase early");
				TriggerChaseEndClientRpc();
			}
		}

		public void LateUpdate()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)activeObserver != (Object)null) || base.isEnemyDead || (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 1))
			{
				return;
			}
			PlayerControllerB val = null;
			if (base.currentBehaviourStateIndex == 0)
			{
				val = GameNetworkManager.Instance.localPlayerController;
			}
			else if (base.currentBehaviourStateIndex == 1)
			{
				val = base.targetPlayer;
			}
			if ((Object)(object)val != (Object)null)
			{
				Animator componentInChildren = activeObserver.GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.applyRootMotion = false;
				}
				Vector3 val2 = ((Component)val.gameplayCamera).transform.position - activeObserver.transform.position;
				val2.y = 0f;
				if (val2 != Vector3.zero)
				{
					Quaternion val3 = Quaternion.LookRotation(val2) * Quaternion.Euler(SpectreRotationOffset);
					activeObserver.transform.rotation = Quaternion.Slerp(activeObserver.transform.rotation, val3, Time.deltaTime * 5f);
				}
			}
			if ((Object)(object)cachedScanNode != (Object)null && ((Component)cachedScanNode).gameObject.activeSelf)
			{
				((Component)cachedScanNode).transform.position = activeObserver.transform.position + Vector3.up * 1.5f;
			}
		}

		public override void DoAIInterval()
		{
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			int num = currentBehaviourStateIndex;
			if (num != 2 || (Object)(object)base.targetPlayer == (Object)null || BreakIntoShip())
			{
				return;
			}
			bool flag = !base.targetPlayer.isInsideFactory;
			bool isOutside = base.isOutside;
			base.agent.speed = ((slowDownTimer > 0f) ? 3f : baseSpeed);
			BustOpenDoorsInRadius();
			if (!base.isOutside && RoundManager.Instance.currentDungeonType == 4)
			{
				if ((Object)(object)elevatorScript == (Object)null)
				{
					elevatorScript = Object.FindObjectOfType<MineshaftElevatorController>();
				}
				if ((Object)(object)elevatorScript != (Object)null)
				{
					if (isInElevatorStartRoom)
					{
						if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < 10f)
						{
							isInElevatorStartRoom = false;
						}
					}
					else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < 10f)
					{
						isInElevatorStartRoom = true;
					}
					bool flag2 = Mathf.Abs(((Component)base.targetPlayer).transform.position.y - elevatorScript.elevatorTopPoint.position.y) < Mathf.Abs(((Component)base.targetPlayer).transform.position.y - elevatorScript.elevatorBottomPoint.position.y);
					if (flag2 != isInElevatorStartRoom)
					{
						bool goUp = !isInElevatorStartRoom;
						UseElevator(goUp);
						return;
					}
				}
			}
			if (base.isOutside != flag)
			{
				base.movingTowardsTargetPlayer = false;
				EntranceTeleport closestDoorToChaser = GetClosestDoorToChaser();
				if (!((Object)(object)closestDoorToChaser != (Object)null))
				{
					return;
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)closestDoorToChaser).transform.position, false);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)closestDoorToChaser).transform.position) < 4f)
				{
					EntranceTeleport correspondingDoor = GetCorrespondingDoor(closestDoorToChaser);
					if ((Object)(object)correspondingDoor != (Object)null)
					{
						TeleportEnemyServerRpc(correspondingDoor.entrancePoint.position, flag);
					}
				}
			}
			else
			{
				base.moveTowardsDestination = true;
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true);
			}
		}

		private void ToggleAndMoveScanNode(bool enable, Vector3 newPosition = default(Vector3))
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			ScanNodeProperties[] componentsInChildren = ((Component)this).GetComponentsInChildren<ScanNodeProperties>(true);
			ScanNodeProperties[] array = componentsInChildren;
			foreach (ScanNodeProperties val in array)
			{
				if (val.nodeType == 1)
				{
					cachedScanNode = val;
					((Component)val).gameObject.SetActive(enable);
					Collider component = ((Component)val).GetComponent<Collider>();
					if ((Object)(object)component != (Object)null)
					{
						component.enabled = enable;
					}
					if (enable)
					{
						((Component)val).transform.position = newPosition + Vector3.up * 1.5f;
					}
					break;
				}
			}
		}

		[ClientRpc]
		public void TogglePossessionSwarmClientRpc(bool enable)
		{
			//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(4022354919u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 4022354919u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					possessionSwarmParticles.SetActive(enable);
				}
			}
		}

		private EntranceTeleport GetClosestDoorToChaser()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (allTeleports == null || allTeleports.Length == 0)
			{
				allTeleports = Object.FindObjectsOfType<EntranceTeleport>();
			}
			EntranceTeleport result = null;
			float num = float.MaxValue;
			EntranceTeleport[] array = allTeleports;
			foreach (EntranceTeleport val in array)
			{
				if (val.isEntranceToBuilding == base.isOutside)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (num2 < num)
					{
						num = num2;
						result = val;
					}
				}
			}
			return result;
		}

		public override void SetEnemyStunned(bool setToStunned, float setToStunTime = 2f, PlayerControllerB setStunnedByPlayer = null)
		{
			if (base.currentBehaviourStateIndex == 2)
			{
				((EnemyAI)this).SetEnemyStunned(setToStunned, setToStunTime, setStunnedByPlayer);
			}
		}

		private EntranceTeleport GetCorrespondingDoor(EntranceTeleport chaserDoor)
		{
			if ((Object)(object)chaserDoor == (Object)null)
			{
				return null;
			}
			EntranceTeleport[] array = allTeleports;
			foreach (EntranceTeleport val in array)
			{
				if (val.entranceId == chaserDoor.entranceId && val.isEntranceToBuilding != chaserDoor.isEntranceToBuilding)
				{
					return val;
				}
			}
			return null;
		}

		private void UseElevator(bool goUp)
		{
			//IL_0036: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)elevatorScript == (Object)null)
			{
				return;
			}
			Vector3 val = (goUp ? elevatorScript.elevatorBottomPoint.position : elevatorScript.elevatorTopPoint.position);
			if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) < 2f)
			{
				((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false);
				base.agent.speed = 0f;
				if (elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorDoorOpen && elevatorScript.elevatorMovingDown == goUp)
				{
					elevatorScript.PressElevatorButtonOnServer(true);
				}
				if (!elevatorScript.elevatorFinishedMoving)
				{
					((Behaviour)base.agent).enabled = false;
					((Component)this).transform.position = elevatorScript.elevatorInsidePoint.position;
				}
				else
				{
					((Behaviour)base.agent).enabled = true;
				}
				return;
			}
			((Behaviour)base.agent).enabled = true;
			if (elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorDoorOpen && elevatorScript.elevatorMovingDown == goUp)
			{
				((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false);
				base.agent.speed = baseSpeed;
				return;
			}
			((EnemyAI)this).SetDestinationToPosition(val, false);
			if (Vector3.Distance(((Component)this).transform.position, val) < 2f)
			{
				if (!elevatorScript.elevatorCalled && elevatorScript.elevatorMovingDown != goUp)
				{
					elevatorScript.CallElevatorOnServer(goUp);
				}
				base.agent.speed = 0f;
			}
			else
			{
				base.agent.speed = baseSpeed;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TriggerChaseEndServerRpc()
		{
			//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.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3538892510u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3538892510u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			foreach (ObserversAI allChaser in allChasers)
			{
				if ((Object)(object)allChaser != (Object)null)
				{
					allChaser.TriggerChaseEndClientRpc();
				}
			}
		}

		[ClientRpc]
		public void TriggerChaseEndClientRpc()
		{
			//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(2624471623u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2624471623u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				currentChaseDuration = 0f;
				base.creatureVoice.Stop();
				base.creatureSFX.PlayOneShot(base.dieSFX);
				isPlayingMarkAnimation = false;
				base.agent.speed = 0f;
				DoAnimationClientRpc("hasBeenKilled");
				SpectreSetBoolClientRpc("isBlasting", state: false);
				if (((NetworkBehaviour)this).IsServer)
				{
					chaseTimer = 0f;
					((EnemyAI)this).SwitchToBehaviourState(3);
					((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
				}
				SpectreSirenClientRpc(play: false);
			}
		}

		[ClientRpc]
		public void SpectreAnimationClientRpc(string animationTrigger)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			//IL_00ba: 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(2864545691u, val2, (RpcDelivery)0);
				bool flag = animationTrigger != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(animationTrigger, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2864545691u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)activeObserver != (Object)null)
			{
				Animator componentInChildren = activeObserver.GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.SetTrigger(animationTrigger);
					Plugin.Logger.LogInfo((object)("Triggered Spectre animation: " + animationTrigger));
				}
			}
		}

		private IEnumerator MarkAndChaseSequence()
		{
			PlayVictimWhisperClientRpc();
			SpectreAnimationClientRpc("isMarked");
			yield return (object)new WaitForSeconds(SirenDelay);
			if (base.isEnemyDead || base.currentBehaviourStateIndex != 1)
			{
				yield break;
			}
			Plugin.Logger.LogInfo((object)"!!SIREN SOUNDING!!");
			SpectreSirenClientRpc(play: true);
			SpectreSetBoolClientRpc("isBlasting", state: true);
			((MonoBehaviour)this).StartCoroutine(FinishAirRaidAfter(AirRaidLength));
			yield return (object)new WaitForSeconds(11f);
			if (base.isEnemyDead || base.currentBehaviourStateIndex != 1)
			{
				yield break;
			}
			foreach (ObserversAI chaser in allChasers)
			{
				if ((Object)(object)chaser != (Object)null && !((EnemyAI)chaser).isEnemyDead)
				{
					chaser.DoAnimationClientRpc("hasBeenSummoned");
					chaser.ToggleVisualKnifeClientRpc(enable: true);
					chaser.PlayClientFXClientRpc(0);
					chaser.PlayChaserSFXClientRpc("reanimate");
					chaser.TogglePossessionSwarmClientRpc(enable: true);
					((MonoBehaviour)chaser).StartCoroutine(chaser.FlickerLightsDuringRise(6f));
				}
			}
			yield return (object)new WaitForSeconds(8f);
			foreach (ObserversAI chaser2 in allChasers)
			{
				if ((Object)(object)chaser2 != (Object)null && !((EnemyAI)chaser2).isEnemyDead)
				{
					chaser2.TogglePossessionSwarmClientRpc(enable: false);
				}
			}
			yield return (object)new WaitForSeconds(3f);
			if (base.isEnemyDead || base.currentBehaviourStateIndex != 1)
			{
				yield break;
			}
			foreach (ObserversAI chaser3 in allChasers)
			{
				if ((Object)(object)chaser3 != (Object)null && !((EnemyAI)chaser3).isEnemyDead)
				{
					chaser3.DoAnimationClientRpc("riseFinished");
					chaser3.PlayClientFXClientRpc(1);
					((EnemyAI)chaser3).agent.speed = baseSpeed;
					((EnemyAI)chaser3).SwitchToBehaviourState(2);
					((EnemyAI)chaser3).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
					chaser3.isPlayingMarkAnimation = false;
				}
			}
		}

		private IEnumerator FinishAirRaidAfter(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			SpectreSetBoolClientRpc("isBlasting", state: false);
			SpectreAnimationClientRpc("isPoweringDown");
			SpectreSetEmissionClientRpc(0f);
			ToggleSpotlightClientRpc(enable: false);
		}

		[ClientRpc]
		public void ToggleSpotlightClientRpc(bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1878763915u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1878763915u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((Object)(object)activeObserver != (Object)null))
			{
				return;
			}
			Transform[] componentsInChildren = activeObserver.GetComponentsInChildren<Transform>(true);
			Transform[] array = componentsInChildren;
			foreach (Transform val3 in array)
			{
				if (((Object)val3).name == "Spot Light")
				{
					((Component)val3).gameObject.SetActive(enable);
					break;
				}
			}
		}

		[ClientRpc]
		public void SpectreSetEmissionClientRpc(float intensity)
		{
			//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_01a4: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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(3285939813u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref intensity, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3285939813u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((Object)(object)activeObserver != (Object)null))
			{
				return;
			}
			Renderer[] componentsInChildren = activeObserver.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val3 in array)
			{
				Material[] materials = val3.materials;
				foreach (Material val4 in materials)
				{
					string[] array2 = new string[1] { "_EmissiveColor" };
					string[] array3 = array2;
					foreach (string text in array3)
					{
						if (val4.HasProperty(text))
						{
							int instanceID = ((Object)val4).GetInstanceID();
							if (!originalEmissions.ContainsKey(instanceID))
							{
								originalEmissions[instanceID] = val4.GetColor(text);
							}
							Color val5 = originalEmissions[instanceID];
							float num = Mathf.Max(val5.r, Mathf.Max(val5.g, val5.b));
							if (num > 0.0001f)
							{
								val4.SetColor(text, val5 / num * intensity);
							}
							else
							{
								val4.SetColor(text, Color.white * intensity);
							}
						}
					}
				}
			}
		}

		[ClientRpc]
		public void SpectreSetBoolClientRpc(string boolName, bool state)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: 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(2011207444u, val2, (RpcDelivery)0);
				bool flag = boolName != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(boolName, false);
				}
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2011207444u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (boolName == "isBlasting")
			{
				isBlasting = state;
				if ((Object)(object)activeObserver != (Object)null)
				{
					Transform val3 = activeObserver.transform.Find("Shockwave");
					if ((Object)(object)val3 != (Object)null)
					{
						ParticleSystem component = ((Component)val3).GetComponent<ParticleSystem>();
						if ((Object)(object)component != (Object)null)
						{
							if (state)
							{
								component.Play();
							}
							else
							{
								component.Stop(true, (ParticleSystemStopBehavior)0);
							}
						}
					}
				}
			}
			if ((Object)(object)activeObserver != (Object)null)
			{
				Animator componentInChildren = activeObserver.GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.SetBool(boolName, state);
					Plugin.Logger.LogInfo((object)$"Set Spectre bool: {boolName} to {state}");
				}
			}
		}

		[ClientRpc]
		public void SpectreSirenClientRpc(bool play)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4281834236u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref play, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4281834236u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)activeObserver != (Object)null)
			{
				AudioSource val3 = activeObserver.GetComponentsInChildren<AudioSource>()[SirenAudioSourceIndex];
				val3.volume = raidVolume;
				if (play)
				{
					val3.Play();
				}
				else
				{
					val3.Stop();
				}
			}
		}

		[ClientRpc]
		public void PlayAtmosphereClientRpc(int clipIndex)
		{
			//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(1947800209u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, clipIndex);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1947800209u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					spectreVoice.PlayOneShot(AtmosphereClips[clipIndex]);
				}
			}
		}

		[ClientRpc]
		public void ToggleVisualKnifeClientRpc(bool enable)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(228764123u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enable, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 228764123u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (activeWeaponIndex >= 0 && activeWeaponIndex < knifeModels.Length)
			{
				for (int i = 0; i < knifeModels.Length; i++)
				{
					knifeModels[i].SetActive(enable && i == activeWeaponIndex);
				}
			}
		}

		public void SpawnItemLocally()
		{
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_0129: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			string targetItemName = "Kitchen knife";
			if (activeWeaponIndex >= 0 && activeWeaponIndex < knifeModels.Length)
			{
				string text = ((Object)knifeModels[activeWeaponIndex]).name.ToLower();
				if (text.Contains("shovel"))
				{
					targetItemName = "Shovel";
				}
				else if (text.Contains("stop"))
				{
					targetItemName = "Stop sign";
				}
				else if (text.Contains("yield"))
				{
					targetItemName = "Yield sign";
				}
			}
			Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item x) => x.itemName == targetItemName);
			if (!((Object)(object)val == (Object)null))
			{
				Vector3 val2 = (((Object)(object)handBone != (Object)null) ? handBone.position : (((Component)this).transform.position + Vector3.up));
				GameObject val3 = Object.Instantiate<GameObject>(val.spawnPrefab, val2, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
				GrabbableObject component = val3.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				component.targetFloorPosition = component.GetItemFloorPosition(val2);
				int num = (int)((float)Random.Range(val.minValue, val.maxValue) * RoundManager.Instance.scrapValueMultiplier);
				component.SetScrapValue(num);
				NetworkObject component2 = val3.GetComponent<NetworkObject>();
				component2.Spawn(false);
				RoundManager.Instance.SyncScrapValuesClientRpc((NetworkObjectReference[])(object)new NetworkObjectReference[1] { NetworkObjectReference.op_Implicit(component2) }, new int[1] { num });
			}
		}

		private void BustOpenDoorsInRadius()
		{
			//IL_0052: 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)
			//IL_0063: 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)
			if (!((NetworkBehaviour)this).IsOwner || cachedDoors == null)
			{
				return;
			}
			float num = 5.5f;
			DoorLock[] array = cachedDoors;
			foreach (DoorLock val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Vector3 val2 = ((Component)this).transform.position - ((Component)val).transform.position;
				if (!(((Vector3)(ref val2)).sqrMagnitude < num) || (doorCooldowns.ContainsKey(val) && Time.time - doorCooldowns[val] < 3f))
				{
					continue;
				}
				AnimatedObjectTrigger component = ((Component)val).GetComponent<AnimatedObjectTrigger>();
				if ((Object)(object)component != (Object)null && !component.boolValue)
				{
					if (val.isLocked)
					{
						val.UnlockDoorServerRpc();
					}
					DoAnimationClientRpc("bashDoor");
					component.TriggerAnimationNonPlayer(true, true, false);
					val.OpenDoorAsEnemyServerRpc();
					Plugin.Logger.LogInfo((object)"Chaser bashed a door open");
					doorCooldowns[val] = Time.time;
				}
			}
		}

		private IEnumerator FlickerLightsDuringRise(float radius = 20f)
		{
			Vector3 chaserPos = ((Component)this).transform.position;
			List<Animator> lightsNearby = new List<Animator>();
			for (int i = 0; i < RoundManager.Instance.allPoweredLightsAnimators.Count; i++)
			{
				Animator anim = RoundManager.Instance.allPoweredLightsAnimators[i];
				if ((Object)(object)anim != (Object)null && Vector3.Distance(((Component)anim).transform.position, chaserPos) <= radius)
				{
					lightsNearby.Add(anim);
				}
			}
			if (lightsNearby.Count == 0)
			{
				yield break;
			}
			int loopCount = 0;
			for (int b = 4; b > 0; b--)
			{
				int limit = lightsNearby.Count / b;
				for (int j = loopCount; j < limit; j++)
				{
					if (j < lightsNearby.Count && (Object)(object)lightsNearby[j] != (Object)null)
					{
						lightsNearby[j].SetTrigger("Flicker");
					}
					loopCount++;
				}
				yield return (object)new WaitForSeconds(0.05f);
			}
		}

		[ServerRpc]
		public void TeleportEnemyServerRpc(Vector3 pos, bool setOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Invalid comparison between Unknown and I4
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3926938328u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3926938328u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				TeleportEnemyClientRpc(pos, setOutside);
			}
		}

		[ClientRpc]
		public void TeleportEnemyClientRpc(Vector3 pos, bool setOutside)
		{
			//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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			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(2194695671u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref pos);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2194695671u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					TeleportEnemyLocally(pos, setOutside);
				}
			}
		}

		private void TeleportEnemyLocally(Vector3 pos, bool setOutside)
		{
			//IL_0014: 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_002a: 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)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)base.agent).enabled = false;
			((Component)this).transform.position = pos;
			((Behaviour)base.agent).enabled = true;
			base.serverPosition = pos;
			((EnemyAI)this).SetEnemyOutside(setOutside);
			mainEntrancePosition = RoundManager.FindMainEntrancePosition(true, base.isOutside);
			EntranceTeleport val = RoundManager.FindMainEntranceScript(setOutside);
			if ((Object)(object)val != (Object)null && val.doorAudios != null && val.doorAudios.Length != 0)
			{
				val.entrancePointAudio.PlayOneShot(val.doorAudios[0]);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0062: 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)
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (!base.isEnemyDead && base.currentBehaviourStateIndex == 2 && !(attackCooldown > 0f) && !(base.stunNormalizedTimer > 0f))
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if ((Object)(object)val != (Object)null)
				{
					val.DamagePlayer(chaserDamage, true, true, (CauseOfDeath)14, 0, false, default(Vector3));
					attackCooldown = 0.5f;
					slowDownTimer = 0.4f;
					TriggerAttackAnimationServerRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TriggerAttackAnimationServerRpc()
		{
			//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(1031757427u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1031757427u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					int soundIdx = Random.Range(0, weaponStabSounds[activeWeaponIndex].sounds.Length);
					TriggerAttackAnimationClientRpc(soundIdx);
				}
			}
		}

		[ClientRpc]
		public void TriggerAttackAnimationClientRpc(int soundIdx)
		{
			//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)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3518219662u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, soundIdx);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3518219662u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				attackCooldown = 0.5f;
				slowDownTimer = 0.4f;
				Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.SetTrigger("stabAttack");
				}
				base.creatureSFX.PlayOneShot(weaponStabSounds[activeWeaponIndex].sounds[soundIdx]);
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (base.isEnemyDead || base.currentBehaviourStateIndex != 2)
			{
				return;
			}
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (!base.isEnemyDead)
			{
				base.enemyHP -= force;
				if (base.enemyHP <= 0)
				{
					base.agent.speed = 0f;
					attackCooldown = 10f;
					base.creatureVoice.Stop();
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
				else if (((NetworkBehaviour)this).IsServer)
				{
					DoAnimationClientRpc("TakeDamage");
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			if (base.isEnemyDead)
			{
				return;
			}
			base.agent.speed = 0f;
			((Behaviour)base.agent).enabled = false;
			base.creatureVoice.Stop();
			((EnemyAI)this).KillEnemy(destroy);
			base.creatureSFX.PlayOneShot(base.dieSFX);
			if (((NetworkBehaviour)this).IsServer)
			{
				DoAnimationClientRpc("hasBeenKilled");
				if (itemDrop)
				{
					SpawnItemLocally();
				}
				ToggleVisualKnifeClientRpc(enable: false);
				if (!AreOtherChasersAlive())
				{
					SpectreSirenClientRpc(play: false);
					DespawnObserverSpectre();
				}
			}
		}

		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