using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RepoOmniPossession")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RepoOmniPossession")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f4d2af55-46b2-4b16-94e2-5a7f21cb951b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace RepoOmniPossession; public class AnimalController : IPossessedController { private EnemyAnimal animal; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private FieldInfo currentStateField; private float havocTimer = 0f; public void OnEnter(GameObject enemyObject) { animal = enemyObject.GetComponent(); havocTimer = 0f; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; currentStateField = typeof(EnemyAnimal).GetField("currentState", bindingAttr); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)animal).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)animal).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_01fe: 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_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animal == (Object)null) { return; } NavMeshAgent component = ((Component)animal).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = 0f; float num4 = 6f; if (Input.GetMouseButtonDown(0)) { havocTimer = 3f; SetAnimalState("WreakHavoc"); } if (Input.GetKeyDown((KeyCode)32)) { if (nativeStates.ContainsKey("jump")) { SetAnimalState("Jump"); } else if (nativeStates.ContainsKey("leap")) { SetAnimalState("Leap"); } } if (Input.GetMouseButtonDown(1)) { SetAnimalState("PlayerNotice"); } if (havocTimer > 0f) { havocTimer -= Time.deltaTime; num3 = num4 * 1.8f; Vector3 forward2 = ((Component)animal).transform.forward; Vector3 val3 = ((Component)animal).transform.position + forward2 * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)animal).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)animal).transform.position = val3; SetAnimalState("WreakHavoc"); } else if (((Vector3)(ref val)).magnitude > 0.1f) { num3 = num4; Vector3 val5 = ((Component)animal).transform.position + val * num3 * Time.deltaTime; RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5 + Vector3.up * 1f, Vector3.down, ref val6, 2f) && (Object)(object)((RaycastHit)(ref val6)).transform.root != (Object)(object)((Component)animal).transform.root && !((RaycastHit)(ref val6)).collider.isTrigger) { val5.y = ((RaycastHit)(ref val6)).point.y; } ((Component)animal).transform.position = val5; SetAnimalState("Roam"); } else { SetAnimalState("Idle"); } if ((Object)(object)animal.enemyAnimalAnim != (Object)null) { Component val7 = ((Component)animal.enemyAnimalAnim).GetComponent("UnityEngine.Animator") ?? ((Component)animal.enemyAnimalAnim).GetComponent("Animator"); if ((Object)(object)val7 != (Object)null) { MethodInfo method = ((object)val7).GetType().GetMethod("SetFloat", new Type[2] { typeof(string), typeof(float) }); method?.Invoke(val7, new object[2] { "Speed", num3 }); method?.Invoke(val7, new object[2] { "velocity", num3 }); } } } public void HandleCamera() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)animal == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Vector3 eulerAngles = ((Component)animal).transform.eulerAngles; eulerAngles.y = OmniPossessionManager.CameraYaw; ((Component)animal).transform.eulerAngles = eulerAngles; Enemy component = ((Component)animal).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)animal).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_009d: 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) if ((Object)(object)animal == (Object)null) { return; } Rigidbody component = ((Component)animal).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)animal).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)animal).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)animal).transform.position, ref val, 5f, -1)) { ((Component)animal).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SetAnimalState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value) && (!(currentStateField != null) || !currentStateField.GetValue(animal).Equals(value))) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; currentStateField?.SetValue(animal, value); typeof(EnemyAnimal).GetField("stateImpulse", bindingAttr)?.SetValue(animal, true); typeof(EnemyAnimal).GetField("stateTimer", bindingAttr)?.SetValue(animal, 0f); PhotonView component = ((Component)animal).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class BangController : IPossessedController { private EnemyBang bang; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; public void OnEnter(GameObject enemyObject) { bang = enemyObject.GetComponent(); FieldInfo field = typeof(EnemyBang).GetField("currentState", flags); if (field != null) { Type fieldType = field.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)bang).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)bang).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bang == (Object)null) { return; } NavMeshAgent component = ((Component)bang).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 3.5f); if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)bang).transform.position + val * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)bang).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)bang).transform.position = val3; SetBangState("Move"); } else { SetBangState("Idle"); } if (Input.GetMouseButtonDown(0)) { InvokeFuse(active: true, 0.1f); SetBangState("Fuse"); } if (Input.GetMouseButtonDown(1)) { PhotonView component2 = ((Component)bang).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { component2.RPC("TalkBreakerRPC", (RpcTarget)0, new object[1] { true }); } else { ((Component)bang).SendMessage("TalkBreakerRPC", (object)true, (SendMessageOptions)1); } } if (Input.GetKeyDown((KeyCode)101)) { PhotonView component3 = ((Component)bang).GetComponent(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("ExplodeRPC", (RpcTarget)0, Array.Empty()); } else { ((Component)bang).SendMessage("ExplodeRPC", (SendMessageOptions)1); } OmniPossessionManager.ExitPossession(); } } public void HandleCamera() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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) if ((Object)(object)bang == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Vector3 eulerAngles = ((Component)bang).transform.eulerAngles; eulerAngles.y = OmniPossessionManager.CameraYaw; ((Component)bang).transform.eulerAngles = eulerAngles; Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); typeof(EnemyBang).GetField("horizontalRotationTarget", flags)?.SetValue(bang, val); FieldInfo field = typeof(EnemyBang).GetField("rotationTransform", BindingFlags.Instance | BindingFlags.Public); if (field != null) { object? value = field.GetValue(bang); Transform val2 = (Transform)((value is Transform) ? value : null); if (val2 != null) { val2.rotation = val; } } Enemy component = ((Component)bang).GetComponent(); Vector3 val3 = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)bang).transform.position + Vector3.up * 1f)); Quaternion val4 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val3 - val4 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val4; } public void OnExit() { //IL_00a3: 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) if ((Object)(object)bang == (Object)null) { return; } Rigidbody component = ((Component)bang).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)bang).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)bang).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)bang).transform.position, ref val, 5f, -1)) { ((Component)bang).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SetBangState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { typeof(EnemyBang).GetField("currentState", flags)?.SetValue(bang, value); typeof(EnemyBang).GetField("stateImpulse", flags)?.SetValue(bang, true); typeof(EnemyBang).GetField("stateTimer", flags)?.SetValue(bang, 0f); PhotonView component = ((Component)bang).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void InvokeFuse(bool active, float lerp) { typeof(EnemyBang).GetField("fuseActive", flags)?.SetValue(bang, active); typeof(EnemyBang).GetField("fuseLerp", flags)?.SetValue(bang, lerp); PhotonView component = ((Component)bang).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("FuseRPC", (RpcTarget)0, new object[2] { active, lerp }); OmniPossessionManager.IsModSendingRPC = false; } } } public class BeamerController : IPossessedController { private EnemyBeamer beamer; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private FieldInfo currentStateField; private FieldInfo stateImpulseField; private FieldInfo stateTimerField; private FieldInfo moveFastField; private bool isAttackingWindup = false; private float attackWindupTimer = 0f; public void OnEnter(GameObject enemyObject) { beamer = enemyObject.GetComponent(); isAttackingWindup = false; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; currentStateField = typeof(EnemyBeamer).GetField("currentState", bindingAttr); stateImpulseField = typeof(EnemyBeamer).GetField("stateImpulse", bindingAttr); stateTimerField = typeof(EnemyBeamer).GetField("stateTimer", bindingAttr); moveFastField = typeof(EnemyBeamer).GetField("moveFast", bindingAttr); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)beamer).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)beamer).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)beamer == (Object)null) { return; } NavMeshAgent component = ((Component)beamer).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } bool flag = moveFastField != null && (bool)moveFastField.GetValue(beamer); float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 3.5f); if (flag) { num3 *= 2f; } if (!isAttackingWindup) { object obj = ((currentStateField != null) ? currentStateField.GetValue(beamer) : null); if (!nativeStates.TryGetValue("attack", out var value) || obj == null || !obj.Equals(value)) { if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)beamer).transform.position + val * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)beamer).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)beamer).transform.position = val3; SetBeamerState("Roam"); } else { SetBeamerState("Idle"); } } } if (Input.GetMouseButtonDown(0)) { isAttackingWindup = true; attackWindupTimer = 0f; SetBeamerState("AttackStart"); } if (isAttackingWindup) { attackWindupTimer += Time.deltaTime; if (attackWindupTimer >= 1.5f) { isAttackingWindup = false; SetBeamerState("Attack"); } } if (Input.GetMouseButtonUp(0)) { isAttackingWindup = false; SetBeamerState("Idle"); } if (Input.GetMouseButtonDown(1)) { PhotonView component2 = ((Component)beamer).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { component2.RPC("MeleeTriggerRPC", (RpcTarget)0, Array.Empty()); } else { ((Component)beamer).SendMessage("MeleeTriggerRPC", (SendMessageOptions)1); } SetBeamerState("MeleeStart"); } if (Input.GetKeyDown((KeyCode)101)) { bool flag2 = !flag; moveFastField?.SetValue(beamer, flag2); PhotonView component3 = ((Component)beamer).GetComponent(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("MoveFastRPC", (RpcTarget)1, new object[1] { flag2 }); } } } public void HandleCamera() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01b1: 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) if (!((Object)(object)beamer == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 60f); ((Component)beamer).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); if ((Object)(object)beamer.aimVerticalTransform != (Object)null) { beamer.aimVerticalTransform.localRotation = Quaternion.Euler(OmniPossessionManager.CameraPitch, 0f, 0f); } if ((Object)(object)beamer.laserRayTransform != (Object)null) { beamer.laserRayTransform.localRotation = Quaternion.Euler(OmniPossessionManager.CameraPitch, 0f, 0f); } Enemy component = ((Component)beamer).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)beamer).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00aa: 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) if ((Object)(object)beamer == (Object)null) { return; } isAttackingWindup = false; Rigidbody component = ((Component)beamer).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)beamer).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)beamer).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)beamer).transform.position, ref val, 5f, -1)) { ((Component)beamer).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SetBeamerState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(beamer, value); stateImpulseField?.SetValue(beamer, true); stateTimerField?.SetValue(beamer, 0f); PhotonView component = ((Component)beamer).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class BirthdayBoyController : IPossessedController { private EnemyBirthdayBoy boy; private const float CameraRadius = 3.5f; private FieldInfo stateField; private FieldInfo impulseField; private FieldInfo timerField; private MethodInfo blowMethod; public void OnEnter(GameObject enemyObject) { boy = enemyObject.GetComponent(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; stateField = typeof(EnemyBirthdayBoy).GetField("currentState", bindingAttr); impulseField = typeof(EnemyBirthdayBoy).GetField("stateImpulse", bindingAttr); timerField = typeof(EnemyBirthdayBoy).GetField("onScreenTimer", bindingAttr); blowMethod = typeof(EnemyBirthdayBoy).GetMethod("BlowBalloonAnimation", bindingAttr); Rigidbody component = ((Component)boy).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)boy).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)boy == (Object)null) { return; } NavMeshAgent component = ((Component)boy).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 3.5f); if (Input.GetKey((KeyCode)304)) { num3 *= 1.5f; } if (Input.GetMouseButton(0)) { SafeUpdateState((State)13); } if (Input.GetMouseButtonDown(1)) { SafeUpdateState((State)4); blowMethod?.Invoke(boy, null); } if (Input.GetKeyDown((KeyCode)101)) { SafeUpdateState((State)9); } if (((Vector3)(ref val)).magnitude > 0.1f) { Transform transform = ((Component)boy).transform; transform.position += val * num3 * Time.deltaTime; if (!Input.GetMouseButton(0)) { SafeUpdateState((State)10); } } else if (!Input.GetMouseButton(0)) { SafeUpdateState((State)2); } } public void HandleCamera() { //IL_008f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0103: 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_010f: 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) //IL_0115: 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_0124: 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_00e9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)boy == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 60f); ((Component)boy).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Enemy component = ((Component)boy).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)boy).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_009d: 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) if ((Object)(object)boy == (Object)null) { return; } Rigidbody component = ((Component)boy).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)boy).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)boy).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)boy).transform.position, ref val, 5f, -1)) { ((Component)boy).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SafeUpdateState(State targetState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) if (boy.currentState == targetState) { return; } boy.UpdateState(targetState); if (stateField != null && (State)stateField.GetValue(boy) != targetState) { stateField.SetValue(boy, targetState); impulseField?.SetValue(boy, true); timerField?.SetValue(boy, 0f); PhotonView component = ((Component)boy).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { targetState }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class BombThrowerController : IPossessedController { private EnemyBombThrower bombEnemy; private const float CameraRadius = 4f; private MethodInfo updateStateMethod; private MethodInfo headGrownSetMethod; private FieldInfo currentStateField; private FieldInfo headGrownField; private FieldInfo playerTargetField; public void OnEnter(GameObject enemyObject) { bombEnemy = enemyObject.GetComponent(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; updateStateMethod = typeof(EnemyBombThrower).GetMethod("UpdateState", bindingAttr); headGrownSetMethod = typeof(EnemyBombThrower).GetMethod("HeadGrownSet", bindingAttr); currentStateField = typeof(EnemyBombThrower).GetField("currentState", bindingAttr); headGrownField = typeof(EnemyBombThrower).GetField("headGrown", bindingAttr); playerTargetField = typeof(EnemyBombThrower).GetField("playerTarget", bindingAttr); Rigidbody component = ((Component)bombEnemy).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)bombEnemy).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //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_0134: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bombEnemy == (Object)null) { return; } NavMeshAgent component = ((Component)bombEnemy).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } if (playerTargetField != null && playerTargetField.GetValue(bombEnemy) == null && (Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null) { PlayerAvatar component2 = OmniPossessionManager.LocalPlayerObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { playerTargetField.SetValue(bombEnemy, component2); } } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = 3f; if (Input.GetKey((KeyCode)304)) { num3 *= 1.5f; } if (Input.GetMouseButton(0)) { SafeUpdateState((State)8); } if (Input.GetMouseButtonDown(1)) { SafeUpdateState((State)9); } if (Input.GetKeyDown((KeyCode)101) && headGrownField != null && headGrownSetMethod != null) { bool flag = (bool)headGrownField.GetValue(bombEnemy); headGrownSetMethod.Invoke(bombEnemy, new object[1] { !flag }); } if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = val * num3 * Time.deltaTime; Vector3 val4 = ((Component)bombEnemy).transform.position + val3; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4 + Vector3.up * 1f, Vector3.down, ref val5, 2f) && (Object)(object)((RaycastHit)(ref val5)).transform.root != (Object)(object)((Component)bombEnemy).transform.root && !((RaycastHit)(ref val5)).collider.isTrigger) { val4.y = ((RaycastHit)(ref val5)).point.y; } ((Component)bombEnemy).transform.position = val4; if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1)) { SafeUpdateState((State)5); } } else if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1)) { SafeUpdateState((State)1); } } public void HandleCamera() { //IL_008f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0103: 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_010f: 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) //IL_0115: 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_0124: 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_00e9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)bombEnemy == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 60f); ((Component)bombEnemy).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Enemy component = ((Component)bombEnemy).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)bombEnemy).transform.position + Vector3.up * 1.2f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00b3: 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) if ((Object)(object)bombEnemy == (Object)null) { return; } Rigidbody component = ((Component)bombEnemy).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)bombEnemy).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)bombEnemy).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = true; component3.updateRotation = true; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)bombEnemy).transform.position, ref val, 5f, -1)) { ((Component)bombEnemy).transform.position = ((NavMeshHit)(ref val)).position; } } } private void SafeUpdateState(State targetState) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0082: Unknown result type (might be due to invalid IL or missing references) if (!(currentStateField != null) || !(updateStateMethod != null)) { return; } State val = (State)currentStateField.GetValue(bombEnemy); if (val != targetState) { OmniPossessionManager.IsModSendingRPC = true; PhotonView component = ((Component)bombEnemy).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { targetState }); } updateStateMethod.Invoke(bombEnemy, new object[1] { targetState }); OmniPossessionManager.IsModSendingRPC = false; } } } public class BowtieController : IPossessedController { private EnemyBowtie bowtie; private const float CameraRadius = 4.5f; private MethodInfo updateStateMethod; private FieldInfo playerTargetField; private FieldInfo leaveSpeedField; private Collider cachedHurtCollider; public void OnEnter(GameObject enemyObject) { bowtie = enemyObject.GetComponent(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; updateStateMethod = typeof(EnemyBowtie).GetMethod("UpdateState", bindingAttr); playerTargetField = typeof(EnemyBowtie).GetField("playerTarget", bindingAttr); leaveSpeedField = typeof(EnemyBowtie).GetField("leaveSpeed", bindingAttr) ?? typeof(EnemyBowtie).GetField("speedLeave", bindingAttr); cachedHurtCollider = null; FieldInfo fieldInfo = typeof(EnemyBowtie).GetField("hurtColliderLeave", bindingAttr) ?? typeof(EnemyBowtie).GetField("leaveCollider", bindingAttr); if (fieldInfo != null) { object? value = fieldInfo.GetValue(bowtie); Collider val = (Collider)((value is Collider) ? value : null); if (val != null) { cachedHurtCollider = val; } } if ((Object)(object)cachedHurtCollider == (Object)null) { Collider[] componentsInChildren = ((Component)bowtie).GetComponentsInChildren(true); foreach (Collider val2 in componentsInChildren) { string text = ((Object)((Component)val2).gameObject).name.ToLower(); if (text.Contains("leave") || text.Contains("hurt") || text.Contains("damage")) { cachedHurtCollider = val2; break; } } } Rigidbody component = ((Component)bowtie).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)bowtie).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Invalid comparison between Unknown and I4 //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Invalid comparison between Unknown and I4 //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Invalid comparison between Unknown and I4 //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Invalid comparison between Unknown and I4 //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Invalid comparison between Unknown and I4 //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Invalid comparison between Unknown and I4 //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Invalid comparison between Unknown and I4 //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Invalid comparison between Unknown and I4 //IL_0422: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bowtie == (Object)null) { return; } NavMeshAgent component = ((Component)bowtie).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } if (playerTargetField != null && playerTargetField.GetValue(bowtie) == null && (Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null) { playerTargetField.SetValue(bowtie, OmniPossessionManager.LocalPlayerObject.GetComponent()); } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = 3f; if (Input.GetKey((KeyCode)304)) { num3 *= 1.5f; } if (Input.GetMouseButton(0)) { SafeUpdateState((State)5); if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = false; } return; } if (Input.GetMouseButtonUp(0) && (int)bowtie.currentState == 5) { SafeUpdateState((State)1); } if (Input.GetKeyDown((KeyCode)101)) { if ((int)bowtie.currentState == 7) { SafeUpdateState((State)1); if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = false; } } else { SafeUpdateState((State)7); if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = true; } } } float num4 = num3; Vector3 val3 = val; if ((int)bowtie.currentState == 7) { if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = true; } float num5 = ((leaveSpeedField != null && leaveSpeedField.GetValue(bowtie) is float num6 && num6 > 0f) ? num6 : (num3 * 4f)); num4 = num5; if (((Vector3)(ref val3)).magnitude < 0.1f) { val3 = ((Component)bowtie).transform.forward; } } else if ((int)bowtie.currentState == 5) { num4 = 0f; if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = false; } } if (((Vector3)(ref val3)).magnitude > 0.1f && num4 > 0f) { Vector3 val4 = ((Vector3)(ref val3)).normalized * num4 * Time.deltaTime; Vector3 val5 = ((Component)bowtie).transform.position + val4; RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5 + Vector3.up * 1f, Vector3.down, ref val6, 2f) && (Object)(object)((RaycastHit)(ref val6)).transform.root != (Object)(object)((Component)bowtie).transform.root && !((RaycastHit)(ref val6)).collider.isTrigger) { val5.y = ((RaycastHit)(ref val6)).point.y; } ((Component)bowtie).transform.position = val5; if ((int)bowtie.currentState != 7 && (int)bowtie.currentState != 5) { SafeUpdateState((State)2); } } else if ((int)bowtie.currentState != 7 && (int)bowtie.currentState != 5) { SafeUpdateState((State)1); } } public void HandleCamera() { //IL_008f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0103: 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_010f: 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) //IL_0115: 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_0124: 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_00e9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)bowtie == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 60f); ((Component)bowtie).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Enemy component = ((Component)bowtie).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)bowtie).transform.position + Vector3.up * 1.2f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 4.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00bc: 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) if ((Object)(object)bowtie == (Object)null) { return; } Rigidbody component = ((Component)bowtie).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } if ((Object)(object)cachedHurtCollider != (Object)null) { cachedHurtCollider.enabled = false; } Component component2 = ((Component)bowtie).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)bowtie).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)bowtie).transform.position, ref val, 5f, -1)) { ((Component)bowtie).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SafeUpdateState(State targetState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0076: Unknown result type (might be due to invalid IL or missing references) if (bowtie.currentState != targetState) { OmniPossessionManager.IsModSendingRPC = true; PhotonView component = ((Component)bowtie).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { targetState }); } updateStateMethod?.Invoke(bowtie, new object[1] { targetState }); OmniPossessionManager.IsModSendingRPC = false; } } } public class DuckController : IPossessedController { private EnemyDuck duck; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private FieldInfo cachedStateField = null; private FieldInfo cachedImpulseField = null; private FieldInfo cachedTimerField = null; private MethodInfo cachedJumpMethod = null; private int attackStage = 0; private float attackStageTimer = 0f; public void OnEnter(GameObject enemyObject) { duck = enemyObject.GetComponent(); attackStage = 0; attackStageTimer = 0f; cachedStateField = typeof(EnemyDuck).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); cachedImpulseField = typeof(EnemyDuck).GetField("stateImpulse", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); cachedTimerField = typeof(EnemyDuck).GetField("stateTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (cachedStateField != null) { Type fieldType = cachedStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)duck).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = false; } Component component2 = ((Component)duck).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0333: 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) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)duck == (Object)null) { return; } NavMeshAgent component = ((Component)duck).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 4f); Rigidbody component2 = ((Component)duck).GetComponent(); if (Input.GetMouseButton(0)) { if (attackStage == 0) { attackStage = 1; attackStageTimer = 0.5f; SetDuckState("AttackStart"); } } else if (attackStage > 0 || Input.GetMouseButtonDown(1)) { attackStage = 0; SetDuckState("DeTransform"); } if (attackStage == 1) { attackStageTimer -= Time.deltaTime; if (attackStageTimer <= 0f) { attackStage = 2; attackStageTimer = 1.4f; SetDuckState("Transform"); } } else if (attackStage == 2) { attackStageTimer -= Time.deltaTime; if (attackStageTimer <= 0f) { attackStage = 3; SetDuckState("ChaseTowards"); } } Vector3 val; if (attackStage == 3) { if ((Object)(object)component2 != (Object)null && !component2.isKinematic) { component2.isKinematic = true; } if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; val = forward * num2 + right * num; Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).magnitude < 0.1f) { val2 = forward; } Transform transform = ((Component)duck).transform; transform.position += val2 * (num3 * 3.5f) * Time.deltaTime; } } else if (attackStage == 0) { if ((Object)(object)component2 != (Object)null && component2.isKinematic) { component2.isKinematic = false; component2.useGravity = false; } Vector3 val3 = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward2 = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right2 = ((Component)OmniPossessionManager.MainCamera).transform.right; forward2.y = 0f; right2.y = 0f; val = ((Vector3)(ref forward2)).normalized * num2 + ((Vector3)(ref right2)).normalized * num; val3 = ((Vector3)(ref val)).normalized; } if (((Vector3)(ref val3)).magnitude > 0.1f) { Vector3 val4 = ((Component)duck).transform.position + val3 * num3 * Time.deltaTime; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4 + Vector3.up * 1f, Vector3.down, ref val5, 2f) && (Object)(object)((RaycastHit)(ref val5)).transform.root != (Object)(object)((Component)duck).transform.root && !((RaycastHit)(ref val5)).collider.isTrigger) { val4.y = ((RaycastHit)(ref val5)).point.y; } if ((Object)(object)component2 != (Object)null) { component2.MovePosition(val4); } else { ((Component)duck).transform.position = val4; } SetDuckState("Roam"); } else { SetDuckState("Idle"); } } if (Input.GetKeyDown((KeyCode)32)) { TriggerOriginalJump(); } } public void HandleCamera() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0116: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)duck == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -75f, 85f); if (attackStage > 0) { ((Component)duck).transform.rotation = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); } else { ((Component)duck).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); } Enemy component = ((Component)duck).GetComponent(); Vector3 val = (((Object)(object)component != (Object)null && (Object)(object)component.CenterTransform != (Object)null) ? component.CenterTransform.position : (((Component)duck).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)duck == (Object)null) { return; } attackStage = 0; Rigidbody component = ((Component)duck).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = true; } Component component2 = ((Component)duck).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)duck).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)duck).transform.position, ref val, 5f, -1)) { ((Component)duck).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void TriggerOriginalJump() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Enemy component = ((Component)duck).GetComponent(); if ((Object)(object)component != (Object)null) { FieldInfo field = typeof(Enemy).GetField("Jump", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(component); if (value != null) { if (cachedJumpMethod == null) { cachedJumpMethod = value.GetType().GetMethod("StuckTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (cachedJumpMethod != null) { cachedJumpMethod.Invoke(value, new object[1] { ((Component)duck).transform.forward }); return; } } } } SemiFunc.EnemyCartJump(((Component)duck).GetComponent()); } private void SetDuckState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value) && (!(cachedStateField != null) || !value.Equals(cachedStateField.GetValue(duck)))) { cachedStateField?.SetValue(duck, value); cachedImpulseField?.SetValue(duck, true); cachedTimerField?.SetValue(duck, 0f); PhotonView component = ((Component)duck).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class ElsaController : IPossessedController { private EnemyElsa elsa; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private FieldInfo cachedStateField = null; private FieldInfo cachedImpulseField = null; private FieldInfo cachedTimerField = null; private FieldInfo cachedAngryTimerField = null; private MethodInfo cachedJumpMethod = null; public void OnEnter(GameObject enemyObject) { elsa = enemyObject.GetComponent(); FieldInfo field = typeof(EnemyElsa).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { Type fieldType = field.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } CacheFields(); Rigidbody component = ((Component)elsa).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = false; } Component component2 = ((Component)elsa).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)elsa == (Object)null) { return; } NavMeshAgent component = ((Component)elsa).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 3f); float num4 = num3 * 4.5f; Rigidbody component2 = ((Component)elsa).GetComponent(); bool flag = ((object)Unsafe.As(ref elsa.currentState)/*cast due to .constrained prefix*/).ToString().Contains("Big"); if (Input.GetMouseButtonDown(0)) { if (!flag) { SetElsaStateAndForceTransform("TransformSmallToBig", toBig: true); } else { SetElsaStateAndForceTransform("TransformBigToSmall", toBig: false); } } if (Input.GetMouseButtonDown(1)) { PhotonView component3 = ((Component)elsa).GetComponent(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("BarkRPC", (RpcTarget)0, Array.Empty()); } else { ((Component)elsa).SendMessage("BarkRPC", (SendMessageOptions)1); } } if (Input.GetKeyDown((KeyCode)101)) { if (!flag) { SetElsaState("GoToPlayerUnderSmall"); } else { SetElsaState("LookUnderStartBig"); } } if (Input.GetKeyDown((KeyCode)32)) { TriggerOriginalJump(); } if ((Object)(object)component2 != (Object)null && component2.isKinematic) { component2.isKinematic = false; component2.useGravity = false; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)elsa).transform.position + val * num4 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)elsa).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } if ((Object)(object)component2 != (Object)null) { component2.MovePosition(val3); } else { ((Component)elsa).transform.position = val3; } if (!Input.GetKey((KeyCode)101) && !((object)Unsafe.As(ref elsa.currentState)/*cast due to .constrained prefix*/).ToString().Contains("Transform")) { SetElsaState(flag ? "GoToPlayerBig" : "RoamSmall"); } } else if (!Input.GetKey((KeyCode)101) && !((object)Unsafe.As(ref elsa.currentState)/*cast due to .constrained prefix*/).ToString().Contains("Transform")) { SetElsaState(flag ? "LookUnderBig" : "IdleSmall"); } } public void HandleCamera() { //IL_0095: 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_00dd: 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_00f4: 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_0115: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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 (!((Object)(object)elsa == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { float num = Input.GetAxis("Mouse X") * 3.5f; float num2 = Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraYaw += num; OmniPossessionManager.CameraPitch -= num2; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -75f, 85f); ((Component)elsa).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Enemy enemy = elsa.enemy; Vector3 val = (((Object)(object)enemy != (Object)null && (Object)(object)enemy.CenterTransform != (Object)null) ? enemy.CenterTransform.position : (((Component)elsa).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00ad: 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) if ((Object)(object)elsa == (Object)null) { return; } Rigidbody component = ((Component)elsa).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = true; } Component component2 = ((Component)elsa).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)elsa).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)elsa).transform.position, ref val, 5f, -1)) { ((Component)elsa).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void TriggerOriginalJump() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)elsa.enemy != (Object)null) { FieldInfo field = typeof(Enemy).GetField("Jump", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(elsa.enemy); if (value != null) { if (cachedJumpMethod == null) { cachedJumpMethod = value.GetType().GetMethod("StuckTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (cachedJumpMethod != null) { cachedJumpMethod.Invoke(value, new object[1] { ((Component)elsa).transform.forward }); return; } } } } SemiFunc.EnemyCartJump(elsa.enemy); } private void SetElsaState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value) && (!(cachedStateField != null) || !value.Equals(cachedStateField.GetValue(elsa)))) { cachedStateField?.SetValue(elsa, value); cachedImpulseField?.SetValue(elsa, true); cachedTimerField?.SetValue(elsa, 0f); PhotonView component = ((Component)elsa).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); } } } private void SetElsaStateAndForceTransform(string stateName, bool toBig) { if (!nativeStates.TryGetValue(stateName.ToLower(), out var value)) { return; } cachedAngryTimerField?.SetValue(elsa, toBig ? 15f : 0f); cachedStateField?.SetValue(elsa, value); cachedImpulseField?.SetValue(elsa, true); cachedTimerField?.SetValue(elsa, 0f); PhotonView component = ((Component)elsa).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); if (toBig) { component.RPC("TransformSmallToBigRPC", (RpcTarget)0, Array.Empty()); return; } component.RPC("TransformBigToSmallRPC", (RpcTarget)0, new object[1] { true }); } else if (toBig) { ((Component)elsa).SendMessage("TransformSmallToBigRPC", (SendMessageOptions)1); } else { ((Component)elsa).SendMessage("TransformBigToSmallRPC", (object)true, (SendMessageOptions)1); } } private void CacheFields() { if (cachedStateField == null) { Type typeFromHandle = typeof(EnemyElsa); cachedStateField = typeFromHandle.GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); cachedImpulseField = typeFromHandle.GetField("stateImpulse", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); cachedTimerField = typeFromHandle.GetField("stateTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); cachedAngryTimerField = typeFromHandle.GetField("angryTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } } public class FloaterController : IPossessedController { private EnemyFloater floater; private const float CameraRadius = 4f; private Dictionary nativeStates = new Dictionary(); private FieldInfo currentStateField; private FieldInfo stateImpulseField; private FieldInfo stateTimerField; private float attackTimer = 0f; private bool isCharging = false; private string currentFloaterState = ""; private float postAttackTimer = 0f; public void OnEnter(GameObject enemyObject) { floater = enemyObject.GetComponent(); isCharging = false; attackTimer = 0f; postAttackTimer = 0f; currentFloaterState = ""; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; currentStateField = typeof(EnemyFloater).GetField("currentState", bindingAttr); stateImpulseField = typeof(EnemyFloater).GetField("stateImpulse", bindingAttr); stateTimerField = typeof(EnemyFloater).GetField("stateTimer", bindingAttr); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)floater).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)floater).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00d3: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_013f: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)floater == (Object)null) { return; } Component val = ((Component)floater).GetComponent("UnityEngine.AI.NavMeshAgent") ?? ((Component)floater).GetComponent("NavMeshAgent"); if ((Object)(object)val != (Object)null) { ((object)val).GetType().GetProperty("enabled")?.SetValue(val, false); } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val2 = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val3 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val2 = ((Vector3)(ref val3)).normalized; } float num3 = 3.2f; if (postAttackTimer > 0f) { postAttackTimer -= Time.deltaTime; if (postAttackTimer <= 0f) { SendStateRPC("Idle"); isCharging = false; } ((Component)floater).SendMessage("FloatingAnimation", (SendMessageOptions)1); } if (attackTimer > 0f) { attackTimer -= Time.deltaTime; if (attackTimer <= 0f) { SendStateRPC("Attack"); postAttackTimer = 2f; } ((Component)floater).SendMessage("FloatingAnimation", (SendMessageOptions)1); } if (Input.GetKey((KeyCode)324)) { num3 = 1.5f; } Vector3 val4 = ((Component)floater).transform.position; if (((Vector3)(ref val2)).magnitude > 0.1f) { val4 += val2 * num3 * Time.deltaTime; if (!isCharging && attackTimer <= 0f && postAttackTimer <= 0f) { if (!Input.GetKey((KeyCode)324)) { SendStateRPC("Roam"); } else { SendStateRPC("Sneak"); } } } else if (!isCharging && attackTimer <= 0f && postAttackTimer <= 0f && !Input.GetKey((KeyCode)324)) { SendStateRPC("Idle"); } float num4 = val4.y; NavMeshHit val5 = default(NavMeshHit); if (NavMesh.SamplePosition(val4, ref val5, 5f, -1)) { num4 = ((NavMeshHit)(ref val5)).position.y + 0.3f; } val4.y = Mathf.Lerp(((Component)floater).transform.position.y, num4, Time.deltaTime * 12f); ((Component)floater).transform.position = val4; ((Component)floater).SendMessage("FloatingAnimation", (SendMessageOptions)1); if (Input.GetMouseButtonDown(0) && !isCharging) { SendStateRPC("ChargeAttack"); isCharging = true; } else if (Input.GetMouseButtonUp(0) && isCharging) { SendStateRPC("DelayAttack"); isCharging = false; attackTimer = 1.2f; } } public void HandleCamera() { //IL_008f: 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_00d5: 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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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) //IL_0115: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)floater == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 60f); ((Component)floater).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Vector3 val = (((Object)(object)floater.enemy != (Object)null && (Object)(object)floater.enemy.CenterTransform != (Object)null) ? floater.enemy.CenterTransform.position : (((Component)floater).transform.position + Vector3.up * 1f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_0073: 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) if ((Object)(object)floater == (Object)null) { return; } Rigidbody component = ((Component)floater).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component val = ((Component)floater).GetComponent("UnityEngine.AI.NavMeshAgent") ?? ((Component)floater).GetComponent("NavMeshAgent"); if ((Object)(object)val != (Object)null) { NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)floater).transform.position, ref val2, 5f, -1)) { ((Component)floater).transform.position = ((NavMeshHit)(ref val2)).position; } ((object)val).GetType().GetProperty("enabled")?.SetValue(val, true); } } private void SendStateRPC(string stateName) { if (currentFloaterState == stateName) { return; } currentFloaterState = stateName; if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(floater, value); stateImpulseField?.SetValue(floater, true); stateTimerField?.SetValue(floater, 0f); PhotonView component = ((Component)floater).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } [HarmonyPatch] public class UniversalUpdateStatePatch { private static IEnumerable TargetMethods() { Type[] enemyTypes = new Type[14] { typeof(EnemyDuck), typeof(EnemyElsa), typeof(EnemySlowWalker), typeof(EnemyHunter), typeof(EnemyBombThrower), typeof(EnemyBang), typeof(EnemyBeamer), typeof(EnemyFloater), typeof(EnemyBowtie), typeof(EnemyBirthdayBoy), typeof(EnemyAnimal), typeof(EnemyHeadController), typeof(EnemyGnome), typeof(EnemyHeadGrabber) }; Type[] array = enemyTypes; foreach (Type t in array) { MethodInfo m = t.GetMethod("UpdateState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (m != null) { yield return m; } } } private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyDuck), "Update")] public class EnemyDuckUpdatePatch { private static bool Prefix(EnemyDuck __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyDuck), "UpdateStateRPC")] public class EnemyDuckRPCBlockPatch { private static bool Prefix(EnemyDuck __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyElsa), "Update")] public class EnemyElsaUpdatePatch { private static bool Prefix(EnemyElsa __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (!OmniPossessionManager.IsPossessed || (Object)(object)OmniPossessionManager.CurrentEnemyObject != (Object)(object)((Component)__instance).gameObject) { return true; } Type typeFromHandle = typeof(EnemyElsa); FieldInfo field = typeFromHandle.GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field2 = typeFromHandle.GetField("stateTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field2 != null) { object value = field.GetValue(__instance); if (value != null && value.ToString() == "TransformBigToSmall") { float num = (float)field2.GetValue(__instance); num -= Time.deltaTime; field2.SetValue(__instance, num); if (num <= 0f) { try { object obj = Enum.Parse(field.FieldType, "IdleSmall", ignoreCase: true); field.SetValue(__instance, obj); typeFromHandle.GetField("stateImpulse", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(__instance, true); field2.SetValue(__instance, 0f); PhotonView component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { obj }); OmniPossessionManager.IsModSendingRPC = false; } } catch { } } } } return false; } } [HarmonyPatch(typeof(EnemyElsa), "UpdateStateRPC")] public class EnemyElsaRPCBlockPatch { private static bool Prefix(EnemyElsa __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemySlowWalker), "Update")] public class EnemySlowWalkerUpdatePatch { private static bool Prefix(EnemySlowWalker __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemySlowWalker), "UpdateStateRPC")] public class EnemySlowWalkerRPCBlockPatch { private static bool Prefix(EnemySlowWalker __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHunter), "Update")] public class EnemyHunterUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHunter), "UpdateStateRPC")] public class EnemyHunterRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBombThrower), "Update")] public class EnemyBombThrowerUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBombThrower), "UpdateStateRPC")] public class EnemyBombThrowerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBang), "Update")] public class EnemyBangUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBang), "UpdateStateRPC")] public class EnemyBangRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBeamer), "Update")] public class EnemyBeamerUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { ((Component)__instance).SendMessage("VerticalAimLogic", (SendMessageOptions)1); ((Component)__instance).SendMessage("LaserLogic", (SendMessageOptions)1); return false; } return true; } } [HarmonyPatch(typeof(EnemyBeamer), "UpdateStateRPC")] public class EnemyBeamerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyFloater), "Update")] public class EnemyFloaterUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyFloater), "UpdateStateRPC")] public class EnemyFloaterRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBowtie), "Update")] public class EnemyBowtieUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBowtie), "UpdateStateRPC")] public class EnemyBowtieRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBirthdayBoy), "Update")] public class EnemyBirthdayBoyUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyBirthdayBoy), "UpdateStateRPC")] public class EnemyBirthdayBoyRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyAnimal), "Update")] public class EnemyAnimalUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyAnimal), "UpdateStateRPC")] public class EnemyAnimalRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHeadController), "Update")] public class EnemyHeadControllerUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject != (Object)null && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)((Component)__instance).transform.root).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyGnome), "Update")] public class EnemyGnomeUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyGnome), "UpdateStateRPC")] public class EnemyGnomeRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHeadGrabber), "Update")] public class EnemyHeadGrabberUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHeadGrabber), "UpdateStateRPC")] public class EnemyHeadGrabberRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHeartHugger), "StateSetRPC")] public class EnemyHeartHuggerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHidden), "Update")] public class EnemyHiddenUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyHidden), "UpdateStateRPC")] public class EnemyHiddenRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyRobe), "Update")] public class EnemyRobeUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyRobe), "UpdateStateRPC")] public class EnemyRobeRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyRunner), "Update")] public class EnemyRunnerUpdatePatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { return false; } return true; } } [HarmonyPatch(typeof(EnemyRunner), "UpdateStateRPC")] public class EnemyRunnerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyShadow), "UpdateStateRPC")] public class EnemyShadowRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemySpinny), "Update")] public class EnemySpinnyUpdatePatch { private static bool Prefix(EnemySpinny __instance) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !__instance.RouletteGoingOn() && (int)__instance.currentState != 12) { return false; } return true; } } [HarmonyPatch(typeof(EnemySlowMouth), "UpdateStateRPC")] public class EnemySlowMouthRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyTick), "UpdateStateRPC")] public class EnemyTickRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyTricycle), "SetStateRPC")] public class EnemyTricycleRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyTumbler), "UpdateStateRPC")] public class EnemyTumblerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyUpscream), "Update")] public class EnemyUpscreamUpdatePatch { private static bool Prefix(EnemyUpscream __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject) { __instance.HeadLogic(); __instance.EyeLogic(); return false; } return true; } } [HarmonyPatch(typeof(EnemyUpscream), "UpdateStateRPC")] public class EnemyUpscreamRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } [HarmonyPatch(typeof(EnemyValuableThrower), "UpdateStateRPC")] public class EnemyValuableThrowerRPCBlockPatch { private static bool Prefix(MonoBehaviour __instance) { if ((Object)(object)__instance == (Object)null) { return true; } if (OmniPossessionManager.IsPossessed && (Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)(object)((Component)__instance).gameObject && !OmniPossessionManager.IsModSendingRPC) { return false; } return true; } } public class GnomeController : IPossessedController { private EnemyGnome gnome; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo stateImpulseField; private FieldInfo stateTimerField; private FieldInfo rotationTargetField; public void OnEnter(GameObject enemyObject) { gnome = enemyObject.GetComponent(); currentStateField = typeof(EnemyGnome).GetField("currentState", flags); stateImpulseField = typeof(EnemyGnome).GetField("stateImpulse", flags); stateTimerField = typeof(EnemyGnome).GetField("stateTimer", flags); rotationTargetField = typeof(EnemyGnome).GetField("rotationTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)gnome).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } public void HandleInputAndMovement() { //IL_0078: 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_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_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_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_00e0: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0116: 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_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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) if ((Object)(object)gnome == (Object)null) { return; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; Vector3 forward = ((Component)gnome).transform.forward; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward2 = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward2.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward2)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; forward.y = Mathf.Max(0.2f, forward.y); } bool flag = false; if ((Object)(object)gnome.enemy != (Object)null) { FieldInfo field = typeof(Enemy).GetField("Jump", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(gnome.enemy); if (value != null) { FieldInfo field2 = value.GetType().GetField("jumping", BindingFlags.Instance | BindingFlags.Public); if (field2 != null) { flag = (bool)field2.GetValue(value); } } } } if (!flag) { NavMeshAgent component = ((Component)gnome).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } if (component.hasPath) { component.ResetPath(); } component.velocity = Vector3.zero; float num3 = ((component.speed > 0f) ? component.speed : 3.5f); if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * num3 * Time.deltaTime); SetGnomeState("Move"); } else { SetGnomeState("Idle"); } } } if (Input.GetKeyDown((KeyCode)32) && !flag) { TriggerJump(((Vector3)(ref forward)).normalized); } if (Input.GetMouseButtonDown(0)) { SetGnomeState("Attack"); } if (Input.GetMouseButtonDown(1)) { PhotonView component2 = ((Component)gnome).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component2.RPC("IdleBreakerRPC", (RpcTarget)0, Array.Empty()); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)gnome).SendMessage("IdleBreakerRPC", (SendMessageOptions)1); } } } public void HandleCamera() { //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_009c: 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_00cb: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_014f: 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_0164: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)gnome == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); rotationTargetField?.SetValue(gnome, val); if ((Object)(object)gnome.rotationTransform != (Object)null) { gnome.rotationTransform.rotation = val; } else { ((Component)gnome).transform.rotation = val; } Vector3 val2 = (((Object)(object)gnome.enemy != (Object)null && (Object)(object)gnome.enemy.CenterTransform != (Object)null) ? gnome.enemy.CenterTransform.position : (((Component)gnome).transform.position + Vector3.up * 1f)); Quaternion val3 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val3 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val3; } } public void OnExit() { //IL_0080: 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) if ((Object)(object)gnome == (Object)null) { return; } Component component = ((Component)gnome).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)gnome).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)gnome).transform.position, ref val, 5f, -1)) { ((Component)gnome).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } private void SetGnomeState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(gnome, value); stateImpulseField?.SetValue(gnome, true); stateTimerField?.SetValue(gnome, 0f); PhotonView component = ((Component)gnome).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void TriggerJump(Vector3 jumpDirection) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gnome != (Object)null && (Object)(object)gnome.enemy != (Object)null) { FieldInfo field = typeof(Enemy).GetField("Jump", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(gnome.enemy); value?.GetType().GetMethod("StuckTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(value, new object[1] { jumpDirection }); } } } } public class HeadController : IPossessedController { private EnemyHeadController headController; private Component enemyComp; private Transform rootTransform; private Transform lookAtTransform; private const float CameraRadius = 3.5f; private FieldInfo currentStateField; private FieldInfo targetPlayerField; private MethodInfo isStunnedMethod; private Dictionary enemyStates = new Dictionary(); private bool isChaseMode = false; private float biteLockTimer = 0f; public void OnEnter(GameObject enemyObject) { headController = enemyObject.GetComponent(); if ((Object)(object)headController == (Object)null) { headController = enemyObject.GetComponentInChildren(); } isChaseMode = false; biteLockTimer = 0f; if ((Object)(object)headController != (Object)null) { FieldInfo field = typeof(EnemyHeadController).GetField("Enemy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { ref Component reference = ref enemyComp; object? value = field.GetValue(headController); reference = (Component)((value is Component) ? value : null); } lookAtTransform = headController.LookAtTransform; } rootTransform = (((Object)(object)enemyComp != (Object)null) ? enemyComp.transform : (((Object)(object)headController != (Object)null) ? ((Component)headController).transform.root : enemyObject.transform.root)); if ((Object)(object)enemyComp != (Object)null) { currentStateField = ((object)enemyComp).GetType().GetField("CurrentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)enemyComp).GetType().GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); targetPlayerField = ((object)enemyComp).GetType().GetField("TargetPlayerAvatar", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); isStunnedMethod = ((object)enemyComp).GetType().GetMethod("IsStunned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; enemyStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { enemyStates[text.ToLower()] = Enum.Parse(fieldType, text); } } } PhotonView component = ((Component)rootTransform).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer() && !component.IsMine) { component.RequestOwnership(); } Rigidbody component2 = ((Component)rootTransform).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = true; component2.useGravity = false; } SafeToggleHealthBar(enable: false); } public void HandleInputAndMovement() { //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: 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) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)headController == (Object)null || (Object)(object)rootTransform == (Object)null || !((Component)rootTransform).gameObject.activeInHierarchy) { OmniPossessionManager.ExitPossession(); return; } if ((Object)(object)enemyComp != (Object)null && currentStateField != null) { object value = currentStateField.GetValue(enemyComp); if (value != null && value.ToString() == "Despawn") { OmniPossessionManager.ExitPossession(); return; } } if ((Object)(object)enemyComp != (Object)null && targetPlayerField != null && (Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && targetPlayerField.GetValue(enemyComp) == null) { Component component = OmniPossessionManager.LocalPlayerObject.GetComponent("PlayerAvatar"); if ((Object)(object)component != (Object)null) { targetPlayerField.SetValue(enemyComp, component); } } bool flag = false; if (isStunnedMethod != null && (Object)(object)enemyComp != (Object)null) { try { flag = (bool)isStunnedMethod.Invoke(enemyComp, null); } catch { } } if (flag) { return; } NavMeshAgent val = ((Component)rootTransform).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)rootTransform).GetComponentInChildren(); } if ((Object)(object)val != (Object)null && ((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; } float num = (((Object)(object)val != (Object)null && val.speed > 0f) ? val.speed : 4f); if (biteLockTimer > 0f) { biteLockTimer -= Time.deltaTime; } float num2 = 0f; float num3 = 0f; float num4 = 0f; if (Input.GetKey((KeyCode)119)) { num3 += 1f; } if (Input.GetKey((KeyCode)115)) { num3 -= 1f; } if (Input.GetKey((KeyCode)97)) { num2 -= 1f; } if (Input.GetKey((KeyCode)100)) { num2 += 1f; } if (Input.GetKey((KeyCode)32)) { num4 += 1f; } if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)99)) { num4 -= 1f; } Vector3 val2 = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; ((Vector3)(ref forward)).Normalize(); ((Vector3)(ref right)).Normalize(); Vector3 val3 = forward * num3 + right * num2 + Vector3.up * num4; val2 = ((Vector3)(ref val3)).normalized; } if (Input.GetMouseButtonDown(1)) { isChaseMode = !isChaseMode; } if (isChaseMode) { num *= 1.6f; } if (Input.GetMouseButtonDown(0)) { TriggerBiteAnimation(); biteLockTimer = 0.4f; if (!isChaseMode) { SafeSetEnemyState("Chase"); } } if (((Vector3)(ref val2)).magnitude > 0.1f && num > 0f && biteLockTimer <= 0f) { SafeSetEnemyState(isChaseMode ? "Chase" : "Roaming"); Vector3 val4 = val2 * num * Time.deltaTime; Vector3 position = rootTransform.position + val4; if (!Physics.Raycast(rootTransform.position + Vector3.up * 0.5f, val2, ((Vector3)(ref val4)).magnitude + 0.3f, LayerMask.GetMask(new string[2] { "Default", "Interactive" }))) { rootTransform.position = position; } } else if (biteLockTimer <= 0f) { SafeSetEnemyState("Idle"); } } public void HandleCamera() { //IL_0092: 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_00ad: 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_00e0: 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) //IL_00f4: 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_0169: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)headController == (Object)null || (Object)(object)rootTransform == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -75f, 85f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); rootTransform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); if ((Object)(object)lookAtTransform != (Object)null) { lookAtTransform.rotation = val; } Vector3 val2 = rootTransform.position + Vector3.up * 1.5f; if ((Object)(object)enemyComp != (Object)null) { FieldInfo field = ((object)enemyComp).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(enemyComp); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rootTransform == (Object)null) { return; } isChaseMode = false; biteLockTimer = 0f; Rigidbody component = ((Component)rootTransform).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = true; } NavMeshAgent val = ((Component)rootTransform).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)rootTransform).GetComponentInChildren(); } if ((Object)(object)val != (Object)null) { NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(rootTransform.position, ref val2, 5f, -1)) { rootTransform.position = ((NavMeshHit)(ref val2)).position; } ((Behaviour)val).enabled = true; } SafeToggleHealthBar(enable: true); } private void TriggerBiteAnimation() { if ((Object)(object)headController != (Object)null && (Object)(object)headController.AnimationSystem != (Object)null) { MethodInfo method = typeof(EnemyHeadAnimationSystem).GetMethod("ChaseBiteTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(headController.AnimationSystem, null); } else if ((Object)(object)headController.AnimationSystem.Animator != (Object)null) { headController.AnimationSystem.Animator.SetTrigger("ChaseBite"); } } } private void SafeSetEnemyState(string stateName) { if ((Object)(object)enemyComp == (Object)null || currentStateField == null || !enemyStates.TryGetValue(stateName.ToLower(), out var value)) { return; } object value2 = currentStateField.GetValue(enemyComp); if (value2 != null && !value2.Equals(value)) { currentStateField.SetValue(enemyComp, value); PhotonView component = ((Component)rootTransform).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void SafeToggleHealthBar(bool enable) { if ((Object)(object)rootTransform == (Object)null) { return; } Component val = ((Component)rootTransform).GetComponent("EnemyHealthBar"); if ((Object)(object)val == (Object)null) { Component[] componentsInChildren = ((Component)rootTransform).GetComponentsInChildren(true); foreach (Component val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && ((object)val2).GetType().Name == "EnemyHealthBar") { val = val2; break; } } } if ((Object)(object)val != (Object)null) { ((object)val).GetType().GetProperty("enabled")?.SetValue(val, enable); } } } public class HeadGrabberController : IPossessedController { private EnemyHeadGrabber headGrabber; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo stateImpulseField; private FieldInfo stateTimerField; private FieldInfo rotationTargetField; private bool isHeadGrabbed = false; public void OnEnter(GameObject enemyObject) { headGrabber = enemyObject.GetComponent(); currentStateField = typeof(EnemyHeadGrabber).GetField("currentState", flags); stateImpulseField = typeof(EnemyHeadGrabber).GetField("stateImpulse", flags); stateTimerField = typeof(EnemyHeadGrabber).GetField("stateTimer", flags); rotationTargetField = typeof(EnemyHeadGrabber).GetField("horizontalRotationTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)headGrabber).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)headGrabber).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } FieldInfo field = typeof(EnemyHeadGrabber).GetField("headTargetActive", flags); if (field != null) { isHeadGrabbed = (bool)field.GetValue(headGrabber); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_0186: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Expected O, but got Unknown //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)headGrabber == (Object)null) { return; } NavMeshAgent component = ((Component)headGrabber).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } bool key = Input.GetKey((KeyCode)304); float num3 = (((Object)(object)component != (Object)null && component.speed > 0f) ? component.speed : 3.5f); float num4 = (key ? (num3 * 2.5f) : num3); if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)headGrabber).transform.position + val * num4 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)headGrabber).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)headGrabber).transform.position = val3; SetHeadGrabberState(key ? "RoamFast" : "Roam"); } else { SetHeadGrabberState("Idle"); } if (Input.GetKeyDown((KeyCode)32)) { TriggerJump(); } if (Input.GetMouseButtonDown(0)) { int num5 = Random.Range(0, 3); PhotonView component2 = ((Component)headGrabber).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component2.RPC("AttackSetRPC", (RpcTarget)0, new object[1] { num5 }); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)headGrabber).SendMessage("AttackSetRPC", (object)num5, (SendMessageOptions)1); } SetHeadGrabberState("Attack"); } if (Input.GetMouseButtonDown(1)) { int num6 = Random.Range(0, 3); PhotonView component3 = ((Component)headGrabber).GetComponent(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component3.RPC("IdleBreakerSetRPC", (RpcTarget)0, new object[1] { num6 }); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)headGrabber).SendMessage("IdleBreakerSetRPC", (object)num6, (SendMessageOptions)1); } SetHeadGrabberState("IdleBreaker"); } if (!Input.GetKeyDown((KeyCode)101)) { return; } if (isHeadGrabbed) { isHeadGrabbed = false; PhotonView component4 = ((Component)headGrabber).GetComponent(); if ((Object)(object)component4 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component4.RPC("UpdateHeadTargetActiveRPC", (RpcTarget)0, new object[1] { false }); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)headGrabber).SendMessage("UpdateHeadTargetActiveRPC", (object)false, (SendMessageOptions)1); } SetHeadGrabberState("ReleaseHead"); return; } FieldInfo field = typeof(EnemyHeadGrabber).GetField("headTarget", flags); if (!(field != null)) { return; } Type fieldType = field.FieldType; Object[] array = Object.FindObjectsOfType(fieldType); Component val5 = null; float num7 = 4f; Object[] array2 = array; for (int i = 0; i < array2.Length; i++) { Component val6 = (Component)array2[i]; float num8 = Vector3.Distance(((Component)headGrabber).transform.position, val6.transform.position); if (num8 < num7) { num7 = num8; val5 = val6; } } if ((Object)(object)val5 != (Object)null) { field.SetValue(headGrabber, val5); isHeadGrabbed = true; PhotonView component5 = ((Component)headGrabber).GetComponent(); if ((Object)(object)component5 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component5.RPC("UpdateHeadTargetActiveRPC", (RpcTarget)0, new object[1] { true }); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)headGrabber).SendMessage("UpdateHeadTargetActiveRPC", (object)true, (SendMessageOptions)1); } SetHeadGrabberState("GrabHead"); } } public void HandleCamera() { //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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00db: 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_015c: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)headGrabber == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); rotationTargetField?.SetValue(headGrabber, val); ((Component)headGrabber).transform.rotation = val; Vector3 val2 = ((Component)headGrabber).transform.position + Vector3.up * 1.5f; Component component = ((Component)headGrabber).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } Quaternion val4 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val4 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val4; } public void OnExit() { //IL_00a3: 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) if ((Object)(object)headGrabber == (Object)null) { return; } Rigidbody component = ((Component)headGrabber).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)headGrabber).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)headGrabber).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)headGrabber).transform.position, ref val, 5f, -1)) { ((Component)headGrabber).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SetHeadGrabberState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(headGrabber, value); stateImpulseField?.SetValue(headGrabber, true); stateTimerField?.SetValue(headGrabber, 0f); PhotonView component = ((Component)headGrabber).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void TriggerJump() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)headGrabber != (Object)null)) { return; } Component component = ((Component)headGrabber).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("Jump", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(component); value?.GetType().GetMethod("StuckTrigger", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(value, new object[1] { ((Component)headGrabber).transform.forward }); } } } } public class HeartHuggerController : IPossessedController { private EnemyHeartHugger hugger; private const float CameraRadius = 4f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo stateTimerField; private FieldInfo stateStartField; private float chompTimer = 0f; private bool isChomping = false; public void OnEnter(GameObject enemyObject) { hugger = enemyObject.GetComponent(); currentStateField = typeof(EnemyHeartHugger).GetField("currentState", flags); stateTimerField = typeof(EnemyHeartHugger).GetField("stateTimer", flags); stateStartField = typeof(EnemyHeartHugger).GetField("stateStart", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = (int)Enum.Parse(fieldType, text); } } Component component = ((Component)hugger).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } public void HandleInputAndMovement() { if ((Object)(object)hugger == (Object)null) { return; } typeof(EnemyHeartHugger).GetField("currentTarget", flags)?.SetValue(hugger, null); typeof(EnemyHeartHugger).GetField("lookAtActiveTimer", flags)?.SetValue(hugger, 1f); if (Input.GetKeyDown((KeyCode)101)) { TeleportToClosestPlayer(); } if (Input.GetMouseButtonDown(0)) { SetHuggerState("Lure"); } if (Input.GetMouseButtonUp(0)) { SetHuggerState("LureStop"); } if (Input.GetMouseButtonDown(1) && !isChomping) { SetHuggerState("ChompGasp"); isChomping = true; chompTimer = 1f; } if (isChomping) { chompTimer -= Time.deltaTime; if (chompTimer <= 0f) { SetHuggerState("Chomp"); isChomping = false; } } } private void TeleportToClosestPlayer() { //IL_00b1: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) PlayerAvatar val = null; float num = float.MaxValue; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field = ((object)val2).GetType().GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null) || !(bool)field.GetValue(val2)) { float num2 = Vector3.Distance(((Component)hugger).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { Vector3 val3 = ((Component)val).transform.position + ((Component)val).transform.forward * 2.5f; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 2f, Vector3.down, ref val4, 10f, LayerMask.GetMask(new string[1] { "Default" }))) { val3 = ((RaycastHit)(ref val4)).point; } ((Component)hugger).transform.position = val3; SetHuggerState("AggroGrow"); } } public void HandleCamera() { //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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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) if (!((Object)(object)hugger == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); ((Component)hugger).transform.rotation = rotation; object? obj = typeof(EnemyHeartHugger).GetField("headLook", flags)?.GetValue(hugger); Transform val = (Transform)((obj is Transform) ? obj : null); if ((Object)(object)val != (Object)null) { val.rotation = ((Component)OmniPossessionManager.MainCamera).transform.rotation; } Vector3 val2 = ((Component)hugger).transform.position + Vector3.up * 2f; Quaternion val3 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val3 * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val3; } } public void OnExit() { if (!((Object)(object)hugger == (Object)null)) { Component component = ((Component)hugger).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } } } private void SetHuggerState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { object value2 = Enum.ToObject(currentStateField.FieldType, value); currentStateField?.SetValue(hugger, value2); stateTimerField?.SetValue(hugger, 0f); stateStartField?.SetValue(hugger, true); PhotonView component = ((Component)hugger).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("StateSetRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class HiddenController : IPossessedController { private EnemyHidden hidden; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo rotationTargetField; private float grabTransitionTimer = 0f; public void OnEnter(GameObject enemyObject) { hidden = enemyObject.GetComponent(); currentStateField = typeof(EnemyHidden).GetField("currentState", flags); rotationTargetField = typeof(EnemyHidden).GetField("rotationTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)hidden).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } public void HandleInputAndMovement() { //IL_0078: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00d9: 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) //IL_00e4: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hidden == (Object)null) { return; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } if (grabTransitionTimer > 0f) { grabTransitionTimer -= Time.deltaTime; if (grabTransitionTimer <= 0f) { SetHiddenState("PlayerMove"); } } NavMeshAgent component = ((Component)hidden).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } if (component.hasPath) { component.ResetPath(); } component.velocity = Vector3.zero; float num3 = 3.5f; if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * num3 * Time.deltaTime); if (grabTransitionTimer <= 0f && GetCurrentStateName() != "playermove") { SetHiddenState("Roam"); } } else if (grabTransitionTimer <= 0f && GetCurrentStateName() != "playermove") { SetHiddenState("Idle"); } } if (Input.GetMouseButtonDown(0) && grabTransitionTimer <= 0f && GetCurrentStateName() != "playermove") { TryGrabPlayer(); } if ((Input.GetMouseButtonDown(1) || Input.GetKeyDown((KeyCode)32)) && GetCurrentStateName() == "playermove") { SetHiddenState("PlayerRelease"); } } private string GetCurrentStateName() { return currentStateField?.GetValue(hidden)?.ToString().ToLower() ?? ""; } private void TryGrabPlayer() { //IL_0061: 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) PlayerAvatar val = null; float num = 3.5f; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field = ((object)val2).GetType().GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null) || !(bool)field.GetValue(val2)) { float num2 = Vector3.Distance(((Component)hidden).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { PhotonView component = ((Component)hidden).GetComponent(); PhotonView component2 = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { component2.ViewID }); OmniPossessionManager.IsModSendingRPC = false; } else { typeof(EnemyHidden).GetField("playerTarget", flags)?.SetValue(hidden, val); } SetHiddenState("PlayerPickup"); grabTransitionTimer = 1f; } } public void HandleCamera() { //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_009c: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)hidden == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); rotationTargetField?.SetValue(hidden, val); ((Component)hidden).transform.rotation = val; Vector3 val2 = ((Component)hidden).transform.position + Vector3.up * 1.5f; Quaternion val3 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val3 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val3; } } public void OnExit() { //IL_0080: 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) if ((Object)(object)hidden == (Object)null) { return; } Component component = ((Component)hidden).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)hidden).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)hidden).transform.position, ref val, 5f, -1)) { ((Component)hidden).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } private void SetHiddenState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(hidden, value); typeof(EnemyHidden).GetField("stateImpulse", flags)?.SetValue(hidden, true); typeof(EnemyHidden).GetField("stateTimer", flags)?.SetValue(hidden, 0f); PhotonView component = ((Component)hidden).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class HunterController : IPossessedController { private EnemyHunter hunter; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private Type stateEnumType = null; private FieldInfo currentStateField; private FieldInfo stateImpulseField; private FieldInfo stateTimerField; private FieldInfo invPointField; private FieldInfo shootFastField; private FieldInfo invHasTransField; private FieldInfo shotsFiredField; private FieldInfo targetPlayerField; private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; public void OnEnter(GameObject enemyObject) { hunter = enemyObject.GetComponent(); currentStateField = typeof(EnemyHunter).GetField("currentState", flags); stateImpulseField = typeof(EnemyHunter).GetField("stateImpulse", flags); stateTimerField = typeof(EnemyHunter).GetField("stateTimer", flags); if (currentStateField != null) { stateEnumType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(stateEnumType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(stateEnumType, text); } } invPointField = typeof(EnemyHunter).GetField("investigatePoint", flags); shootFastField = typeof(EnemyHunter).GetField("shootFast", flags); invHasTransField = typeof(EnemyHunter).GetField("investigatePointHasTransform", flags); shotsFiredField = typeof(EnemyHunter).GetField("shotsFired", flags); targetPlayerField = typeof(EnemyHunter).GetField("targetPlayer", flags); Rigidbody component = ((Component)hunter).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)hunter).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0105: 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) //IL_0115: 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_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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017f: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hunter == (Object)null) { return; } NavMeshAgent component = ((Component)hunter).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = 4f; float speed = 0f; object value3; if (((Vector3)(ref val)).magnitude > 0.1f) { speed = num3; Vector3 val3 = ((Component)hunter).transform.position + val * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)hunter).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)hunter).transform.position = val3; if (currentStateField != null && nativeStates.TryGetValue("roam", out var value)) { object value2 = currentStateField.GetValue(hunter); if (!value2.Equals(value)) { SetHunterStateWithImpulse("Roam"); } } } else if (currentStateField != null && nativeStates.TryGetValue("idle", out value3)) { object value4 = currentStateField.GetValue(hunter); if (nativeStates.TryGetValue("roam", out var value5) && value4.Equals(value5)) { SetHunterStateWithImpulse("Idle"); } } SyncAnimatorAndMovement(speed); if (Input.GetMouseButtonDown(1) || Input.GetMouseButton(1)) { SetHunterStateWithImpulse("Aim"); } if (Input.GetMouseButtonDown(0)) { TriggerHunterAttackNetworked(); } if (Input.GetKeyDown((KeyCode)101)) { SetHunterStateWithImpulse("Investigate"); } if (Input.GetKeyDown((KeyCode)114)) { SetHunterStateWithImpulse("LeaveStart"); } } public void HandleCamera() { //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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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) if (!((Object)(object)hunter == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { float num = Input.GetAxis("Mouse X") * 3.5f; float num2 = Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraYaw += num; OmniPossessionManager.CameraPitch -= num2; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Vector3 eulerAngles = ((Component)hunter).transform.eulerAngles; eulerAngles.y = OmniPossessionManager.CameraYaw; ((Component)hunter).transform.eulerAngles = eulerAngles; if ((Object)(object)hunter.verticalAimTransform != (Object)null) { hunter.verticalAimTransform.localEulerAngles = new Vector3(OmniPossessionManager.CameraPitch, 0f, 0f); } Vector3 val = (((Object)(object)hunter.enemy != (Object)null && (Object)(object)hunter.enemy.CenterTransform != (Object)null) ? hunter.enemy.CenterTransform.position : (((Component)hunter).transform.position + Vector3.up * 1.3f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00a3: 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) if ((Object)(object)hunter == (Object)null) { return; } Rigidbody component = ((Component)hunter).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)hunter).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)hunter).GetComponent(); if ((Object)(object)component3 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)hunter).transform.position, ref val, 5f, -1)) { ((Component)hunter).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component3).enabled = true; } } private void SyncAnimatorAndMovement(float speed) { Component val = ((Component)hunter).GetComponent("UnityEngine.Animator") ?? ((Component)hunter).GetComponent("Animator"); if ((Object)(object)val != (Object)null) { MethodInfo method = ((object)val).GetType().GetMethod("SetFloat", new Type[2] { typeof(string), typeof(float) }); method?.Invoke(val, new object[2] { "Speed", speed }); method?.Invoke(val, new object[2] { "velocity", speed }); } } private void SetHunterStateWithImpulse(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(hunter, value); stateImpulseField?.SetValue(hunter, true); stateTimerField?.SetValue(hunter, 0f); PhotonView component = ((Component)hunter).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void TriggerHunterAttackNetworked() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_01d9: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)hunter.gunAimTransform != (Object)null) ? hunter.gunAimTransform.position : (((Component)hunter).transform.position + Vector3.up * 1.5f)); Ray val2 = OmniPossessionManager.MainCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); Vector3 val3 = ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * 100f; Transform val4 = null; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val2, ref val5, 100f, LayerMask.GetMask(new string[5] { "Default", "Player", "Enemy", "PhysGrabObject", "Interactive" }))) { if ((Object)(object)((Component)((RaycastHit)(ref val5)).collider).transform.root == (Object)(object)((Component)hunter).transform.root) { Ray val6 = default(Ray); ((Ray)(ref val6))..ctor(((RaycastHit)(ref val5)).point + ((Ray)(ref val2)).direction * 0.1f, ((Ray)(ref val2)).direction); RaycastHit val7 = default(RaycastHit); if (Physics.Raycast(val6, ref val7, 100f, LayerMask.GetMask(new string[5] { "Default", "Player", "Enemy", "PhysGrabObject", "Interactive" }))) { val3 = ((RaycastHit)(ref val7)).point; val5 = val7; } } else { val3 = ((RaycastHit)(ref val5)).point; } MonoBehaviour componentInParent = ((Component)((RaycastHit)(ref val5)).collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && ((object)componentInParent).GetType().Name.ToLower().Contains("player")) { val4 = ((Component)componentInParent).transform; } } float num = Vector3.Distance(val, val3); Vector3 val8; if (!(num < 1.5f)) { Vector3 direction = ((Ray)(ref val2)).direction; val8 = val3 - val; if (!(Vector3.Dot(direction, ((Vector3)(ref val8)).normalized) < 0f)) { goto IL_0238; } } val3 = val + ((Component)OmniPossessionManager.MainCamera).transform.forward * 10f; goto IL_0238; IL_0238: NavMeshAgent component = ((Component)hunter).GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = true; } invPointField?.SetValue(hunter, val3); shootFastField?.SetValue(hunter, true); invHasTransField?.SetValue(hunter, false); shotsFiredField?.SetValue(hunter, 0); if ((Object)(object)val4 == (Object)null) { MonoBehaviour[] array = Object.FindObjectsOfType(); MonoBehaviour[] array2 = array; foreach (MonoBehaviour val9 in array2) { if (((object)val9).GetType().Name.ToLower().Equals("player")) { val4 = ((Component)val9).transform; break; } } } targetPlayerField?.SetValue(hunter, val4); SetHunterStateWithImpulse("Shoot"); Component val10 = ((Component)hunter).GetComponent("UnityEngine.Animator") ?? ((Component)hunter).GetComponent("Animator"); if ((Object)(object)val10 != (Object)null) { MethodInfo method = ((object)val10).GetType().GetMethod("SetTrigger", new Type[1] { typeof(string) }); method?.Invoke(val10, new object[1] { "Shoot" }); method?.Invoke(val10, new object[1] { "shoot" }); method?.Invoke(val10, new object[1] { "Attack" }); method?.Invoke(val10, new object[1] { "attack" }); method?.Invoke(val10, new object[1] { "Fire" }); } val8 = val3 - val; Vector3 normalized = ((Vector3)(ref val8)).normalized; RaycastHit val11 = default(RaycastHit); if (Physics.Raycast(val, normalized, ref val11, 100f) && (Object)(object)((Component)((RaycastHit)(ref val11)).collider).transform.root != (Object)(object)((Component)hunter).transform.root) { MonoBehaviour componentInParent2 = ((Component)((RaycastHit)(ref val11)).collider).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { (((object)componentInParent2).GetType().GetMethod("Damage") ?? ((object)componentInParent2).GetType().GetMethod("Hurt"))?.Invoke(componentInParent2, new object[1] { 50f }); } Rigidbody val12 = ((Component)((RaycastHit)(ref val11)).collider).GetComponent() ?? ((Component)((RaycastHit)(ref val11)).collider).GetComponentInParent(); if ((Object)(object)val12 != (Object)null && !val12.isKinematic) { val12.AddForce(normalized * 300f, (ForceMode)1); } } PhotonView component2 = ((Component)hunter).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component2.RPC("ShootRPC", (RpcTarget)0, new object[1] { val3 }); OmniPossessionManager.IsModSendingRPC = false; } else { typeof(EnemyHunter).GetMethod("ShootRPC", flags)?.Invoke(hunter, new object[1] { val3 }); } } } public static class OmniPossessionManager { public static bool IsPossessed = false; public static bool IsModSendingRPC = false; public static GameObject CurrentEnemyObject = null; public static IPossessedController CurrentController = null; public static GameObject LastEnemyObject = null; public static Type LastControllerType = null; public static GameObject LocalPlayerObject = null; public static Vector3 OriginalPlayerPos; public static Quaternion OriginalPlayerRot; public static List DisabledPlayerBehaviours = new List(); public static Camera MainCamera = null; public static Transform OriginalCamParent = null; public static Vector3 OriginalCamLocalPos; public static Quaternion OriginalCamLocalRot; public static AudioListener CurrentAudioListener = null; public static Transform OriginalAudioListenerParent = null; public static Vector3 OriginalAudioListenerLocalPos; public static Quaternion OriginalAudioListenerLocalRot; public static float CameraYaw = 0f; public static float CameraPitch = 20f; public static Dictionary OriginalVoiceLocalPos = new Dictionary(); public static bool IsGodmodeEnabled = false; public static bool IsNoTumbleEnabled = false; public static void SetGodmode(bool enable) { IsGodmodeEnabled = enable; ApplyGodmode(enable); } public static void SetNoTumble(bool enable) { IsNoTumbleEnabled = enable; ApplyNoTumble(enable); } public static void TickCheats() { if (IsGodmodeEnabled) { ApplyGodmode(enable: true); } if (IsNoTumbleEnabled) { ApplyNoTumble(enable: true); } } private static void ApplyGodmode(bool enable) { try { PlayerHealth val = PlayerAvatar.instance?.playerHealth; if ((Object)(object)val != (Object)null) { ((object)val).GetType().GetField("godMode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val, enable); } } catch { } } private static void ApplyNoTumble(bool enable) { try { if ((Object)(object)PlayerController.instance != (Object)null) { FieldInfo field = ((object)PlayerController.instance).GetType().GetField("DebugNoTumble", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(PlayerController.instance, enable); } else { ((object)PlayerController.instance).GetType().GetProperty("DebugNoTumble", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(PlayerController.instance, enable); } } } catch { } } public static void EnterPossession(GameObject enemyObj, IPossessedController controller) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) //IL_0087: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown IsPossessed = true; CurrentEnemyObject = enemyObj; CurrentController = controller; SetGodmode(enable: true); MainCamera = Camera.main; if ((Object)(object)MainCamera != (Object)null) { OriginalCamParent = ((Component)MainCamera).transform.parent; OriginalCamLocalPos = ((Component)MainCamera).transform.localPosition; OriginalCamLocalRot = ((Component)MainCamera).transform.localRotation; ((Component)MainCamera).transform.SetParent((Transform)null); CameraYaw = enemyObj.transform.eulerAngles.y; CameraPitch = 20f; } CurrentAudioListener = Object.FindObjectOfType(); if ((Object)(object)CurrentAudioListener != (Object)null && (Object)(object)MainCamera != (Object)null) { OriginalAudioListenerParent = ((Component)CurrentAudioListener).transform.parent; OriginalAudioListenerLocalPos = ((Component)CurrentAudioListener).transform.localPosition; OriginalAudioListenerLocalRot = ((Component)CurrentAudioListener).transform.localRotation; ((Component)CurrentAudioListener).transform.SetParent(((Component)MainCamera).transform, false); } LocalPlayerObject = GameObject.FindGameObjectWithTag("Player"); if ((Object)(object)LocalPlayerObject != (Object)null) { OriginalPlayerPos = LocalPlayerObject.transform.position; OriginalPlayerRot = LocalPlayerObject.transform.rotation; Renderer[] componentsInChildren = LocalPlayerObject.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { val.enabled = false; } Rigidbody component = LocalPlayerObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } DisabledPlayerBehaviours.Clear(); Behaviour[] componentsInChildren2 = LocalPlayerObject.GetComponentsInChildren(true); foreach (Behaviour val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null)) { string text = ((object)val2).GetType().Name.ToLower(); if ((text.Contains("playernamechecker") || text.Contains("move") || text.Contains("controller") || text.Contains("look") || text.Contains("fall") || text.Contains("interact") || text.Contains("grab") || text.Contains("action")) && val2.enabled) { val2.enabled = false; DisabledPlayerBehaviours.Add(val2); } } } } PhotonView component2 = enemyObj.GetComponent(); if ((Object)(object)component2 != (Object)null) { if (SemiFunc.IsMultiplayer() && !component2.IsMine) { component2.RequestOwnership(); } if (SemiFunc.IsMultiplayer()) { Hashtable val3 = new Hashtable(); val3[(object)"OmniPossess"] = component2.ViewID; PhotonNetwork.LocalPlayer.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null); } } CurrentController.OnEnter(enemyObj); Debug.Log((object)("[RepoOmni] 成功夺舍实体: " + ((Object)enemyObj).name)); } public static void ExitPossession() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown if (!IsPossessed) { return; } SetGodmode(enable: false); if ((Object)(object)CurrentEnemyObject != (Object)null && CurrentController != null) { LastEnemyObject = CurrentEnemyObject; LastControllerType = CurrentController.GetType(); } if (CurrentController != null) { CurrentController.OnExit(); } if ((Object)(object)CurrentAudioListener != (Object)null) { ((Component)CurrentAudioListener).transform.SetParent(OriginalAudioListenerParent); ((Component)CurrentAudioListener).transform.localPosition = OriginalAudioListenerLocalPos; ((Component)CurrentAudioListener).transform.localRotation = OriginalAudioListenerLocalRot; CurrentAudioListener = null; } if ((Object)(object)LocalPlayerObject != (Object)null) { LocalPlayerObject.transform.position = OriginalPlayerPos; LocalPlayerObject.transform.rotation = OriginalPlayerRot; Renderer[] componentsInChildren = LocalPlayerObject.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { val.enabled = true; } Rigidbody component = LocalPlayerObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } if ((Object)(object)MainCamera != (Object)null) { ((Component)MainCamera).transform.SetParent(OriginalCamParent); ((Component)MainCamera).transform.localPosition = OriginalCamLocalPos; ((Component)MainCamera).transform.localRotation = OriginalCamLocalRot; MainCamera = null; OriginalCamParent = null; } foreach (Behaviour disabledPlayerBehaviour in DisabledPlayerBehaviours) { if ((Object)(object)disabledPlayerBehaviour != (Object)null) { disabledPlayerBehaviour.enabled = true; } } DisabledPlayerBehaviours.Clear(); if (SemiFunc.IsMultiplayer()) { Hashtable val2 = new Hashtable(); val2[(object)"OmniPossess"] = -1; PhotonNetwork.LocalPlayer.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); } IsPossessed = false; CurrentEnemyObject = null; CurrentController = null; Debug.Log((object)"[RepoOmni] 退出夺舍,原版控制完全恢复。"); } } public interface IPossessedController { void OnEnter(GameObject enemyObject); void HandleInputAndMovement(); void HandleCamera(); void OnExit(); } public class OmniUIManager : MonoBehaviour { private struct ScannedEntity { public GameObject gameObject; public float distance; public Type controllerType; public string labelZh; public string labelEn; } private bool isMenuOpen = false; private Rect windowRect; private bool isRectInitialized = false; private Vector2 scrollPosition = Vector2.zero; private bool isChinese = false; private KeyCode toggleKey = (KeyCode)282; private KeyCode quickExitKey = (KeyCode)286; private bool isListeningForToggle = false; private bool isListeningForExit = false; private GUIStyle windowStyle; private GUIStyle buttonStyle; private GUIStyle labelStyle; private GUIStyle titleStyle; private bool isStyleInitialized = false; private float scanTimer = 0f; private const float SCAN_INTERVAL = 1f; private static readonly Array cachedKeyCodes = Enum.GetValues(typeof(KeyCode)); private List scannedEntities = new List(); private void Update() { //IL_00b9: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_007d: Unknown result type (might be due to invalid IL or missing references) if (isListeningForToggle || isListeningForExit) { if (!Input.anyKeyDown) { return; } { foreach (KeyCode cachedKeyCode in cachedKeyCodes) { if (Input.GetKeyDown(cachedKeyCode) && (int)cachedKeyCode != 27) { if (isListeningForToggle) { toggleKey = cachedKeyCode; } if (isListeningForExit) { quickExitKey = cachedKeyCode; } isListeningForToggle = false; isListeningForExit = false; break; } } return; } } if (Input.GetKeyDown(quickExitKey)) { if (OmniPossessionManager.IsPossessed) { OmniPossessionManager.ExitPossession(); if (isMenuOpen) { ToggleMenu(); } } else if ((Object)(object)OmniPossessionManager.LastEnemyObject != (Object)null && OmniPossessionManager.LastEnemyObject.activeInHierarchy && OmniPossessionManager.LastControllerType != null) { IPossessedController controller = (IPossessedController)Activator.CreateInstance(OmniPossessionManager.LastControllerType); OmniPossessionManager.EnterPossession(OmniPossessionManager.LastEnemyObject, controller); if (isMenuOpen) { ToggleMenu(); } } return; } if (Input.GetKeyDown(toggleKey)) { ToggleMenu(); } if (isMenuOpen && !OmniPossessionManager.IsPossessed) { scanTimer += Time.deltaTime; if (scanTimer >= 1f) { ScanForEntitiesOptimized(); scanTimer = 0f; } } } private void ToggleMenu() { isMenuOpen = !isMenuOpen; Cursor.visible = isMenuOpen; Cursor.lockState = (CursorLockMode)(!isMenuOpen); if (isMenuOpen && !OmniPossessionManager.IsPossessed) { ScanForEntitiesOptimized(); scanTimer = 0f; } } private void ScanForEntitiesOptimized() { //IL_0029: 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_002e: 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_0086: Unknown result type (might be due to invalid IL or missing references) scannedEntities.Clear(); Camera main = Camera.main; Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.position : Vector3.zero); PhotonView[] array = Object.FindObjectsOfType(); PhotonView[] array2 = array; foreach (PhotonView val2 in array2) { if ((Object)(object)val2 == (Object)null || !((Component)val2).gameObject.activeInHierarchy || ((Component)val2).gameObject.CompareTag("Player")) { continue; } float num = Vector3.Distance(val, ((Component)val2).transform.position); if (!(num > 500f)) { GameObject gameObject = ((Component)val2).gameObject; string arg = null; string arg2 = null; Type type = null; if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "鸭子"; arg2 = "EnemyDuck"; type = typeof(DuckController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "小狗/巨兽"; arg2 = "EnemyElsa"; type = typeof(ElsaController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "大锤"; arg2 = "EnemySlowWalker"; type = typeof(SlowWalkerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "男枪"; arg2 = "EnemyHunter"; type = typeof(HunterController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "炸弹投掷者"; arg2 = "BombThrower"; type = typeof(BombThrowerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "爆爆怪"; arg2 = "EnemyBang"; type = typeof(BangController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "激光怪"; arg2 = "EnemyBeamer"; type = typeof(BeamerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "外星人"; arg2 = "EnemyFloater"; type = typeof(FloaterController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "大白"; arg2 = "EnemyBowtie"; type = typeof(BowtieController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "气球怪"; arg2 = "EnemyBirthdayBoy"; type = typeof(BirthdayBoyController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "蟑螂动物"; arg2 = "EnemyAnimal"; type = typeof(AnimalController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "大头"; arg2 = "EnemyHead"; type = typeof(HeadController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "地精"; arg2 = "EnemyGnome"; type = typeof(GnomeController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "猎头者"; arg2 = "EnemyHeadGrabber"; type = typeof(HeadGrabberController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "魅惑花"; arg2 = "HeartHugger"; type = typeof(HeartHuggerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "隐形人"; arg2 = "Hidden"; type = typeof(HiddenController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "长袍"; arg2 = "Robe"; type = typeof(RobeController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "稻草人"; arg2 = "Runner"; type = typeof(RunnerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "老奶"; arg2 = "Shadow"; type = typeof(ShadowController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "转盘怪"; arg2 = "Spinny"; type = typeof(SpinnyController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "呕吐怪"; arg2 = "SlowMouth"; type = typeof(SlowMouthController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "蜱虫"; arg2 = "Tick"; type = typeof(TickController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "自行车"; arg2 = "Tricycle"; type = typeof(TricycleController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "青蛙"; arg2 = "Tumbler"; type = typeof(TumblerController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "吼叫怪"; arg2 = "Upscream"; type = typeof(UpscreamController); } else if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { arg = "小屁孩"; arg2 = "ValuableThrower"; type = typeof(ValuableThrowerController); } if (type != null) { string labelZh = $"夺舍 {arg} [距离: {num:F1}m]"; string labelEn = $"{arg2} [Dist: {num:F1}m]"; scannedEntities.Add(new ScannedEntity { gameObject = gameObject, distance = num, controllerType = type, labelZh = labelZh, labelEn = labelEn }); } } } scannedEntities.Sort((ScannedEntity a, ScannedEntity b) => a.distance.CompareTo(b.distance)); } private void OnGUI() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (isMenuOpen) { InitStyles(); if (!isRectInitialized) { windowRect = new Rect((float)Screen.width / 2f - 400f, 20f, 800f, 500f); isRectInitialized = true; } windowRect = GUI.Window(999, windowRect, new WindowFunction(DrawMenu), "", windowStyle); } } private void DrawMenu(int windowID) { //IL_0138: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); string text = (isChinese ? "Repo 夺舍控制台" : "Repo Omni Control"); GUILayout.Label(text, titleStyle, Array.Empty()); GUILayout.Space(5f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(isChinese ? "\ud83c\udf10 中文" : "\ud83c\udf10 EN", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(22f) })) { isChinese = !isChinese; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); string text2 = ((!OmniPossessionManager.IsPossessed) ? (isChinese ? "状态: 未控制" : "Status: Uncontrolled") : (isChinese ? "状态: 夺舍中" : "Status: Possessed")); GUILayout.Label(text2, labelStyle, Array.Empty()); GUILayout.FlexibleSpace(); string text3 = ((!isListeningForExit) ? (isChinese ? $"脱离/重连: {quickExitKey}" : $"Exit/Reconnect: {quickExitKey}") : (isChinese ? "请按任意键..." : "Press any key...")); if (GUILayout.Button(text3, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(170f), GUILayout.Height(30f) })) { isListeningForExit = true; isListeningForToggle = false; } GUILayout.Space(10f); string text4 = ((!isListeningForToggle) ? (isChinese ? $"呼出菜单: {toggleKey}" : $"Toggle Menu: {toggleKey}") : (isChinese ? "请按任意键..." : "Press any key...")); if (GUILayout.Button(text4, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(160f), GUILayout.Height(30f) })) { isListeningForToggle = true; isListeningForExit = false; } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(Array.Empty()); bool isGodmodeEnabled = OmniPossessionManager.IsGodmodeEnabled; string text5 = (isChinese ? " 无敌模式" : " Godmode"); bool flag = GUILayout.Toggle(isGodmodeEnabled, text5, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); if (flag != isGodmodeEnabled) { OmniPossessionManager.SetGodmode(flag); } GUILayout.Space(10f); bool isNoTumbleEnabled = OmniPossessionManager.IsNoTumbleEnabled; string text6 = (isChinese ? " 防摔不倒地" : " NoTumble"); bool flag2 = GUILayout.Toggle(isNoTumbleEnabled, text6, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); if (flag2 != isNoTumbleEnabled) { OmniPossessionManager.SetNoTumble(flag2); } GUILayout.EndHorizontal(); GUILayout.Space(10f); DrawSeparator(); scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(300f) }); if (OmniPossessionManager.IsPossessed) { GUILayout.Space(50f); string text7 = (isChinese ? $"【 脱离控制 (按 {quickExitKey} 也可快速退出) 】" : $"【 Exit Possession (Press {quickExitKey} to quick exit) 】"); if (GUILayout.Button(text7, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(50f) })) { OmniPossessionManager.ExitPossession(); } } else { string text8 = (isChinese ? "周边可夺舍实体雷达扫描 (500m):" : "Nearby Possessable Radar Scan (500m):"); GUILayout.Label(text8, labelStyle, Array.Empty()); GUILayout.Space(10f); if (scannedEntities.Count == 0) { string text9 = (isChinese ? "当前范围内未检测到可夺舍实体..." : "No possessable entities detected in range..."); GUILayout.Label(text9, labelStyle, Array.Empty()); } else { foreach (ScannedEntity scannedEntity in scannedEntities) { if (!((Object)(object)scannedEntity.gameObject == (Object)null)) { string text10 = (isChinese ? scannedEntity.labelZh : scannedEntity.labelEn); if (GUILayout.Button(text10, buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) })) { IPossessedController controller = (IPossessedController)Activator.CreateInstance(scannedEntity.controllerType); OmniPossessionManager.EnterPossession(scannedEntity.gameObject, controller); ToggleMenu(); break; } } } } } GUILayout.EndScrollView(); GUI.DragWindow(); } private void InitStyles() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0132: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0157: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) if (!isStyleInitialized) { windowStyle = new GUIStyle(); windowStyle.normal.background = MakeTex(2, 2, new Color(0.08f, 0.08f, 0.1f, 0.95f)); windowStyle.border = new RectOffset(0, 0, 0, 0); windowStyle.padding = new RectOffset(20, 20, 20, 20); titleStyle = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; titleStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f); labelStyle = new GUIStyle(GUI.skin.label) { fontSize = 14, alignment = (TextAnchor)3 }; labelStyle.normal.textColor = new Color(0.8f, 0.8f, 0.8f); buttonStyle = new GUIStyle(GUI.skin.button) { fontSize = 14, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, margin = new RectOffset(5, 5, 5, 5) }; buttonStyle.normal.background = MakeTex(2, 2, new Color(0.2f, 0.2f, 0.25f, 1f)); buttonStyle.hover.background = MakeTex(2, 2, new Color(0.3f, 0.3f, 0.35f, 1f)); buttonStyle.active.background = MakeTex(2, 2, new Color(0.4f, 0.4f, 0.45f, 1f)); buttonStyle.normal.textColor = Color.white; isStyleInitialized = true; } } private void DrawSeparator() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(); val.normal.background = MakeTex(2, 2, new Color(0.3f, 0.3f, 0.3f, 1f)); GUILayout.Box(GUIContent.none, val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(1f), GUILayout.ExpandWidth(true) }); GUILayout.Space(10f); } private Texture2D MakeTex(int width, int height, Color col) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_002c: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } } [BepInPlugin("com.modder.repo.omnipossession", "Repo Omni Possession", "1.0.0")] public class Plugin : BaseUnityPlugin { private Harmony harmony; private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown try { harmony = new Harmony("com.modder.repo.omnipossession"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"【Repo Omni】所有怪物 Harmony 拦截补丁注入成功!"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("【Repo Omni】Harmony 注入失败!请检查 GlobalPatch.cs: " + ex.Message)); } try { ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"【Repo Omni】UI控制台与核心循环组件已成功挂载!"); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("【Repo Omni】挂载 UI 组件时发生致命错误: " + ex2.Message)); } } } [DefaultExecutionOrder(10000)] public class PossessionUpdater : MonoBehaviour { private void Update() { OmniPossessionManager.TickCheats(); if (OmniPossessionManager.IsPossessed) { if ((Object)(object)OmniPossessionManager.CurrentEnemyObject == (Object)null || !OmniPossessionManager.CurrentEnemyObject.activeInHierarchy) { OmniPossessionManager.ExitPossession(); } else if (OmniPossessionManager.CurrentController != null) { OmniPossessionManager.CurrentController.HandleInputAndMovement(); } } } private void LateUpdate() { SyncAllPlayersVoiceOptimized(); if (OmniPossessionManager.IsPossessed && OmniPossessionManager.CurrentController != null) { OmniPossessionManager.CurrentController.HandleCamera(); } } private void SyncAllPlayersVoiceOptimized() { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) PhotonView[] array = Object.FindObjectsOfType(); foreach (PhotonView val in array) { if ((Object)(object)val == (Object)null || val.Owner == null || !((Component)val).gameObject.CompareTag("Player")) { continue; } int actorNumber = val.Owner.ActorNumber; AudioSource val2 = null; AudioSource[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (AudioSource val3 in componentsInChildren) { if ((Object)(object)((Component)val3).transform == (Object)(object)((Component)val).transform) { continue; } bool flag = false; Component[] components = ((Component)val3).gameObject.GetComponents(); foreach (Component val4 in components) { if (!((Object)(object)val4 == (Object)null)) { string text = ((object)val4).GetType().Name.ToLower(); if (text.Contains("speaker") || text.Contains("voice") || text.Contains("chat") || text.Contains("tts")) { flag = true; break; } } } string text2 = ((Object)((Component)val3).gameObject).name.ToLower(); if (flag || text2.Contains("voice") || text2.Contains("speaker") || text2.Contains("chat")) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { continue; } if (!OmniPossessionManager.OriginalVoiceLocalPos.ContainsKey(actorNumber)) { OmniPossessionManager.OriginalVoiceLocalPos[actorNumber] = ((Component)val2).transform.localPosition; } object obj = val.Owner.CustomProperties[(object)"OmniPossess"]; if (obj != null && (int)obj != -1) { int num = (int)obj; PhotonView val5 = PhotonView.Find(num); if ((Object)(object)val5 != (Object)null) { ((Component)val2).transform.position = ((Component)val5).transform.position + Vector3.up * 1.5f; continue; } } if (OmniPossessionManager.OriginalVoiceLocalPos.ContainsKey(actorNumber)) { ((Component)val2).transform.localPosition = OmniPossessionManager.OriginalVoiceLocalPos[actorNumber]; } } } } public class RobeController : IPossessedController { private EnemyRobe robe; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo rotationTargetField; private float attackCooldown = 0f; public void OnEnter(GameObject enemyObject) { robe = enemyObject.GetComponent(); currentStateField = typeof(EnemyRobe).GetField("currentState", flags); rotationTargetField = typeof(EnemyRobe).GetField("rotationTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)robe).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } private void EnsureTargetPlayer() { FieldInfo field = typeof(EnemyRobe).GetField("targetPlayer", flags); object? obj = field?.GetValue(robe); PlayerAvatar val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); bool flag = false; if ((Object)(object)val != (Object)null) { FieldInfo field2 = ((object)val).GetType().GetField("isDisabled", flags); flag = field2 != null && (bool)field2.GetValue(val); } if (!((Object)(object)val == (Object)null || flag)) { return; } PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field3 = ((object)val2).GetType().GetField("isDisabled", flags); if (!(field3 != null) || !(bool)field3.GetValue(val2)) { field?.SetValue(robe, val2); break; } } } public void HandleInputAndMovement() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_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_011c: 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_0125: 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_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)robe == (Object)null) { return; } EnsureTargetPlayer(); string currentStateName = GetCurrentStateName(); if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } NavMeshAgent component = ((Component)robe).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } if (component.hasPath) { component.ResetPath(); } component.velocity = Vector3.zero; float num3 = 4f; if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * num3 * Time.deltaTime); if (currentStateName != "seekplayer" && currentStateName != "lookunder" && currentStateName != "lookunderstart" && currentStateName != "targetplayer" && currentStateName != "attack") { SetRobeState("Roam"); } } else if (currentStateName == "roam") { SetRobeState("Idle"); } } if (Input.GetKeyDown((KeyCode)113)) { SetRobeState("TargetPlayer"); PhotonView component2 = ((Component)robe).GetComponent(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component2.RPC("IdleBreakRPC", (RpcTarget)0, Array.Empty()); OmniPossessionManager.IsModSendingRPC = false; } else { ((Component)robe).SendMessage("IdleBreakRPC", (SendMessageOptions)1); } } if (Input.GetKeyDown((KeyCode)101)) { SetRobeState("LookUnderStart"); typeof(EnemyRobe).GetField("lookUnderPositionNavmesh", flags)?.SetValue(robe, ((Component)robe).transform.position); typeof(EnemyRobe).GetField("stateTimer", flags)?.SetValue(robe, 0f); } if (Input.GetMouseButtonDown(1)) { SetRobeState("SeekPlayer"); } if (!Input.GetMouseButtonDown(0) || !(attackCooldown <= 0f)) { return; } PhotonView component3 = ((Component)robe).GetComponent(); OmniPossessionManager.IsModSendingRPC = true; if (currentStateName == "lookunder" || currentStateName == "lookunderstart") { if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("LookUnderAttackImpulseRPC", (RpcTarget)0, Array.Empty()); } else { ((Component)robe).SendMessage("LookUnderAttackImpulseRPC", (SendMessageOptions)1); } SetRobeState("LookUnderAttack"); } else { if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("AttackImpulseRPC", (RpcTarget)0, Array.Empty()); } else { ((Component)robe).SendMessage("AttackImpulseRPC", (SendMessageOptions)1); } SetRobeState("Attack"); } OmniPossessionManager.IsModSendingRPC = false; attackCooldown = 0.3f; } private string GetCurrentStateName() { return currentStateField?.GetValue(robe)?.ToString().ToLower() ?? ""; } public void HandleCamera() { //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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00db: 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_015c: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)robe == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); rotationTargetField?.SetValue(robe, val); ((Component)robe).transform.rotation = val; Vector3 val2 = ((Component)robe).transform.position + Vector3.up * 1.5f; Component component = ((Component)robe).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } Quaternion val4 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val4 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val4; } public void OnExit() { //IL_0080: 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) if ((Object)(object)robe == (Object)null) { return; } Component component = ((Component)robe).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)robe).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)robe).transform.position, ref val, 5f, -1)) { ((Component)robe).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } private void SetRobeState(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(robe, value); typeof(EnemyRobe).GetField("stateImpulse", flags)?.SetValue(robe, true); typeof(EnemyRobe).GetField("stateTimer", flags)?.SetValue(robe, 0f); PhotonView component = ((Component)robe).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class RunnerController : IPossessedController { private EnemyRunner runner; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo rotationTargetField; private float attackCooldown = 0f; private float modStateTimer = 0f; public void OnEnter(GameObject enemyObject) { runner = enemyObject.GetComponent(); currentStateField = typeof(EnemyRunner).GetField("currentState", flags); rotationTargetField = typeof(EnemyRunner).GetField("rotationTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)runner).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } Rigidbody component2 = ((Component)runner).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = true; } } public void HandleInputAndMovement() { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)runner == (Object)null) { return; } EnsureTargetPlayer(); NavMeshAgent component = ((Component)runner).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } string text = currentStateField?.GetValue(runner)?.ToString().ToLower() ?? ""; if (modStateTimer > 0f) { modStateTimer -= Time.deltaTime; if (modStateTimer <= 0f) { if (text == "attackplayer" || text == "stuckattack" || text == "lookunderstop") { SetRunnerState("SeekPlayer"); } else if (text == "lookunderstart") { SetRunnerState("LookUnder"); } } } if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } bool key = Input.GetKey((KeyCode)304); float num3 = (key ? 7f : 2.5f); if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)runner).transform.position + val * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 2f, LayerMask.GetMask(new string[2] { "Default", "Interactive" })) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)runner).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)runner).transform.position = val3; if (text != "attackplayer" && text != "lookunderstart" && text != "lookunder") { SetRunnerState(key ? "SeekPlayer" : "Sneak"); } } else if (text == "sneak" || text == "seekplayer") { SetRunnerState("Idle"); } if (Input.GetMouseButton(0) && attackCooldown <= 0f) { SetRunnerState("AttackPlayer", 1f); DamageMonstersInFront(2.5f, 25f, 400f); attackCooldown = 0.6f; } else if ((Input.GetMouseButton(1) || Input.GetKey((KeyCode)101)) && attackCooldown <= 0f) { SetRunnerState("LookUnderStart", 1.5f); DamageMonstersInFront(2.5f, 25f, 400f); attackCooldown = 0.8f; } } private void SetRunnerState(string stateName, float duration = 0f) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(runner, value); typeof(EnemyRunner).GetField("stateImpulse", flags)?.SetValue(runner, true); if (duration > 0f) { modStateTimer = duration; } PhotonView component = ((Component)runner).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void DamageMonstersInFront(float radius, float damage, float knockback) { //IL_000c: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01aa: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)runner).transform.position + ((Component)runner).transform.forward * 1.5f + Vector3.up * 1f; Collider[] array = Physics.OverlapSphere(val, radius); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform.root == (Object)(object)((Component)runner).transform.root || ((Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && (Object)(object)((Component)val2).transform.root == (Object)(object)OmniPossessionManager.LocalPlayerObject.transform.root)) { continue; } bool flag = (Object)(object)((Component)val2).GetComponentInParent() != (Object)null; MonoBehaviour[] componentsInParent = ((Component)val2).GetComponentsInParent(); MonoBehaviour[] array3 = componentsInParent; foreach (MonoBehaviour val3 in array3) { MethodInfo methodInfo = ((object)val3).GetType().GetMethod("Damage") ?? ((object)val3).GetType().GetMethod("Hurt"); if (methodInfo != null) { methodInfo.Invoke(val3, new object[1] { damage }); break; } } if (!flag) { Rigidbody componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isKinematic) { componentInParent.AddForce(((Component)runner).transform.forward * knockback + Vector3.up * (knockback * 0.25f), (ForceMode)1); } } } } private void EnsureTargetPlayer() { FieldInfo field = typeof(EnemyRunner).GetField("targetPlayer", flags); object? obj = field?.GetValue(runner); PlayerAvatar val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); if (!((Object)(object)val == (Object)null) && !(bool)(((object)val).GetType().GetField("isDisabled", flags)?.GetValue(val) ?? ((object)false))) { return; } PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { if (!(bool)(((object)val2).GetType().GetField("isDisabled", flags)?.GetValue(val2) ?? ((object)true))) { field?.SetValue(runner, val2); break; } } } public void HandleCamera() { //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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00db: 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_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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_0149: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)runner == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); rotationTargetField?.SetValue(runner, val); ((Component)runner).transform.rotation = val; Vector3 val2 = ((Component)runner).transform.position + Vector3.up * 1.5f; Component component = ((Component)runner).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } Quaternion val4 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val4 * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val4; } public void OnExit() { //IL_00ab: 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) if ((Object)(object)runner == (Object)null) { return; } ((object)((Component)runner).GetComponent("EnemyHealthBar"))?.GetType().GetProperty("enabled")?.SetValue(((Component)runner).GetComponent("EnemyHealthBar"), true); Rigidbody component = ((Component)runner).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; component.useGravity = true; } NavMeshAgent component2 = ((Component)runner).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)runner).transform.position, ref val, 5f, -1)) { ((Component)runner).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } } public class ShadowController : IPossessedController { private EnemyShadow shadow; private const float CameraRadius = 4f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo stateTimerField; private string currentModState = "follow"; private float attackCooldown = 0f; private bool hasDealtDamage = false; public void OnEnter(GameObject enemyObject) { shadow = enemyObject.GetComponent(); currentStateField = typeof(EnemyShadow).GetField("currentState", flags); stateTimerField = typeof(EnemyShadow).GetField("stateTimer", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)shadow).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } public void HandleInputAndMovement() { //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_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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0140: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shadow == (Object)null) { return; } EnsureTargetPlayer(); float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } NavMeshAgent component = ((Component)shadow).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } if (component.hasPath) { component.ResetPath(); } component.velocity = Vector3.zero; if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * 4f * Time.deltaTime); } } if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; if (attackCooldown <= 1.5f && !hasDealtDamage) { DamageMonstersInFront(3.5f, 50f, 1000f); hasDealtDamage = true; } if (attackCooldown <= 0f) { TriggerStateChange("Follow", forceImpulse: true); } } if (attackCooldown <= 0f) { if (Input.GetMouseButtonDown(0)) { TriggerAttack("Slap"); } else if (Input.GetMouseButtonDown(1)) { TriggerAttack("StuckAttack"); } else { KeepStateLocked((((Vector3)(ref val)).magnitude > 0.1f) ? "Follow" : "CoolDown"); } } } private void TriggerAttack(string newState) { TriggerStateChange(newState, forceImpulse: false); attackCooldown = 2.5f; hasDealtDamage = false; } private void TriggerStateChange(string stateName, bool forceImpulse) { currentModState = stateName; if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(shadow, value); typeof(EnemyShadow).GetField("stateImpulse", flags)?.SetValue(shadow, true); stateTimerField?.SetValue(shadow, 0f); PhotonView component = ((Component)shadow).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } private void KeepStateLocked(string stateName) { currentModState = stateName; if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { currentStateField?.SetValue(shadow, value); stateTimerField?.SetValue(shadow, 100f); } } private void DamageMonstersInFront(float radius, float damage, float knockback) { //IL_000c: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)shadow).transform.position + ((Component)shadow).transform.forward * 2f + Vector3.up * 1f; Collider[] array = Physics.OverlapSphere(val, radius); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform.root == (Object)(object)((Component)shadow).transform.root || ((Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && (Object)(object)((Component)val2).transform.root == (Object)(object)OmniPossessionManager.LocalPlayerObject.transform.root)) { continue; } bool flag = (Object)(object)((Component)val2).GetComponentInParent() != (Object)null; MonoBehaviour[] componentsInParent = ((Component)val2).GetComponentsInParent(); MonoBehaviour[] array3 = componentsInParent; foreach (MonoBehaviour val3 in array3) { MethodInfo methodInfo = ((object)val3).GetType().GetMethod("Damage") ?? ((object)val3).GetType().GetMethod("Hurt"); if (methodInfo != null) { methodInfo.Invoke(val3, new object[1] { damage }); break; } } if (!flag) { Rigidbody componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isKinematic) { componentInParent.AddForce(((Component)shadow).transform.forward * knockback + Vector3.up * 300f, (ForceMode)1); } } } } private void EnsureTargetPlayer() { FieldInfo field = typeof(EnemyShadow).GetField("playerTarget", flags); object? obj = field?.GetValue(shadow); PlayerAvatar val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); bool flag = false; if ((Object)(object)val != (Object)null) { FieldInfo field2 = ((object)val).GetType().GetField("isDisabled", flags); flag = field2 != null && (bool)field2.GetValue(val); } if (!((Object)(object)val == (Object)null || flag)) { return; } PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field3 = ((object)val2).GetType().GetField("isDisabled", flags); if (field3 != null && !(bool)field3.GetValue(val2)) { field?.SetValue(shadow, val2); break; } } } public void HandleCamera() { //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_0097: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_013e: 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_014e: 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_0150: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shadow == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); ((Component)shadow).transform.rotation = rotation; Vector3 val = ((Component)shadow).transform.position + Vector3.up * 1.5f; Component component = ((Component)shadow).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val2 = (Transform)((value is Transform) ? value : null); if (val2 != null && (Object)(object)val2 != (Object)null) { val = val2.position; } } } Quaternion val3 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val3 * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val3; } public void OnExit() { if (!((Object)(object)shadow == (Object)null)) { Component component = ((Component)shadow).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)shadow).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; } } } } public class SlowMouthController : IPossessedController { private EnemySlowMouth slowMouth; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo followTargetField; private string currentModState = "idle"; public void OnEnter(GameObject enemyObject) { slowMouth = enemyObject.GetComponent(); currentStateField = typeof(EnemySlowMouth).GetField("currentState", flags); followTargetField = typeof(EnemySlowMouth).GetField("followTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)slowMouth).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } ChangeState("Idle", forceImpulse: true); } public void HandleInputAndMovement() { //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)slowMouth == (Object)null) { return; } string text = currentStateField?.GetValue(slowMouth)?.ToString().ToLower() ?? ""; int num; switch (text) { default: num = ((text == "notice") ? 1 : 0); break; case "attack": case "attached": case "puke": case "detach": case "leave": case "movebacktonavmesh": case "gotoplayer": case "gotoplayerover": case "gotoplayerunder": num = 1; break; } bool flag = (byte)num != 0; Rigidbody component = ((Component)slowMouth).GetComponent(); NavMeshAgent component2 = ((Component)slowMouth).GetComponent(); if (!flag) { if ((Object)(object)component != (Object)null) { component.isKinematic = true; } if ((Object)(object)component2 != (Object)null) { if (!((Behaviour)component2).enabled) { ((Behaviour)component2).enabled = true; } component2.updateRotation = false; component2.acceleration = 9999f; } if (Input.GetMouseButton(0)) { ChangeState("IdlePuke"); return; } if (Input.GetKeyDown((KeyCode)101)) { AttachToClosestPlayer(); return; } float num2 = 0f; float num3 = 0f; if (Input.GetKey((KeyCode)119)) { num3 += 1f; } if (Input.GetKey((KeyCode)115)) { num3 -= 1f; } if (Input.GetKey((KeyCode)97)) { num2 -= 1f; } if (Input.GetKey((KeyCode)100)) { num2 += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num3 + ((Vector3)(ref right)).normalized * num2; val = ((Vector3)(ref val2)).normalized; } if ((Object)(object)component2 != (Object)null) { component2.ResetPath(); if (((Vector3)(ref val)).magnitude > 0.1f) { component2.Move(val * 5.5f * Time.deltaTime); ChangeState("Roam"); } else { ChangeState("Idle"); } } } else { if ((Object)(object)component != (Object)null) { component.isKinematic = false; } if ((Object)(object)component2 != (Object)null && ((Behaviour)component2).enabled) { ((Behaviour)component2).enabled = false; } if (Input.GetKeyDown((KeyCode)113) && (text == "attached" || text == "puke")) { ChangeState("Detach", forceImpulse: true); } } } private void AttachToClosestPlayer() { //IL_0061: 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) PlayerAvatar val = null; float num = 6f; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field = ((object)val2).GetType().GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null) || !(bool)field.GetValue(val2)) { float num2 = Vector3.Distance(((Component)slowMouth).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { PhotonView component = ((Component)slowMouth).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); OmniPossessionManager.IsModSendingRPC = false; } ChangeState("Attack", forceImpulse: true); } } private void ChangeState(string newState, bool forceImpulse = false) { if (!(currentModState != newState.ToLower() || forceImpulse)) { return; } currentModState = newState.ToLower(); if (nativeStates.TryGetValue(newState.ToLower(), out var value)) { currentStateField?.SetValue(slowMouth, value); typeof(EnemySlowMouth).GetField("stateImpulse", flags)?.SetValue(slowMouth, true); typeof(EnemySlowMouth).GetField("stateStartFixed", flags)?.SetValue(slowMouth, true); typeof(EnemySlowMouth).GetField("stateTimer", flags)?.SetValue(slowMouth, 0f); PhotonView component = ((Component)slowMouth).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)slowMouth == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); string text = currentStateField?.GetValue(slowMouth)?.ToString().ToLower() ?? ""; switch (text) { default: if (!(text == "notice")) { ((Component)slowMouth).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); object? obj = followTargetField?.GetValue(slowMouth); Transform val2 = (Transform)((obj is Transform) ? obj : null); if ((Object)(object)val2 != (Object)null) { val2.rotation = val; } } break; case "attack": case "attached": case "puke": case "detach": case "leave": case "movebacktonavmesh": case "gotoplayer": case "gotoplayerover": case "gotoplayerunder": break; } Vector3 val3 = ((Component)slowMouth).transform.position + Vector3.up * 1f; Component component = ((Component)slowMouth).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val4 = (Transform)((value is Transform) ? value : null); if (val4 != null && (Object)(object)val4 != (Object)null) { val3 = val4.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val3 - val * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { if (!((Object)(object)slowMouth == (Object)null)) { Rigidbody component = ((Component)slowMouth).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)slowMouth).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } NavMeshAgent component3 = ((Component)slowMouth).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = true; component3.updateRotation = true; } } } } public class SlowWalkerController : IPossessedController { private EnemySlowWalker walker; private const float CameraRadius = 3.2f; private Dictionary nativeStates = new Dictionary(); private Type stateEnumType = null; private bool isAttacking = false; private float attackTimer = 0f; public void OnEnter(GameObject enemyObject) { walker = enemyObject.GetComponent(); isAttacking = false; attackTimer = 0f; FieldInfo field = typeof(EnemySlowWalker).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { stateEnumType = field.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(stateEnumType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(stateEnumType, text); } } Rigidbody component = ((Component)walker).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)walker).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } } public void HandleInputAndMovement() { //IL_00d3: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_013f: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)walker == (Object)null) { return; } Component val = ((Component)walker).GetComponent("UnityEngine.AI.NavMeshAgent") ?? ((Component)walker).GetComponent("NavMeshAgent"); if ((Object)(object)val != (Object)null) { ((object)val).GetType().GetProperty("enabled")?.SetValue(val, false); } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val2 = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val3 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val2 = ((Vector3)(ref val3)).normalized; } float num3 = 4f; float num4 = 0f; if (((Vector3)(ref val2)).magnitude > 0.1f) { num4 = num3; Vector3 val4 = ((Component)walker).transform.position + val2 * num3 * Time.deltaTime; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4 + Vector3.up * 1f, Vector3.down, ref val5, 2f) && (Object)(object)((RaycastHit)(ref val5)).transform.root != (Object)(object)((Component)walker).transform.root && !((RaycastHit)(ref val5)).collider.isTrigger) { val4.y = ((RaycastHit)(ref val5)).point.y; } ((Component)walker).transform.position = val4; ((Component)walker).transform.rotation = Quaternion.Slerp(((Component)walker).transform.rotation, Quaternion.LookRotation(val2), Time.deltaTime * 15f); } Component val6 = ((Component)walker).GetComponent("UnityEngine.Animator") ?? ((Component)walker).GetComponent("Animator"); if ((Object)(object)val6 != (Object)null) { MethodInfo method = ((object)val6).GetType().GetMethod("SetFloat", new Type[2] { typeof(string), typeof(float) }); method?.Invoke(val6, new object[2] { "Speed", num4 }); method?.Invoke(val6, new object[2] { "velocity", num4 }); } if (Input.GetMouseButtonDown(0) && !isAttacking) { SendStateRPCByName("Attack"); isAttacking = true; attackTimer = 0.8f; } if (Input.GetKeyDown((KeyCode)101) && !isAttacking) { SendStateRPCByName("LookUnder"); } if (Input.GetKeyDown((KeyCode)113) && !isAttacking) { SendStateRPCByName("Sneak"); } if (Input.GetKeyDown((KeyCode)114) && !isAttacking) { SendStateRPCByName("StuckAttack"); isAttacking = true; attackTimer = 2.5f; } if (isAttacking) { attackTimer -= Time.deltaTime; if (attackTimer <= 0f) { SendStateRPCByName("Roam"); isAttacking = false; } } } public void HandleCamera() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0108: 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_012c: 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) if (!((Object)(object)walker == (Object)null) && !((Object)(object)OmniPossessionManager.MainCamera == (Object)null)) { float num = Input.GetAxis("Mouse X") * 3.5f; float num2 = Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraYaw += num; OmniPossessionManager.CameraPitch -= num2; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -15f, 65f); Vector3 val = (((Object)(object)walker.enemy != (Object)null && (Object)(object)walker.enemy.CenterTransform != (Object)null) ? walker.enemy.CenterTransform.position : (((Component)walker).transform.position + Vector3.up * 1.3f)); Quaternion val2 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val2 * Vector3.forward * 3.2f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val2; } } public void OnExit() { //IL_00bc: 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) if ((Object)(object)walker == (Object)null) { return; } Rigidbody component = ((Component)walker).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } Component component2 = ((Component)walker).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, true); } Component val = ((Component)walker).GetComponent("UnityEngine.AI.NavMeshAgent") ?? ((Component)walker).GetComponent("NavMeshAgent"); if ((Object)(object)val != (Object)null) { NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)walker).transform.position, ref val2, 5f, -1)) { ((Component)walker).transform.position = ((NavMeshHit)(ref val2)).position; } ((object)val).GetType().GetProperty("enabled")?.SetValue(val, true); } } private void SendStateRPCByName(string stateName) { if (nativeStates.TryGetValue(stateName.ToLower(), out var value)) { Component component = ((Component)walker).GetComponent("PhotonView"); if ((Object)(object)component != (Object)null && stateEnumType != null) { MethodInfo method = ((object)component).GetType().GetMethod("RPC", new Type[3] { typeof(string), typeof(RpcTarget), typeof(object[]) }); OmniPossessionManager.IsModSendingRPC = true; method?.Invoke(component, new object[3] { "UpdateStateRPC", (object)(RpcTarget)0, new object[1] { value } }); OmniPossessionManager.IsModSendingRPC = false; } } } } public class SpinnyController : IPossessedController { private EnemySpinny spinny; private const float CameraRadius = 4f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private bool isChasing = false; public void OnEnter(GameObject enemyObject) { spinny = enemyObject.GetComponent(); currentStateField = typeof(EnemySpinny).GetField("currentState", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)spinny).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)spinny).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } isChasing = false; } private void EnsureTargetPlayer() { FieldInfo field = typeof(EnemySpinny).GetField("playerTarget", flags); object? obj = field?.GetValue(spinny); PlayerAvatar val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); if (!((Object)(object)val == (Object)null) && !(bool)(((object)val).GetType().GetField("isDisabled", flags)?.GetValue(val) ?? ((object)false))) { return; } PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { if (!(bool)(((object)val2).GetType().GetField("isDisabled", flags)?.GetValue(val2) ?? ((object)true))) { field?.SetValue(spinny, val2); break; } } } public void HandleInputAndMovement() { //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_017d: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)spinny == (Object)null) { return; } string text = currentStateField?.GetValue(spinny)?.ToString().ToLower() ?? ""; switch (text) { case "roulette": return; case "rouletteendpause": return; case "rouletteend": return; case "rouletteeffect": return; } if (text == "closemouth") { return; } NavMeshAgent component = ((Component)spinny).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } EnsureTargetPlayer(); if (Input.GetMouseButtonDown(1)) { isChasing = !isChasing; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } float num3 = (isChasing ? 5f : 4f); string newState = (isChasing ? "GoToPlayer" : "Roam"); typeof(EnemySpinny).GetField("stateTimer", flags)?.SetValue(spinny, 100f); typeof(EnemySpinny).GetField("maxStateTimer", flags)?.SetValue(spinny, 100f); if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)spinny).transform.position + val * num3 * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 4f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)spinny).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)spinny).transform.position = val3; ((Component)spinny).transform.rotation = Quaternion.Slerp(((Component)spinny).transform.rotation, Quaternion.LookRotation(val), 15f * Time.deltaTime); ChangeState(newState); } else { ChangeState("Idle"); } if (Input.GetMouseButtonDown(0)) { TriggerRouletteOnClosestPlayer(); } } private void TriggerRouletteOnClosestPlayer() { //IL_0061: 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) PlayerAvatar val = null; float num = 8f; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { if (!(bool)(((object)val2).GetType().GetField("isDisabled", flags)?.GetValue(val2) ?? ((object)true))) { float num2 = Vector3.Distance(((Component)spinny).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { PhotonView component = ((Component)spinny).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); component.RPC("GetAndSyncRandomRotationRPC", (RpcTarget)0, new object[2] { Random.Range(2, 5), Random.Range(0f, 360f) }); OmniPossessionManager.IsModSendingRPC = false; } ChangeState("WaitForRoulette", forceImpulse: true); } } private void ChangeState(string newState, bool forceImpulse = false) { string text = currentStateField?.GetValue(spinny)?.ToString().ToLower() ?? ""; if (!(text != newState.ToLower() || forceImpulse) || !nativeStates.TryGetValue(newState.ToLower(), out var value)) { return; } currentStateField?.SetValue(spinny, value); if (forceImpulse) { typeof(EnemySpinny).GetField("stateImpulse", flags)?.SetValue(spinny, true); typeof(EnemySpinny).GetField("stateTimer", flags)?.SetValue(spinny, 0f); PhotonView component = ((Component)spinny).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) //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) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)spinny == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Vector3 val = ((Component)spinny).transform.position + Vector3.up * 1.5f; Component component = ((Component)spinny).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val2 = (Transform)((value is Transform) ? value : null); if (val2 != null && (Object)(object)val2 != (Object)null) { val = val2.position; } } } Quaternion val3 = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)OmniPossessionManager.MainCamera).transform.position = val - val3 * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val3; } public void OnExit() { //IL_00a1: 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) if ((Object)(object)spinny == (Object)null) { return; } ((object)((Component)spinny).GetComponent("EnemyHealthBar"))?.GetType().GetProperty("enabled")?.SetValue(((Component)spinny).GetComponent("EnemyHealthBar"), true); Rigidbody component = ((Component)spinny).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } NavMeshAgent component2 = ((Component)spinny).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)spinny).transform.position, ref val, 5f, -1)) { ((Component)spinny).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } } public class TickController : IPossessedController { private EnemyTick tick; private const float CameraRadius = 3f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private string currentModState = "idle"; public void OnEnter(GameObject enemyObject) { tick = enemyObject.GetComponent(); currentStateField = typeof(EnemyTick).GetField("currentState", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)tick).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)tick).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } ChangeState("Idle", forceImpulse: true); } public void HandleInputAndMovement() { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tick == (Object)null) { return; } string text = currentStateField?.GetValue(tick)?.ToString().ToLower() ?? ""; bool flag = text == "bite" || text == "runaway"; NavMeshAgent component = ((Component)tick).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } if (!flag) { if (Input.GetMouseButtonDown(0)) { AttachToClosestPlayer(); return; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } if (((Vector3)(ref val)).magnitude > 0.1f) { Vector3 val3 = ((Component)tick).transform.position + val * 5f * Time.deltaTime; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3 + Vector3.up * 1f, Vector3.down, ref val4, 4f) && (Object)(object)((RaycastHit)(ref val4)).transform.root != (Object)(object)((Component)tick).transform.root && !((RaycastHit)(ref val4)).collider.isTrigger) { val3.y = ((RaycastHit)(ref val4)).point.y; } ((Component)tick).transform.position = val3; ((Component)tick).transform.rotation = Quaternion.Slerp(((Component)tick).transform.rotation, Quaternion.LookRotation(val), 15f * Time.deltaTime); ChangeState("Roam"); } else { ChangeState("Idle"); } } else if (Input.GetKeyDown((KeyCode)113)) { ChangeState("RunAway", forceImpulse: true); } } private void AttachToClosestPlayer() { //IL_0061: 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) PlayerAvatar val = null; float num = 5f; PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { if (!(bool)(((object)val2).GetType().GetField("isDisabled", flags)?.GetValue(val2) ?? ((object)true))) { float num2 = Vector3.Distance(((Component)tick).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { PhotonView component = ((Component)tick).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); OmniPossessionManager.IsModSendingRPC = false; } ChangeState("Bite", forceImpulse: true); } } private void ChangeState(string newState, bool forceImpulse = false) { if (!(currentModState != newState.ToLower() || forceImpulse)) { return; } currentModState = newState.ToLower(); if (nativeStates.TryGetValue(newState.ToLower(), out var value)) { currentStateField?.SetValue(tick, value); typeof(EnemyTick).GetField("stateImpulse", flags)?.SetValue(tick, true); typeof(EnemyTick).GetField("stateTimer", flags)?.SetValue(tick, 0f); PhotonView component = ((Component)tick).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a9: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014e: 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) if ((Object)(object)tick == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); Vector3 val2 = ((Component)tick).transform.position + Vector3.up * 1f; Component component = ((Component)tick).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val * Vector3.forward * 3f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { //IL_00a1: 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) if ((Object)(object)tick == (Object)null) { return; } ((object)((Component)tick).GetComponent("EnemyHealthBar"))?.GetType().GetProperty("enabled")?.SetValue(((Component)tick).GetComponent("EnemyHealthBar"), true); Rigidbody component = ((Component)tick).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } NavMeshAgent component2 = ((Component)tick).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)tick).transform.position, ref val, 5f, -1)) { ((Component)tick).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } } public class TricycleController : IPossessedController { private EnemyTricycle tricycle; private const float CameraRadius = 4.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private string currentModState = "idle"; private float attackCooldown = 0f; public void OnEnter(GameObject enemyObject) { tricycle = enemyObject.GetComponent(); currentStateField = typeof(EnemyTricycle).GetField("currentState", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = (int)Enum.Parse(fieldType, text); } } Component component = ((Component)tricycle).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } } public void HandleInputAndMovement() { //IL_034d: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tricycle == (Object)null) { return; } if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; if (currentModState == "attackdive" && attackCooldown <= 1f) { DamageMonstersInFront(3.5f, 40f, 600f); } if (attackCooldown <= 0f) { ChangeState("Idle"); } } NavMeshAgent component = ((Component)tricycle).GetComponent(); if (attackCooldown <= 0f) { if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } component.updateRotation = false; component.acceleration = 9999f; } if (Input.GetMouseButtonDown(1)) { string[] array = new string[3] { "BellRing", "BellRing2", "BellRing3" }; ChangeState(array[Random.Range(0, 3)], forceImpulse: true); attackCooldown = 1.5f; return; } if (Input.GetMouseButtonDown(0)) { ChangeState("AttackDive", forceImpulse: true); attackCooldown = 2f; return; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } if ((Object)(object)component != (Object)null) { component.ResetPath(); bool key = Input.GetKey((KeyCode)304); float num3 = (key ? 7f : 3.5f); if (((Vector3)(ref val)).magnitude > 0.1f) { component.velocity = val * num3; ((Component)tricycle).transform.rotation = Quaternion.Slerp(((Component)tricycle).transform.rotation, Quaternion.LookRotation(val), 15f * Time.deltaTime); ChangeState(key ? "RoamAggro" : "Roam"); } else { component.velocity = Vector3.zero; ChangeState("Idle"); } } } else if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { component.velocity = Vector3.zero; } } private void DamageMonstersInFront(float radius, float damage, float knockback) { //IL_000c: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)tricycle).transform.position + ((Component)tricycle).transform.forward * 2f + Vector3.up * 1f; Collider[] array = Physics.OverlapSphere(val, radius); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform.root == (Object)(object)((Component)tricycle).transform.root || ((Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && (Object)(object)((Component)val2).transform.root == (Object)(object)OmniPossessionManager.LocalPlayerObject.transform.root)) { continue; } bool flag = (Object)(object)((Component)val2).GetComponentInParent() != (Object)null; MonoBehaviour[] componentsInParent = ((Component)val2).GetComponentsInParent(); MonoBehaviour[] array3 = componentsInParent; foreach (MonoBehaviour val3 in array3) { MethodInfo methodInfo = ((object)val3).GetType().GetMethod("Damage") ?? ((object)val3).GetType().GetMethod("Hurt"); if (methodInfo != null) { methodInfo.Invoke(val3, new object[1] { damage }); break; } } if (!flag) { Rigidbody componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isKinematic) { componentInParent.AddForce(((Component)tricycle).transform.forward * knockback + Vector3.up * 200f, (ForceMode)1); } } } } private void ChangeState(string newState, bool forceImpulse = false) { if (!(currentModState != newState.ToLower() || forceImpulse)) { return; } currentModState = newState.ToLower(); if (nativeStates.TryGetValue(newState.ToLower(), out var value)) { object value2 = Enum.ToObject(currentStateField.FieldType, value); currentStateField?.SetValue(tricycle, value2); typeof(EnemyTricycle).GetField("stateStart", flags)?.SetValue(tricycle, true); typeof(EnemyTricycle).GetField("stateTimer", flags)?.SetValue(tricycle, 0f); PhotonView component = ((Component)tricycle).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("SetStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a9: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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) if ((Object)(object)tricycle == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); Vector3 val2 = ((Component)tricycle).transform.position + Vector3.up * 1.5f; Component component = ((Component)tricycle).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val * Vector3.forward * 4.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { if (!((Object)(object)tricycle == (Object)null)) { Component component = ((Component)tricycle).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)tricycle).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; component2.updateRotation = true; } } } } public class TumblerController : IPossessedController { private EnemyTumbler tumbler; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo lookDirectionField; private string currentModState = "idle"; private float attackCooldown = 0f; public void OnEnter(GameObject enemyObject) { tumbler = enemyObject.GetComponent(); currentStateField = typeof(EnemyTumbler).GetField("currentState", flags); lookDirectionField = typeof(EnemyTumbler).GetField("lookDirection", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)tumbler).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } ChangeState("Idle", forceImpulse: true); } public void HandleInputAndMovement() { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tumbler == (Object)null) { return; } NavMeshAgent component = ((Component)tumbler).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } component.updateRotation = false; component.acceleration = 9999f; component.ResetPath(); } if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; } bool mouseButton = Input.GetMouseButton(1); if (mouseButton && Input.GetMouseButtonDown(0) && attackCooldown <= 0f) { ChangeState("Tumble", forceImpulse: true); DamageMonstersInFront(3.5f, 35f, 500f); attackCooldown = 1f; } else if (mouseButton && attackCooldown <= 0f) { ChangeState("Tell"); } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } if (!((Object)(object)component != (Object)null)) { return; } bool key = Input.GetKey((KeyCode)304); float num3 = (mouseButton ? 2.5f : (key ? 6.5f : 3.5f)); if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * num3 * Time.deltaTime); if (!mouseButton && attackCooldown <= 0f) { ChangeState(key ? "MoveToPlayer" : "Roam"); } } else { component.velocity = Vector3.zero; if (!mouseButton && attackCooldown <= 0f) { ChangeState("Idle"); } } } private void DamageMonstersInFront(float radius, float damage, float knockback) { //IL_000c: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)tumbler).transform.position + ((Component)tumbler).transform.forward * 1.5f + Vector3.up * 1f; Collider[] array = Physics.OverlapSphere(val, radius); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform.root == (Object)(object)((Component)tumbler).transform.root || ((Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && (Object)(object)((Component)val2).transform.root == (Object)(object)OmniPossessionManager.LocalPlayerObject.transform.root)) { continue; } bool flag = (Object)(object)((Component)val2).GetComponentInParent() != (Object)null; MonoBehaviour[] componentsInParent = ((Component)val2).GetComponentsInParent(); MonoBehaviour[] array3 = componentsInParent; foreach (MonoBehaviour val3 in array3) { MethodInfo methodInfo = ((object)val3).GetType().GetMethod("Damage") ?? ((object)val3).GetType().GetMethod("Hurt"); if (methodInfo != null) { methodInfo.Invoke(val3, new object[1] { damage }); break; } } if (!flag) { Rigidbody componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isKinematic) { componentInParent.AddForce(((Component)tumbler).transform.forward * knockback + Vector3.up * 200f, (ForceMode)1); } } } } private void ChangeState(string newState, bool forceImpulse = false) { if (!(currentModState != newState.ToLower() || forceImpulse)) { return; } currentModState = newState.ToLower(); if (!nativeStates.TryGetValue(newState.ToLower(), out var value)) { return; } currentStateField?.SetValue(tumbler, value); if (forceImpulse) { typeof(EnemyTumbler).GetField("stateImpulse", flags)?.SetValue(tumbler, true); typeof(EnemyTumbler).GetField("stateTimer", flags)?.SetValue(tumbler, 0f); PhotonView component = ((Component)tumbler).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0197: 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) if ((Object)(object)tumbler == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); Quaternion val2 = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); ((Component)tumbler).transform.rotation = val2; lookDirectionField?.SetValue(tumbler, val2); Vector3 val3 = ((Component)tumbler).transform.position + Vector3.up * 1.5f; Component component = ((Component)tumbler).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val4 = (Transform)((value is Transform) ? value : null); if (val4 != null && (Object)(object)val4 != (Object)null) { val3 = val4.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val3 - val * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { if (!((Object)(object)tumbler == (Object)null)) { Component component = ((Component)tumbler).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)tumbler).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; component2.updateRotation = true; } } } } public class UpscreamController : IPossessedController { private EnemyUpscream upscream; private const float CameraRadius = 4f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo targetPlayerField; private string currentModState = "idle"; private float attackCooldown = 0f; public void OnEnter(GameObject enemyObject) { upscream = enemyObject.GetComponent(); currentStateField = typeof(EnemyUpscream).GetField("currentState", flags); targetPlayerField = typeof(EnemyUpscream).GetField("targetPlayer", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Rigidbody component = ((Component)upscream).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } Component component2 = ((Component)upscream).GetComponent("EnemyHealthBar"); if ((Object)(object)component2 != (Object)null) { ((object)component2).GetType().GetProperty("enabled")?.SetValue(component2, false); } ChangeState("Idle", forceImpulse: true); } public void HandleInputAndMovement() { //IL_020b: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)upscream == (Object)null) { return; } targetPlayerField?.SetValue(upscream, null); NavMeshAgent component = ((Component)upscream).GetComponent(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } if (attackCooldown > 0f) { attackCooldown -= Time.deltaTime; } if (Input.GetMouseButtonDown(0) && attackCooldown <= 0f) { typeof(EnemyUpscream).GetField("attackImpulse", flags)?.SetValue(upscream, true); ChangeState("Attack", forceImpulse: true); if ((Object)(object)upscream.upscreamAnim != (Object)null) { Animator val = ((Component)upscream.upscreamAnim).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)upscream.upscreamAnim).GetComponentInChildren(); } if ((Object)(object)val != (Object)null) { val.SetTrigger("Attack"); } } DamageMonstersInFront(1.2f, 20f, 1500f); attackCooldown = 2f; } else if (Input.GetMouseButtonDown(1) && attackCooldown <= 0f) { ChangeState("IdleBreak", forceImpulse: true); attackCooldown = 1.5f; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val2 = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val3 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val2 = ((Vector3)(ref val3)).normalized; } bool key = Input.GetKey((KeyCode)304); float num3 = (key ? 7.5f : 4f); if (((Vector3)(ref val2)).magnitude > 0.1f) { Vector3 val4 = ((Component)upscream).transform.position + val2 * num3 * Time.deltaTime; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4 + Vector3.up * 1f, Vector3.down, ref val5, 4f) && (Object)(object)((RaycastHit)(ref val5)).transform.root != (Object)(object)((Component)upscream).transform.root && !((RaycastHit)(ref val5)).collider.isTrigger) { val4.y = ((RaycastHit)(ref val5)).point.y; } ((Component)upscream).transform.position = val4; ((Component)upscream).transform.rotation = Quaternion.Slerp(((Component)upscream).transform.rotation, Quaternion.LookRotation(val2), 15f * Time.deltaTime); if (attackCooldown <= 0f) { ChangeState(key ? "GoToPlayer" : "Roam"); } } else if (attackCooldown <= 0f) { ChangeState("Idle"); } } private void DamageMonstersInFront(float radius, float damage, float knockback) { //IL_000c: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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) Vector3 val = ((Component)upscream).transform.position + ((Component)upscream).transform.forward * 1.2f + Vector3.up * 1.5f; Collider[] array = Physics.OverlapSphere(val, radius); Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform.root == (Object)(object)((Component)upscream).transform.root || ((Object)(object)OmniPossessionManager.LocalPlayerObject != (Object)null && (Object)(object)((Component)val2).transform.root == (Object)(object)OmniPossessionManager.LocalPlayerObject.transform.root)) { continue; } bool flag = (Object)(object)((Component)val2).GetComponentInParent() != (Object)null; MonoBehaviour[] componentsInParent = ((Component)val2).GetComponentsInParent(); MonoBehaviour[] array3 = componentsInParent; foreach (MonoBehaviour val3 in array3) { MethodInfo methodInfo = ((object)val3).GetType().GetMethod("Damage") ?? ((object)val3).GetType().GetMethod("Hurt"); if (methodInfo != null) { methodInfo.Invoke(val3, new object[1] { damage }); break; } } if (!flag) { Rigidbody componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isKinematic) { Vector3 val4 = ((Component)val2).transform.position - ((Component)upscream).transform.position; componentInParent.AddForce(((Vector3)(ref val4)).normalized * knockback + Vector3.up * (knockback * 0.3f), (ForceMode)1); } } } } private void ChangeState(string newState, bool forceImpulse = false) { if (!(currentModState != newState.ToLower() || forceImpulse)) { return; } currentModState = newState.ToLower(); if (!nativeStates.TryGetValue(newState.ToLower(), out var value)) { return; } currentStateField?.SetValue(upscream, value); if (forceImpulse) { typeof(EnemyUpscream).GetField("stateImpulse", flags)?.SetValue(upscream, true); typeof(EnemyUpscream).GetField("stateTimer", flags)?.SetValue(upscream, 0f); PhotonView component = ((Component)upscream).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a9: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014e: 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) if ((Object)(object)upscream == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); Vector3 val2 = ((Component)upscream).transform.position + Vector3.up * 1.5f; Component component = ((Component)upscream).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val * Vector3.forward * 4f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { //IL_00a1: 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) if ((Object)(object)upscream == (Object)null) { return; } ((object)((Component)upscream).GetComponent("EnemyHealthBar"))?.GetType().GetProperty("enabled")?.SetValue(((Component)upscream).GetComponent("EnemyHealthBar"), true); Rigidbody component = ((Component)upscream).GetComponent(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } NavMeshAgent component2 = ((Component)upscream).GetComponent(); if ((Object)(object)component2 != (Object)null) { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)upscream).transform.position, ref val, 5f, -1)) { ((Component)upscream).transform.position = ((NavMeshHit)(ref val)).position; } ((Behaviour)component2).enabled = true; } } } public class ValuableThrowerController : IPossessedController { private EnemyValuableThrower thrower; private const float CameraRadius = 3.5f; private Dictionary nativeStates = new Dictionary(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private FieldInfo currentStateField; private FieldInfo playerTargetField; private FieldInfo valuableTargetField; private float actionCooldown = 0f; private float pickupTimeout = 0f; public void OnEnter(GameObject enemyObject) { thrower = enemyObject.GetComponent(); currentStateField = typeof(EnemyValuableThrower).GetField("currentState", flags); playerTargetField = typeof(EnemyValuableThrower).GetField("playerTarget", flags); valuableTargetField = typeof(EnemyValuableThrower).GetField("valuableTarget", flags); if (currentStateField != null) { Type fieldType = currentStateField.FieldType; nativeStates.Clear(); string[] names = Enum.GetNames(fieldType); foreach (string text in names) { nativeStates[text.ToLower()] = Enum.Parse(fieldType, text); } } Component component = ((Component)thrower).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, false); } ChangeState("Idle", forceImpulse: true); } public void HandleInputAndMovement() { //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)thrower == (Object)null) { return; } string text = currentStateField?.GetValue(thrower)?.ToString().ToLower() ?? ""; NavMeshAgent component = ((Component)thrower).GetComponent(); if (text == "getvaluable" || text == "gototarget" || text == "leave") { ChangeState("Idle", forceImpulse: true); text = "idle"; } if (text == "targetplayer" || text == "throw") { typeof(EnemyValuableThrower).GetField("stateTimer", flags)?.SetValue(thrower, 100f); } if (actionCooldown > 0f) { actionCooldown -= Time.deltaTime; if (actionCooldown <= 0f && text == "throw") { ChangeState("Idle", forceImpulse: true); text = "idle"; } } bool flag = text == "pickuptarget"; bool flag2 = text == "throw"; if (flag) { pickupTimeout -= Time.deltaTime; if (pickupTimeout <= 0f) { ChangeState("Idle", forceImpulse: true); } if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } return; } if ((Object)(object)component != (Object)null) { if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } component.updateRotation = false; component.acceleration = 9999f; component.ResetPath(); } bool flag3 = valuableTargetField?.GetValue(thrower) != null && text == "targetplayer"; if (flag2 || !(actionCooldown <= 0f)) { return; } if (Input.GetMouseButtonDown(1) && !flag3) { TryPickUpNearestValuable(); return; } if (Input.GetMouseButtonDown(0) && flag3) { ExecuteThrow(); return; } if (Input.GetKeyDown((KeyCode)101)) { TriggerNoticeAction(); actionCooldown = 1f; return; } float num = 0f; float num2 = 0f; if (Input.GetKey((KeyCode)119)) { num2 += 1f; } if (Input.GetKey((KeyCode)115)) { num2 -= 1f; } if (Input.GetKey((KeyCode)97)) { num -= 1f; } if (Input.GetKey((KeyCode)100)) { num += 1f; } Vector3 val = Vector3.zero; if ((Object)(object)OmniPossessionManager.MainCamera != (Object)null) { Vector3 forward = ((Component)OmniPossessionManager.MainCamera).transform.forward; Vector3 right = ((Component)OmniPossessionManager.MainCamera).transform.right; forward.y = 0f; right.y = 0f; Vector3 val2 = ((Vector3)(ref forward)).normalized * num2 + ((Vector3)(ref right)).normalized * num; val = ((Vector3)(ref val2)).normalized; } bool key = Input.GetKey((KeyCode)304); float num3 = (key ? 6.5f : 3.5f); if (!((Object)(object)component != (Object)null)) { return; } if (((Vector3)(ref val)).magnitude > 0.1f) { component.Move(val * num3 * Time.deltaTime); ((Component)thrower).transform.rotation = Quaternion.Slerp(((Component)thrower).transform.rotation, Quaternion.LookRotation(val), 15f * Time.deltaTime); if (!flag3) { ChangeState(key ? "Roam" : "Roam"); } } else { component.velocity = Vector3.zero; if (!flag3) { ChangeState("Idle"); } } } private void TryPickUpNearestValuable() { //IL_0014: 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_0087: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject val = null; float num = 3.5f; Collider[] array = Physics.OverlapSphere(((Component)thrower).transform.position, num, LayerMask.GetMask(new string[1] { "PhysGrabObject" })); Collider[] array2 = array; foreach (Collider val2 in array2) { ValuableObject componentInParent = ((Component)val2).GetComponentInParent(); PhysGrabObject componentInParent2 = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent2 != (Object)null) { float num2 = Vector3.Distance(((Component)thrower).transform.position, ((Component)componentInParent2).transform.position); if (num2 < num) { num = num2; val = componentInParent2; } } } if (!((Object)(object)val == (Object)null)) { valuableTargetField?.SetValue(thrower, val); EnsureTargetPlayer(); ChangeState("PickUpTarget", forceImpulse: true); pickupTimeout = 3f; } } private void ExecuteThrow() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_008d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) object? obj = valuableTargetField?.GetValue(thrower); PhysGrabObject val = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null); if ((Object)(object)val != (Object)null) { Vector3 val2 = (((Object)(object)OmniPossessionManager.MainCamera != (Object)null) ? ((Component)OmniPossessionManager.MainCamera).transform.forward : ((Component)thrower).transform.forward); val.ResetMass(); float num = Mathf.Min(25f * val.rb.mass, 120f); val.ResetIndestructible(); Rigidbody rb = val.rb; Vector3 val3 = val2 + Vector3.up * 0.15f; rb.AddForce(((Vector3)(ref val3)).normalized * num, (ForceMode)1); val.rb.AddTorque(((Component)thrower).transform.right * 3f, (ForceMode)1); FieldInfo field = ((object)val).GetType().GetField("impactDetector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(val); value?.GetType().GetMethod("PlayerHurtMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(value, new object[2] { 5f, 2f }); } valuableTargetField?.SetValue(thrower, null); } ChangeState("Throw", forceImpulse: true); actionCooldown = 1.2f; } private void EnsureTargetPlayer() { object? obj = playerTargetField?.GetValue(thrower); PlayerAvatar val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); bool flag = false; if ((Object)(object)val != (Object)null) { FieldInfo field = ((object)val).GetType().GetField("isDisabled", flags); flag = field != null && (bool)field.GetValue(val); } if (!((Object)(object)val == (Object)null || flag)) { return; } PlayerAvatar[] array = Object.FindObjectsOfType(); foreach (PlayerAvatar val2 in array) { FieldInfo field2 = ((object)val2).GetType().GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null && !(bool)field2.GetValue(val2)) { playerTargetField?.SetValue(thrower, val2); break; } } } private void TriggerNoticeAction() { ChangeState("PlayerNotice", forceImpulse: true); PhotonView component = ((Component)thrower).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; PlayerAvatar[] array = Object.FindObjectsOfType(); int num = 0; if (num < array.Length) { PlayerAvatar val = array[num]; component.RPC("NoticeRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); } OmniPossessionManager.IsModSendingRPC = false; } } private void ChangeState(string newState, bool forceImpulse = false) { string text = currentStateField?.GetValue(thrower)?.ToString().ToLower() ?? ""; if (!(text != newState.ToLower() || forceImpulse) || !nativeStates.TryGetValue(newState.ToLower(), out var value)) { return; } currentStateField?.SetValue(thrower, value); if (forceImpulse) { typeof(EnemyValuableThrower).GetField("stateImpulse", flags)?.SetValue(thrower, true); typeof(EnemyValuableThrower).GetField("stateTimer", flags)?.SetValue(thrower, 0f); PhotonView component = ((Component)thrower).GetComponent(); if ((Object)(object)component != (Object)null && SemiFunc.IsMultiplayer()) { OmniPossessionManager.IsModSendingRPC = true; component.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { value }); OmniPossessionManager.IsModSendingRPC = false; } } } public void HandleCamera() { //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_00a4: 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_00c9: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)thrower == (Object)null || (Object)(object)OmniPossessionManager.MainCamera == (Object)null) { return; } OmniPossessionManager.CameraYaw += Input.GetAxis("Mouse X") * 3.5f; OmniPossessionManager.CameraPitch -= Input.GetAxis("Mouse Y") * 3.5f; OmniPossessionManager.CameraPitch = Mathf.Clamp(OmniPossessionManager.CameraPitch, -45f, 45f); Quaternion val = Quaternion.Euler(OmniPossessionManager.CameraPitch, OmniPossessionManager.CameraYaw, 0f); ((Component)thrower).transform.rotation = Quaternion.Euler(0f, OmniPossessionManager.CameraYaw, 0f); Vector3 val2 = ((Component)thrower).transform.position + Vector3.up * 1.5f; Component component = ((Component)thrower).GetComponent("Enemy"); if ((Object)(object)component != (Object)null) { FieldInfo field = ((object)component).GetType().GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(component); Transform val3 = (Transform)((value is Transform) ? value : null); if (val3 != null && (Object)(object)val3 != (Object)null) { val2 = val3.position; } } } ((Component)OmniPossessionManager.MainCamera).transform.position = val2 - val * Vector3.forward * 3.5f; ((Component)OmniPossessionManager.MainCamera).transform.rotation = val; } public void OnExit() { if (!((Object)(object)thrower == (Object)null)) { Component component = ((Component)thrower).GetComponent("EnemyHealthBar"); if ((Object)(object)component != (Object)null) { ((object)component).GetType().GetProperty("enabled")?.SetValue(component, true); } NavMeshAgent component2 = ((Component)thrower).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; component2.updateRotation = true; } } } }