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 v1.0.1
plugins/Observer/Reiko888.Observers.dll
Decompiled 2 hours 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Observers.Configuration; using Observers.src; using Reiko888.Observers.NetcodePatcher; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Reiko888.Observers")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+abd508b4976059d71ec5b4fedd4b8949ddc3aaa5")] [assembly: AssemblyProduct("Observers")] [assembly: AssemblyTitle("Reiko888.Observers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DigitalRuby.LightningBolt { public enum LightningBoltAnimationMode { None, Random, Loop, PingPong } [RequireComponent(typeof(LineRenderer))] public class LightningBoltScript : MonoBehaviour { [Tooltip("The game object where the lightning will emit from. If null, StartPosition is used.")] public GameObject StartObject; [Tooltip("The start position where the lightning will emit from. This is in world space if StartObject is null, otherwise this is offset from StartObject position.")] public Vector3 StartPosition; [Tooltip("The game object where the lightning will end at. If null, EndPosition is used.")] public GameObject EndObject; [Tooltip("The end position where the lightning will end at. This is in world space if EndObject is null, otherwise this is offset from EndObject position.")] public Vector3 EndPosition; [Range(0f, 8f)] [Tooltip("How manu generations? Higher numbers create more line segments.")] public int Generations = 6; [Range(0.01f, 1f)] [Tooltip("How long each bolt should last before creating a new bolt. In ManualMode, the bolt will simply disappear after this amount of seconds.")] public float Duration = 0.05f; private float timer; [Range(0f, 1f)] [Tooltip("How chaotic should the lightning be? (0-1)")] public float ChaosFactor = 0.15f; [Tooltip("In manual mode, the trigger method must be called to create a bolt")] public bool ManualMode; [Range(1f, 64f)] [Tooltip("The number of rows in the texture. Used for animation.")] public int Rows = 1; [Range(1f, 64f)] [Tooltip("The number of columns in the texture. Used for animation.")] public int Columns = 1; [Tooltip("The animation mode for the lightning")] public LightningBoltAnimationMode AnimationMode = LightningBoltAnimationMode.PingPong; [NonSerialized] [HideInInspector] public Random RandomGenerator = new Random(); private LineRenderer lineRenderer; private List<KeyValuePair<Vector3, Vector3>> segments = new List<KeyValuePair<Vector3, Vector3>>(); private int startIndex; private Vector2 size; private Vector2[] offsets; private int animationOffsetIndex; private int animationPingPongDirection = 1; private bool orthographic; private void GetPerpendicularVector(ref Vector3 directionNormalized, out Vector3 side) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (directionNormalized == Vector3.zero) { side = Vector3.right; return; } float x = directionNormalized.x; float y = directionNormalized.y; float z = directionNormalized.z; float num = Mathf.Abs(x); float num2 = Mathf.Abs(y); float num3 = Mathf.Abs(z); float num4; float num5; float num6; if (num >= num2 && num2 >= num3) { num4 = 1f; num5 = 1f; num6 = (0f - (y * num4 + z * num5)) / x; } else if (num2 >= num3) { num6 = 1f; num5 = 1f; num4 = (0f - (x * num6 + z * num5)) / y; } else { num6 = 1f; num4 = 1f; num5 = (0f - (x * num6 + y * num4)) / z; } Vector3 val = new Vector3(num6, num4, num5); side = ((Vector3)(ref val)).normalized; } private void GenerateLightningBolt(Vector3 start, Vector3 end, int generation, int totalGenerations, float offsetAmount) { //IL_004a: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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) if (generation < 0 || generation > 8) { return; } if (orthographic) { start.z = (end.z = Mathf.Min(start.z, end.z)); } segments.Add(new KeyValuePair<Vector3, Vector3>(start, end)); if (generation == 0) { return; } if (offsetAmount <= 0f) { Vector3 val = end - start; offsetAmount = ((Vector3)(ref val)).magnitude * ChaosFactor; } while (generation-- > 0) { int num = startIndex; startIndex = segments.Count; for (int i = num; i < startIndex; i++) { start = segments[i].Key; end = segments[i].Value; Vector3 val2 = (start + end) * 0.5f; RandomVector(ref start, ref end, offsetAmount, out var result); val2 += result; segments.Add(new KeyValuePair<Vector3, Vector3>(start, val2)); segments.Add(new KeyValuePair<Vector3, Vector3>(val2, end)); } offsetAmount *= 0.5f; } } public void RandomVector(ref Vector3 start, ref Vector3 end, float offsetAmount, out Vector3 result) { //IL_006b: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Vector3 val; if (orthographic) { val = end - start; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f - normalized.y, normalized.x, normalized.z); float num = (float)RandomGenerator.NextDouble() * offsetAmount * 2f - offsetAmount; result = val2 * num; } else { val = end - start; Vector3 directionNormalized = ((Vector3)(ref val)).normalized; GetPerpendicularVector(ref directionNormalized, out var side); float num2 = ((float)RandomGenerator.NextDouble() + 0.1f) * offsetAmount; float num3 = (float)RandomGenerator.NextDouble() * 360f; result = Quaternion.AngleAxis(num3, directionNormalized) * side * num2; } } private void SelectOffsetFromAnimationMode() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (AnimationMode == LightningBoltAnimationMode.None) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; return; } int num; if (AnimationMode == LightningBoltAnimationMode.PingPong) { num = animationOffsetIndex; animationOffsetIndex += animationPingPongDirection; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = offsets.Length - 2; animationPingPongDirection = -1; } else if (animationOffsetIndex < 0) { animationOffsetIndex = 1; animationPingPongDirection = 1; } } else if (AnimationMode == LightningBoltAnimationMode.Loop) { num = animationOffsetIndex++; if (animationOffsetIndex >= offsets.Length) { animationOffsetIndex = 0; } } else { num = RandomGenerator.Next(0, offsets.Length); } if (num >= 0 && num < offsets.Length) { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[num]; } else { ((Renderer)lineRenderer).material.mainTextureOffset = offsets[0]; } } private void UpdateLineRenderer() { //IL_0052: 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) int num = segments.Count - startIndex + 1; lineRenderer.positionCount = num; if (num >= 1) { int num2 = 0; lineRenderer.SetPosition(num2++, segments[startIndex].Key); for (int i = startIndex; i < segments.Count; i++) { lineRenderer.SetPosition(num2++, segments[i].Value); } segments.Clear(); SelectOffsetFromAnimationMode(); } } private void Start() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; lineRenderer = ((Component)this).GetComponent<LineRenderer>(); lineRenderer.positionCount = 0; UpdateFromMaterialChange(); } private void Update() { orthographic = (Object)(object)Camera.main != (Object)null && Camera.main.orthographic; if (timer <= 0f) { if (ManualMode) { timer = Duration; lineRenderer.positionCount = 0; } else { Trigger(); } } timer -= Time.deltaTime; } public void Trigger() { //IL_0045: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008e: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) timer = Duration + Mathf.Min(0f, timer); Vector3 start = ((!((Object)(object)StartObject == (Object)null)) ? (StartObject.transform.position + StartPosition) : StartPosition); Vector3 end = ((!((Object)(object)EndObject == (Object)null)) ? (EndObject.transform.position + EndPosition) : EndPosition); startIndex = 0; GenerateLightningBolt(start, end, Generations, Generations, 0f); UpdateLineRenderer(); } public void UpdateFromMaterialChange() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0088: Unknown result type (might be due to invalid IL or missing references) size = new Vector2(1f / (float)Columns, 1f / (float)Rows); ((Renderer)lineRenderer).material.mainTextureScale = size; offsets = (Vector2[])(object)new Vector2[Rows * Columns]; for (int i = 0; i < Rows; i++) { for (int j = 0; j < Columns; j++) { offsets[j + i * Columns] = new Vector2((float)j / (float)Columns, (float)i / (float)Rows); } } } } } namespace Observers { internal class ObserversAI : EnemyAI { private enum State { Observing, MarkingPlayer, Chase, Cooldown } [CompilerGenerated] private sealed class <FlickerLightsDuringRise>d__78 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public ObserversAI <>4__this; private Light[] <allLights>5__1; private Dictionary<Light, float> <originalIntensities>5__2; private List<Light> <nearbyLights>5__3; private float <radiusSq>5__4; private float <timer>5__5; private Light[] <>s__6; private int <>s__7; private Light <l>5__8; private string <nameLower>5__9; private List<Light>.Enumerator <>s__10; private Light <l>5__11; private float <rand>5__12; private Dictionary<Light, float>.Enumerator <>s__13; private KeyValuePair<Light, float> <kvp>5__14; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlickerLightsDuringRise>d__78(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <allLights>5__1 = null; <originalIntensities>5__2 = null; <nearbyLights>5__3 = null; <>s__6 = null; <l>5__8 = null; <nameLower>5__9 = null; <>s__10 = default(List<Light>.Enumerator); <l>5__11 = null; <>s__13 = default(Dictionary<Light, float>.Enumerator); <kvp>5__14 = default(KeyValuePair<Light, float>); <>1__state = -2; } private bool MoveNext() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //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_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <allLights>5__1 = Object.FindObjectsOfType<Light>(); <originalIntensities>5__2 = new Dictionary<Light, float>(); <nearbyLights>5__3 = new List<Light>(); <radiusSq>5__4 = 400f; <>s__6 = <allLights>5__1; for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++) { <l>5__8 = <>s__6[<>s__7]; if (!((Object)(object)<l>5__8 == (Object)null) && (int)<l>5__8.type != 1) { <nameLower>5__9 = ((Object)((Component)<l>5__8).gameObject).name.ToLower(); if (!<nameLower>5__9.Contains("helmet") && !<nameLower>5__9.Contains("visor") && !<nameLower>5__9.Contains("sun")) { Vector3 val = ((Component)<l>5__8).transform.position - ((Component)<>4__this).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= <radiusSq>5__4) { <nearbyLights>5__3.Add(<l>5__8); <originalIntensities>5__2[<l>5__8] = <l>5__8.intensity; } <nameLower>5__9 = null; <l>5__8 = null; } } } <>s__6 = null; <timer>5__5 = 0f; break; case 1: <>1__state = -1; <timer>5__5 += 0.1f; break; } if (<timer>5__5 < duration) { <>s__10 = <nearbyLights>5__3.GetEnumerator(); try { while (<>s__10.MoveNext()) { <l>5__11 = <>s__10.Current; if ((Object)(object)<l>5__11 != (Object)null && <originalIntensities>5__2.ContainsKey(<l>5__11)) { <rand>5__12 = Random.value; if (<rand>5__12 > 0.8f) { <l>5__11.intensity = <originalIntensities>5__2[<l>5__11] * 2.5f; } else if (<rand>5__12 > 0.5f) { <l>5__11.intensity = <originalIntensities>5__2[<l>5__11] * 0.1f; } else { <l>5__11.intensity = <originalIntensities>5__2[<l>5__11]; } } <l>5__11 = null; } } finally { ((IDisposable)<>s__10).Dispose(); } <>s__10 = default(List<Light>.Enumerator); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } <>s__13 = <originalIntensities>5__2.GetEnumerator(); try { while (<>s__13.MoveNext()) { <kvp>5__14 = <>s__13.Current; if ((Object)(object)<kvp>5__14.Key != (Object)null) { <kvp>5__14.Key.intensity = <kvp>5__14.Value; } <kvp>5__14 = default(KeyValuePair<Light, float>); } } finally { ((IDisposable)<>s__13).Dispose(); } <>s__13 = default(Dictionary<Light, float>.Enumerator); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MarkAndChaseSequence>d__73 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ObserversAI <>4__this; private Vector3 <skyPosition>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MarkAndChaseSequence>d__73(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0077: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0165: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; Plugin.Logger.LogInfo((object)"!!SIREN SOUNDING!!"); if ((Object)(object)Plugin.SirenObj != (Object)null && (Object)(object)<>4__this.activeSiren == (Object)null) { <skyPosition>5__1 = <>4__this.mainEntrancePosition + Vector3.up * 40f; <>4__this.activeSiren = Object.Instantiate<GameObject>(Plugin.SirenObj, <skyPosition>5__1, Quaternion.identity); <>4__this.activeSiren.GetComponent<NetworkObject>().Spawn(false); } if (((NetworkBehaviour)<>4__this).IsServer && (Object)(object)((EnemyAI)<>4__this).targetPlayer != (Object)null) { <>4__this.PlayTauntInEarClientRpc(((EnemyAI)<>4__this).targetPlayer.actualClientId); } <>4__this.SpectreAnimationClientRpc("isMarked"); if ((Object)(object)((EnemyAI)<>4__this).targetPlayer != (Object)null) { <>4__this.PlayVictimWhisperClientRpc((int)((EnemyAI)<>4__this).targetPlayer.playerClientId); } <>2__current = (object)new WaitForSeconds(15f); <>1__state = 1; return true; case 1: <>1__state = -1; if (((EnemyAI)<>4__this).isEnemyDead) { return false; } if (((EnemyAI)<>4__this).currentBehaviourStateIndex != 1) { return false; } <>4__this.DespawnObserverSpectre(); <>4__this.DoAnimationClientRpc("hasBeenSummoned"); <>4__this.ToggleVisualKnifeClientRpc(enable: true); <>4__this.PlayClientFXClientRpc(0); <>4__this.PlayChaserSFXClientRpc("reanimate"); <>4__this.TogglePossessionSwarmClientRpc(enable: true); ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FlickerLightsDuringRise(6f)); <>2__current = (object)new WaitForSeconds(8f); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.TogglePossessionSwarmClientRpc(enable: false); if (((EnemyAI)<>4__this).isEnemyDead) { return false; } <>2__current = (object)new WaitForSeconds(3f); <>1__state = 3; return true; case 3: <>1__state = -1; if (((EnemyAI)<>4__this).isEnemyDead) { return false; } <>4__this.DoAnimationClientRpc("riseFinished"); <>4__this.PlayClientFXClientRpc(1); ((EnemyAI)<>4__this).SwitchToBehaviourClientRpc(2); <>4__this.isPlayingMarkAnimation = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public GameObject activeObserver; public Transform attackArea = null; private Random enemyRandom = null; private bool hasSpawnedSpectre = false; private Vector3 mainEntrancePosition; private bool isPlayingMarkAnimation = false; private float chaseTimer = 0f; private bool isStartingCooldown = false; private GameObject activeSiren; private float attackCooldown = 0f; private Ray enemyRay; private RaycastHit enemyRayHit; public AudioClip[] customFootstepSounds; private float footstepTimer = 0f; public AudioSource movementAudio; public GameObject knifeModel; public AudioClip[] knifeStabSounds; 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; 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; [Conditional("DEBUG")] private void LogIfDebugBuild(string text) { Plugin.Logger.LogInfo((object)text); } public override void Start() { //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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); LogIfDebugBuild("Observer Spawned"); isHalted = true; base.enemyHP = Plugin.BoundConfig.ChaserHealth.Value; if ((Object)(object)base.enemyType != (Object)null) { base.enemyType.stunTimeMultiplier = Plugin.BoundConfig.ChaserStunMultiplier.Value; } if ((Object)(object)attackArea != (Object)null) { Vector3 localScale = attackArea.localScale; localScale.z = Plugin.BoundConfig.ChaserHitRange.Value; attackArea.localScale = localScale; Vector3 localPosition = attackArea.localPosition; localPosition.z = localScale.z / 2f; attackArea.localPosition = localPosition; } enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); if (meshVariants != null && meshVariants.Length != 0) { GameObject[] array = meshVariants; foreach (GameObject val in array) { val.SetActive(false); } int num = enemyRandom.Next(0, meshVariants.Length); GameObject val2 = meshVariants[num]; val2.SetActive(true); SkinnedMeshRenderer componentInChildren = val2.GetComponentInChildren<SkinnedMeshRenderer>(); if ((Object)(object)componentInChildren != (Object)null) { base.skinnedMeshRenderers = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[1] { componentInChildren }; } Plugin.Logger.LogInfo((object)$"Spawned variant {num}"); } 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 componentInChildren2 = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.cullingMode = (AnimatorCullingMode)0; ((Behaviour)componentInChildren2).enabled = true; componentInChildren2.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; } public override void OnDestroy() { ((EnemyAI)this).OnDestroy(); if ((Object)(object)activeObserver != (Object)null) { Object.Destroy((Object)(object)activeObserver); } if ((Object)(object)activeSiren != (Object)null) { Object.Destroy((Object)(object)activeSiren); } 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(); } if ((Object)(object)activeSiren != (Object)null && activeSiren.GetComponent<NetworkObject>().IsSpawned) { activeSiren.GetComponent<NetworkObject>().Despawn(true); } 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(); } } } [ClientRpc] public void DoAnimationClientRpc(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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(895819299u, val, (RpcDelivery)0); bool flag = animationTrigger != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationTrigger, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 895819299u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { 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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3891565636u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, victimClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3891565636u, val, (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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3962993773u, val, (RpcDelivery)0); bool flag = sfxType != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(sfxType, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3962993773u, val, (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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(549905190u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, fxType); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 549905190u, val, (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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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)Plugin.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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1365692926u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnPos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref spawnRot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1365692926u, val, (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)Plugin.ObserverPrefab != (Object)null) { activeObserver = Object.Instantiate<GameObject>(Plugin.ObserverPrefab, spawnPos, spawnRot); Terminal val3 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val3 != (Object)null) { foreach (TerminalNode enemyFile in val3.enemyFiles) { if (!((Object)(object)enemyFile != (Object)null) || !enemyFile.creatureName.Contains("Observer")) { continue; } ScanNodeProperties[] componentsInChildren = ((Component)this).GetComponentsInChildren<ScanNodeProperties>(true); foreach (ScanNodeProperties val4 in componentsInChildren) { if (val4.nodeType == 1) { val4.creatureScanID = enemyFile.creatureFileID; } } break; } } } Object.Instantiate<GameObject>(Plugin.ManifestParticles, spawnPos + Vector3.up * 1.5f, Quaternion.identity); 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) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4289629946u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4289629946u, val, (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[playerId]; Plugin.Logger.LogInfo((object)("Target synced to clients: " + base.targetPlayer.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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3975555292u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, targetClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3975555292u, val, (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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(272201980u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 272201980u, val, (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); } public override void Update() { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_0200: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); 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>(); } } Vector3 val3; if (!base.isEnemyDead && base.currentBehaviourStateIndex == 2 && base.stunNormalizedTimer <= 0f) { if (((NetworkBehaviour)this).IsServer) { currentChaseDuration += Time.deltaTime; if (currentChaseDuration >= Plugin.BoundConfig.BaseChaseTime.Value) { Plugin.Logger.LogInfo((object)"Chase time expired"); TriggerChaseEndClientRpc(); return; } } if (attackCooldown <= 0f && (Object)(object)base.targetPlayer != (Object)null && (Object)(object)attackArea != (Object)null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController != (Object)null && !localPlayerController.isPlayerDead && (Object)(object)localPlayerController == (Object)(object)base.targetPlayer) { int num = 8; Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale / 2f, attackArea.rotation, num); Collider[] array2 = array; foreach (Collider val in array2) { PlayerControllerB val2 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val, false, false); if ((Object)(object)val2 == (Object)(object)localPlayerController) { Plugin.Logger.LogInfo((object)"Target stabbed"); int value = Plugin.BoundConfig.ChaserDamage.Value; val3 = default(Vector3); localPlayerController.DamagePlayer(value, true, true, (CauseOfDeath)14, 0, false, val3); attackCooldown = 1.5f; slowDownTimer = 1.5f; TriggerAttackAnimationServerRpc(); break; } } } } } else if (base.currentBehaviourStateIndex == 3) { chaseTimer += Time.deltaTime; if (chaseTimer > 30f) { chaseTimer = 0f; base.targetPlayer = null; ((EnemyAI)this).SwitchToBehaviourState(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(); val3 = base.agent.velocity; bool flag = ((Vector3)(ref val3)).sqrMagnitude > 0.1f; if (base.agent.speed == 0f && !isHalted) { isHalted = true; DoAnimationClientRpc("isHalted"); } else if (base.agent.speed > 0f && isHalted) { isHalted = false; DoAnimationClientRpc("hasAccelerated"); } } else { isHalted = false; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; } public void LateUpdate() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)activeObserver != (Object)null) || base.isEnemyDead || (base.currentBehaviourStateIndex != 0 && base.currentBehaviourStateIndex != 1)) { return; } PlayerControllerB val = null; if (base.currentBehaviourStateIndex == 0) { val = GameNetworkManager.Instance.localPlayerController; } else if (base.currentBehaviourStateIndex == 1) { val = base.targetPlayer; } if ((Object)(object)val != (Object)null) { Animator componentInChildren = activeObserver.GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.applyRootMotion = false; } Vector3 val2 = ((Component)val.gameplayCamera).transform.position - activeObserver.transform.position; val2.y = 0f; if (val2 != Vector3.zero) { Quaternion val3 = Quaternion.LookRotation(val2); 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; } } [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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1418583216u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, newVictimId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1418583216u, val, (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 (!hasSpawnedSpectre) { SpawnObserverSpectre(); } int num = Mathf.Min(StartOfRound.Instance.connectedPlayersAmount + 1, 4); int threshold = 6 - num; PlayerControllerB val = ObserverScrapListener.CheckForGreedyPlayer(threshold); if ((Object)(object)val != (Object)null) { base.targetPlayer = val; Plugin.Logger.LogInfo((object)"Scrap anger threshold met"); SyncTargetClientRpc((int)val.playerClientId); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } break; } case 1: 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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4022354919u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4022354919u, val, (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 GetClosestDoorToPlayer() { //IL_008a: 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) if ((Object)(object)base.targetPlayer == (Object)null) { return null; } if (allTeleports == null || allTeleports.Length == 0) { allTeleports = Object.FindObjectsOfType<EntranceTeleport>(); } EntranceTeleport result = null; float num = float.MaxValue; bool flag = !base.targetPlayer.isInsideFactory; EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if (val.isEntranceToBuilding == flag) { float num2 = Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } private EntranceTeleport GetCorrespondingDoor(EntranceTeleport playerDoor) { if ((Object)(object)playerDoor == (Object)null) { return null; } EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if (val.entranceId == playerDoor.entranceId && val.isEntranceToBuilding != playerDoor.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_0087: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) 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) < 2.5f) { base.agent.speed = 0f; ((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false); if (elevatorScript.elevatorDoorOpen && elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorMovingDown == goUp) { elevatorScript.PressElevatorButtonOnServer(true); } } else if (elevatorScript.elevatorFinishedMoving) { if (elevatorScript.elevatorDoorOpen) { base.agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; ((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false); return; } base.agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; ((EnemyAI)this).SetDestinationToPosition(val, false); if (Vector3.Distance(((Component)this).transform.position, val) < 1.5f && elevatorScript.elevatorMovingDown != goUp && !elevatorScript.elevatorCalled) { elevatorScript.CallElevatorOnServer(goUp); } } else { base.agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; ((EnemyAI)this).SetDestinationToPosition(val, false); } } [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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2624471623u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2624471623u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((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; ((EnemyAI)this).SwitchToBehaviourClientRpc(3); if ((Object)(object)activeSiren != (Object)null) { activeSiren.GetComponent<NetworkObject>().Despawn(true); } } ToggleVisualKnifeClientRpc(enable: false); activeSiren = null; } [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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(27746030u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enablePhysics, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 27746030u, val, (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) < Plugin.BoundConfig.SpectreTriggerRadius.Value && !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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2864545691u, val, (RpcDelivery)0); bool flag = animationTrigger != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationTrigger, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2864545691u, val, (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)); } } } [IteratorStateMachine(typeof(<MarkAndChaseSequence>d__73))] private IEnumerator MarkAndChaseSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MarkAndChaseSequence>d__73(0) { <>4__this = this }; } [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 val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(228764123u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 228764123u, val, (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 || knifeModels.Length == 0) { return; } GameObject[] array = knifeModels; foreach (GameObject val3 in array) { if ((Object)(object)val3 != (Object)null) { val3.SetActive(enable); } } } public void SpawnKnifeItemLocally() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e0: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer) { return; } Item val = null; foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == "Kitchen knife" || items.itemName == "Knife") { val = items; break; } } if (!((Object)(object)val == (Object)null)) { Vector3 val2 = (((Object)(object)handBone != (Object)null) ? handBone.position : (((Component)this).transform.position + Vector3.up * 1.5f)); Vector3 val3 = RoundManager.Instance.GetNavMeshPosition(val2, RoundManager.Instance.navHit, 5f, -1); if (!RoundManager.Instance.GotNavMeshPositionResult) { val3 = ((Component)this).transform.position; } val3.y += 1f; GameObject val4 = Object.Instantiate<GameObject>(val.spawnPrefab, val3, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = val4.GetComponent<GrabbableObject>(); component.fallTime = 0f; component.targetFloorPosition = component.GetItemFloorPosition(val3); int scrapValue = (int)((float)Random.Range(val.minValue, val.maxValue) * RoundManager.Instance.scrapValueMultiplier); component.SetScrapValue(scrapValue); val4.GetComponent<NetworkObject>().Spawn(false); component.EnableItemMeshes(true); Plugin.Logger.LogInfo((object)"Dropped kitchen knife item"); } } private void ManageChaseState() { //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null) { return; } bool flag = !base.targetPlayer.isInsideFactory; bool isOutside = base.isOutside; base.agent.speed = ((slowDownTimer > 0f) ? 3f : Plugin.BoundConfig.ChaserChaseSpeed.Value); BustOpenDoorsInRadius(); if (!base.isOutside && RoundManager.Instance.currentDungeonType == 4) { if ((Object)(object)elevatorScript == (Object)null) { elevatorScript = Object.FindObjectOfType<MineshaftElevatorController>(); } if ((Object)(object)elevatorScript != (Object)null) { if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < 10f) { isInElevatorStartRoom = false; } else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < 10f) { isInElevatorStartRoom = true; } bool flag2 = ((Component)base.targetPlayer).transform.position.y < elevatorScript.elevatorBottomPoint.position.y + 10f; bool flag3 = ((Component)base.targetPlayer).transform.position.y > elevatorScript.elevatorTopPoint.position.y - 10f; if ((isInElevatorStartRoom && flag2) || (!isInElevatorStartRoom && flag3)) { bool goUp = !isInElevatorStartRoom; UseElevator(goUp); return; } } } if (flag != isOutside) { base.movingTowardsTargetPlayer = false; EntranceTeleport closestDoorToPlayer = GetClosestDoorToPlayer(); EntranceTeleport correspondingDoor = GetCorrespondingDoor(closestDoorToPlayer); if ((Object)(object)correspondingDoor != (Object)null) { Vector3 position = ((Component)correspondingDoor).transform.position; ((EnemyAI)this).SetDestinationToPosition(position, false); if (Vector3.Distance(((Component)this).transform.position, position) < 4f) { Plugin.Logger.LogInfo((object)$"Chaser is traversing door ID {correspondingDoor.entranceId}!"); bool setOutside = !isOutside; Vector3 pos = (((Object)(object)closestDoorToPlayer.entrancePoint != (Object)null) ? closestDoorToPlayer.entrancePoint.position : ((Component)closestDoorToPlayer).transform.position); TeleportEnemyServerRpc(pos, setOutside); } } else { Vector3 val = RoundManager.FindMainEntrancePosition(true, isOutside); ((EnemyAI)this).SetDestinationToPosition(val, false); if (Vector3.Distance(((Component)this).transform.position, val) < 4f) { bool flag4 = !isOutside; Vector3 pos2 = RoundManager.FindMainEntrancePosition(true, flag4); TeleportEnemyServerRpc(pos2, flag4); } } } else { base.moveTowardsDestination = true; ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true); } } private void BustOpenDoorsInRadius() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsServer || cachedDoors == null) { return; } float num = 4f; DoorLock[] array = cachedDoors; foreach (DoorLock val in array) { if ((Object)(object)val == (Object)null) { continue; } Vector3 val2 = ((Component)this).transform.position - ((Component)val).transform.position; if (!(((Vector3)(ref val2)).sqrMagnitude < num) || (doorCooldowns.ContainsKey(val) && Time.time - doorCooldowns[val] < 3f)) { continue; } AnimatedObjectTrigger component = ((Component)val).GetComponent<AnimatedObjectTrigger>(); if ((Object)(object)component != (Object)null && !component.boolValue) { if (val.isLocked) { val.UnlockDoorServerRpc(); } DoAnimationClientRpc("bashDoor"); component.TriggerAnimationNonPlayer(true, true, false); val.OpenDoorAsEnemyServerRpc(); Plugin.Logger.LogInfo((object)"Chaser bashed a door open"); doorCooldowns[val] = Time.time; } } } [IteratorStateMachine(typeof(<FlickerLightsDuringRise>d__78))] private IEnumerator FlickerLightsDuringRise(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlickerLightsDuringRise>d__78(0) { <>4__this = this, duration = duration }; } [ServerRpc] public void TeleportEnemyServerRpc(Vector3 pos, bool setOutside) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3926938328u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3926938328u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TeleportEnemyClientRpc(pos, setOutside); } } [ClientRpc] public void TeleportEnemyClientRpc(Vector3 pos, bool setOutside) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2194695671u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2194695671u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TeleportEnemyLocally(pos, setOutside); } } } private void TeleportEnemyLocally(Vector3 pos, bool setOutside) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = pos; ((Behaviour)base.agent).enabled = true; base.serverPosition = pos; ((EnemyAI)this).SetEnemyOutside(setOutside); mainEntrancePosition = RoundManager.FindMainEntrancePosition(true, base.isOutside); EntranceTeleport val = RoundManager.FindMainEntranceScript(setOutside); if ((Object)(object)val != (Object)null && val.doorAudios != null && val.doorAudios.Length != 0) { val.entrancePointAudio.PlayOneShot(val.doorAudios[0]); } } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); } [ServerRpc(RequireOwnership = false)] public void TriggerAttackAnimationServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1031757427u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1031757427u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviou