#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+d05fb78cee3bd5e9ff3d794db95928b6b1a3817f")] [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> segments = new List>(); 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(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(start, val2)); segments.Add(new KeyValuePair(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.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 d__78 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public ObserversAI <>4__this; private Light[] 5__1; private Dictionary 5__2; private List 5__3; private float 5__4; private float 5__5; private Light[] <>s__6; private int <>s__7; private Light 5__8; private string 5__9; private List.Enumerator <>s__10; private Light 5__11; private float 5__12; private Dictionary.Enumerator <>s__13; private KeyValuePair 5__14; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__78(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; <>s__6 = null; 5__8 = null; 5__9 = null; <>s__10 = default(List.Enumerator); 5__11 = null; <>s__13 = default(Dictionary.Enumerator); 5__14 = default(KeyValuePair); <>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; 5__1 = Object.FindObjectsOfType(); 5__2 = new Dictionary(); 5__3 = new List(); 5__4 = 400f; <>s__6 = 5__1; for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++) { 5__8 = <>s__6[<>s__7]; if (!((Object)(object)5__8 == (Object)null) && (int)5__8.type != 1) { 5__9 = ((Object)((Component)5__8).gameObject).name.ToLower(); if (!5__9.Contains("helmet") && !5__9.Contains("visor") && !5__9.Contains("sun")) { Vector3 val = ((Component)5__8).transform.position - ((Component)<>4__this).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= 5__4) { 5__3.Add(5__8); 5__2[5__8] = 5__8.intensity; } 5__9 = null; 5__8 = null; } } } <>s__6 = null; 5__5 = 0f; break; case 1: <>1__state = -1; 5__5 += 0.1f; break; } if (5__5 < duration) { <>s__10 = 5__3.GetEnumerator(); try { while (<>s__10.MoveNext()) { 5__11 = <>s__10.Current; if ((Object)(object)5__11 != (Object)null && 5__2.ContainsKey(5__11)) { 5__12 = Random.value; if (5__12 > 0.8f) { 5__11.intensity = 5__2[5__11] * 2.5f; } else if (5__12 > 0.5f) { 5__11.intensity = 5__2[5__11] * 0.1f; } else { 5__11.intensity = 5__2[5__11]; } } 5__11 = null; } } finally { ((IDisposable)<>s__10).Dispose(); } <>s__10 = default(List.Enumerator); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } <>s__13 = 5__2.GetEnumerator(); try { while (<>s__13.MoveNext()) { 5__14 = <>s__13.Current; if ((Object)(object)5__14.Key != (Object)null) { 5__14.Key.intensity = 5__14.Value; } 5__14 = default(KeyValuePair); } } finally { ((IDisposable)<>s__13).Dispose(); } <>s__13 = default(Dictionary.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 d__73 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ObserversAI <>4__this; private Vector3 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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) { 5__1 = <>4__this.mainEntrancePosition + Vector3.up * 40f; <>4__this.activeSiren = Object.Instantiate(Plugin.SirenObj, 5__1, Quaternion.identity); <>4__this.activeSiren.GetComponent().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); <>4__this.SetChasePhysicsClientRpc(enablePhysics: true); <>4__this.isHalted = false; ((EnemyAI)<>4__this).agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; ((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 doorCooldowns = new Dictionary(); public AudioClip chaserDeathSound; public AudioClip chaserReanimateSound; private Vector3 lastPosition; private MineshaftElevatorController elevatorScript; private bool isInElevatorStartRoom = false; private bool isHalted = false; public AudioSource markedLineAudio; public ParticleSystem manifestationParticles; public SkinnedMeshRenderer chaserRenderer; public Mesh[] randomMeshes; public GameObject[] meshVariants; public GameObject[] knifeModels; private EntranceTeleport[] allTeleports; public GameObject possessionSwarmParticles; public AudioClip tauntVoiceline; public Transform handBone; private ScanNodeProperties cachedScanNode; private bool isStunned = false; private float slowDownTimer = 0f; private float currentChaseDuration = 0f; [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_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0338: 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(); if ((Object)(object)componentInChildren != (Object)null) { base.skinnedMeshRenderers = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[1] { componentInChildren }; } Plugin.Logger.LogInfo((object)$"Spawned variant {num}"); } if ((Object)(object)Plugin.SirenObj != (Object)null) { AudioSource val3 = Plugin.SirenObj.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = Plugin.SirenObj.GetComponentInChildren(); } if ((Object)(object)val3 != (Object)null) { val3.volume = Plugin.BoundConfig.SirenVolume.Value; } else { Plugin.Logger.LogWarning((object)"Could not find AudioSource on SirenObj prefab!"); } } 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(); 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().IsSpawned) { activeSiren.GetComponent().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(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(); 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(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 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(Plugin.ObserverPrefab, spawnPos, spawnRot); Terminal val3 = Object.FindObjectOfType(); 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(true); foreach (ScanNodeProperties val4 in componentsInChildren) { if (val4.nodeType == 1) { val4.creatureScanID = enemyFile.creatureFileID; } } break; } } } Object.Instantiate(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(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_01e9: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: 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(); } } Vector3 val3; if (!base.isEnemyDead && base.enemyHP > 0 && 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(); if ((Object)(object)base.agent != (Object)null && ((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { 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"); } } } 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(); 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(); 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 = Plugin.BoundConfig.BaseScrapThreshold.Value - 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(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(); 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(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 GetClosestDoorToChaser() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (allTeleports == null || allTeleports.Length == 0) { allTeleports = Object.FindObjectsOfType(); } EntranceTeleport result = null; float num = float.MaxValue; EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if (val.isEntranceToBuilding == base.isOutside) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (num2 < num) { num = num2; result = val; } } } return result; } private EntranceTeleport GetCorrespondingDoor(EntranceTeleport chaserDoor) { if ((Object)(object)chaserDoor == (Object)null) { return null; } EntranceTeleport[] array = allTeleports; foreach (EntranceTeleport val in array) { if (val.entranceId == chaserDoor.entranceId && val.isEntranceToBuilding != chaserDoor.isEntranceToBuilding) { return val; } } return null; } private void UseElevator(bool goUp) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)elevatorScript == (Object)null) { return; } Vector3 val = (goUp ? elevatorScript.elevatorBottomPoint.position : elevatorScript.elevatorTopPoint.position); if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) < 2f) { ((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false); base.agent.speed = 0f; if (elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorDoorOpen && elevatorScript.elevatorMovingDown == goUp) { elevatorScript.PressElevatorButtonOnServer(true); } if (!elevatorScript.elevatorFinishedMoving) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = elevatorScript.elevatorInsidePoint.position; } else { ((Behaviour)base.agent).enabled = true; } return; } ((Behaviour)base.agent).enabled = true; if (elevatorScript.elevatorFinishedMoving && elevatorScript.elevatorDoorOpen && elevatorScript.elevatorMovingDown == goUp) { ((EnemyAI)this).SetDestinationToPosition(elevatorScript.elevatorInsidePoint.position, false); base.agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; return; } ((EnemyAI)this).SetDestinationToPosition(val, false); if (Vector3.Distance(((Component)this).transform.position, val) < 2f) { if (!elevatorScript.elevatorCalled && elevatorScript.elevatorMovingDown != goUp) { elevatorScript.CallElevatorOnServer(goUp); } base.agent.speed = 0f; } else { base.agent.speed = Plugin.BoundConfig.ChaserChaseSpeed.Value; } } [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().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(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().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(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(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger(animationTrigger); Plugin.Logger.LogInfo((object)("Triggered Spectre animation: " + animationTrigger)); } } } [IteratorStateMachine(typeof(d__73))] private IEnumerator MarkAndChaseSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(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(val.spawnPrefab, val3, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = val4.GetComponent(); 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().Spawn(false); component.EnableItemMeshes(true); Plugin.Logger.LogInfo((object)"Dropped kitchen knife item"); } } private void ManageChaseState() { //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_010f: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) 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(); } if ((Object)(object)elevatorScript != (Object)null) { if (isInElevatorStartRoom) { if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < 10f) { isInElevatorStartRoom = false; } } else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < 10f) { isInElevatorStartRoom = true; } bool flag2 = Mathf.Abs(((Component)base.targetPlayer).transform.position.y - elevatorScript.elevatorTopPoint.position.y) < Mathf.Abs(((Component)base.targetPlayer).transform.position.y - elevatorScript.elevatorBottomPoint.position.y); if (flag2 != isInElevatorStartRoom) { bool goUp = !isInElevatorStartRoom; UseElevator(goUp); return; } } } if (base.isOutside != flag) { base.movingTowardsTargetPlayer = false; EntranceTeleport closestDoorToChaser = GetClosestDoorToChaser(); if (!((Object)(object)closestDoorToChaser != (Object)null)) { return; } ((EnemyAI)this).SetDestinationToPosition(((Component)closestDoorToChaser).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)closestDoorToChaser).transform.position) < 4f) { EntranceTeleport correspondingDoor = GetCorrespondingDoor(closestDoorToChaser); if ((Object)(object)correspondingDoor != (Object)null) { TeleportEnemyServerRpc(correspondingDoor.entrancePoint.position, flag); } } } else { base.moveTowardsDestination = true; ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true); } } private void 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(); 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(d__78))] private IEnumerator FlickerLightsDuringRise(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(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(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)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TriggerAttackAnimationClientRpc(); } } } [ClientRpc] public void TriggerAttackAnimationClientRpc() { //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(3866338387u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3866338387u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; attackCooldown = 2f; slowDownTimer = 1.5f; Animator componentInChildren = ((Component)this).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.SetTrigger("stabAttack"); } if (knifeStabSounds != null && knifeStabSounds.Length != 0 && (Object)(object)base.creatureSFX != (Object)null) { int num = Random.Range(0, knifeStabSounds.Length); if ((Object)(object)knifeStabSounds[num] != (Object)null) { base.creatureSFX.PlayOneShot(knifeStabSounds[num], 1f); } } } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (base.isEnemyDead || base.currentBehaviourStateIndex == 3) { return; } base.enemyHP -= force; if (base.enemyHP <= 0) { base.agent.speed = 0f; attackCooldown = 10f; if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } } else if (((NetworkBehaviour)this).IsServer) { DoAnimationClientRpc("TakeDamage"); } if (base.enemyHP <= 0 && ((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).KillEnemyOnOwnerClient(true); } } public override void KillEnemy(bool destroy = false) { if (base.isEnemyDead) { return; } base.agent.speed = 0f; ((Behaviour)base.agent).enabled = false; if ((Object)(object)base.creatureVoice != (Object)null) { base.creatureVoice.Stop(); } AudioClip dieSFX = base.dieSFX; base.dieSFX = null; ((EnemyAI)this).KillEnemy(destroy); base.dieSFX = dieSFX; if ((Object)(object)base.dieSFX != (Object)null && (Object)(object)base.creatureSFX != (Object)null) { base.creatureSFX.PlayOneShot(base.dieSFX, 1f); } if (((NetworkBehaviour)this).IsServer) { DoAnimationClientRpc("hasBeenKilled"); SpawnKnifeItemLocally(); ToggleVisualKnifeClientRpc(enable: false); if ((Object)(object)activeSiren != (Object)null) { activeSiren.GetComponent().Despawn(true); activeSiren = null; } } DespawnObserverSpectre(); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(895819299u, new RpcReceiveHandler(__rpc_handler_895819299), "DoAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(3891565636u, new RpcReceiveHandler(__rpc_handler_3891565636), "PlayVictimWhisperClientRpc"); ((NetworkBehaviour)this).__registerRpc(3962993773u, new RpcReceiveHandler(__rpc_handler_3962993773), "PlayChaserSFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(549905190u, new RpcReceiveHandler(__rpc_handler_549905190), "PlayClientFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(1365692926u, new RpcReceiveHandler(__rpc_handler_1365692926), "SpawnSpectreClientRpc"); ((NetworkBehaviour)this).__registerRpc(4289629946u, new RpcReceiveHandler(__rpc_handler_4289629946), "SyncTargetClientRpc"); ((NetworkBehaviour)this).__registerRpc(3975555292u, new RpcReceiveHandler(__rpc_handler_3975555292), "PlayTauntInEarClientRpc"); ((NetworkBehaviour)this).__registerRpc(272201980u, new RpcReceiveHandler(__rpc_handler_272201980), "DespawnSpectreClientRpc"); ((NetworkBehaviour)this).__registerRpc(1418583216u, new RpcReceiveHandler(__rpc_handler_1418583216), "SyncNewTargetClientRpc"); ((NetworkBehaviour)this).__registerRpc(4022354919u, new RpcReceiveHandler(__rpc_handler_4022354919), "TogglePossessionSwarmClientRpc"); ((NetworkBehaviour)this).__registerRpc(2624471623u, new RpcReceiveHandler(__rpc_handler_2624471623), "TriggerChaseEndClientRpc"); ((NetworkBehaviour)this).__registerRpc(27746030u, new RpcReceiveHandler(__rpc_handler_27746030), "SetChasePhysicsClientRpc"); ((NetworkBehaviour)this).__registerRpc(2864545691u, new RpcReceiveHandler(__rpc_handler_2864545691), "SpectreAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(228764123u, new RpcReceiveHandler(__rpc_handler_228764123), "ToggleVisualKnifeClientRpc"); ((NetworkBehaviour)this).__registerRpc(3926938328u, new RpcReceiveHandler(__rpc_handler_3926938328), "TeleportEnemyServerRpc"); ((NetworkBehaviour)this).__registerRpc(2194695671u, new RpcReceiveHandler(__rpc_handler_2194695671), "TeleportEnemyClientRpc"); ((NetworkBehaviour)this).__registerRpc(1031757427u, new RpcReceiveHandler(__rpc_handler_1031757427), "TriggerAttackAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(3866338387u, new RpcReceiveHandler(__rpc_handler_3866338387), "TriggerAttackAnimationClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_895819299(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string animationTrigger = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationTrigger, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).DoAnimationClientRpc(animationTrigger); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3891565636(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int victimClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref victimClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).PlayVictimWhisperClientRpc(victimClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3962993773(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string sfxType = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref sfxType, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).PlayChaserSFXClientRpc(sfxType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_549905190(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int fxType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref fxType); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).PlayClientFXClientRpc(fxType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1365692926(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 spawnPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPos); Quaternion spawnRot = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnRot); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).SpawnSpectreClientRpc(spawnPos, spawnRot); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4289629946(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).SyncTargetClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3975555292(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong targetClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).PlayTauntInEarClientRpc(targetClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_272201980(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).DespawnSpectreClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1418583216(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newVictimId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newVictimId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).SyncNewTargetClientRpc(newVictimId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4022354919(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TogglePossessionSwarmClientRpc(enable); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2624471623(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TriggerChaseEndClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_27746030(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool chasePhysicsClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref chasePhysicsClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).SetChasePhysicsClientRpc(chasePhysicsClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2864545691(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string animationTrigger = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationTrigger, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).SpectreAnimationClientRpc(animationTrigger); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_228764123(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).ToggleVisualKnifeClientRpc(enable); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3926938328(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); bool setOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setOutside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TeleportEnemyServerRpc(pos, setOutside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2194695671(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); bool setOutside = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setOutside, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TeleportEnemyClientRpc(pos, setOutside); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1031757427(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TriggerAttackAnimationServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3866338387(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ObserversAI)(object)target).TriggerAttackAnimationClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ObserversAI"; } } [BepInPlugin("Reiko888.Observer", "Observer", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle? ModAssets; public static GameObject? SirenObj; public static GameObject? ObserverPrefab; public static GameObject? ManifestParticles; internal static PluginConfig BoundConfig { get; private set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("Reiko888.Observer"); val.PatchAll(Assembly.GetExecutingAssembly()); Logger = ((BaseUnityPlugin)this).Logger; BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); InitializeNetworkBehaviours(); ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Observers")); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } ObserverPrefab = ModAssets.LoadAsset("ObserverSpectre"); SirenObj = ModAssets.LoadAsset("SirenSFX"); ManifestParticles = ModAssets.LoadAsset("Manifest"); Logger.LogInfo((object)"Observer Prefab loaded successfully!"); EnemyType val2 = ModAssets.LoadAsset("ObserversEnemy"); TerminalNode val3 = ModAssets.LoadAsset("ObserverTN"); TerminalKeyword val4 = ModAssets.LoadAsset("ObserverTK"); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); NetworkPrefabs.RegisterNetworkPrefab(SirenObj); NetworkPrefabs.RegisterNetworkPrefab(ManifestParticles); Dictionary dictionary = new Dictionary { { (LevelTypes)512, BoundConfig.SpawnWeightTitan.Value }, { (LevelTypes)128, BoundConfig.SpawnWeightRend.Value }, { (LevelTypes)256, BoundConfig.SpawnWeightDine.Value }, { (LevelTypes)32, BoundConfig.SpawnWeightOffense.Value }, { (LevelTypes)64, BoundConfig.SpawnWeightMarch.Value }, { (LevelTypes)4, BoundConfig.SpawnWeightExperimentation.Value }, { (LevelTypes)8, BoundConfig.SpawnWeightAssurance.Value }, { (LevelTypes)16, BoundConfig.SpawnWeightVow.Value }, { (LevelTypes)4096, BoundConfig.SpawnWeightArtifice.Value }, { (LevelTypes)8192, BoundConfig.SpawnWeightEmbrion.Value }, { (LevelTypes)2048, BoundConfig.SpawnWeightAdamance.Value }, { (LevelTypes)1024, BoundConfig.SpawnWeightModded.Value } }; Dictionary dictionary2 = new Dictionary(); Enemies.RegisterEnemy(val2, dictionary, dictionary2, val3, val4); Logger.LogInfo((object)"Observer enemy has loaded!"); } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "Reiko888.Observers"; public const string PLUGIN_NAME = "Observers"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Observers.src { [HarmonyPatch] public static class ObserversEventManager { public static event Action OnShipLeft; public static event Action OnPlayerDied; public static event Action OnPlayerDisconnect; [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] private static void TriggerShipLeave() { ObserversEventManager.OnShipLeft?.Invoke(); } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPostfix] private static void TriggerPlayerDied(PlayerControllerB __instance) { ObserversEventManager.OnPlayerDied?.Invoke(__instance); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPostfix] private static void TriggerPlayerDisconnect(int playerObjectNumber) { if ((Object)(object)StartOfRound.Instance != (Object)null && playerObjectNumber >= 0 && playerObjectNumber < StartOfRound.Instance.allPlayerScripts.Length) { ObserversEventManager.OnPlayerDisconnect?.Invoke(StartOfRound.Instance.allPlayerScripts[playerObjectNumber]); } } } public static class ObserverScrapListener { public static Dictionary> playerScrapReg = new Dictionary>(); public static HashSet SpawnedScrapReg = new HashSet(); public static HashSet globallyFoundScrapIDs = new HashSet(); public static void RegisterScrapPickup(ulong playerId, ulong scrapId) { if (SpawnedScrapReg.Contains(scrapId) && !globallyFoundScrapIDs.Contains(scrapId)) { globallyFoundScrapIDs.Add(scrapId); if (!playerScrapReg.ContainsKey(playerId)) { playerScrapReg[playerId] = new HashSet(); } playerScrapReg[playerId].Add(scrapId); Plugin.Logger.LogInfo((object)$"Registered pickup of scrap with ID {scrapId} by player with ID {playerId}"); } } public static PlayerControllerB CheckForGreedyPlayer(int threshold) { PlayerControllerB result = null; int num = threshold - 1; foreach (KeyValuePair> item in playerScrapReg) { int count = item.Value.Count; if (count > num) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[item.Key]; if ((Object)(object)val != (Object)null && !val.isPlayerDead && val.isPlayerControlled) { result = val; num = count; } } } return result; } public static void ClearData() { playerScrapReg.Clear(); SpawnedScrapReg.Clear(); globallyFoundScrapIDs.Clear(); Plugin.Logger.LogInfo((object)"Scrap list cleared for new round"); } } internal class ScrapListenerPatch { [HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")] public class ScrapSyncPatch { [HarmonyPostfix] public static void GetSpawnedScrap(NetworkObjectReference[] spawnedScrap) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) NetworkObject val2 = default(NetworkObject); for (int i = 0; i < spawnedScrap.Length; i++) { NetworkObjectReference val = spawnedScrap[i]; if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null)) { ulong networkObjectId = val2.NetworkObjectId; if (ObserverScrapListener.SpawnedScrapReg.Add(networkObjectId)) { Plugin.Logger.LogInfo((object)$"Added scrap with ID {networkObjectId} to SpawnedScrapReg"); } } } } } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] public class pickedUpUniqueScrapPatch { [HarmonyPostfix] public static void addItemToScrapReg(PlayerControllerB __instance, bool grabValidated, NetworkObjectReference grabbedObject) { NetworkObject val = default(NetworkObject); if (grabValidated && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null)) { ulong networkObjectId = val.NetworkObjectId; ulong playerClientId = __instance.playerClientId; ObserverScrapListener.RegisterScrapPickup(playerClientId, networkObjectId); } } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] public class DisconnectPatch { [HarmonyPostfix] public static void ClearScrapData() { ObserverScrapListener.ClearData(); Plugin.Logger.LogInfo((object)"Lobby disconnected: Cleared Observer scrap memory and targets."); } } } } namespace Observers.Configuration { public class PluginConfig { public ConfigEntry SpawnWeightTitan; public ConfigEntry SpawnWeightRend; public ConfigEntry SpawnWeightDine; public ConfigEntry SpawnWeightOffense; public ConfigEntry SpawnWeightMarch; public ConfigEntry SpawnWeightExperimentation; public ConfigEntry SpawnWeightAssurance; public ConfigEntry SpawnWeightVow; public ConfigEntry SpawnWeightArtifice; public ConfigEntry SpawnWeightEmbrion; public ConfigEntry SpawnWeightAdamance; public ConfigEntry SpawnWeightModded; public ConfigEntry BaseChaseTime; public ConfigEntry SpectreTriggerRadius; public ConfigEntry ChaserChaseSpeed; public ConfigEntry ChaserHitRange; public ConfigEntry ChaserHealth; public ConfigEntry ChaserStunMultiplier; public ConfigEntry ChaserDamage; public ConfigEntry BaseScrapThreshold; public ConfigEntry SirenVolume; public ConfigEntry SpawnWeight; public PluginConfig(ConfigFile cfg) { BaseChaseTime = cfg.Bind("1. Chaser Settings", "Base Chase Time", 60f, "How many seconds the Chaser will pursue a player before giving up (Timeout)."); SpectreTriggerRadius = cfg.Bind("1. Chaser Settings", "Spectre Trigger Radius", 30f, "How close the marked player must get to the Spectre to trigger the rise."); ChaserChaseSpeed = cfg.Bind("1. Chaser Settings", "Chaser Chase Speed", 8f, "Top speed of the Chaser while running."); ChaserHitRange = cfg.Bind("1. Chaser Settings", "Chaser Hit Range", 4f, "How far forward the Chaser's knife attack reaches."); ChaserHealth = cfg.Bind("1. Chaser Settings", "Chaser Health", 4, "How many hits the Chaser can take before dying."); ChaserStunMultiplier = cfg.Bind("1. Chaser Settings", "Chaser Stun Time Multiplier", 1f, "Multiplier for how long the Chaser stays stunned (1 = default vanilla)."); ChaserDamage = cfg.Bind("1. Chaser Settings", "Chaser Damage", 30, "How much damage a single stab does to the player (100 = instant kill)."); BaseScrapThreshold = cfg.Bind("1. Chaser Settings", "Base Scrap Anger Threshold", 6, "Base number used for scrap target calculation (Base - Active Players = Items needed to anger)."); SirenVolume = cfg.Bind("1. Chaser Settings", "Siren Volume", 1f, "Volume of the global siren when a player is marked (0.0 = completely silent, 1.0 = normal volume, can go higher if you want to deafen them)."); SpawnWeightTitan = cfg.Bind("0. Spawn Weights", "Titan", 60, "Spawn weight of Observer on Titan."); SpawnWeightRend = cfg.Bind("0. Spawn Weights", "Rend", 15, "Spawn weight of Observer on Rend."); SpawnWeightDine = cfg.Bind("0. Spawn Weights", "Dine", 15, "Spawn weight of Observer on Dine."); SpawnWeightOffense = cfg.Bind("0. Spawn Weights", "Offense", 30, "Spawn weight of Observer on Offense."); SpawnWeightMarch = cfg.Bind("0. Spawn Weights", "March", 45, "Spawn weight of Observer on March."); SpawnWeightExperimentation = cfg.Bind("0. Spawn Weights", "Experimentation", 60, "Spawn weight of Observer on Experimentation."); SpawnWeightAssurance = cfg.Bind("0. Spawn Weights", "Assurance", 40, "Spawn weight of Observer on Assurance."); SpawnWeightVow = cfg.Bind("0. Spawn Weights", "Vow", 70, "Spawn weight of Observer on Vow."); SpawnWeightArtifice = cfg.Bind("0. Spawn Weights", "Artifice", 45, "Spawn weight of Observer on Artifice."); SpawnWeightEmbrion = cfg.Bind("0. Spawn Weights", "Embrion", 50, "Spawn weight of Observer on Embrion."); SpawnWeightAdamance = cfg.Bind("0. Spawn Weights", "Adamance", 30, "Spawn weight of Observer on Adamance."); SpawnWeightModded = cfg.Bind("0. Spawn Weights", "Modded Moons", 45, "Base spawn weight of Observer on custom modded moons."); ClearUnusedEntries(cfg); } private void ClearUnusedEntries(ConfigFile cfg) { PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary dictionary = (Dictionary)property.GetValue(cfg, null); dictionary.Clear(); cfg.Save(); } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Reiko888.Observers.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }