Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Observer v2.0.1
plugins/Reiko888.Observers.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
#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.0.1.0")] [assembly: AssemblyInformationalVersion("2.0.1+cece1756811f2c50425d62adde1d1b54965d8b26")] [assembly: AssemblyProduct("Observers")] [assembly: AssemblyTitle("Reiko888.Observers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.1.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; } private enum State { Observing, MarkingPlayer, Chase, Cooldown } 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 Transform attackArea = null; 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>(); [Header("Door Prying")] public HangarShipDoor shipDoor; public bool isPryingDoor; private bool inSpecialAnimation; private float pryingDoorAnimTime; 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; private Ray enemyRay; private RaycastHit enemyRayHit; public AudioClip[] customFootstepSounds; private float footstepTimer = 0f; public AudioSource movementAudio; public GameObject knifeModel; public WeaponSoundSet[] weaponStabSounds; public int activeWeaponIndex = 0; private DoorLock[] cachedDoors; private float slowScanTimer = 0f; private const float SLOW_SCAN_INTERVAL = 2f; private Dictionary<DoorLock, float> doorCooldowns = new Dictionary<DoorLock, float>(); public AudioClip chaserDeathSound; public AudioClip chaserReanimateSound; private Vector3 lastPosition; private MineshaftElevatorController elevatorScript; private bool isInElevatorStartRoom = false; private bool isHalted = false; public AudioSource markedLineAudio; public ParticleSystem manifestationParticles; public SkinnedMeshRenderer chaserRenderer; public Mesh[] randomMeshes; public GameObject[] meshVariants; public GameObject[] knifeModels; private EntranceTeleport[] allTeleports; public GameObject possessionSwarmParticles; public AudioClip tauntVoiceline; 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; private void HandleOwnershipChange(int newStateIndex) { if (((NetworkBehaviour)this).IsServer) { if (newStateIndex == 2 && (Object)(object)base.targetPlayer != (Object)null) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } else if (newStateIndex == 3 || newStateIndex == 0) { ((EnemyAI)this).ChangeOwnershipOfEnemy(0uL); } } } public void SyncStateSafely(int newStateIndex) { if (inSpecialAnimation) { queuedState = newStateIndex; } else if (((NetworkBehaviour)this).IsServer) { HandleOwnershipChange(newStateIndex); SyncStateSafelyClientRpc(newStateIndex); } else { SyncStateSafelyServerRpc(newStateIndex); } } [ServerRpc(RequireOwnership = false)] private void SyncStateSafelyServerRpc(int newStateIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3736050795u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newStateIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3736050795u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; HandleOwnershipChange(newStateIndex); SyncStateSafelyClientRpc(newStateIndex); } } } [ClientRpc] private void SyncStateSafelyClientRpc(int newStateIndex) { //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(996601758u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newStateIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 996601758u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (base.currentBehaviourStateIndex != newStateIndex) { base.currentBehaviourStateIndex = newStateIndex; Plugin.Logger.LogInfo((object)$"Observer State changed to {(State)newStateIndex}"); } } } [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: 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"); isHalted = true; shipDoor = Object.FindObjectOfType<HangarShipDoor>(); chaserAnimator = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)attackArea != (Object)null) { Vector3 localScale = attackArea.localScale; localScale.z = 2f; attackArea.localScale = localScale; Vector3 localPosition = attackArea.localPosition; localPosition.z = localScale.z / 2f; attackArea.localPosition = localPosition; } SetupChaserMesh(); if ((Object)(object)movementAudio != (Object)null) { movementAudio.spatialize = false; if ((Object)(object)SoundManager.Instance != (Object)null && (Object)(object)SoundManager.Instance.diageticMixer != (Object)null) { movementAudio.outputAudioMixerGroup = SoundManager.Instance.diageticMixer.FindMatchingGroups("Master")[0]; } } if ((Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.spatialize = false; } Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.cullingMode = (AnimatorCullingMode)0; ((Behaviour)componentInChildren).enabled = true; componentInChildren.applyRootMotion = false; } ((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"); } base.currentBehaviourStateIndex = 0; } 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0224: 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); } if ((Object)(object)breakDownDoorAudio != (Object)null && (Object)(object)breakAndEnter != (Object)null) { breakDownDoorAudio.PlayOneShot(breakAndEnter); WalkieTalkie.TransmitOneShotAudio(breakDownDoorAudio, breakAndEnter, 1f); } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.9f, 0, false, 0); if ((Object)(object)shipAlarm != (Object)null) { 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) { SyncStateSafely(queuedState); } 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); } if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } Plugin.Logger.LogInfo((object)"Enemy destroyed"); } private void OnEnable() { ObserversEventManager.OnShipLeft += HandleShipLeft; ObserversEventManager.OnPlayerDied += HandlePlayerDeathOrDC; ObserversEventManager.OnPlayerDisconnect += HandlePlayerDeathOrDC; } private void OnDisable() { ObserversEventManager.OnShipLeft -= HandleShipLeft; ObserversEventManager.OnPlayerDied -= HandlePlayerDeathOrDC; ObserversEventManager.OnPlayerDisconnect -= HandlePlayerDeathOrDC; } private void HandleShipLeft() { Plugin.Logger.LogInfo((object)"Ship is leaving! Cleaning up"); if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } SpectreSirenClientRpc(play: false); DespawnObserverSpectre(); isHalted = false; base.targetPlayer = null; ObserverScrapListener.ClearData(); } private void HandlePlayerDeathOrDC(PlayerControllerB player) { if (((NetworkBehaviour)this).IsServer && !base.isEnemyDead && (Object)(object)base.targetPlayer == (Object)(object)player) { Plugin.Logger.LogInfo((object)"Target died or disconnected."); if (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 1) { TriggerChaseEndClientRpc(); } } } [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)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { if (isBool) { componentInChildren.SetBool(animationTrigger, state); } else { componentInChildren.SetTrigger(animationTrigger); } } } [ClientRpc] public void PlayVictimWhisperClientRpc(int victimClientId) { //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(3891565636u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, victimClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3891565636u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId == victimClientId && (Object)(object)markedLineAudio != (Object)null) { markedLineAudio.Play(); } } } [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" && (Object)(object)base.dieSFX != (Object)null) { 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_019c: 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) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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); if ((Object)(object)ObserverPrefab != (Object)null) { 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) 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 && (Object)(object)ObserverPrefab != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(ObserverPrefab, spawnPos, spawnRot); foreach (ObserversAI allChaser in allChasers) { if ((Object)(object)allChaser != (Object)null) { allChaser.activeObserver = val3; allChaser.hasSpawnedSpectre = true; } } Terminal val4 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val4 != (Object)null) { 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)); } [ClientRpc] public void PlayTauntInEarClientRpc(ulong targetClientId) { //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(3975555292u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, targetClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3975555292u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (StartOfRound.Instance.localPlayerController.actualClientId == targetClientId) { if ((Object)(object)tauntVoiceline != (Object)null) { HUDManager.Instance.UIAudio.PlayOneShot(tauntVoiceline, 1f); } else { Plugin.Logger.LogWarning((object)"Taunt voiceline is missing"); } } } 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { 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)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)activeObserver != (Object)null) { Vector3 position = activeObserver.transform.position; if ((Object)(object)manifestationParticles != (Object)null) { ParticleSystem val3 = Object.Instantiate<ParticleSystem>(manifestationParticles, position + Vector3.up * 1.5f, Quaternion.identity); ((Component)val3).gameObject.SetActive(true); val3.Play(true); Object.Destroy((Object)(object)((Component)val3).gameObject, 3f); } else { Plugin.Logger.LogWarning((object)"Manifest particles are missing in the Inspector! Skipping despawn VFX."); } 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) 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; } ((EnemyAI)this).Update(); if (((NetworkBehaviour)this).IsServer && isMaster && !base.isEnemyDead && base.currentBehaviourStateIndex == 0) { atmosphereTimer += Time.deltaTime; if (atmosphereTimer >= 10f) { atmosphereTimer = 0f; if (Random.value <= 0.3f) { PlayAtmosphereClientRpc(); } } } 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) { slowScanTimer += Time.deltaTime; if (slowScanTimer >= 2f) { slowScanTimer = 0f; cachedDoors = Object.FindObjectsOfType<DoorLock>(); } } if (!base.isEnemyDead && base.enemyHP > 0 && base.currentBehaviourStateIndex == 2 && base.stunNormalizedTimer <= 0f) { if (((NetworkBehaviour)this).IsOwner) { 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; allChaser.SyncStateSafely(0); } } } } } 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(); } if (!base.isEnemyDead && base.currentBehaviourStateIndex == 2) { HandleCustomFootsteps(); if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { Vector3 velocity = base.agent.velocity; bool flag = ((Vector3)(ref velocity)).sqrMagnitude > 0.1f; if (base.agent.speed == 0f && !isHalted) { isHalted = true; DoAnimationClientRpc("isHalted"); } else if (base.agent.speed > 0f && isHalted) { isHalted = false; DoAnimationClientRpc("hasAccelerated"); } } } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; } public void LateUpdate() { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_012f: 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_0142: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0159: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { if (!choseMasterObserver) { choseMasterObserver = true; ChooseMasterObserver(); } else if ((Object)(object)master == (Object)null || ((EnemyAI)master).isEnemyDead) { ChooseMasterObserver(); } } if ((Object)(object)activeObserver != (Object)null && !base.isEnemyDead && (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1)) { 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); } Light componentInChildren2 = activeObserver.GetComponentInChildren<Light>(); if ((Object)(object)componentInChildren2 != (Object)null) { Vector3 val4 = ((Component)val.gameplayCamera).transform.position - ((Component)componentInChildren2).transform.position; if (val4 != Vector3.zero) { ((Component)componentInChildren2).transform.rotation = Quaternion.Slerp(((Component)componentInChildren2).transform.rotation, Quaternion.LookRotation(val4), Time.deltaTime * 10f); } } } if ((Object)(object)cachedScanNode != (Object)null && ((Component)cachedScanNode).gameObject.activeSelf) { ((Component)cachedScanNode).transform.position = activeObserver.transform.position + Vector3.up * 1.5f; } } if (!((NetworkBehaviour)this).IsServer && !base.isEnemyDead) { if (base.currentBehaviourStateIndex == 2) { base.agent.speed = ((slowDownTimer > 0f) ? 3f : baseSpeed); } else if (base.currentBehaviourStateIndex == 3) { base.agent.speed = 0f; } else { base.agent.speed = baseSpeed; } } } [ClientRpc] public void SyncNewTargetClientRpc(int newVictimId) { //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(1418583216u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, newVictimId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1418583216u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[newVictimId]; Plugin.Logger.LogInfo((object)("Clients synced new target: " + base.targetPlayer.playerUsername)); } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } switch (base.currentBehaviourStateIndex) { case 0: if (isMaster) { if (!hasSpawnedSpectre) { SpawnObserverSpectre(); } int num = Mathf.Min(StartOfRound.Instance.connectedPlayersAmount + 1, 4); 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); SyncStateSafely(1); } } break; case 1: if (isMaster) { ManageMarkingState(); } break; case 2: ManageChaseState(); break; case 3: if (isStartingCooldown) { } break; } } 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) { return; } 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; if ((Object)(object)possessionSwarmParticles != (Object)null) { 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; } 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(); if ((Object)(object)base.dieSFX != (Object)null) { base.creatureSFX.PlayOneShot(base.dieSFX, 1f); } base.agent.speed = 0f; SetChasePhysicsClientRpc(enablePhysics: false); DoAnimationClientRpc("hasBeenKilled"); if (((NetworkBehaviour)this).IsServer) { chaseTimer = 0f; SyncStateSafely(3); } SpectreSirenClientRpc(play: false); } } [ClientRpc] public void SetChasePhysicsClientRpc(bool enablePhysics) { //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(27746030u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enablePhysics, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 27746030u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((Component)this).GetComponentInChildren<Collider>().enabled = enablePhysics; if (!enablePhysics) { base.agent.speed = 0f; } } } private void ManageMarkingState() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.targetPlayer == (Object)null)) { Vector3 val = (((Object)(object)activeObserver != (Object)null) ? activeObserver.transform.position : RoundManager.FindMainEntrancePosition(true, base.isOutside)); if (Vector3.Distance(((Component)base.targetPlayer).transform.position, val) < detectRange && !isPlayingMarkAnimation) { isPlayingMarkAnimation = true; ((MonoBehaviour)this).StartCoroutine(MarkAndChaseSequence()); } } } private void HandleCustomFootsteps() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(((Component)this).transform.position, lastPosition); if (num > 0.02f) { footstepTimer += Time.deltaTime; if (footstepTimer > 0.35f) { footstepTimer = 0f; if (customFootstepSounds != null && customFootstepSounds.Length != 0 && (Object)(object)movementAudio != (Object)null) { int num2 = Random.Range(0, customFootstepSounds.Length); movementAudio.pitch = Random.Range(0.9f, 1.1f); movementAudio.PlayOneShot(customFootstepSounds[num2], 1f); } } } else { footstepTimer = 0f; } lastPosition = ((Component)this).transform.position; } [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() { if (((NetworkBehaviour)this).IsServer && (Object)(object)base.targetPlayer != (Object)null) { PlayTauntInEarClientRpc(base.targetPlayer.actualClientId); } SpectreAnimationClientRpc("isMarked"); if ((Object)(object)base.targetPlayer != (Object)null) { PlayVictimWhisperClientRpc((int)base.targetPlayer.playerClientId); } 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); } } if (base.isEnemyDead) { yield break; } yield return (object)new WaitForSeconds(3f); if (base.isEnemyDead) { yield break; } foreach (ObserversAI chaser3 in allChasers) { if ((Object)(object)chaser3 != (Object)null && !((EnemyAI)chaser3).isEnemyDead) { chaser3.DoAnimationClientRpc("riseFinished"); chaser3.PlayClientFXClientRpc(1); chaser3.SetChasePhysicsClientRpc(enablePhysics: true); chaser3.isHalted = false; ((EnemyAI)chaser3).agent.speed = baseSpeed; chaser3.SyncStateSafely(2); 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_01ac: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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[2] { "_EmissionColor", "_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)) { return; } AudioSource[] componentsInChildren = activeObserver.GetComponentsInChildren<AudioSource>(); if (SirenAudioSourceIndex >= 0 && SirenAudioSourceIndex < componentsInChildren.Length) { AudioSource val3 = componentsInChildren[SirenAudioSourceIndex]; if ((Object)(object)val3 != (Object)null) { val3.volume = raidVolume; if (play) { val3.Play(); } else { val3.Stop(); } } } else { Plugin.Logger.LogWarning((object)$"Siren index {SirenAudioSourceIndex} out of bounds! Found {componentsInChildren.Length} sources."); } } [ClientRpc] public void PlayAtmosphereClientRpc() { //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(3330627720u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3330627720u, 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) || AtmosphereClips == null || AtmosphereClips.Length == 0) { return; } AudioSource[] componentsInChildren = activeObserver.GetComponentsInChildren<AudioSource>(); if (AtmosphereAudioSourceIndex >= 0 && AtmosphereAudioSourceIndex < componentsInChildren.Length) { AudioSource val3 = componentsInChildren[AtmosphereAudioSourceIndex]; if ((Object)(object)val3 != (Object)null) { int num = Random.Range(0, AtmosphereClips.Length); val3.PlayOneShot(AtmosphereClips[num]); Plugin.Logger.LogInfo((object)"Played sound from spectre."); } } else { Plugin.Logger.LogWarning((object)$"Atmosphere index {AtmosphereAudioSourceIndex} out of bounds! Found {componentsInChildren.Length} sources."); } } [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 (knifeModels == null ||