Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Transform into a monster v1.0.0
RepoOmniPossession.dll
Decompiled an hour ago
The result has been truncated due to the large size, download it to view full contents!
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<string, object> nativeStates = new Dictionary<string, object>(); private FieldInfo currentStateField; private float havocTimer = 0f; public void OnEnter(GameObject enemyObject) { animal = enemyObject.GetComponent<EnemyAnimal>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<string, object> nativeStates = new Dictionary<string, object>(); private BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; public void OnEnter(GameObject enemyObject) { bang = enemyObject.GetComponent<EnemyBang>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<PhotonView>(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("ExplodeRPC", (RpcTarget)0, Array.Empty<object>()); } 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<PhotonView>(); 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<string, object> nativeStates = new Dictionary<string, object>(); 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<EnemyBeamer>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); if ((Object)(object)component2 != (Object)null && SemiFunc.IsMultiplayer()) { component2.RPC("MeleeTriggerRPC", (RpcTarget)0, Array.Empty<object>()); } 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<PhotonView>(); 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<EnemyBirthdayBoy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<EnemyBombThrower>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PlayerAvatar>(); 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<EnemyBowtie>(); 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<Collider>(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<Rigidbody>(); 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<NavMeshAgent>(); 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<PlayerAvatar>()); } 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<string, object> nativeStates = new Dictionary<string, object>(); 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<EnemyDuck>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<Rigidbody>(); 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<Enemy>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<Enemy>(); 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<Enemy>()); } 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<PhotonView>(); 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<string, object> nativeStates = new Dictionary<string, object>(); 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<EnemyElsa>(); 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<Rigidbody>(); 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<NavMeshAgent>(); 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<Rigidbody>(); bool flag = ((object)Unsafe.As<State, State>(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<PhotonView>(); if ((Object)(object)component3 != (Object)null && SemiFunc.IsMultiplayer()) { component3.RPC("BarkRPC", (RpcTarget)0, Array.Empty<object>()); } 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<State, State>(ref elsa.currentState)/*cast due to .constrained prefix*/).ToString().Contains("Transform")) { SetElsaState(flag ? "GoToPlayerBig" : "RoamSmall"); } } else if (!Input.GetKey((KeyCode)101) && !((object)Unsafe.As<State, State>(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<Rigidbody>(); 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<NavMeshAgent>(); 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<PhotonView>(); 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<PhotonView>(); 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<object>()); 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<string, object> nativeStates = new Dictionary<string, object>(); 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<EnemyFloater>(); 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<Rigidbody>(); 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 re