Decompiled source of BillionNemesis v0.3.0
BillionNemesis.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BillionNemesis.Func; using Configgy; using Discord; using HarmonyLib; using Logic; using Microsoft.CodeAnalysis; using Steamworks; using TMPro; using ULTRAKILL.Cheats; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BillionNemesis")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.3.0.0")] [assembly: AssemblyInformationalVersion("0.3.0+5a951ddcdc1c7f559a8f29e96b43156ef7901ff4")] [assembly: AssemblyProduct("Billion Nemesis")] [assembly: AssemblyTitle("BillionNemesis")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BillionNemesis { [BepInPlugin("billy.billionnemesis", "Billion Nemesis", "0.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private ConfigBuilder config; [Configgable("", "Enable Billion Nemesis", 0, "Lets you enable or disable the custom enemy encounters. If you're currently in a level, changing this will require a level restart")] public static ConfigToggle IsEnabled = new ConfigToggle(true); public static bool IsPatched = false; public static bool forceDefaultLevelPath = false; public static Dictionary<string, GameObject> objectsLookedUpThisScene = new Dictionary<string, GameObject>(); public const string NemesisColorHex = "ff00af"; private static readonly Harmony Harmony = new Harmony("billy.billionnemesis"); internal static ManualLogSource Logger; public void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); Logger.LogInfo((object)"Plugin BillionNemesis is loaded!"); SceneManager.activeSceneChanged += LevelPatching.SceneManagerActiveSceneChanged; LevelAssets.GetAssets(); config = new ConfigBuilder("billy.billionnemesis", "Billion Nemesis"); ConfigToggle isEnabled = IsEnabled; ((ConfigValueElement<bool>)(object)isEnabled).OnValueChanged = (Action<bool>)Delegate.Combine(((ConfigValueElement<bool>)(object)isEnabled).OnValueChanged, new Action<bool>(EnabledValueChanged)); config.BuildAll(); Logger.LogInfo((object)"Plugin BillionNemesis is loadedest!"); } public static void EnabledValueChanged(bool v) { RankStuff.UpdateRanks(); } } public static class ChangedInfo { public static int[] ChangedLevels = new int[4] { 1, 2, 3, 4 }; public static string[] ChangedScenes = new string[4] { "Level 0-1", "Level 0-2", "Level 0-3", "Level 0-4" }; public static Dictionary<string, string> NewLevelNames = new Dictionary<string, string> { ["INTO THE FIRE"] = "UNTO THE CORE", ["THE MEATGRINDER"] = "THE BACKBURNER", ["DOUBLE DOWN"] = "<size=150%>UP</size> THE ANTE", ["A ONE-MACHINE ARMY"] = "DELTA P", ["CERBERUS"] = "the Kiln" }; public static Dictionary<string, string> PlainLevelNames = new Dictionary<string, string> { ["<size=150%>UP</size> THE ANTE"] = "UP THE ANTE" }; } [HarmonyPatch] public class DeadcaughtEnemyPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Deathcatcher), "EnemyDeath")] public static bool EnemyDeathPrefix(EnemyIdentifier eid, Deathcatcher __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0165: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } if ((Object)(object)eid == (Object)null) { Debug.LogWarning((object)"EnemyIdentifier is null. Cannot track death."); return false; } if ((Object)(object)((Component)eid).gameObject.GetComponent<DontCatch>() != (Object)null) { return false; } Debug.Log((object)("EnemyDeath called for " + ((Object)eid).name)); if (!__instance.canRespawnIdols && (int)eid.enemyType == 21) { return false; } EnemyTracker instance = MonoSingleton<EnemyTracker>.Instance; if ((Object)(object)instance == (Object)null) { Debug.LogWarning((object)"EnemyTracker instance not found. Cannot track enemy death."); return false; } if (!instance.spawnedEnemies.TryGetValue(((Object)eid).GetInstanceID(), out var value)) { Debug.LogWarning((object)("Enemy " + ((Object)eid).name + " not found in spawned enemies. Cannot track death.")); return false; } TeleportOnCondition teleportOnCondition = null; GameObject[] activateOnDeath = eid.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (!(((Object)val).name != "TeleportOnCondition")) { teleportOnCondition = val.GetComponent<TeleportOnCondition>(); } } CaughtEnemy val2 = new CaughtEnemy(eid, value); if (!__instance.deadCaughtEnemies.Contains(val2)) { Debug.Log((object)$"Tracking death of enemy {eid} at position {val2.position} with rotation {val2.rotation}"); __instance.deadCaughtEnemies.Add(val2); if ((Object)(object)teleportOnCondition != (Object)null && teleportOnCondition.onDeadcaught) { val2.position = TeleportOnCondition.CheckConditions(val2.position, teleportOnCondition.conditions, teleportOnCondition.returnOnFirstSuccess); } } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(CaughtEnemy), "UpdatePuppet")] public static void UpdatePuppetPrefix(GameObject newPuppet, CaughtEnemy __instance) { ReaddComponents(newPuppet, __instance.original, __instance); } public static void ReaddComponents(GameObject puppet, EnemyIdentifier original, CaughtEnemy __instance) { //IL_00eb: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) GameObject[] activateOnDeath = original.activateOnDeath; foreach (GameObject val in activateOnDeath) { switch (((Object)val).name) { case "StopEnemyMovement": { StopEnemyMovement component2 = val.GetComponent<StopEnemyMovement>(); StopEnemyMovement orAddComponent2 = GameObjectExtensions.GetOrAddComponent<StopEnemyMovement>(puppet); component2.CopyValuesTo(orAddComponent2); break; } case "MoveTo": { MoveTo component3 = val.GetComponent<MoveTo>(); MoveTo orAddComponent3 = GameObjectExtensions.GetOrAddComponent<MoveTo>(puppet); component3.CopyValuesTo(orAddComponent3); break; } case "TeleportOnCondition": { TeleportOnCondition component = val.GetComponent<TeleportOnCondition>(); TeleportOnCondition orAddComponent = GameObjectExtensions.GetOrAddComponent<TeleportOnCondition>(puppet); component.CopyValuesTo(orAddComponent); if (orAddComponent.onDeadcaught) { TeleportOnCondition.ChangeAxisTargetsToPuppet(orAddComponent.conditions, puppet.transform); __instance.position = TeleportOnCondition.CheckConditions(__instance.position, orAddComponent.conditions, orAddComponent.returnOnFirstSuccess); } puppet.transform.position = __instance.position; break; } } } } } public class DontCatch : MonoBehaviour { } public class EnemyBlockBreakables : MonoBehaviour { public EnemyIdentifier eid; public void Awake() { eid = ((Component)this).GetComponent<EnemyIdentifier>(); } public void Start() { BreakableAllower[] array = Object.FindObjectsByType<BreakableAllower>((FindObjectsInactive)1, (FindObjectsSortMode)0); BreakableAllower[] array2 = array; foreach (BreakableAllower breakableAllower in array2) { breakableAllower.enemyBlocks.Add(this); } } } [HarmonyPatch] public class GroundWavePatch { [HarmonyPatch(typeof(GroundWave), "FixedUpdate")] public static bool FixedUpdatePrefix(GroundWave __instance, bool __runOriginal) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_0140: 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) if (!Util.IsPatched()) { return true; } if (!__instance.isTraversingLink || !__runOriginal) { return false; } Vector3 val = __instance.traversalVelocity * Time.fixedDeltaTime; Transform transform = ((Component)__instance).transform; transform.position += val; if (((Vector3)(ref __instance.traversalVelocity)).sqrMagnitude > 0.001f) { ((Component)__instance).transform.rotation = Quaternion.LookRotation(((Vector3)(ref __instance.traversalVelocity)).normalized, Vector3.up); } if (Object.op_Implicit((Object)(object)__instance.rb)) { __instance.rb.position = ((Component)__instance).transform.position; __instance.rb.rotation = ((Component)__instance).transform.rotation; } if (__instance.hasCrossed) { __instance.postTeleportDistance += ((Vector3)(ref val)).magnitude; if (__instance.postTeleportDistance >= 2f) { __instance.isTraversingLink = false; ((Behaviour)__instance.nma).enabled = true; __instance.nma.Warp(((Component)__instance).transform.position); __instance.nma.velocity = __instance.traversalVelocity; if ((Object)(object)__instance.nma != (Object)null && ((Behaviour)__instance.nma).enabled) { __instance.nma.SetDestination(__instance.target.GetNavPoint()); } } } return false; } } public class MoveTo : MonoBehaviour { public float speed = 20f; public Transform targetTransform = null; public bool removeOnDeath = true; public float delay = -1f; public float delayProgress = 0f; public bool moveX = true; public bool moveY = true; public bool moveZ = true; public float targetX = 0f; public float targetY = 0f; public float targetZ = 0f; public MoveTo MoveXYZ(bool moveX = true, bool moveY = true, bool moveZ = true) { this.moveX = moveX; this.moveY = moveY; this.moveZ = moveZ; return this; } public MoveTo TargetXYZ(float targetX = 0f, float targetY = 0f, float targetZ = 0f) { this.targetX = targetX; this.targetY = targetY; this.targetZ = targetZ; return this; } public void Update() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //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)targetTransform == (Object)null)) { if (delayProgress < delay) { delayProgress += Time.deltaTime; return; } Vector3 position = targetTransform.position; targetTransform.position = new Vector3(moveX ? Mathf.MoveTowards(position.x, targetX, speed * Time.deltaTime) : position.x, moveY ? Mathf.MoveTowards(position.y, targetY, speed * Time.deltaTime) : position.y, moveZ ? Mathf.MoveTowards(position.z, targetZ, speed * Time.deltaTime) : position.z); } } public void Start() { SaveForPuppet(); } public void SaveForPuppet() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown EnemyIdentifier componentInChildren = ((Component)this).GetComponentInChildren<EnemyIdentifier>(); if ((Object)(object)componentInChildren == (Object)null) { return; } GameObject[] activateOnDeath = componentInChildren.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "MoveTo") { return; } } GameObject val2 = new GameObject("MoveTo"); MoveTo newMover = val2.AddComponent<MoveTo>(); CopyValuesTo(newMover); Util.ArrayAdd(ref componentInChildren.activateOnDeath, val2); } public void CopyValuesTo(MoveTo newMover) { newMover.speed = speed; newMover.targetTransform = targetTransform; newMover.removeOnDeath = removeOnDeath; newMover.MoveXYZ(moveX, moveY, moveZ); newMover.TargetXYZ(targetX, targetY, targetZ); } } [HarmonyPatch(typeof(EnemyIdentifier), "ProcessDeath")] public class DeathPatch { public static void Prefix(EnemyIdentifier __instance) { MoveTo component = ((Component)__instance).GetComponent<MoveTo>(); if ((Object)(object)component != (Object)null && component.removeOnDeath) { Object.Destroy((Object)(object)component); } } } [HarmonyPatch(typeof(Power), "Awake")] public class PowerPatch { public static bool Prefix(Power __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } __instance.anim = ((Component)__instance).GetComponent<Animator>(); __instance.eid = ((Component)__instance).GetComponent<EnemyIdentifier>(); __instance.rb = ((Component)__instance).GetComponent<Rigidbody>(); __instance.mach = ((Component)__instance).GetComponent<Enemy>(); __instance.environmentMask = LayerMaskDefaults.Get((LMD)1); __instance.ensims = ((Component)__instance).GetComponentsInChildren<EnemySimplifier>(); __instance.aud = ((Component)__instance).GetComponent<AudioSource>(); if (__instance.voicePitch == -1f) { __instance.voicePitch = Random.Range(0.95f, 1.05f); } if (__instance.originalPosition == Vector3.zero) { __instance.originalPosition = ((Component)__instance).transform.position; } if (Object.op_Implicit((Object)(object)__instance.stabEffect)) { __instance.stabParticle = __instance.stabEffect.GetComponentInChildren<ParticleSystem>(); __instance.stabTrail = __instance.stabEffect.GetComponentInChildren<TrailRenderer>(); __instance.stabAudio = __instance.stabEffect.GetComponentInChildren<AudioSource>(); } if ((Object)(object)__instance.physicsArm == (Object)null) { __instance.physicsArm = new GameObject("NemesisPhysicsArm").transform; } __instance.physicsArm.SetParent(((Component)__instance).transform.parent); return false; } } public class PowerStayClose : MonoBehaviour { public float distanceLimit = 22.5f; } [HarmonyPatch(typeof(Power), "FixedUpdate")] public class PowerStayClosePatch { public static void Postfix(Power __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) PowerStayClose component = ((Component)__instance).GetComponent<PowerStayClose>(); if (!((Object)(object)component == (Object)null) && !(Vector3.Distance(((Component)__instance).transform.position, ((Component)MonoSingleton<NewMovement>.Instance).transform.position) <= component.distanceLimit)) { __instance.Teleport(true, false, false, false, false, true); } } } public class StatueSpeed : MonoBehaviour { public float multiplier = 1.2f; } [HarmonyPatch(typeof(StatueFake), "Start")] public class StatueFakePatch { public static void Postfix(StatueFake __instance) { StatueSpeed component = ((Component)__instance).GetComponent<StatueSpeed>(); if (!((Object)(object)component == (Object)null)) { Animator anim = __instance.anim; anim.speed *= component.multiplier; } } } public class StopEnemyMovement : MonoBehaviour { public bool stopWalking = false; public bool stopDashing = true; public NavMeshAgent nma; public static bool CheckDash(Component __instance) { StopEnemyMovement component = __instance.GetComponent<StopEnemyMovement>(); if (component != null && ((Behaviour)component).enabled && component != null && component.stopDashing) { return false; } return true; } public void Awake() { nma = ((Component)this).GetComponent<NavMeshAgent>(); } public void Start() { SaveForPuppet(); } public void SaveForPuppet() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown EnemyIdentifier component = ((Component)this).GetComponent<EnemyIdentifier>(); if ((Object)(object)component == (Object)null) { return; } GameObject[] activateOnDeath = component.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "StopEnemyMovement") { return; } } GameObject val2 = new GameObject("StopEnemyMovement"); StopEnemyMovement newStopper = val2.AddComponent<StopEnemyMovement>(); CopyValuesTo(newStopper); Util.ArrayAdd(ref component.activateOnDeath, val2); } public void FixedUpdate() { if (stopWalking && (Object)(object)nma != (Object)null && ((Behaviour)nma).enabled) { ((Behaviour)nma).enabled = false; } } public void CopyValuesTo(StopEnemyMovement newStopper) { newStopper.stopWalking = stopWalking; newStopper.stopDashing = stopDashing; } } [HarmonyPatch(typeof(StatueBoss))] public class CerberusMovementPatch { [HarmonyPrefix] [HarmonyPatch(typeof(StatueBoss), "Tackle")] [HarmonyPriority(800)] public static bool TacklePrefix(StatueBoss __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) bool flag = StopEnemyMovement.CheckDash((Component)(object)__instance); if (!flag) { __instance.inAction = true; if (Vector3.Distance(((Component)__instance).transform.position, __instance.targetPlanePos) >= 9f) { __instance.Throw(); } else { __instance.Stomp(); } } return flag; } } [HarmonyPatch(typeof(Drone))] public class DroneMovementPatch { [HarmonyPrefix] [HarmonyPatch(typeof(Drone), "Dodge", new Type[] { typeof(Vector3) })] [HarmonyPriority(800)] public static bool DodgePrefix(Drone __instance) { return StopEnemyMovement.CheckDash((Component)(object)__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(Drone), "ProcessTargeting")] [HarmonyPriority(800)] public static bool ProcessTargetingPrefix(Drone __instance) { return StopEnemyMovement.CheckDash((Component)(object)__instance); } } public class AddDeathANW : MonoBehaviour { public void Add() { ActivateNextWave component = ((Component)this).GetComponent<ActivateNextWave>(); component.deadEnemies++; } } [HarmonyPatch(typeof(SwordsMachine), "TeleportAway")] public class SwordsMachinePatch { public static bool Prefix(SwordsMachine __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } BossHealthBar component = ((Component)__instance).GetComponent<BossHealthBar>(); component.DisappearBar(); new Vector3(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 1.5f, ((Component)__instance).transform.position.z); __instance.teleportEffect.SetActive(true); __instance.teleportEffect.transform.SetParent((Transform)null, true); ((Component)__instance).gameObject.SetActive(false); SwordsMachine[] componentsInChildren = ((Component)__instance.secondPhasePosTarget).GetComponentsInChildren<SwordsMachine>(); if (componentsInChildren.Length != 0) { SwordsMachine[] array = componentsInChildren; SwordsMachine[] array2 = array; foreach (SwordsMachine val in array2) { ((Component)val).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)val).gameObject); } } ((Component)__instance).transform.position = __instance.secondPhasePosTarget.position; ((Component)__instance).transform.parent = __instance.secondPhasePosTarget; __instance.eid.spawnIn = true; ((Component)__instance).gameObject.SetActive(true); ((Behaviour)component).enabled = true; __instance.secondPhasePosTarget = null; AddDeathANW[] array3 = Object.FindObjectsByType<AddDeathANW>((FindObjectsInactive)1, (FindObjectsSortMode)0); AddDeathANW[] array4 = array3; foreach (AddDeathANW addDeathANW in array4) { addDeathANW.Add(); } CheckPointPatch.InheritCheckpointRooms(__instance.cpToReset); __instance.cpToReset.UpdateRooms(); return false; } } public class TeleportOnCondition : MonoBehaviour { public bool processPassively = false; public bool processIfEnemyDead = false; public bool onDeadcaught = true; public bool returnOnFirstSuccess = false; public TeleportCondition[] conditions = Array.Empty<TeleportCondition>(); public EnemyIdentifier eid = null; public void Configure(bool processPassively = true, bool processIfEnemyDead = false, bool onDeadcaught = true, bool returnOnFirstSuccess = false) { this.processPassively = processPassively; this.processIfEnemyDead = processIfEnemyDead; this.onDeadcaught = onDeadcaught; this.returnOnFirstSuccess = returnOnFirstSuccess; } public TeleportCondition AddCondition(Vector3 moveVector, bool isMoveVectorAbsolute = false, bool ignoreAbsoluteMoveVectorZeroAxes = false) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("TeleportCondition" + conditions.Length); val.transform.SetParent(((Component)this).transform); TeleportCondition teleportCondition = new TeleportCondition(moveVector, isMoveVectorAbsolute, ignoreAbsoluteMoveVectorZeroAxes); Util.ArrayAdd(ref conditions, teleportCondition); return teleportCondition; } public void Awake() { eid = ((Component)this).GetComponentInChildren<EnemyIdentifier>(); } public void Start() { SaveForPuppet(); } public void SaveForPuppet() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if ((Object)(object)eid == (Object)null) { return; } GameObject[] activateOnDeath = eid.activateOnDeath; foreach (GameObject val in activateOnDeath) { if (((Object)val).name == "TeleportOnCondition") { return; } } GameObject val2 = new GameObject("TeleportOnCondition"); TeleportOnCondition newTeleport = val2.AddComponent<TeleportOnCondition>(); CopyValuesTo(newTeleport); Util.ArrayAdd(ref eid.activateOnDeath, val2); } public void FixedUpdate() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) bool flag = !processIfEnemyDead && ((Object)(object)eid == (Object)null || eid.dead); if (!(!processPassively || flag)) { ((Component)this).transform.position = CheckConditions(((Component)this).transform.position, conditions, returnOnFirstSuccess); } } public static Vector3 CheckConditions(Vector3 moveTargetPosition, TeleportCondition[] conditions, bool returnOnFirstSuccess = false) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) foreach (TeleportCondition teleportCondition in conditions) { if (teleportCondition != null && teleportCondition.CheckCondition()) { moveTargetPosition = Teleport(teleportCondition, moveTargetPosition); if (returnOnFirstSuccess) { return moveTargetPosition; } } } return moveTargetPosition; } public static Vector3 Teleport(TeleportCondition condition, Vector3 moveTargetPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Vector3 moveVector = condition.moveVector; if (!condition.isMoveVectorAbsolute) { moveTargetPosition += moveVector; return moveTargetPosition; } if (!condition.ignoreAbsoluteMoveVectorZeroAxes) { moveTargetPosition = moveVector; return moveTargetPosition; } ((Vector3)(ref moveTargetPosition))..ctor((moveVector.x != 0f) ? moveVector.x : moveTargetPosition.x, (moveVector.y != 0f) ? moveVector.y : moveTargetPosition.y, (moveVector.z != 0f) ? moveVector.z : moveTargetPosition.z); return moveTargetPosition; } public static void ChangeAxisTargetsToPuppet(TeleportCondition[] conditions, Transform puppet) { foreach (TeleportCondition teleportCondition in conditions) { TeleportConditionAxis[] conditionAxes = teleportCondition.conditionAxes; foreach (TeleportConditionAxis teleportConditionAxis in conditionAxes) { if (teleportConditionAxis.canChangeTargetToPuppet) { teleportConditionAxis.checkTarget = puppet; } } } } public void CopyValuesTo(TeleportOnCondition newTeleport) { newTeleport.Configure(processPassively, processIfEnemyDead, onDeadcaught, returnOnFirstSuccess); newTeleport.conditions = conditions; newTeleport.eid = eid; } } public class TeleportCondition { public TeleportConditionAxis[] conditionAxes = Array.Empty<TeleportConditionAxis>(); public Vector3 moveVector = Vector3.zero; public bool isMoveVectorAbsolute = false; public bool ignoreAbsoluteMoveVectorZeroAxes = false; public bool Success { get; private set; } public TeleportCondition(Vector3 moveVector, bool isMoveVectorAbsolute = false, bool ignoreAbsoluteMoveVectorZeroAxes = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Success = false; this.moveVector = moveVector; this.isMoveVectorAbsolute = isMoveVectorAbsolute; this.ignoreAbsoluteMoveVectorZeroAxes = ignoreAbsoluteMoveVectorZeroAxes; } public TeleportConditionAxis AddAxis(Transform checkTarget, char axis = 'y', float value = -25f, bool greater = false, bool orEqual = false, bool useLastTargetPositionIfNull = true, bool canChangeTargetToPuppet = true) { TeleportConditionAxis teleportConditionAxis = new TeleportConditionAxis(checkTarget, axis, value, greater, orEqual, useLastTargetPositionIfNull, canChangeTargetToPuppet); Util.ArrayAdd(ref conditionAxes, teleportConditionAxis); return teleportConditionAxis; } public bool CheckCondition() { TeleportConditionAxis[] array = conditionAxes; foreach (TeleportConditionAxis teleportConditionAxis in array) { if (teleportConditionAxis != null && !teleportConditionAxis.CheckAxis()) { Success = false; return Success; } } Success = true; return Success; } } public class TeleportConditionAxis { public Transform checkTarget; public Vector3 lastTargetPosition; public char axis = 'y'; public float value = -25f; public bool greater = false; public bool orEqual = false; public bool useLastTargetPositionIfNull = true; public bool canChangeTargetToPuppet = true; public bool Success { get; private set; } public TeleportConditionAxis(Transform checkTarget, char axis = 'y', float value = -25f, bool greater = false, bool orEqual = false, bool useLastTargetPositionIfNull = true, bool canChangeTargetToPuppet = true) { Success = false; this.checkTarget = checkTarget; this.axis = axis; this.value = value; this.greater = greater; this.orEqual = orEqual; this.useLastTargetPositionIfNull = useLastTargetPositionIfNull; this.canChangeTargetToPuppet = canChangeTargetToPuppet; if (axis != 'x' && axis != 'y' && axis != 'z') { Plugin.Logger.LogWarning((object)$"(new) TeleportConditionAxis must have axis 'x', 'y' or 'z', not {axis}. Resetting to 'y'"); this.axis = 'y'; } } public bool CheckAxis() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)checkTarget == (Object)null && !useLastTargetPositionIfNull) { return false; } if ((Object)(object)checkTarget != (Object)null) { lastTargetPosition = checkTarget.position; } bool success; switch (axis) { case 'x': success = CheckX(); break; case 'y': success = CheckY(); break; case 'z': success = CheckZ(); break; default: Plugin.Logger.LogWarning((object)$"(FixedUpdate) TeleportConditionAxis must have axis 'x', 'y' or 'z', not {axis}. Resetting to 'y'"); axis = 'y'; success = CheckY(); break; } Success = success; return Success; } public bool CheckX() { bool flag = ((!greater) ? (lastTargetPosition.x < value) : (lastTargetPosition.x > value)); if (orEqual) { flag = flag || lastTargetPosition.x == value; } return flag; } public bool CheckY() { bool flag = ((!greater) ? (lastTargetPosition.y < value) : (lastTargetPosition.y > value)); if (orEqual) { flag = flag || lastTargetPosition.y == value; } return flag; } public bool CheckZ() { bool flag = ((!greater) ? (lastTargetPosition.z < value) : (lastTargetPosition.z > value)); if (orEqual) { flag = flag || lastTargetPosition.z == value; } return flag; } } public class ArenaDelay : MonoBehaviour { public float delay = 0f; public ActivateArena target = null; } public class ArenaLink : MonoBehaviour { public ActivateArena[] linkedArenas = Array.Empty<ActivateArena>(); public bool delete = true; public bool activated = false; public ArenaLink unclonedSelf = null; public void Update() { if (activated) { return; } ActivateArena[] array = linkedArenas; foreach (ActivateArena val in array) { if ((Object)(object)val != (Object)null && val.activated) { OnArenaActivated(val); break; } } } public void OnArenaActivated(ActivateArena arenaActivated = null) { ActivateArena[] array = linkedArenas; foreach (ActivateArena val in array) { bool flag = (Object)(object)arenaActivated != (Object)null && (Object)(object)val == (Object)(object)arenaActivated; if (!((Object)(object)val == (Object)null || flag)) { if (delete) { Object.Destroy((Object)(object)val); } else { val.Activate(); } } } activated = true; if ((Object)(object)unclonedSelf != (Object)null && (Object)(object)unclonedSelf != (Object)(object)this) { unclonedSelf.OnArenaActivated(); } } } public class AudioOnEnable : MonoBehaviour { public AudioSource audioSource; public void OnEnable() { if (!((Object)(object)audioSource == (Object)null)) { audioSource.Play(); } } } public class BackAndForth : MonoBehaviour { public float speed = 10f; public float startZ = 0f; public float endZ = -40f; public bool forward = true; public void FixedUpdate() { //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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) Vector3 localPosition = ((Component)this).transform.localPosition; Vector3 val = default(Vector3); if (forward) { ((Vector3)(ref val))..ctor(localPosition.x, localPosition.y, endZ); ((Component)this).transform.localPosition = Vector3.MoveTowards(localPosition, val, speed * Time.deltaTime); } else { ((Vector3)(ref val))..ctor(localPosition.x, localPosition.y, startZ); ((Component)this).transform.localPosition = Vector3.MoveTowards(localPosition, val, speed * Time.deltaTime); } if (((Component)this).transform.localPosition == val) { forward = !forward; } } public BackAndForth Configure(float speed = 10f, float startZ = 0f, float endZ = -40f) { this.speed = speed; this.startZ = startZ; this.endZ = endZ; return this; } } public class BeamDelayHelper : MonoBehaviour { public float chargeUpTimeToSubtract = 0f; public bool subtracted = false; public ObjectActivator objectActivator = null; public void Subtract() { if (!subtracted) { ObjectActivator obj = objectActivator; obj.delay -= chargeUpTimeToSubtract; subtracted = true; } } } public class BreakableAllower : MonoBehaviour { public Breakable breakable; public List<EnemyBlockBreakables> enemyBlocks = new List<EnemyBlockBreakables>(); public void FixedUpdate() { if ((Object)(object)breakable == (Object)null) { return; } List<EnemyBlockBreakables> list = new List<EnemyBlockBreakables>(); foreach (EnemyBlockBreakables enemyBlock in enemyBlocks) { if ((Object)(object)enemyBlock == (Object)null || !((Behaviour)enemyBlock).enabled || (Object)(object)enemyBlock.eid == (Object)null || enemyBlock.eid.Dead) { list.Add(enemyBlock); Object.Destroy((Object)(object)enemyBlock); } else if (!enemyBlock.eid.Dead) { breakable.broken = true; RemoveEnemyBlocks(list); return; } } breakable.broken = false; RemoveEnemyBlocks(list); } public void RemoveEnemyBlocks(List<EnemyBlockBreakables> toRemove) { foreach (EnemyBlockBreakables item in toRemove) { enemyBlocks.Remove(item); } } } public class CheckPointActivator : MonoBehaviour { public CheckPoint checkpoint; public void OnEnable() { if (!((Object)(object)checkpoint == (Object)null)) { checkpoint.activated = false; checkpoint.SetForceOff(false); checkpoint.SetInvisibility(false); checkpoint.ActivateCheckPoint(); } } } public class CheckPointConstantOff : MonoBehaviour { public CheckPoint checkpoint; public void FixedUpdate() { if (!((Object)(object)checkpoint == (Object)null) && !checkpoint.forceOff) { checkpoint.SetForceOff(true); checkpoint.SetInvisibility(true); checkpoint.unteleportable = true; } } } public class CheckPointToUpdate : MonoBehaviour { public Dictionary<int, GameObject> rooms = new Dictionary<int, GameObject>(); } public class CheckPointTurnOn : MonoBehaviour { public CheckPoint checkpoint; public void OnEnable() { if (!((Object)(object)checkpoint == (Object)null)) { checkpoint.activated = false; checkpoint.SetForceOff(false); } } } public class DontManipulateLight : MonoBehaviour { public Light targetLight; } public class DoorAltarHelper : MonoBehaviour { public Door door = null; public ItemPlaceZone[] itemPlaceZones = Array.Empty<ItemPlaceZone>(); public bool reversed = false; public bool playerInArena = false; public void Update() { if (!playerInArena && !((Object)(object)door == (Object)null)) { ProcessDoor(CheckShouldUnlock()); } } public bool CheckShouldUnlock() { bool flag = true; bool flag2 = true; ItemPlaceZone[] array = itemPlaceZones; foreach (ItemPlaceZone val in array) { bool flag3 = (val.acceptedItemPlaced && !reversed) || (!val.acceptedItemPlaced && reversed); if (flag2) { flag = flag3; flag2 = false; } else if (flag3 != flag) { flag = reversed; break; } } return flag; } public void ProcessDoor(bool shouldUnlock) { if (shouldUnlock && door.locked) { door.Unlock(); door.Open(false, true); } else if (!shouldUnlock && !door.locked) { door.Lock(); door.Close(false); } } } public class DoorConstantLocker : MonoBehaviour { public Door door; public bool unlockOnDisable = true; public void FixedUpdate() { if (!((Object)(object)door == (Object)null) && !door.locked) { door.Lock(); } } public void OnDisable() { if (!((Object)(object)door == (Object)null) && unlockOnDisable) { door.Unlock(); } } } public class InheritRoomExceptions : MonoBehaviour { public string[] roomNames = Array.Empty<string>(); } public class LightManipulator : MonoBehaviour { public float multiplier = 0.125f; public int dimmedCounter = 0; public bool invertColors = true; public bool ignoreEnemies = true; public void OnEnable() { DimLights(); } public void DimLights(bool reversed = false) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_00ba: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) Light[] array = Object.FindObjectsByType<Light>((FindObjectsInactive)1, (FindObjectsSortMode)0); Light[] array2 = array; foreach (Light val in array2) { if (ignoreEnemies && ((Object)(object)((Component)val).GetComponentInChildren<EnemyIdentifier>() != (Object)null || (Object)(object)((Component)val).GetComponentInParent<EnemyIdentifier>() != (Object)null)) { continue; } DontManipulateLight component = ((Component)val).GetComponent<DontManipulateLight>(); if (!((Object)(object)component != (Object)null) || !((Behaviour)component).enabled || !((Object)(object)component.targetLight == (Object)(object)val)) { val.intensity *= ((!reversed) ? multiplier : (1f / multiplier)); if (invertColors) { val.color = new Color(1f - val.color.r, 1f - val.color.g, 1f - val.color.b); } } } dimmedCounter += ((!reversed) ? 1 : (-1)); if (invertColors) { Color fogColor = RenderSettings.fogColor; RenderSettings.fogColor = new Color(1f - fogColor.r, 1f - fogColor.g, 1f - fogColor.b); } } public LightManipulator Configure(float multiplier = 0.125f, bool invertColors = true, bool ignoreEnemies = true) { this.multiplier = multiplier; this.invertColors = invertColors; this.ignoreEnemies = ignoreEnemies; return this; } } public class MusicSlower : MonoBehaviour { public float multiplier = 0.1f; public int slowedCounter = 0; public bool isGradualPitch = false; public float gradualPitchSpeed = 0.2f; public float gradualPitchMultiplierTarget = 1.25f; public Dictionary<int, float> gradualPitchOriginals = new Dictionary<int, float>(); public bool gradualPitchOriginalsSet = false; public void OnEnable() { Slow(); } public void Slow(bool reversed = false) { if (!((Object)(object)MonoSingleton<MusicManager>.Instance == (Object)null)) { AudioSource[] allThemes = MonoSingleton<MusicManager>.Instance.allThemes; foreach (AudioSource val in allThemes) { float num = AudioSourceExtensions.GetPitch(val) * ((!reversed) ? multiplier : (1f / multiplier)); AudioSourceExtensions.SetPitch(val, num); } slowedCounter += ((!reversed) ? 1 : (-1)); } } public void Update() { if (!isGradualPitch || (Object)(object)MonoSingleton<MusicManager>.Instance == (Object)null) { return; } bool flag = true; AudioSource[] allThemes = MonoSingleton<MusicManager>.Instance.allThemes; foreach (AudioSource val in allThemes) { int key = Array.IndexOf(MonoSingleton<MusicManager>.Instance.allThemes, val); if (!gradualPitchOriginalsSet) { gradualPitchOriginals[key] = AudioSourceExtensions.GetPitch(val); } float num = Mathf.MoveTowards(AudioSourceExtensions.GetPitch(val), gradualPitchOriginals[key] * gradualPitchMultiplierTarget, gradualPitchSpeed * Time.deltaTime); AudioSourceExtensions.SetPitch(val, num); if (AudioSourceExtensions.GetPitch(val) != gradualPitchOriginals[key] * gradualPitchMultiplierTarget) { flag = false; } } if (!gradualPitchOriginalsSet) { gradualPitchOriginalsSet = true; } if (flag) { isGradualPitch = false; } } public void GradualPitchChange(float gradualPitchMultiplierTarget = 1.25f, float gradualPitchSpeed = 0.2f) { isGradualPitch = true; this.gradualPitchMultiplierTarget = gradualPitchMultiplierTarget; this.gradualPitchSpeed = gradualPitchSpeed; gradualPitchOriginalsSet = false; } } public class SimpleScrollingText : MonoBehaviour { public TMP_Text text; public float secondsBetweenLetters = 0.025f; public int totalCharacters; public bool running = true; public bool finished = false; public float cooldown = 0f; public bool isLevelName = false; public string stringLevelName = null; public TMP_Text textLevelName; public void Start() { if (text == null) { text = ((Component)this).GetComponent<TMP_Text>(); } Reset(); } public void Reset() { text.ForceMeshUpdate(true, true); totalCharacters = text.textInfo.characterCount; text.maxVisibleCharacters = 0; } public void Update() { if (!((Component)this).gameObject.activeInHierarchy || !running || finished) { return; } cooldown += Time.deltaTime; if (!(cooldown < secondsBetweenLetters)) { cooldown -= secondsBetweenLetters; TMP_Text obj = text; obj.maxVisibleCharacters += 1; if (isLevelName) { int length = Mathf.Min(2 + GetLastVisibleLetterIndex(), stringLevelName.Length); textLevelName.text = stringLevelName.Substring(0, length); } if (text.maxVisibleCharacters >= totalCharacters) { finished = true; running = false; } } } public int GetLastVisibleLetterIndex() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) int result = -1; for (int num = text.textInfo.characterCount - 1; num >= 0; num--) { TMP_CharacterInfo val = text.textInfo.characterInfo[num]; if (val.isVisible) { result = val.index; break; } } return result; } } public class SimpleScrollingTextActivator : MonoBehaviour { public SimpleScrollingText simpleScrollingText; public void OnEnable() { simpleScrollingText.running = true; } public void OnDisable() { simpleScrollingText.running = false; } } [HarmonyPatch(typeof(ActivateArena), "Activate")] public class ActivateArenaPatch { public static bool Prefix(ActivateArena __instance) { if (!Util.IsPatched()) { return true; } if (DisableEnemySpawns.DisableArenaTriggers || __instance.activated) { return false; } __instance.activated = true; if (!__instance.onlyWave && !__instance.forEnemy) { MonoSingleton<MusicManager>.Instance.ArenaMusicStart(true); } float num = -1f; ArenaDelay[] components = ((Component)__instance).GetComponents<ArenaDelay>(); ArenaDelay[] array = components; foreach (ArenaDelay arenaDelay in array) { if (!((Object)(object)arenaDelay.target != (Object)(object)__instance)) { num = arenaDelay.delay; break; } } if (__instance.doors.Length != 0) { Door[] doors = __instance.doors; Door[] array2 = doors; foreach (Door val in array2) { if ((Object)(object)val != (Object)null) { if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } DoorAltarHelper componentInChildren = ((Component)val).GetComponentInChildren<DoorAltarHelper>(); if (componentInChildren != null) { componentInChildren.playerInArena = true; } val.Lock(); } } if (__instance.enemies.Length != 0) { if (num < 0f) { ((MonoBehaviour)__instance).Invoke("SpawnEnemy", 1f); } else { ((MonoBehaviour)__instance).Invoke("SpawnEnemy", num); } } else { Object.Destroy((Object)(object)__instance); } } else if (__instance.enemies.Length != 0) { if (num < 0f) { __instance.SpawnEnemy(); } else { ((MonoBehaviour)__instance).Invoke("SpawnEnemy", num); } } else { Object.Destroy((Object)(object)__instance); } return false; } } [HarmonyPatch(typeof(ActivateNextWave))] public class ActivateNextWavePatch { [HarmonyPrefix] [HarmonyPatch(typeof(ActivateNextWave), "FixedUpdate")] public static bool FixedUpdatePrefix(ActivateNextWave __instance) { if (!Util.IsPatched()) { return true; } if (__instance.deadEnemies < 0) { __instance.deadEnemies = 0; } if (__instance.activated || __instance.deadEnemies < __instance.enemyCount) { return false; } __instance.activated = true; if (__instance.lastWave) { ((MonoBehaviour)__instance).Invoke("EndWaves", (float)((!__instance.noActivationDelay) ? 1 : 0)); if (!__instance.forEnemies) { MonoSingleton<TimeController>.Instance.SlowDown(0.15f); } return false; } if (__instance.toActivate.Length != 0) { GameObject[] toActivate = __instance.toActivate; GameObject[] array = toActivate; foreach (GameObject val in array) { if (val != null) { val.SetActive(true); } } } if (__instance.doors.Length != 0) { Door[] doors = __instance.doors; Door[] array2 = doors; foreach (Door val2 in array2) { if (!((Object)(object)val2 != (Object)null)) { continue; } DoorAltarHelper componentInChildren = ((Component)val2).GetComponentInChildren<DoorAltarHelper>(); if (componentInChildren != null) { componentInChildren.playerInArena = false; } val2.Unlock(); if (componentInChildren != null) { Door door = componentInChildren.door; if (door != null) { door.Open(false, true); } } } } ((MonoBehaviour)__instance).Invoke("SpawnEnemy", (float)((!__instance.noActivationDelay) ? 1 : 0)); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(ActivateNextWave), "EndWaves")] public static bool EndWavesPrefix(ActivateNextWave __instance) { if (!Util.IsPatched()) { return true; } if (__instance.toActivate.Length != 0 && !__instance.objectsActivated) { GameObject[] toActivate = __instance.toActivate; GameObject[] array = toActivate; foreach (GameObject val in array) { if (val != null) { val.SetActive(true); } } __instance.objectsActivated = true; __instance.EndWaves(); } else if (__instance.currentDoor < __instance.doors.Length) { Door val2 = __instance.doors[__instance.currentDoor]; DoorAltarHelper componentInChildren = ((Component)val2).GetComponentInChildren<DoorAltarHelper>(); if (componentInChildren != null) { componentInChildren.playerInArena = false; } val2.Unlock(); if ((Object)(object)val2 == (Object)(object)__instance.doorForward) { val2.Open(false, true); } else if (componentInChildren != null) { Door door = componentInChildren.door; if (door != null) { door.Open(false, true); } } __instance.currentDoor++; ((MonoBehaviour)__instance).Invoke("EndWaves", 0.1f); } else { if (!__instance.forEnemies) { MonoSingleton<MusicManager>.Instance.ArenaMusicEnd(); __instance.slowDown = 1f; } if (__instance.killChallenge) { MonoSingleton<ChallengeManager>.Instance.ChallengeDone(); } Object.Destroy((Object)(object)__instance); } return false; } } [HarmonyPatch(typeof(CheckPoint))] public class CheckPointPatch { [CompilerGenerated] private sealed class <UpdateRooms>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CheckPoint __instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UpdateRooms>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; __instance.i = 0; __instance.UpdateRooms(); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; case 2: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPostfix] [HarmonyPatch(typeof(CheckPoint), "Start")] public static void StartPostfix(CheckPoint __instance) { if (!Util.IsPatched()) { return; } InheritRoomExceptions component = ((Component)__instance).GetComponent<InheritRoomExceptions>(); if ((Object)(object)component != (Object)null) { string[] roomNames = component.roomNames; foreach (string item in roomNames) { if (__instance.inheritNames.Contains(item)) { int index = __instance.inheritNames.IndexOf(item); __instance.roomsToInherit.RemoveAt(index); __instance.inheritNames.RemoveAt(index); __instance.inheritParents.RemoveAt(index); break; } } } CheckPointToUpdate component2 = ((Component)__instance).GetComponent<CheckPointToUpdate>(); if ((Object)(object)component2 == (Object)null || __instance.defaultRooms.Count == 0) { return; } foreach (int key in component2.rooms.Keys) { __instance.defaultRooms[key] = component2.rooms[key]; } ((MonoBehaviour)__instance).StartCoroutine(UpdateRooms(__instance)); } [IteratorStateMachine(typeof(<UpdateRooms>d__1))] public static IEnumerator UpdateRooms(CheckPoint __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UpdateRooms>d__1(0) { __instance = __instance }; } [HarmonyPrefix] [HarmonyPatch(typeof(CheckPoint), "ResetRoom")] public static bool ResetRoomPrefix(CheckPoint __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Invalid comparison between Unknown and I4 //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_0381: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Invalid comparison between Unknown and I4 //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } if ((Object)(object)__instance.newRooms[__instance.i] != (Object)null && (Object)(object)__instance.defaultRooms[__instance.i] != (Object)null) { Vector3 position = __instance.newRooms[__instance.i].transform.position; __instance.newRooms[__instance.i].SetActive(false); Object.Destroy((Object)(object)__instance.newRooms[__instance.i]); __instance.newRooms[__instance.i] = Object.Instantiate<GameObject>(__instance.defaultRooms[__instance.i], position, __instance.defaultRooms[__instance.i].transform.rotation, __instance.defaultRooms[__instance.i].transform.parent); __instance.newRooms[__instance.i].SetActive(true); Bonus[] componentsInChildren = __instance.newRooms[__instance.i].GetComponentsInChildren<Bonus>(true); if (componentsInChildren != null && componentsInChildren.Length != 0) { Bonus[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { array[i].UpdateStatsManagerReference(); } } } if (__instance.i + 1 < __instance.defaultRooms.Count) { __instance.i++; __instance.ResetRoom(); return false; } if (Object.op_Implicit((Object)(object)__instance.toActivate)) { __instance.toActivate.SetActive(true); } UnityEvent onRestart = __instance.onRestart; if (onRestart != null) { onRestart.Invoke(); } if (!__instance.activated) { __instance.activated = true; if (Object.op_Implicit((Object)(object)__instance.graphic)) { __instance.graphic.SetActive(false); } } __instance.player.transform.position = ((Component)__instance).transform.position + ((Component)__instance).transform.up * 1.25f; Rigidbody component = __instance.player.GetComponent<Rigidbody>(); component.velocity = Vector3.zero; if ((Object)(object)__instance.nm == (Object)null) { __instance.nm = MonoSingleton<NewMovement>.Instance; } CameraController cc = __instance.nm.cc; PhysicsExtensions.SetCustomGravityMode(__instance.nm.rb, false); cc.gravityRotation = Quaternion.identity; Vector3 gravity = Physics.gravity; cc.gravityVec = ((Vector3)(ref gravity)).normalized; cc.rotationOffset = Quaternion.identity; cc.transitionRotationZ = 0f; cc.transitionRotationZSmooth = 0f; cc.tiltRotationZ = 0f; cc.tiltRotationZSmooth = 0f; Quaternion rotation = ((Component)__instance).transform.rotation; float num = ((Quaternion)(ref rotation)).eulerAngles.y + 0.01f + __instance.additionalSpawnRotation; if (Object.op_Implicit((Object)(object)__instance.player) && Object.op_Implicit((Object)(object)__instance.player.transform.parent) && ((Component)__instance.player.transform.parent).gameObject.CompareTag("Moving")) { float num2 = num; rotation = __instance.player.transform.parent.rotation; num = num2 - ((Quaternion)(ref rotation)).eulerAngles.y; } if ((int)MonoSingleton<PlayerTracker>.Instance.playerType == 0) { cc.ResetCamera(num, 0f); } else { MonoSingleton<PlatformerMovement>.Instance.ResetCamera(num, 0f); } cc.ApplyRotations(false); PhysicsExtensions.SetCustomGravity(__instance.nm.rb, __instance.gravity); PhysicsExtensions.SetCustomGravityMode(__instance.nm.rb, true); __instance.nm.gc.heavyFall = false; cc.Transform(Matrix4x4.identity, (Vector3?)__instance.gravity, (Quaternion?)null); MonoSingleton<CameraController>.Instance.activated = true; component.position = ((Component)__instance).transform.position + ((Component)__instance).transform.up * 1.25f; if (!((Behaviour)__instance.nm).enabled) { ((Behaviour)__instance.nm).enabled = true; } __instance.nm.Respawn(); __instance.nm.GetHealth(0, true, false, true); __instance.nm.cc.StopShake(); __instance.nm.ActivatePlayer(); if ((int)MonoSingleton<PlayerTracker>.Instance.playerType == 1) { ((Component)MonoSingleton<PlatformerMovement>.Instance).transform.position = ((Component)__instance).transform.position; MonoSingleton<PlatformerMovement>.Instance.rb.velocity = Vector3.zero; MonoSingleton<PlatformerMovement>.Instance.playerModel.rotation = ((Component)__instance).transform.rotation; if (__instance.additionalSpawnRotation != 0f) { MonoSingleton<PlatformerMovement>.Instance.playerModel.Rotate(Vector3.up, __instance.additionalSpawnRotation); } ((Component)MonoSingleton<PlatformerMovement>.Instance).gameObject.SetActive(true); MonoSingleton<PlatformerMovement>.Instance.SnapCamera(); MonoSingleton<PlatformerMovement>.Instance.Respawn(); MonoSingleton<CrateCounter>.Instance.ResetUnsavedStuff(); } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(CheckPoint), "UpdateRooms")] public static void UpdateRoomsPrefix(CheckPoint __instance) { if (!((Object)(object)__instance.defaultRooms[__instance.i].GetComponent<GoreZone>() != (Object)null)) { if (__instance.i + 1 < __instance.defaultRooms.Count) { __instance.i++; __instance.UpdateRooms(); } else { __instance.i = 0; } } } [HarmonyPrefix] [HarmonyPatch(typeof(CheckPoint), "ActivateCheckPoint")] public static bool ActivateCheckPointPrefix(CheckPoint __instance) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } __instance.sm = MonoSingleton<StatsManager>.Instance; __instance.inDuringResetSafety = false; if (Object.op_Implicit((Object)(object)__instance.sm.currentCheckPoint) && (Object)(object)__instance.sm.currentCheckPoint != (Object)(object)__instance) { MonoSingleton<NewMovement>.Instance.sameCheckpointRestarts = 0; if (__instance.sm.currentCheckPoint.resetOnGetOtherCheckpoint) { __instance.sm.currentCheckPoint.ReactivateCheckpoint(); } } __instance.gravity = PhysicsExtensions.GetGravityVector(MonoSingleton<NewMovement>.Instance.rb); __instance.sm.currentCheckPoint = __instance; __instance.activated = true; if (!__instance.invisible && __instance.activateEffect.RuntimeKeyIsValid()) { Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(__instance.activateEffect), MonoSingleton<PlayerTracker>.Instance.GetPlayer().position, Quaternion.identity); } if (Object.op_Implicit((Object)(object)__instance.graphic)) { __instance.graphic.SetActive(false); } if (Object.op_Implicit((Object)(object)MonoSingleton<PlatformerMovement>.Instance)) { MonoSingleton<CrateCounter>.Instance.SaveStuff(); } if (Object.op_Implicit((Object)(object)MonoSingleton<MapVarManager>.Instance)) { MonoSingleton<MapVarManager>.Instance.StashStore(); } __instance.stylePoints = __instance.sm.stylePoints; __instance.restartKills = 0; if (Object.op_Implicit((Object)(object)MonoSingleton<ChallengeManager>.Instance)) { __instance.challengeAlreadyFailed = MonoSingleton<ChallengeManager>.Instance.challengeFailed; } if (Object.op_Implicit((Object)(object)MonoSingleton<ChallengeManager>.Instance)) { __instance.challengeAlreadyDone = MonoSingleton<ChallengeManager>.Instance.challengeDone; } if (!__instance.firstTime) { __instance.defaultRooms.Clear(); __instance.newRooms.Clear(); if (__instance.rooms.Length != 0) { GameObject[] rooms = __instance.rooms; GameObject[] array = rooms; foreach (GameObject val in array) { __instance.roomsToInherit.Add(val); __instance.inheritNames.Add(((Object)val).name); __instance.inheritParents.Add(val.transform.parent); } __instance.rooms = (GameObject[])(object)new GameObject[0]; } } if ((Object)(object)__instance.shud == (Object)null) { __instance.shud = MonoSingleton<StyleHUD>.Instance; } InheritCheckpointRooms(__instance); MonoSingleton<BloodsplatterManager>.Instance.SaveBloodstains(); __instance.firstTime = false; return false; } public static void InheritCheckpointRooms(CheckPoint __instance) { if (__instance.roomsToInherit.Count == 0) { return; } for (int i = 0; i < __instance.roomsToInherit.Count; i++) { string text = __instance.inheritNames[i]; text = text.Replace("(Clone)", ""); GameObject val = null; if (!((Object)(object)__instance.inheritParents[i] == (Object)null)) { for (int num = __instance.inheritParents[i].childCount - 1; num >= 0; num--) { GameObject gameObject = ((Component)__instance.inheritParents[i].GetChild(num)).gameObject; if (((Object)gameObject).name.Replace("(Clone)", "") == text) { if ((Object)(object)val == (Object)null) { val = gameObject; } else { Object.Destroy((Object)(object)gameObject); } } } } if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<GoreZone>() != (Object)null) { __instance.InheritRoom(val); } } } } [HarmonyPatch(typeof(ItemPlaceZone))] public class ItemPlaceZonePatch { [HarmonyPrefix] [HarmonyPatch(typeof(ItemPlaceZone), "CheckItem")] public static bool CheckItemPrefix(bool prelim, ItemPlaceZone __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } ItemIdentifier componentInChildren = ((Component)__instance).GetComponentInChildren<ItemIdentifier>(); GameObject[] activateOnSuccess; Door[] doors; InstantiateObject[] altarElements; if ((Object)(object)componentInChildren != (Object)null) { if (componentInChildren.itemType == __instance.acceptedItemType) { if (!prelim && !__instance.hideEffects && !__instance.acceptedItemPlaced) { if (Object.op_Implicit((Object)(object)__instance.elementChangeEffect)) { __instance.elementChangeEffect.Play(); } if (Object.op_Implicit((Object)(object)__instance.soundOnActivated)) { Object.Instantiate<AudioSource>(__instance.soundOnActivated, ((Component)__instance).transform.position, Quaternion.identity); } } __instance.acceptedItemPlaced = true; componentInChildren.ipz = __instance; if (!__instance.hideEffects) { ((Component)componentInChildren).SendMessage("OnCorrectUse", (SendMessageOptions)1); } activateOnSuccess = __instance.activateOnSuccess; for (int i = 0; i < activateOnSuccess.Length; i++) { activateOnSuccess[i].SetActive(true); } activateOnSuccess = __instance.deactivateOnSuccess; for (int j = 0; j < activateOnSuccess.Length; j++) { activateOnSuccess[j].SetActive(false); } doors = __instance.doors; foreach (Door val in doors) { DoorAltarHelper componentInChildren2 = ((Component)val).GetComponentInChildren<DoorAltarHelper>(); if ((Object)(object)componentInChildren2 == (Object)null) { val.Open(false, true); } } doors = __instance.reverseDoors; foreach (Door val2 in doors) { DoorAltarHelper componentInChildren3 = ((Component)val2).GetComponentInChildren<DoorAltarHelper>(); if ((Object)(object)componentInChildren3 == (Object)null) { val2.Close(false); } } if (!__instance.hideEffects) { altarElements = __instance.altarElements; InstantiateObject[] array = altarElements; foreach (InstantiateObject val3 in array) { ((Component)val3).gameObject.SetActive(true); if (!prelim && ((Component)val3).gameObject.activeInHierarchy) { val3.Instantiate(); } } } if (!prelim) { ArenaStatus[] arenaStatuses = __instance.arenaStatuses; foreach (ArenaStatus obj in arenaStatuses) { obj.currentStatus++; } arenaStatuses = __instance.reverseArenaStatuses; foreach (ArenaStatus obj2 in arenaStatuses) { obj2.currentStatus--; } } } else { activateOnSuccess = __instance.activateOnFailure; for (int num2 = 0; num2 < activateOnSuccess.Length; num2++) { activateOnSuccess[num2].SetActive(true); } } if (Object.op_Implicit((Object)(object)__instance.col)) { __instance.col.enabled = false; } return false; } if (Object.op_Implicit((Object)(object)__instance.col)) { __instance.col.enabled = true; } if (!prelim && !__instance.acceptedItemPlaced) { return false; } activateOnSuccess = __instance.activateOnSuccess; for (int num3 = 0; num3 < activateOnSuccess.Length; num3++) { activateOnSuccess[num3].SetActive(false); } activateOnSuccess = __instance.activateOnFailure; for (int num4 = 0; num4 < activateOnSuccess.Length; num4++) { activateOnSuccess[num4].SetActive(false); } activateOnSuccess = __instance.deactivateOnSuccess; for (int num5 = 0; num5 < activateOnSuccess.Length; num5++) { activateOnSuccess[num5].SetActive(true); } doors = __instance.doors; Door[] array2 = doors; foreach (Door val4 in array2) { DoorAltarHelper componentInChildren4 = ((Component)val4).GetComponentInChildren<DoorAltarHelper>(); if ((Object)(object)componentInChildren4 == (Object)null && ((int)val4.doorType != 0 || ((Component)val4).transform.localPosition != val4.closedPos)) { val4.Close(false); } } doors = __instance.reverseDoors; Door[] array3 = doors; foreach (Door val5 in array3) { DoorAltarHelper componentInChildren5 = ((Component)val5).GetComponentInChildren<DoorAltarHelper>(); if ((Object)(object)componentInChildren5 == (Object)null && ((int)val5.doorType != 0 || ((Component)val5).transform.localPosition != val5.closedPos + val5.openPos)) { val5.Open(false, true); } } if (!prelim) { __instance.acceptedItemPlaced = false; if (!__instance.hideEffects) { if (Object.op_Implicit((Object)(object)__instance.elementChangeEffect)) { __instance.elementChangeEffect.Play(); } if (Object.op_Implicit((Object)(object)__instance.soundOnDeactivated)) { Object.Instantiate<AudioSource>(__instance.soundOnDeactivated, ((Component)__instance).transform.position, Quaternion.identity); } } ArenaStatus[] arenaStatuses2 = __instance.arenaStatuses; foreach (ArenaStatus obj3 in arenaStatuses2) { obj3.currentStatus--; } arenaStatuses2 = __instance.reverseArenaStatuses; foreach (ArenaStatus obj4 in arenaStatuses2) { obj4.currentStatus++; } } altarElements = __instance.altarElements; for (int num10 = 0; num10 < altarElements.Length; num10++) { ((Component)altarElements[num10]).gameObject.SetActive(false); } return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class LeaderboardPatch { public static bool Prefix(ref bool __result) { if (!Util.IsPatched()) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(GetMissionName), "GetMissionNameOnly")] public class GetMissionNamePatch { public static void Postfix(int missionNum, ref string __result) { if (!Util.IsEnabled() || !ChangedInfo.ChangedLevels.Contains(missionNum)) { return; } __result += " <color=#ff00af>(NEMESIS)</color>"; foreach (string key in ChangedInfo.NewLevelNames.Keys) { if (!__result.Contains(key)) { continue; } __result = __result.Replace(key, ChangedInfo.NewLevelNames[key]); break; } } } [HarmonyPatch(typeof(MapInfoBase), "Awake")] public class MapInfoBasePatch { public static void Postfix(MapInfoBase __instance) { if (!Util.IsEnabled() || !ChangedInfo.ChangedScenes.Contains(SceneHelper.CurrentScene)) { return; } __instance.levelName += " <color=#ff00af>(NEMESIS)</color>"; foreach (string key in ChangedInfo.NewLevelNames.Keys) { if (!__instance.levelName.Contains(key)) { continue; } __instance.levelName = __instance.levelName.Replace(key, ChangedInfo.NewLevelNames[key]); break; } } } [HarmonyPatch(typeof(StockMapInfo), "Awake")] public class StockMapInfoPatch { public static void Postfix(StockMapInfo __instance) { if (!Util.IsEnabled() || !ChangedInfo.ChangedScenes.Contains(SceneHelper.CurrentScene)) { return; } __instance.assets.LargeText += " (NEMESIS)"; foreach (string key in ChangedInfo.NewLevelNames.Keys) { if (!__instance.assets.LargeText.Contains(key)) { continue; } __instance.assets.LargeText = __instance.assets.LargeText.Replace(key, ChangedInfo.NewLevelNames[key]); break; } } } [HarmonyPatch(typeof(LevelStats), "Start")] public class LevelStatsPatch { public static void Postfix(LevelStats __instance) { if (!Util.IsEnabled() || !ChangedInfo.ChangedScenes.Contains(SceneHelper.CurrentScene)) { return; } __instance.levelName.text = __instance.levelName.text.Replace("(NEMESIS)", "<color=#ff00af>(NEMESIS)</color>"); foreach (string key in ChangedInfo.NewLevelNames.Keys) { if (!__instance.levelName.text.Contains(key)) { continue; } __instance.levelName.text = __instance.levelName.text.Replace(key, ChangedInfo.NewLevelNames[key]); break; } } } [HarmonyPatch] public class LevelNamePopupPatch { [CompilerGenerated] private sealed class <NewShowNameText>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LevelNamePopup __instance; private SimpleScrollingText <sst>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <NewShowNameText>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <sst>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <sst>5__1 = ComponentExtensions.GetOrAddComponent<SimpleScrollingText>((Component)(object)__instance.nameText); <sst>5__1.running = false; <sst>5__1.text = __instance.nameText; ((Component)<sst>5__1).GetComponent<TMP_Text>().text = __instance.nameString; <sst>5__1.Reset(); <sst>5__1.secondsBetweenLetters = 0.015f; __instance.countTime = true; __instance.currentLetter = 0; AudioSourceExtensions.Play(__instance.aud, true); <sst>5__1.running = true; goto IL_00fb; case 1: <>1__state = -1; goto IL_00fb; case 2: { <>1__state = -1; __instance.fadingOut = true; __instance.nameAppearRoutine = null; return false; } IL_00fb: if (!<sst>5__1.finished) { <>2__current = (object)new WaitForSeconds(0.015f); <>1__state = 1; return true; } __instance.currentLetter = __instance.nameString.Length + 1; __instance.countTime = false; __instance.aud.Stop(); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <NewerShowNameText>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LevelNamePopup __instance; private SimpleScrollingText <sst>5__1; private GameObject <textPlaceholderObject>5__2; private TextMeshProUGUI <textPlaceholder>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <NewerShowNameText>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <sst>5__1 = null; <textPlaceholderObject>5__2 = null; <textPlaceholder>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_00b6: 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: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <sst>5__1 = ComponentExtensions.GetOrAddComponent<SimpleScrollingText>((Component)(object)__instance.nameText); <sst>5__1.running = false; <sst>5__1.isLevelName = true; <textPlaceholderObject>5__2 = new GameObject("Nemesis TextPlaceholder"); <textPlaceholderObject>5__2.transform.SetParent(((Component)__instance).transform); <textPlaceholder>5__3 = <textPlaceholderObject>5__2.AddComponent<TextMeshProUGUI>(); ((Graphic)<textPlaceholder>5__3).color = new Color(1f, 1f, 1f, 0f); ((TMP_Text)<textPlaceholder>5__3).text = __instance.nameString; <sst>5__1.text = (TMP_Text)(object)<textPlaceholder>5__3; <sst>5__1.stringLevelName = __instance.nameString; <sst>5__1.textLevelName = __instance.nameText; <sst>5__1.Reset(); <sst>5__1.secondsBetweenLetters = 0.015f; __instance.countTime = true; __instance.currentLetter = 0; AudioSourceExtensions.Play(__instance.aud, true); <sst>5__1.running = true; goto IL_018b; case 1: <>1__state = -1; goto IL_018b; case 2: { <>1__state = -1; __instance.fadingOut = true; __instance.nameAppearRoutine = null; return false; } IL_018b: if (!<sst>5__1.finished) { <>2__current = (object)new WaitForSeconds(0.015f); <>1__state = 1; return true; } __instance.currentLetter = __instance.nameString.Length + 1; __instance.countTime = false; __instance.aud.Stop(); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPrefix] [HarmonyPatch(typeof(LevelNamePopup), "ShowNameText")] public static bool ShowNameTextPrefix(LevelNamePopup __instance, ref IEnumerator __result) { if (!Util.IsPatched()) { return true; } __result = NewerShowNameText(__instance); return false; } [IteratorStateMachine(typeof(<NewerShowNameText>d__1))] public static IEnumerator NewerShowNameText(LevelNamePopup __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <NewerShowNameText>d__1(0) { __instance = __instance }; } [IteratorStateMachine(typeof(<NewShowNameText>d__2))] public static IEnumerator NewShowNameText(LevelNamePopup __instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <NewShowNameText>d__2(0) { __instance = __instance }; } } [HarmonyPatch(typeof(DiscordController), "FetchSceneActivity")] public class DiscordPatch { public static bool Prefix(string scene, DiscordController __instance) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (!Util.IsPatched()) { return true; } if (!Object.op_Implicit((Object)(object)DiscordController.Instance) || DiscordController.Instance.disabled || DiscordController.Instance.discord == null) { return false; } __instance.ResetActivityCache(); if (SceneHelper.IsPlayingCustom) { __instance.cachedActivity.State = "Playing Custom Level"; __instance.cachedActivity.Assets = ((SerializedActivityAssets)(ref __instance.customLevelActivityAssets)).Deserialize(); } else { StockMapInfo instance = StockMapInfo.Instance; if (Object.op_Implicit((Object)(object)instance)) { __instance.cachedActivity.Assets = ((SerializedActivityAssets)(ref instance.assets)).Deserialize(); if (string.IsNullOrEmpty(__instance.cachedActivity.Assets.LargeImage)) { __instance.cachedActivity.Assets.LargeImage = ((SerializedActivityAssets)(ref __instance.missingActivityAssets)).Deserialize().LargeImage; } if (string.IsNullOrEmpty(__instance.cachedActivity.Assets.LargeText)) { __instance.cachedActivity.Assets.LargeText = ((SerializedActivityAssets)(ref __instance.missingActivityAssets)).Deserialize().LargeText; } } else { __instance.cachedActivity.Assets = ((SerializedActivityAssets)(ref __instance.missingActivityAssets)).Deserialize(); } foreach (string key in ChangedInfo.PlainLevelNames.Keys) { if (!__instance.cachedActivity.Assets.LargeText.Contains(key)) { continue; } __instance.cachedActivity.Assets.LargeText = __instance.cachedActivity.Assets.LargeText.Replace(key, ChangedInfo.PlainLevelNames[key]); break; } if (scene == "Main Menu") { __instance.cachedActivity.State = "Main Menu"; } else { __instance.cachedActivity.State = "(NEMESIS) "; ref string state = ref __instance.cachedActivity.State; state = state + "DIFFICULTY: " + MonoSingleton<PresenceController>.Instance.diffNames[MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0)]; } } DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); long start = (long)(DateTime.UtcNow - dateTime).TotalSeconds; __instance.cachedActivity.Timestamps = new ActivityTimestamps { Start = start }; __instance.SendActivity(); return false; } } [HarmonyPatch(typeof(SteamController), "FetchSceneActivity")] public static class SteamPatch { public static bool Prefix(string scene) { //IL_00e5: 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) if (!Util.IsPatched()) { return true; } if (!SteamClient.IsValid) { return false; } if (SceneHelper.IsPlayingCustom) { SteamFriends.SetRichPresence("steam_display", "#AtCustomLevel"); return false; } StockMapInfo instance = StockMapInfo.Instance; if (scene == "Main Menu") { SteamFriends.SetRichPresence("steam_display", "#AtMainMenu"); } else if (scene == "Endless") { SteamFriends.SetRichPresence("steam_display", "#AtCyberGrind"); SteamFriends.SetRichPresence("difficulty", MonoSingleton<PresenceController>.Instance.diffNames[MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0)]); SteamFriends.SetRichPresence("wave", "0"); } else if ((Object)(object)instance != (Object)null && !string.IsNullOrEmpty(((SerializedActivityAssets)(ref instance.assets)).Deserialize().LargeText)) { SteamFriends.SetRichPresence("steam_display", "#AtStandardLevel"); SteamFriends.SetRichPresence("difficulty", MonoSingleton<PresenceController>.Instance.diffNames[MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0)]); string text = ((SerializedActivityAssets)(ref instance.assets)).Deserialize().LargeText; foreach (string key in ChangedInfo.PlainLevelNames.Keys) { if (!text.Contains(key)) { continue; } text = text.Replace(key, ChangedInfo.PlainLevelNames[key]); break; } SteamFriends.SetRichPresence("level", text); } else { SteamFriends.SetRichPresence("steam_display", "#UnknownLevel"); } return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class GameProgressSaverPatch { [HarmonyPriority(0)] public static void Postfix(out string path, int lvl, bool returnNull, RankData __instance, ref RankData __result) { path = ((lvl < 0) ? GameProgressSaver.resolveCurrentLevelPath : GameProgressSaver.LevelProgressPath(lvl)); if (__result == null) { return; } int value = ((lvl < 0) ? MonoSingleton<StatsManager>.Instance.levelNumber : lvl); if (ChangedInfo.ChangedLevels.Contains(value) && Util.IsEnabled()) { Plugin.forceDefaultLevelPath = true; string text = ((lvl < 0) ? GameProgressSaver.resolveCurrentLevelPath : GameProgressSaver.LevelProgressPath(lvl)); Plugin.forceDefaultLevelPath = false; string text2 = ((lvl < 0) ? GameProgressSaver.resolveCurrentLevelPath : GameProgressSaver.LevelProgressPath(lvl)); path = text2; object obj = GameProgressSaver.ReadFile(text); RankData val = (RankData)((obj is RankData) ? obj : null); if (val != null) { __result.challenge = val.challenge; } } } } [HarmonyPatch(typeof(GameProgressSaver), "LevelProgressPath")] public class LevelProgressPathPatch { [HarmonyPriority(0)] public static void Postfix(int lvl, ref string __result) { string[] array = Path.GetFileName(__result).Split("."); if (array.Length != 0) { if (!ChangedInfo.ChangedLevels.Contains(lvl) || !Util.IsEnabled() || Plugin.forceDefaultLevelPath) { array[0] = array[0].Replace("_nemesis", ""); __result = Path.Join(Path.GetDirectoryName(__result).AsSpan(), string.Join(".", array).AsSpan()); Plugin.forceDefaultLevelPath = false; } else if (!__result.Contains("_nemesis")) { array[0] += "_nemesis"; __result = Path.Join(Path.GetDirectoryName(__result).AsSpan(), string.Join(".", array).AsSpan()); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class RankDataConstructorPatch { public static void Postfix(StatsManager sman, RankData __instance) { Plugin.forceDefaultLevelPath = true; RankData rank = GameProgressSaver.GetRank(true, -1); Plugin.forceDefaultLevelPath = false; if (rank != null) { __instance.challenge = rank.challenge; } } } public static class LevelAssets { public static Dictionary<string, GameObject> Enemies = new Dictionary<string, GameObject> { ["Filth"] = null, ["Stray"] = null, ["Stalker"] = null, ["Schism"] = null, ["Soldier"] = null, ["Insurrectionist"] = null, ["Ferryman"] = null, ["MirrorReaper"] = null, ["Drone"] = null, ["Streetcleaner"] = null, ["Swordsmachine"] = null, ["Mindflayer"] = null, ["Sentry"] = null, ["Gutterman"] = null, ["Guttertank"] = null, ["RocketLauncher"] = null, ["RocketLauncherNoStand"] = null, ["Mortar"] = null, ["Tower"] = null, ["MaliciousFace"] = null, ["Cerberus"] = null, ["CerberusStatue"] = null, ["CerberusStatueWhite"] = null, ["Idol"] = null, ["Mannequin"] = null, ["MannequinPoser"] = null, ["Deathcatcher"] = null, ["DeathcatcherCase"] = null, ["DeathcatcherClosed"] = null, ["HideousMass"] = null, ["Virtue"] = null, ["Providence"] = null, ["Power"] = null, ["PowerNoEffect"] = null, ["Eye"] = null, ["EyeYellow"] = null, ["EyeMalicious"] = null, ["VeryCancerousRodent"] = null, ["BombSpawner"] = null, ["BombSpawnerBreaker"] = null, ["BombSpawnerGutterman"] = null, ["BombSpawnerGuttertank"] = null }; public static Dictionary<string, GameObject> Objects = new Dictionary<string, GameObject> { ["Checkpoint"] = null, ["CheckpointReusable"] = null, ["Altar"] = null, ["AltarBlue"] = null, ["AltarRed"] = null, ["AltarTorch"] = null, ["HookpointGreen"] = null, ["HookpointBlue"] = null, ["HookpointYellow"] = null, ["HookpointProvidence"] = null, ["JumpPad"] = null, ["JumpPadSmall"] = null, ["JumpPadSteam"] = null, ["ElectricityBox"] = null, ["TeslaCoils"] = null, ["SuicideTree"] = null, ["Terminal"] = null, ["TerminalTestament"] = null, ["TerminalPrime"] = null, ["TerminalPrime1"] = null, ["Plank"] = null, ["PlankBlocker"] = null, ["GlassFloor"] = null, ["GlassWall"] = null, ["GlassWall2"] = null, ["Speakers"] = null, ["SpeakersChime"] = null, ["Breakable"] = null, ["ScreenUsable"] = null, ["ScreenInteractive"] = null, ["ScreenInteractiveButton"] = null, ["ScreenInteractiveStand"] = null, ["ScreenPuzzle"] = null, ["ScreenPuzzle5x5"] = null, ["PierPlatform"] = null, ["PierSegment"] = null, ["PierStairs"] = null, ["Crusher"] = null, ["CrusherBad"] = null, ["Fan"] = null, ["Grinder"] = null, ["EnergyBeam"] = null, ["BrainBeam"] = null, ["BrainBeamObstacle"] = null }; public static Dictionary<string, GameObject> Particles = new Dictionary<string, GameObject> { ["Break"] = null, ["BreakBig"] = null, ["BreakMetal"] = null }; public static Dictionary<string, GameObject> DebugObjects = new Dictionary<string, GameObject> { ["AxisPoint"] = null }; public static Dictionary<string, AudioClip> AudioClips = new Dictionary<string, AudioClip> { ["Shutdown"] = null }; public static object[] Things = Array.Empty<object>(); public static T Ass<T>(string path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion(); } public static GameObject AssGO(string path) { return Ass<GameObject>(path); } public static void GetAssets() { GetEnemiesHusks(); GetEnemiesMachines(); GetEnemiesDemons(); GetEnemiesAngels(); GetEnemiesOther(); GetObjectsMain(); GetObjectsSecondary(); GetObjectsObstacles(); GetParticles(); GetAudioClips(); GetDebugObjects(); } public static void GetEnemiesHusks() { Enemies["Filth"] = AssGO("Assets/Prefabs/Enemies/Filth.prefab"); Enemies["Stray"] = AssGO("Assets/Prefabs/Enemies/Stray.prefab"); Enemies["Stalker"] = AssGO("Assets/Prefabs/Enemies/Stalker.prefab"); Enemies["Schism"] = AssGO("Assets/Prefabs/Enemies/Schism.prefab"); Enemies["Soldier"] = AssGO("Assets/Prefabs/Enemies/Soldier.prefab"); Enemies["Insurrectionist"] = AssGO("Assets/Prefabs/Enemies/Sisyphus.prefab"); Enemies["Ferryman"] = AssGO("Assets/Prefabs/Enemies/Ferryman.prefab"); Enemies["MirrorReaper"] = AssGO("Assets/Prefabs/Enemies/MirrorReaperCyberGrind.prefab"); } public static void GetEnemiesMachines() { Enemies["Drone"] = AssGO("Assets/Prefabs/Enemies/Drone.prefab"); Enemies["Streetcleaner"] = AssGO("Assets/Prefabs/Enemies/Streetcleaner.prefab"); Enemies["Swordsmachine"] = AssGO("Assets/Prefabs/Enemies/SwordsMachine NonBoss.prefab"); Enemies["Mindflayer"] = AssGO("Assets/Prefabs/Enemies/Mindflayer.prefab"); Enemies["Sentry"] = AssGO("Assets/Prefabs/Enemies/Turret.prefab"); Enemies["Gutterman"] = AssGO("Assets/Prefabs/Enemies/Gutterman.prefab"); Enemies["Guttertank"] = AssGO("Assets/Prefabs/Enemies/Guttertank.prefab"); Enemies["RocketLauncher"] = AssGO("Assets/Prefabs/Enemies/CentaurRocketLauncherStand.prefab"); Enemies["RocketLauncherNoStand"] = AssGO("Assets/Prefabs/Enemies/CentaurRocketLauncher.prefab"); Enemies["Mortar"] = AssGO("Assets/Prefabs/Enemies/CentaurMortar.prefab"); Enemies["Tower"] = AssGO("Assets/Prefabs/Enemies/CentaurTower.prefab"); } public static void GetEnemiesDemons() { Enemies["MaliciousFace"] = AssGO("Assets/Prefabs/Enemies/Malicious Face.prefab"); Enemies["Cerberus"] = AssGO("Assets/Prefabs/Enemies/Cerberus.prefab"); Enemies["CerberusStatue"] = AssGO("Assets/Prefabs/Enemies/CerberusStatue.prefab"); Enemies["CerberusStatueWhite"] = AssGO("Assets/Prefabs/Enemies/CerberusStatueWhite.prefab"); Enemies["Idol"] = AssGO("Assets/Prefabs/Enemies/Idol.prefab"); Enemies["Mannequin"] = AssGO("Assets/Prefabs/Enemies/Mannequin.prefab"); Enemies["MannequinPoser"] = AssGO("Assets/Prefabs/Enemies/MannequinPoserWithEnemy.prefab"); Enemies["Deathcatcher"] = AssGO("Assets/Prefabs/Enemies/Deathcatcher.prefab"); Enemies["DeathcatcherCase"] = AssGO("Assets/Prefabs/Enemies/DeathcatcherCase.prefab"); Enemies["DeathcatcherClosed"] = AssGO("Assets/Prefabs/Enemies/DeathcatcherClosed.prefab"); Enemies["HideousMass"] = AssGO("Assets/Prefabs/Enemies/Mass.prefab"); } public static void GetEnemiesAngels() { Enemies["Virtue"] = AssGO("Assets/Prefabs/Enemies/Virtue.prefab"); Enemies["Providence"] = AssGO("Assets/Prefabs/Enemies/Providence.prefab"); Enemies["Power"] = AssGO("Assets/Prefabs/Enemies/PowerWithSpawnEffect.prefab"); Enemies["PowerNoEffect"] = AssGO("Assets/Prefabs/Enemies/Power.prefab"); } public static void GetEnemiesOther() { Enemies["Eye"] = ((Component)AssGO("Assets/