using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DebugMod.Helpers; using DebugMod.Hitbox; using DebugMod.Interop; using DebugMod.MonoBehaviours; using DebugMod.SaveStates; using DebugMod.UI; using DebugMod.UI.Canvas; using GlobalEnums; using GlobalSettings; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using TeamCherry.Localization; using TeamCherry.NestedFadeGroup; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DebugMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+e4dfb8da539f865e993dac26a01aab31632e7645")] [assembly: AssemblyProduct("DebugMod")] [assembly: AssemblyTitle("DebugMod")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/hk-speedrunning/Silksong.DebugMod")] [assembly: NeutralResourcesLanguage("EN")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace DebugMod { [HarmonyPatch] [HarmonyPatch] public static class BindableFunctions { [CompilerGenerated] private sealed class d__73 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__73(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; TimeScale.Frozen = false; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; case 1: <>1__state = -1; TimeScale.Frozen = true; 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(); } } private static string saveLevelStateAction; internal static int frameCounter; [BindableMethod(name = "CHEATS_KILLALL", category = "CATEGORY_CHEATS")] public static void KillAll() { int num = 0; HealthManager[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (HealthManager val in array) { if (!val.isDead) { val.Die((float?)null, (AttackTypes)1, true); num++; } } DebugMod.LogConsole($"Killing {num} HealthManagers in scene"); } [BindableMethod(name = "CHEATS_INFINITEJUMP", category = "CATEGORY_CHEATS")] public static void ToggleInfiniteJump() { PlayerData.instance.infiniteAirJump = !PlayerData.instance.infiniteAirJump; DebugMod.LogConsole("Infinite Jump set to " + PlayerData.instance.infiniteAirJump.ToString().ToUpper()); } [BindableMethod(name = "CHEATS_INFINITESILK", category = "CATEGORY_CHEATS")] public static void ToggleInfiniteSilk() { DebugMod.infiniteSilk = !DebugMod.infiniteSilk; DebugMod.LogConsole("Infinite Silk set to " + DebugMod.infiniteSilk.ToString().ToUpper()); } [BindableMethod(name = "CHEATS_INFINITEHP", category = "CATEGORY_CHEATS")] public static void ToggleInfiniteHP() { DebugMod.infiniteHP = !DebugMod.infiniteHP; DebugMod.LogConsole("Infinite HP set to " + DebugMod.infiniteHP.ToString().ToUpper()); } [BindableMethod(name = "CHEATS_INFINITETOOLS", category = "CATEGORY_CHEATS")] public static void ToggleInfiniteTools() { DebugMod.infiniteTools = !DebugMod.infiniteTools; DebugMod.LogConsole("Infinite Tools set to " + DebugMod.infiniteTools.ToString().ToUpper()); } [BindableMethod(name = "CHEATS_INVINCIBILITY", category = "CATEGORY_CHEATS")] public static void ToggleInvincibility() { DebugMod.playerInvincible = !DebugMod.playerInvincible; DebugMod.LogConsole("Invincibility set to " + DebugMod.playerInvincible.ToString().ToUpper()); PlayerData.instance.isInvincible = DebugMod.playerInvincible; } [BindableMethod(name = "CHEATS_NOCLIP", category = "CATEGORY_CHEATS")] public static void ToggleNoclip() { //IL_0048: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) DebugMod.noclip = !DebugMod.noclip; if (DebugMod.noclip) { DebugMod.LogConsole("Enabled noclip"); DebugMod.noclipPos = DebugMod.RefKnight.transform.position; } else { DebugMod.LogConsole("Disabled noclip"); Rigidbody2D component = DebugMod.RefKnight.GetComponent(); component.constraints = (RigidbodyConstraints2D)(component.constraints & -4); } } [BindableMethod(name = "CHEATS_TOGGLEHEROCOLLIDER", category = "CATEGORY_CHEATS")] public static void ToggleHeroCollider() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (DebugMod.heroColliderDisabled) { DebugMod.heroColliderDisabled = false; ((Behaviour)DebugMod.RefHeroCollider).enabled = true; HeroBox.Inactive = false; DebugMod.LogConsole("Enabled hero collider" + (DebugMod.noclip ? " and disabled noclip" : "")); DebugMod.noclip = false; Rigidbody2D component = DebugMod.RefKnight.GetComponent(); component.constraints = (RigidbodyConstraints2D)(component.constraints & -4); } else { DebugMod.heroColliderDisabled = true; ((Behaviour)DebugMod.RefHeroCollider).enabled = false; HeroBox.Inactive = true; DebugMod.LogConsole("Disabled hero collider" + (DebugMod.noclip ? "" : " and enabled noclip")); DebugMod.noclip = true; DebugMod.noclipPos = DebugMod.RefKnight.transform.position; } } [BindableMethod(name = "CONSUMABLES_GIVEROSARIES", category = "CATEGORY_CONSUMABLES")] public static void GiveRosaries() { HeroController.instance.AddGeo(1000); DebugMod.LogConsole("Giving player 1000 rosaries"); } [BindableMethod(name = "CONSUMABLES_GIVESHELLSHARDS", category = "CATEGORY_CONSUMABLES")] public static void GiveShellShards() { HeroController.instance.AddShards(100); DebugMod.LogConsole("Giving player 100 shell shards"); } [BindableMethod(name = "CONSUMABLES_GIVEQUESTITEMS", category = "CATEGORY_CONSUMABLES")] public static void GiveQuestItems() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) bool flag = false; foreach (FullQuestBase activeQuest in QuestManager.GetActiveQuests()) { foreach (QuestTarget target in activeQuest.Targets) { QuestTargetCounter counter = target.Counter; CollectableItem val = (CollectableItem)(object)((counter is CollectableItem) ? counter : null); if (val != null) { int num = target.Count - val.CollectedAmount; if (num > 0) { val.Collect(num, true); flag = true; } } } } if (flag) { DebugMod.LogConsole("Gave necessary items for all active quests"); } else { DebugMod.LogConsole("No active quests that need items, doing nothing"); } } [BindableMethod(name = "ENEMIES_TOGGLEHPBARS", category = "CATEGORY_ENEMIES")] public static void ToggleEnemyHPBars() { EnemiesPanel.hpBars = !EnemiesPanel.hpBars; if (EnemiesPanel.hpBars) { DebugMod.LogConsole("Enabled HP bars"); } else { DebugMod.LogConsole("Disabled HP bars"); } } [BindableMethod(name = "MASKSANDSPOOLS_GIVEMASK", category = "CATEGORY_MASKSANDSPOOLS")] public static void GiveMask() { if (PlayerData.instance.maxHealthBase < 10) { HeroController.instance.MaxHealth(); HeroController.instance.AddToMaxHealth(1); HudHelper.RefreshMasks(); DebugMod.LogConsole("Added mask"); } else { DebugMod.LogConsole("You have the maximum number of masks"); } } [BindableMethod(name = "MASKSANDSPOOLS_GIVESPOOL", category = "CATEGORY_MASKSANDSPOOLS")] public static void GiveSpool() { if (PlayerData.instance.silkMax < 18) { HeroController.instance.AddToMaxSilk(1); HudHelper.RefreshSpool(); DebugMod.LogConsole("Added spool"); } else { DebugMod.LogConsole("You have the maximum number of spools"); } PlayerData.instance.IsSilkSpoolBroken = false; EventRegister.SendEvent("SPOOL UNBROKEN", (GameObject)null); } [BindableMethod(name = "MASKSANDSPOOLS_TAKEMASK", category = "CATEGORY_MASKSANDSPOOLS")] public static void TakeAwayMask() { if (PlayerData.instance.maxHealthBase > 1) { PlayerData instance = PlayerData.instance; instance.maxHealth--; PlayerData instance2 = PlayerData.instance; instance2.maxHealthBase--; PlayerData.instance.health = Math.Min(PlayerData.instance.health, PlayerData.instance.maxHealth); HudHelper.RefreshMasks(); DebugMod.LogConsole("Removed mask"); } else { DebugMod.LogConsole("You have the minimum number of masks"); } } [BindableMethod(name = "MASKSANDSPOOLS_TAKESPOOL", category = "CATEGORY_MASKSANDSPOOLS")] public static void TakeAwaySpool() { if (PlayerData.instance.silkMax > 9) { PlayerData instance = PlayerData.instance; instance.silkMax--; PlayerData.instance.silk = Math.Min(PlayerData.instance.silk, PlayerData.instance.silkMax); HudHelper.RefreshSpool(); DebugMod.LogConsole("Removed spool"); } else { DebugMod.LogConsole("You have the minimum number of spools"); } } private static bool CanModifyHealth(int health) { if (health <= 0) { DebugMod.LogConsole("Cannot add/take health: health <= 0"); return false; } if (HeroController.instance.cState.dead) { DebugMod.LogConsole("Cannot add/take health: player is dead"); return false; } if (!GameManager.instance.IsGameplayScene()) { DebugMod.LogConsole("Cannot add/take health: not a gameplay scene"); return false; } return true; } [BindableMethod(name = "MASKSANDSPOOLS_ADDHEALTH", category = "CATEGORY_MASKSANDSPOOLS")] public static void AddHealth() { if (CanModifyHealth(PlayerData.instance.health + 1)) { HeroController.instance.AddHealth(1); HudHelper.RefreshMasks(); DebugMod.LogConsole("Added health"); } } [BindableMethod(name = "MASKSANDSPOOLS_TAKEHEALTH", category = "CATEGORY_MASKSANDSPOOLS")] public static void TakeHealth() { if (CanModifyHealth(PlayerData.instance.health - 1)) { HeroController.instance.TakeHealth(1); HudHelper.RefreshMasks(); DebugMod.LogConsole("Took health"); } } [BindableMethod(name = "MASKSANDSPOOLS_ADDSILK", category = "CATEGORY_MASKSANDSPOOLS")] public static void AddSilk() { HeroController.instance.AddSilk(1, true); DebugMod.LogConsole("Added silk"); } [BindableMethod(name = "MASKSANDSPOOLS_TAKESILK", category = "CATEGORY_MASKSANDSPOOLS")] public static void TakeSilk() { HeroController.instance.TakeSilk(1); DebugMod.LogConsole("Attempting to take silk"); } [BindableMethod(name = "MASKSANDSPOOLS_ADDLIFEBLOOD", category = "CATEGORY_MASKSANDSPOOLS")] public static void Lifeblood() { bool isInLifebloodState = HeroController.instance.IsInLifebloodState; EventRegister.SendEvent("ADD BLUE HEALTH", (GameObject)null); if (!isInLifebloodState && HeroController.instance.IsInLifebloodState) { HeroController.instance.HitMaxBlueHealthBurst(); } DebugMod.LogConsole("Attempting to add lifeblood"); } [BindableMethod(name = "MISC_TOGGLEACT3", category = "CATEGORY_MISC")] public static void ToggleAct3() { PlayerData.instance.blackThreadWorld = !PlayerData.instance.blackThreadWorld; DebugMod.LogConsole("Act 3 world is now " + (PlayerData.instance.blackThreadWorld ? "enabled" : "disabled") + ", reload the scene to apply changes"); } [BindableMethod(name = "MISC_SETHAZARDRESPAWN", category = "CATEGORY_MISC")] public static void SetHazardRespawn() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 position = DebugMod.RefKnight.transform.position; HeroController.instance.SetHazardRespawn(position, false); Vector3 val = position; DebugMod.LogConsole("Manual respawn point on this map set to" + ((object)(Vector3)(ref val)).ToString()); } [BindableMethod(name = "MISC_HAZARDRESPAWN", category = "CATEGORY_MISC")] public static void Respawn() { if (GameManager.instance.IsGameplayScene() && !HeroController.instance.cState.dead && PlayerData.instance.health > 0) { if (((object)(UIState)(ref UIManager.instance.uiState)).ToString() == "PAUSED") { ((MonoBehaviour)ManagerSingleton.Instance).StartCoroutine(GameManager.instance.PauseGameToggle(false)); GameManager.instance.HazardRespawn(); DebugMod.LogConsole("Closing pause menu and respawning..."); } else if (((object)(UIState)(ref UIManager.instance.uiState)).ToString() == "PLAYING") { HeroController.instance.RelinquishControl(); GameManager.instance.HazardRespawn(); HeroController.instance.RegainControl(); DebugMod.LogConsole("Respawn signal sent"); } else { DebugMod.LogConsole("How are you seeing this??? (please create a bug report)"); } } } [BindableMethod(name = "MISC_DAMAGESELF", category = "CATEGORY_MISC")] public static void SelfDamage() { if (PlayerData.instance.health <= 0) { DebugMod.LogConsole("Cannot damage self: health <= 0"); return; } if (HeroController.instance.cState.dead) { DebugMod.LogConsole("Cannot damage self: player is dead"); return; } if (!GameManager.instance.IsGameplayScene()) { DebugMod.LogConsole("Cannot damage self: not a gameplay scene"); return; } if (HeroController.instance.cState.recoiling) { DebugMod.LogConsole("Cannot damage self: player is recoiling"); return; } if (HeroController.instance.cState.invulnerable) { DebugMod.LogConsole("Cannot damage self: player is invulnerable"); return; } HeroController.instance.DamageSelf(1); DebugMod.LogConsole("Attempting self damage"); } [BindableMethod(name = "MISC_KILLSELF", category = "CATEGORY_MISC")] public static void KillSelf() { if (!HeroController.instance.cState.dead && !HeroController.instance.cState.transitioning) { ((MonoBehaviour)HeroController.instance).StartCoroutine(HeroController.instance.Die(false, false)); DebugMod.LogConsole("Killed player"); } } [BindableMethod(name = "MISC_BREAKCOCOON", category = "CATEGORY_MISC")] public static void BreakCocoon() { HeroController instance = HeroController.instance; if (instance != null) { instance.CocoonBroken(); } EventRegister.SendEvent("BREAK HERO CORPSE", (GameObject)null); } [BindableMethod(name = "MISC_RESETCURRENTSCENEDATA", category = "CATEGORY_MISC")] public static void ResetCurrentScene() { saveLevelStateAction = GameManager.instance.GetSceneNameString(); DebugMod.LogConsole("Clearing scene data from this scene, reload the scene to apply changes"); } [BindableMethod(name = "MISC_BLOCKSCENEDATACHANGES", category = "CATEGORY_MISC")] public static void BlockCurrentSceneChanges() { saveLevelStateAction = "block"; DebugMod.LogConsole("Scene data changes made since entering this scene will not be saved"); } [BindableMethod(name = "MISC_QUEUEWALLJUMPINTERRUPT", category = "CATEGORY_MISC")] public static void QueueWallJump() { HeroController.instance.queuedWallJumpInterrupt = true; } [HarmonyPatch(typeof(GameManager), "SaveLevelState")] [HarmonyPrefix] private static bool GameManager_SaveLevelState_Prefix() { if (saveLevelStateAction == "block") { saveLevelStateAction = null; return false; } return true; } [HarmonyPatch(typeof(GameManager), "SaveLevelState")] [HarmonyPostfix] private static void GameManager_SaveLevelState_Postfix() { if (saveLevelStateAction != null && saveLevelStateAction != "block") { ((PersistentItemDataCollection)(object)SceneData.instance.persistentBools).scenes.Remove(saveLevelStateAction); ((PersistentItemDataCollection)(object)SceneData.instance.persistentInts).scenes.Remove(saveLevelStateAction); ((PersistentItemDataCollection)(object)SceneData.instance.geoRocks).scenes.Remove(saveLevelStateAction); saveLevelStateAction = null; } } [BindableMethod(name = "MISC_LOCKKEYBINDS", category = "CATEGORY_MISC")] public static void ToggleLockKeyBinds() { DebugMod.KeyBindLock = !DebugMod.KeyBindLock; DebugMod.LogConsole((DebugMod.KeyBindLock ? "Removing" : "Adding") + " the ability to use keybinds"); } [BindableMethod(name = "MISC_RESETCHEATS", category = "CATEGORY_MISC")] public static void Reset() { //IL_004a: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) PlayerData instance = PlayerData.instance; _ = HeroController.instance; GameCameras instance2 = GameCameras.instance; DebugMod.extraNailDamage = 0; PlayerData.instance.nailUpgrades = 0; PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); GameObject gameObject = ((Component)DebugMod.RefKnight.transform.Find("HeroLight")).gameObject; Color color = gameObject.GetComponent().color; color.a = 0.7f; gameObject.GetComponent().color = color; tk2dSprite component = DebugMod.RefKnight.GetComponent(); color = ((tk2dBaseSprite)component).color; color.a = 1f; ((tk2dBaseSprite)component).color = color; DebugMod.noclip = false; Rigidbody2D component2 = DebugMod.RefKnight.GetComponent(); component2.constraints = (RigidbodyConstraints2D)(component2.constraints & -4); TimeScale.Reset(); instance2.tk2dCam.ZoomFactor = 1f; VisualMaskHelper.vignetteDisabled = false; ((Renderer)DebugMod.HC.vignette).enabled = true; EnemiesPanel.hpBars = false; instance.infiniteAirJump = false; DebugMod.infiniteSilk = false; DebugMod.infiniteHP = false; instance.isInvincible = false; DebugMod.LogConsole("Reset all gameplay toggles"); } [BindableMethod(name = "MODUI_TOGGLEALLUI", category = "CATEGORY_MODUI", allowLock = false)] public static void ToggleAllPanels() { bool flag = !DebugMod.settings.InfoPanelVisible && !DebugMod.settings.EnemiesPanelVisible && !DebugMod.settings.MainPanelVisible && !DebugMod.settings.ConsoleVisible && !DebugMod.settings.SaveStatePanelVisible; DebugMod.settings.InfoPanelVisible = flag; DebugMod.settings.MainPanelVisible = flag; DebugMod.settings.EnemiesPanelVisible = flag; DebugMod.settings.ConsoleVisible = flag; DebugMod.settings.SaveStatePanelVisible = flag; } [BindableMethod(name = "MODUI_TOGGLEMAINPANEL", category = "CATEGORY_MODUI")] public static void ToggleMainPanel() { DebugMod.settings.MainPanelVisible = !DebugMod.settings.MainPanelVisible; } [BindableMethod(name = "MODUI_TOGGLEENEMIESPANEL", category = "CATEGORY_MODUI")] public static void ToggleEnemiesPanel() { DebugMod.settings.EnemiesPanelVisible = !DebugMod.settings.EnemiesPanelVisible; } [BindableMethod(name = "MODUI_TOGGLECONSOLEPANEL", category = "CATEGORY_MODUI")] public static void ToggleConsolePanel() { DebugMod.settings.ConsoleVisible = !DebugMod.settings.ConsoleVisible; } [BindableMethod(name = "MODUI_TOGGLEINFOPANEL", category = "CATEGORY_MODUI")] public static void ToggleInfoPanel() { DebugMod.settings.InfoPanelVisible = !DebugMod.settings.InfoPanelVisible; } [BindableMethod(name = "MODUI_TOGGLESAVESTATESPANEL", category = "CATEGORY_MODUI")] public static void ToggleSaveStatePanel() { DebugMod.settings.SaveStatePanelVisible = !DebugMod.settings.SaveStatePanelVisible; if (!DebugMod.settings.SaveStatePanelVisible) { SaveStatesPanel.Instance.CancelSelectState(); } } [BindableMethod(name = "MODUI_EXPANDCOLLAPSESAVESTATES", category = "CATEGORY_MODUI")] public static void ToggleExpandedSaveStatePanel() { SaveStatesPanel.Instance.ToggleView(); } [BindableMethod(name = "MODUI_ALWAYSSHOWCURSOR", category = "CATEGORY_MODUI")] public static void ToggleAlwaysShowCursor() { DebugMod.settings.ShowCursorWhileUnpaused = !DebugMod.settings.ShowCursorWhileUnpaused; if (DebugMod.settings.ShowCursorWhileUnpaused) { DebugMod.LogConsole("Showing cursor while unpaused"); } else { DebugMod.LogConsole("Not showing cursor while unpaused"); } } [BindableMethod(name = "SAVESTATES_QUICKSLOTSAVE", category = "CATEGORY_SAVESTATES")] public static void SaveState() { SaveStateManager.SetQuickState(SaveStateManager.SaveNewState()); } [BindableMethod(name = "SAVESTATES_QUICKSLOTLOAD", category = "CATEGORY_SAVESTATES")] public static void LoadState() { SaveStateManager.LoadState(SaveStateManager.GetQuickState()); } [BindableMethod(name = "SAVESTATES_QUICKSLOTTOFILE", category = "CATEGORY_SAVESTATES")] public static void CurrentSaveStateToFile() { SaveStatesPanel.Instance.EnterSelectState(SelectOperation.QuickslotToFile); } [BindableMethod(name = "SAVESTATES_FILETOQUICKSLOT", category = "CATEGORY_SAVESTATES")] public static void CurrentSlotToSaveMemory() { SaveStatesPanel.Instance.EnterSelectState(SelectOperation.FileToQuickslot); } [BindableMethod(name = "SAVESTATES_SAVETOFILE", category = "CATEGORY_SAVESTATES")] public static void NewSaveStateToFile() { SaveStatesPanel.Instance.EnterSelectState(SelectOperation.SaveToFile); } [BindableMethod(name = "SAVESTATES_LOADFROMFILE", category = "CATEGORY_SAVESTATES")] public static void LoadFromFile() { SaveStatesPanel.Instance.EnterSelectState(SelectOperation.LoadFromFile); } [BindableMethod(name = "SAVESTATES_NEXTSAVESTATEPAGE", category = "CATEGORY_SAVESTATES")] public static void NextStatePage() { SaveStatesPanel.Instance.NextPage(); } [BindableMethod(name = "SAVESTATES_PREVSAVESTATEPAGE", category = "CATEGORY_SAVESTATES")] public static void PrevStatePage() { SaveStatesPanel.Instance.PrevPage(); } [BindableMethod(name = "SAVESTATES_REFRESHFILESLOTS", category = "CATEGORY_SAVESTATES")] public static void RefreshFileSlots() { SaveStateManager.LoadFileStates(); DebugMod.LogConsole("Reimporting file slots from disk"); } [BindableMethod(name = "SAVESTATES_SAVESTATEONDEATH", category = "CATEGORY_SAVESTATES")] public static void LoadStateOnDeath() { DebugMod.stateOnDeath = !DebugMod.stateOnDeath; DebugMod.LogConsole("Quickslot savestate will now" + (DebugMod.stateOnDeath ? " be" : " no longer") + " loaded on death"); } [BindableMethod(name = "SAVESTATES_OVERRIDELOADLOCKOUT", category = "CATEGORY_SAVESTATES")] public static void OverrideLoadLockout() { DebugMod.overrideLoadLockout = !DebugMod.overrideLoadLockout; DebugMod.LogConsole("Savestate lockout override set to " + DebugMod.overrideLoadLockout.ToString().ToUpper()); } [BindableMethod(name = "SKILLS_GIVEALLSKILLS", category = "CATEGORY_SKILLS")] public static void GiveAllSkills() { PlayerData.instance.hasDash = true; PlayerData.instance.hasBrolly = true; PlayerData.instance.hasWalljump = true; PlayerData.instance.hasHarpoonDash = true; PlayerData.instance.hasDoubleJump = true; PlayerData.instance.hasSuperJump = true; PlayerData.instance.hasNeedolin = true; PlayerData.instance.UnlockedFastTravelTeleport = true; PlayerData.instance.hasNeedolinMemoryPowerup = true; PlayerData.instance.hasChargeSlash = true; PlayerData.instance.nailUpgrades = 4; PlayerData.instance.silkRegenMax = 3; PlayerData.instance.ToolKitUpgrades = 4; PlayerData.instance.ToolPouchUpgrades = 4; DebugMod.extraNailDamage = 0; DebugMod.LogConsole("Giving player all skills and upgrades"); } [BindableMethod(name = "SKILLS_TOGGLESWIFTSTEP", category = "CATEGORY_SKILLS")] public static void ToggleSwiftStep() { if (!PlayerData.instance.hasDash) { PlayerData.instance.hasDash = true; DebugMod.LogConsole("Giving player Swift Step"); } else { PlayerData.instance.hasDash = false; DebugMod.LogConsole("Taking away Swift Step"); } } [BindableMethod(name = "SKILLS_TOGGLEDRIFTERSCLOAK", category = "CATEGORY_SKILLS")] public static void ToggleDriftersCloak() { if (!PlayerData.instance.hasBrolly) { PlayerData.instance.hasBrolly = true; DebugMod.LogConsole("Giving player Drifter's Cloak"); } else { PlayerData.instance.hasBrolly = false; DebugMod.LogConsole("Taking away Drifter's Cloak"); } } [BindableMethod(name = "SKILLS_TOGGLECLINGGRIP", category = "CATEGORY_SKILLS")] public static void ToggleClingGrip() { if (!PlayerData.instance.hasWalljump) { PlayerData.instance.hasWalljump = true; DebugMod.LogConsole("Giving player Cling Grip"); } else { PlayerData.instance.hasWalljump = false; DebugMod.LogConsole("Taking away Cling Grip"); } } [BindableMethod(name = "SKILLS_TOGGLENEEDOLIN", category = "CATEGORY_SKILLS")] public static void ToggleNeedolin() { if (!PlayerData.instance.hasNeedolin) { PlayerData.instance.hasNeedolin = true; DebugMod.LogConsole("Giving player Needolin"); return; } PlayerData.instance.hasNeedolin = false; PlayerData.instance.UnlockedFastTravelTeleport = false; PlayerData.instance.hasNeedolinMemoryPowerup = false; DebugMod.LogConsole("Taking away Needolin and any upgrades"); } [BindableMethod(name = "SKILLS_TOGGLECLAWLINE", category = "CATEGORY_SKILLS")] public static void ToggleClawline() { if (!PlayerData.instance.hasHarpoonDash) { PlayerData.instance.hasHarpoonDash = true; DebugMod.LogConsole("Giving player Clawline"); } else { PlayerData.instance.hasHarpoonDash = false; DebugMod.LogConsole("Taking away Clawline"); } } [BindableMethod(name = "SKILLS_TOGGLEFAYDOWNCLOAK", category = "CATEGORY_SKILLS")] public static void ToggleFaydownCloak() { if (!PlayerData.instance.hasDoubleJump) { PlayerData.instance.hasDoubleJump = true; DebugMod.LogConsole("Giving player Faydown Cloak"); } else { PlayerData.instance.hasDoubleJump = false; DebugMod.LogConsole("Taking away Faydown Cloak"); } } [BindableMethod(name = "SKILLS_TOGGLESILKSOAR", category = "CATEGORY_SKILLS")] public static void ToggleSilkSoar() { if (!PlayerData.instance.hasSuperJump) { PlayerData.instance.hasSuperJump = true; DebugMod.LogConsole("Giving player Silk Soar"); } else { PlayerData.instance.hasSuperJump = false; DebugMod.LogConsole("Taking away Silk Soar"); } } [BindableMethod(name = "SKILLS_TOGGLEBEASTLINGCALL", category = "CATEGORY_SKILLS")] public static void ToggleBeastlingCall() { if (!PlayerData.instance.hasNeedolin && !PlayerData.instance.UnlockedFastTravelTeleport) { PlayerData.instance.hasNeedolin = true; PlayerData.instance.UnlockedFastTravelTeleport = true; DebugMod.LogConsole("Giving player Needolin with Beastling Call"); } else if (PlayerData.instance.hasNeedolin && !PlayerData.instance.UnlockedFastTravelTeleport) { PlayerData.instance.UnlockedFastTravelTeleport = true; DebugMod.LogConsole("Giving player Beastling Call"); } else { PlayerData.instance.UnlockedFastTravelTeleport = false; DebugMod.LogConsole("Taking away Beastling Call"); } } [BindableMethod(name = "SKILLS_TOGGLEELEGYOFTHEDEEP", category = "CATEGORY_SKILLS")] public static void ToggleElegyOfTheDeep() { if (!PlayerData.instance.hasNeedolin && !PlayerData.instance.hasNeedolinMemoryPowerup) { PlayerData.instance.hasNeedolin = true; PlayerData.instance.hasNeedolinMemoryPowerup = true; DebugMod.LogConsole("Giving player Needolin with Elegy of the Deep"); } else if (PlayerData.instance.hasNeedolin && !PlayerData.instance.hasNeedolinMemoryPowerup) { PlayerData.instance.hasNeedolinMemoryPowerup = true; DebugMod.LogConsole("Giving player Elegy of the Deep"); } else { PlayerData.instance.hasNeedolinMemoryPowerup = false; DebugMod.LogConsole("Taking away Elegy of the Deep"); } } [BindableMethod(name = "SKILLS_TOGGLENEEDLESTRIKE", category = "CATEGORY_SKILLS")] public static void ToggleNeedleStrike() { if (!PlayerData.instance.hasChargeSlash) { PlayerData.instance.hasChargeSlash = true; DebugMod.LogConsole("Giving player Needle Strike"); } else { PlayerData.instance.hasChargeSlash = false; DebugMod.LogConsole("Taking away Needle Strike"); } } [BindableMethod(name = "TIME_INCREASETIMESCALE", category = "CATEGORY_TIME")] public static void TimescaleUp() { TimeScale.CustomTimeScale = Mathf.Round(TimeScale.CustomTimeScale * 10f + 1f) / 10f; } [BindableMethod(name = "TIME_DECREASETIMESCALE", category = "CATEGORY_TIME")] public static void TimescaleDown() { TimeScale.CustomTimeScale = Mathf.Round(TimeScale.CustomTimeScale * 10f - 1f) / 10f; } [BindableMethod(name = "TIME_RESETTIMESCALE", category = "CATEGORY_TIME")] public static void TimescaleReset() { TimeScale.CustomTimeScale = 1f; } [BindableMethod(name = "TIME_FREEZEGAME", category = "CATEGORY_TIME")] public static void PauseGameNoUI() { TimeScale.Frozen = !TimeScale.Frozen; if (TimeScale.Frozen) { frameCounter = 0; DebugMod.LogConsole("Game frozen"); } else { DebugMod.LogConsole("Game unfrozen"); } } [BindableMethod(name = "TIME_FORCEPAUSE", category = "CATEGORY_TIME")] public static void ForcePause() { try { if (PlayerData.instance.disablePause || GameManager.instance.TimeSlowed || (UIManager.instance.ignoreUnpause && DebugMod.GetSceneName() != "Menu_Title" && DebugMod.GM.IsGameplayScene())) { GameManager.instance.timeSlowedCount = 0; UIManager.instance.ignoreUnpause = false; PlayerData.instance.disablePause = false; UIManager.instance.TogglePauseGame(); DebugMod.LogConsole("Forcing pause menu because pause is disabled"); } else { DebugMod.LogConsole("Pausing game"); UIManager.instance.TogglePauseGame(); } DebugMod.forcePaused = !GameManager.instance.isPaused; } catch (Exception ex) { DebugMod.LogConsole("Error while attempting to pause, please create a bug report"); DebugMod.Log("Error while attempting force pause:\n" + ex); } } [BindableMethod(name = "TIME_ADVANCEFRAME", category = "CATEGORY_TIME")] public static void AdvanceFrame() { if (!TimeScale.Frozen) { TimeScale.Frozen = true; } frameCounter++; ((MonoBehaviour)GameManager.instance).StartCoroutine(AdvanceMyFrame()); } [IteratorStateMachine(typeof(d__73))] private static IEnumerator AdvanceMyFrame() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__73(0); } [BindableMethod(name = "TIME_RESETFRAMECOUNTER", category = "CATEGORY_TIME")] public static void ResetFrameCounter() { DebugMod.LogConsole($"Frame counter reset (was {frameCounter})"); frameCounter = 0; } [BindableMethod(name = "TOOLS_UNLOCKALLTOOLS", category = "CATEGORY_TOOLS")] public static void UnlockAllTools() { HashSet hashSet = new HashSet { "Curve Claws Upgraded", "WebShot Architect", "WebShot Weaver", "Mosscreep Tool 2", "Dazzle Bind Upgraded", "Shell Satchel" }; foreach (ToolItem allTool in ToolItemManager.GetAllTools()) { if (!hashSet.Contains(allTool.name)) { allTool.Unlock((Action)null, (PopupFlags)0); } else { allTool.Lock(); } } DebugMod.LogConsole("Unlocked all tools"); } [BindableMethod(name = "CRESTS_UNLOCKALLCRESTS", category = "CATEGORY_TOOLS")] public static void UnlockAllCrests() { ToolItemManager.UnlockAllCrests(); DebugMod.LogConsole("Unlocked all crests"); } [BindableMethod(name = "TOOLS_CRAFTTOOLS", category = "CATEGORY_TOOLS")] public static void CraftTools() { ToolItemManager.TryReplenishTools(true, (ReplenishMethod)0); DebugMod.LogConsole("Crafted new tools"); } [BindableMethod(name = "CRESTS_TOGGLECURSED", category = "CATEGORY_TOOLS")] public static void ToggleCursed() { if (((ToolBase)Gameplay.CursedCrest).IsEquipped) { ToolItemManager.ResetPreviousCrest(); PlayerData.instance.PreviousCrestID = ""; Utils.AutoEquipCrest(null, removeTools: false); DebugMod.LogConsole("Disabled cursed state"); } else { Utils.AutoEquipCrest(Gameplay.CursedCrest, removeTools: true); DebugMod.LogConsole("Enabled cursed state"); } HeroController.instance.UpdateSilkCursed(); } [BindableMethod(name = "CRESTS_TOGGLECLOAKLESS", category = "CATEGORY_TOOLS")] public static void ToggleCloakless() { if (((ToolBase)Gameplay.CloaklessCrest).IsEquipped) { ToolItemManager.ResetPreviousCrest(); PlayerData.instance.PreviousCrestID = ""; Utils.AutoEquipCrest(null, removeTools: false); DebugMod.LogConsole("Disabled cloakless state"); } else { Utils.AutoEquipCrest(Gameplay.CloaklessCrest, removeTools: true); DebugMod.LogConsole("Enabled cloakless state"); } if (PlayerData.instance.PreviousCrestID == "Cursed") { HeroController.instance.UpdateSilkCursed(); } HeroController.instance.ResetAllCrestState(); HeroController.instance.animCtrl.PlayFromFrame(HeroController.instance.animCtrl.animator.CurrentClip.name, HeroController.instance.animCtrl.animator.CurrentFrame, true); } [BindableMethod(name = "UPGRADES_INCREASENEEDLEDAMAGE", category = "CATEGORY_UPGRADES")] public static void IncreaseNeedleDamage() { if (PlayerData.instance.nailDamage == 0) { PlayerData.instance.nailUpgrades = 0; DebugMod.extraNailDamage = 0; DebugMod.LogConsole("Resetting needle damage to 5"); } else if (PlayerData.instance.nailUpgrades == 4 || DebugMod.extraNailDamage < 0) { DebugMod.extraNailDamage += 4; DebugMod.LogConsole("Adding 4 extra needle damage"); } else { PlayerData instance = PlayerData.instance; instance.nailUpgrades++; DebugMod.LogConsole("Adding needle upgrade"); } PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); } [BindableMethod(name = "UPGRADES_DECREASENEEDLEDAMAGE", category = "CATEGORY_UPGRADES")] public static void DecreaseNeedleDamage() { if (PlayerData.instance.nailUpgrades == 0 || DebugMod.extraNailDamage > 0) { DebugMod.extraNailDamage -= 4; if (DebugMod.extraNailDamage < -5) { DebugMod.extraNailDamage = -5; DebugMod.LogConsole("Setting needle damage to 0"); } else { DebugMod.LogConsole("Reducing needle damage by 4"); } } else { PlayerData instance = PlayerData.instance; instance.nailUpgrades--; DebugMod.LogConsole("Removing needle upgrade"); } PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); } [BindableMethod(name = "UPGRADES_INCREMENTCRAFTINGKIT", category = "CATEGORY_UPGRADES")] public static void IncrementKits() { if (PlayerData.instance.ToolKitUpgrades < 4) { PlayerData instance = PlayerData.instance; instance.ToolKitUpgrades++; DebugMod.LogConsole($"Increasing crafting kit level (now {PlayerData.instance.ToolKitUpgrades})"); } else { DebugMod.LogConsole("Crafting kit already at max level"); } } [BindableMethod(name = "UPGRADES_DECREMENTCRAFTINGKIT", category = "CATEGORY_UPGRADES")] public static void DecrementKits() { if (PlayerData.instance.ToolKitUpgrades > 0) { PlayerData instance = PlayerData.instance; instance.ToolKitUpgrades--; DebugMod.LogConsole($"Decreasing crafting kit level (now {PlayerData.instance.ToolKitUpgrades})"); } else { DebugMod.LogConsole("Crafting kit already at base level"); } } [BindableMethod(name = "UPGRADES_INCREMENTTOOLPOUCH", category = "CATEGORY_UPGRADES")] public static void IncrementPouches() { if (PlayerData.instance.ToolPouchUpgrades < 4) { PlayerData instance = PlayerData.instance; instance.ToolPouchUpgrades++; DebugMod.LogConsole($"Increasing tool pouch level (now {PlayerData.instance.ToolPouchUpgrades})"); } else { DebugMod.LogConsole("Tool pouch already at max level"); } } [BindableMethod(name = "UPGRADES_DECREMENTTOOLPOUCH", category = "CATEGORY_UPGRADES")] public static void DecrementPouches() { if (PlayerData.instance.ToolPouchUpgrades > 0) { PlayerData instance = PlayerData.instance; instance.ToolPouchUpgrades--; DebugMod.LogConsole($"Decreasing tool pouch level (now {PlayerData.instance.ToolPouchUpgrades})"); } else { DebugMod.LogConsole("Tool pouch already at base level"); } } [BindableMethod(name = "UPGRADES_INCREMENTSILKHEARTS", category = "CATEGORY_UPGRADES")] public static void IncrementSilkHeart() { PlayerData instance = PlayerData.instance; instance.silkRegenMax++; DebugMod.LogConsole($"Incremented silk hearts (now {PlayerData.instance.silkRegenMax})"); } [BindableMethod(name = "UPGRADES_DECREMENTSILKHEARTS", category = "CATEGORY_UPGRADES")] public static void DecrementSilkHeart() { if (PlayerData.instance.silkRegenMax > 0) { PlayerData instance = PlayerData.instance; instance.silkRegenMax--; DebugMod.LogConsole($"Decremented silk hearts (now {PlayerData.instance.silkRegenMax})"); } else { DebugMod.LogConsole("Already at 0 silk hearts"); } } [BindableMethod(name = "UPGRADES_ALLMAPS", category = "CATEGORY_UPGRADES")] public static void UnlockAllMaps() { if (PlayerData.instance.HasAllMaps) { PlayerData.instance.HasAbyssMap = false; PlayerData.instance.HasAqueductMap = false; PlayerData.instance.HasArboriumMap = false; PlayerData.instance.HasBellhartMap = false; PlayerData.instance.HasBoneforestMap = false; PlayerData.instance.HasCitadelUnderstoreMap = false; PlayerData.instance.HasCloverMap = false; PlayerData.instance.HasCogMap = false; PlayerData.instance.HasCoralMap = false; PlayerData.instance.HasCradleMap = false; PlayerData.instance.HasCrawlMap = false; PlayerData.instance.HasDocksMap = false; PlayerData.instance.HasDustpensMap = false; PlayerData.instance.HasGreymoorMap = false; PlayerData.instance.HasHallsMap = false; PlayerData.instance.HasHangMap = false; PlayerData.instance.HasHuntersNestMap = false; PlayerData.instance.HasJudgeStepsMap = false; PlayerData.instance.HasLibraryMap = false; PlayerData.instance.HasMossGrottoMap = false; PlayerData.instance.HasPeakMap = false; PlayerData.instance.HasShellwoodMap = false; PlayerData.instance.HasSlabMap = false; PlayerData.instance.HasSongGateMap = false; PlayerData.instance.HasSwampMap = false; PlayerData.instance.HasWardMap = false; PlayerData.instance.HasWeavehomeMap = false; PlayerData.instance.HasWildsMap = false; PlayerData.instance.hasQuill = false; CollectableItemManager.IncrementVersion(); DebugMod.LogConsole("Removed all maps"); return; } PlayerData.instance.HasAbyssMap = true; PlayerData.instance.HasAqueductMap = true; PlayerData.instance.HasArboriumMap = true; PlayerData.instance.HasBellhartMap = true; PlayerData.instance.HasBoneforestMap = true; PlayerData.instance.HasCitadelUnderstoreMap = true; PlayerData.instance.HasCloverMap = true; PlayerData.instance.HasCogMap = true; PlayerData.instance.HasCoralMap = true; PlayerData.instance.HasCradleMap = true; PlayerData.instance.HasCrawlMap = true; PlayerData.instance.HasDocksMap = true; PlayerData.instance.HasDustpensMap = true; PlayerData.instance.HasGreymoorMap = true; PlayerData.instance.HasHallsMap = true; PlayerData.instance.HasHangMap = true; PlayerData.instance.HasHuntersNestMap = true; PlayerData.instance.HasJudgeStepsMap = true; PlayerData.instance.HasLibraryMap = true; PlayerData.instance.HasMossGrottoMap = true; PlayerData.instance.HasPeakMap = true; PlayerData.instance.HasShellwoodMap = true; PlayerData.instance.HasSlabMap = true; PlayerData.instance.HasSongGateMap = true; PlayerData.instance.HasSwampMap = true; PlayerData.instance.HasWardMap = true; PlayerData.instance.HasWeavehomeMap = true; PlayerData.instance.HasWildsMap = true; PlayerData.instance.hasQuill = true; PlayerData.instance.QuillState = 1; CollectableItemManager.IncrementVersion(); ZoneInfo[] mapZoneInfo = GameManager.instance.gameMap.mapZoneInfo; for (int i = 0; i < mapZoneInfo.Length; i++) { ParentInfo[] parents = mapZoneInfo[i].Parents; for (int j = 0; j < parents.Length; j++) { foreach (MapCache map in parents[j].Maps) { string sceneName = map.sceneName; if (!string.IsNullOrEmpty(sceneName)) { PlayerData.instance.scenesVisited.Add(sceneName); PlayerData.instance.scenesMapped.Add(sceneName); } } } } GameManager.instance.gameMap.SetupMap(false); DebugMod.LogConsole("Unlocked all maps"); } [BindableMethod(name = "UPGRADES_ALLFASTTRAVEL", category = "CATEGORY_UPGRADES")] public static void UnlockAllFastTravel() { if (PlayerData.instance.UnlockedAqueductStation && PlayerData.instance.UnlockedBelltownStation && PlayerData.instance.UnlockedBoneforestEastStation && PlayerData.instance.UnlockedCityStation && PlayerData.instance.UnlockedCoralTowerStation && PlayerData.instance.UnlockedDocksStation && PlayerData.instance.UnlockedGreymoorStation && PlayerData.instance.UnlockedPeakStation && PlayerData.instance.UnlockedShadowStation && PlayerData.instance.UnlockedShellwoodStation && PlayerData.instance.UnlockedArboriumTube && PlayerData.instance.UnlockedCityBellwayTube && PlayerData.instance.UnlockedEnclaveTube && PlayerData.instance.UnlockedHangTube && PlayerData.instance.UnlockedSongTube && PlayerData.instance.UnlockedUnderTube) { PlayerData.instance.UnlockedAqueductStation = false; PlayerData.instance.UnlockedBelltownStation = false; PlayerData.instance.UnlockedBoneforestEastStation = false; PlayerData.instance.UnlockedCityStation = false; PlayerData.instance.UnlockedCoralTowerStation = false; PlayerData.instance.UnlockedDocksStation = false; PlayerData.instance.UnlockedGreymoorStation = false; PlayerData.instance.UnlockedPeakStation = false; PlayerData.instance.UnlockedShadowStation = false; PlayerData.instance.UnlockedShellwoodStation = false; PlayerData.instance.UnlockedArboriumTube = false; PlayerData.instance.UnlockedCityBellwayTube = false; PlayerData.instance.UnlockedEnclaveTube = false; PlayerData.instance.UnlockedHangTube = false; PlayerData.instance.UnlockedSongTube = false; PlayerData.instance.UnlockedUnderTube = false; DebugMod.LogConsole("Removed all fast travel"); } else { PlayerData.instance.UnlockedAqueductStation = true; PlayerData.instance.UnlockedBelltownStation = true; PlayerData.instance.UnlockedBoneforestEastStation = true; PlayerData.instance.UnlockedCityStation = true; PlayerData.instance.UnlockedCoralTowerStation = true; PlayerData.instance.UnlockedDocksStation = true; PlayerData.instance.UnlockedGreymoorStation = true; PlayerData.instance.UnlockedPeakStation = true; PlayerData.instance.UnlockedShadowStation = true; PlayerData.instance.UnlockedShellwoodStation = true; PlayerData.instance.UnlockedArboriumTube = true; PlayerData.instance.UnlockedCityBellwayTube = true; PlayerData.instance.UnlockedEnclaveTube = true; PlayerData.instance.UnlockedHangTube = true; PlayerData.instance.UnlockedSongTube = true; PlayerData.instance.UnlockedUnderTube = true; DebugMod.LogConsole("Unlocked all fast travel"); } } [BindableMethod(name = "VISUAL_TOGGLEHITBOXES", category = "CATEGORY_VISUAL")] public static void ShowHitboxes() { if (++DebugMod.settings.ShowHitBoxes > 2) { DebugMod.settings.ShowHitBoxes = 0; } switch (DebugMod.settings.ShowHitBoxes) { case 0: DebugMod.LogConsole("Not showing hitboxes"); break; case 1: DebugMod.LogConsole("Showing hitboxes"); break; case 2: DebugMod.LogConsole("Showing all hitboxes"); break; } } [BindableMethod(name = "VISUAL_FORCECAMERAFOLLOW", category = "CATEGORY_VISUAL")] public static void ForceCameraFollow() { if (!DebugMod.cameraFollow) { DebugMod.LogConsole("Forcing camera follow"); DebugMod.cameraFollow = true; } else { DebugMod.cameraFollow = false; DebugMod.RefCamera.isGameplayScene = true; DebugMod.LogConsole("Returning camera to normal settings"); } } [BindableMethod(name = "VISUAL_PREVIEWCOCOONPOSITION", category = "CATEGORY_VISUAL")] public static void PreviewCocoonPosition() { CocoonPreviewer cocoonPreviewer = ((Component)GameManager.instance).GetComponent() ?? ((Component)GameManager.instance).gameObject.AddComponent(); if (!cocoonPreviewer.previewEnabled) { cocoonPreviewer.previewEnabled = true; DebugMod.LogConsole("Enabled cocoon spawn point preview"); } else { cocoonPreviewer.previewEnabled = false; DebugMod.LogConsole("Disabled cocoon spawn point preview"); } } [BindableMethod(name = "VISUAL_TOGGLEVIGNETTE", category = "CATEGORY_VISUAL")] public static void ToggleVignette() { VisualMaskHelper.ToggleVignette(); } [BindableMethod(name = "VISUAL_DEACTIVATEVISUALMASKS", category = "CATEGORY_VISUAL")] public static void DoDeactivateVisualMasks() { VisualMaskHelper.ToggleAllMasks(); } [BindableMethod(name = "VISUAL_TOGGLEHEROLIGHT", category = "CATEGORY_VISUAL")] public static void ToggleHeroLight() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_004a: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)DebugMod.RefKnight.transform.Find("HeroLight")).gameObject; Color color = gameObject.GetComponent().color; if (Math.Abs(color.a) > 0f) { color.a = 0f; gameObject.GetComponent().color = color; DebugMod.LogConsole("Making hero light invisible"); } else { color.a = 0.7f; gameObject.GetComponent().color = color; DebugMod.LogConsole("Making hero light visible"); } } [BindableMethod(name = "VISUAL_TOGGLEHUD", category = "CATEGORY_VISUAL")] public static void ToggleHUD() { if (((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.activeInHierarchy) { ((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.SetActive(false); DebugMod.LogConsole("Disabling HUD"); } else { ((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.SetActive(true); HudHelper.RefreshSpool(); DebugMod.LogConsole("Enabling HUD"); } } [HarmonyPatch(typeof(SilkSpool), "ChangeSilk")] [HarmonyPrefix] private static bool SilkSpool_ChangeSilk() { return ((Component)GameCameras.instance.hudCanvasSlideOut).gameObject.activeInHierarchy; } [BindableMethod(name = "VISUAL_ZOOMIN", category = "CATEGORY_VISUAL")] public static void ZoomIn() { tk2dCamera tk2dCam = GameCameras.instance.tk2dCam; tk2dCam.zoomFactor *= 1.1f; ZoomHelper.UpdateCameraFOV(); DebugMod.LogConsole($"Zoom level increased to {GameCameras.instance.tk2dCam.ZoomFactor}"); } [BindableMethod(name = "VISUAL_ZOOMOUT", category = "CATEGORY_VISUAL")] public static void ZoomOut() { tk2dCamera tk2dCam = GameCameras.instance.tk2dCam; tk2dCam.zoomFactor *= 0.9f; ZoomHelper.UpdateCameraFOV(); DebugMod.LogConsole($"Zoom level increased to {GameCameras.instance.tk2dCam.ZoomFactor}"); } [BindableMethod(name = "VISUAL_RESETZOOM", category = "CATEGORY_VISUAL")] public static void ResetZoom() { GameCameras.instance.tk2dCam.ZoomFactor = 1f; ZoomHelper.UpdateCameraFOV(); DebugMod.LogConsole("Zoom level was reset"); } [BindableMethod(name = "VISUAL_HIDEHERO", category = "CATEGORY_VISUAL")] public static void HideHero() { //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_0012: 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_0031: Unknown result type (might be due to invalid IL or missing references) tk2dSprite component = DebugMod.RefKnight.GetComponent(); Color color = ((tk2dBaseSprite)component).color; if (Math.Abs(color.a) > 0f) { color.a = 0f; ((tk2dBaseSprite)component).color = color; DebugMod.LogConsole("Making hero sprite invisible"); } else { color.a = 1f; ((tk2dBaseSprite)component).color = color; DebugMod.LogConsole("Making hero sprite visible"); } } [BindableMethod(name = "VISUAL_TOGGLECAMERASHAKE", category = "CATEGORY_VISUAL")] public static void ToggleCameraShake() { bool flag = !((Behaviour)GameCameras.instance.cameraShakeFSM).enabled; ((Behaviour)GameCameras.instance.cameraShakeFSM).enabled = flag; DebugMod.LogConsole((flag ? "Enabling" : "Disabling") + " camera shake"); } } [AttributeUsage(AttributeTargets.Method, Inherited = false)] public class BindableMethod : Attribute { public string name; public string category; public bool allowLock = true; } public class BindAction { public string Name { get; } public string Category { get; } public bool AllowLock { get; } public Action Action { get; } public BindAction(string name, string category, bool allowLock, Action action) { Name = name; Category = category; AllowLock = allowLock; Action = action; } public BindAction(BindableMethod attribute, MethodInfo method) { Name = attribute.name; Category = attribute.category; AllowLock = attribute.allowLock; Action = (Action)Delegate.CreateDelegate(typeof(Action), method); } } [BepInDependency("org.silksong-modding.modlist", "0.2.0")] [HarmonyPatch] [BepInPlugin("io.github.hk-speedrunning.debugmod", "DebugMod", "1.0.3")] public class DebugMod : BaseUnityPlugin { [PublicAPI] public enum InfoPanelColumn { LEFT, RIGHT } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__55_0; public static LogCallback <>9__55_1; public static Action <>9__55_2; public static Func, string> <>9__61_0; internal bool b__55_0(ILogSource x) { return x is UnityLogSource; } internal void b__55_1(string condition, string stackTrace, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 bool flag = (((int)type == 0 || (int)type == 4) ? true : false); if (flag && condition.Contains("Exception")) { LogError(("[UNITY] " + condition + "\n" + stackTrace).Trim()); } } internal void b__55_2() { UICommon.LoadResources(); GUIController.Instance.BuildMenus(); SceneWatcher.Init(); } internal string b__61_0(KeyValuePair pair) { return pair.Key; } } private static GameManager _gm; private static InputHandler _ih; private static HeroController _hc; private static GameObject _refKnight; private static CameraController _refCamera; private static Collider2D _refHeroCollider; private static LightBlurredBackground _lbb; internal static IEnumerator CurrentHazardCoro; internal static IEnumerator CurrentInvulnCoro; public static DebugMod instance; public static readonly string ModBaseDirectory = Path.Combine(Application.persistentDataPath, "DebugModData"); private static float _loadTime; private static float _unloadTime; private static bool _loadingChar; internal static HitInstance? lastHit; internal static int lastDamage; [CanBeNull] internal static DamageScalingConfig lastScaling; internal static int lastScaleLevel; public static bool stateOnDeath; public static bool infiniteHP; public static bool infiniteSilk; public static bool infiniteTools; public static bool playerInvincible; public static bool noclip; internal static Vector3 noclipPos; public static bool heroColliderDisabled; public static bool cameraFollow; public static bool KeyBindLock; public static bool overrideLoadLockout = false; public static int extraNailDamage; public static bool forcePaused; public static readonly Dictionary bindActions = new Dictionary(); internal static readonly Dictionary bindsByMethod = new Dictionary(); public static readonly Dictionary alphaKeyDict = new Dictionary(); public const string Id = "io.github.hk-speedrunning.debugmod"; internal static GameManager GM { get { if (!((Object)(object)_gm != (Object)null)) { return _gm = GameManager.SilentInstance; } return _gm; } } internal static InputHandler IH { get { if (!((Object)(object)_ih != (Object)null)) { return _ih = GM.inputHandler; } return _ih; } } internal static HeroController HC { get { if (!((Object)(object)_hc != (Object)null)) { return _hc = HeroController.instance; } return _hc; } } internal static GameObject RefKnight { get { if (!((Object)(object)_refKnight != (Object)null)) { return _refKnight = ((Component)HC).gameObject; } return _refKnight; } } internal static CameraController RefCamera { get { if (!((Object)(object)_refCamera != (Object)null)) { return _refCamera = GM.cameraCtrl; } return _refCamera; } } internal static Collider2D RefHeroCollider { get { if (!((Object)(object)_refHeroCollider != (Object)null)) { return _refHeroCollider = RefKnight.GetComponent(); } return _refHeroCollider; } } internal static LightBlurredBackground LBB { get { if (!((Object)(object)_lbb != (Object)null)) { return _lbb = Object.FindFirstObjectByType(); } return _lbb; } } public static Settings settings { get; set; } = new Settings(); public static string Name => "DebugMod"; public static string Version => "1.0.3"; public static event Action bindUpdated; public void Awake() { //IL_0051: 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: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) LoadSettings(); if (settings.LogUnityExceptions && !Logger.Sources.Any((ILogSource x) => x is UnityLogSource)) { object obj = <>c.<>9__55_1; if (obj == null) { LogCallback val = delegate(string condition, string stackTrace, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 bool flag = (((int)type == 0 || (int)type == 4) ? true : false); if (flag && condition.Contains("Exception")) { LogError(("[UNITY] " + condition + "\n" + stackTrace).Trim()); } }; <>c.<>9__55_1 = val; obj = (object)val; } Application.logMessageReceived += (LogCallback)obj; } settings.InitMenu(((BaseUnityPlugin)this).Config); bindActions.Clear(); MethodInfo[] methods = typeof(BindableFunctions).GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(BindableMethod), inherit: false); if (customAttributes.Any()) { BindAction bindAction = new BindAction((BindableMethod)customAttributes[0], methodInfo); bindActions.Add(bindAction.Name, bindAction); bindsByMethod.Add(methodInfo, bindAction); } } if (settings.FirstRun || settings.binds == null) { LogWarn("First run detected, setting default binds"); settings.FirstRun = false; settings.binds = new Dictionary(); settings.binds.Add("MODUI_TOGGLEALLUI", (KeyCode)283); } foreach (BindAction value2 in bindActions.Values) { string valueOrDefault = Localization.FallbackSheet.GetValueOrDefault(value2.Name); if (valueOrDefault != null && settings.binds.TryGetValue(valueOrDefault, out var value)) { settings.binds.TryAdd(value2.Name, value); settings.binds.Remove(valueOrDefault); } } if (!settings.binds.ContainsKey("MODUI_TOGGLEALLUI")) { LogWarn("Toggle All UI was unset, resetting to the default value"); settings.binds.Add("MODUI_TOGGLEALLUI", (KeyCode)283); } int num = (settings.NumPadForSaveStates ? 256 : 48); alphaKeyDict.Clear(); for (int j = 0; j < 10; j++) { alphaKeyDict.Add((KeyCode)(num + j), j); } SaveStateManager.Initialize(); TimeScale.Initialize(); new Harmony("io.github.hk-speedrunning.debugmod").PatchAll(); SceneManager.activeSceneChanged += LevelActivated; ModHooks.AfterSavegameLoadHook += LoadCharacter; ModHooks.NewGameHook += NewCharacter; ModHooks.BeforeSceneLoadHook += OnLevelUnload; ModHooks.TakeHealthHook += PlayerDamaged; ModHooks.ApplicationQuitHook += SaveSettings; ModHooks.FinishedLoadingModsHook += delegate { UICommon.LoadResources(); GUIController.Instance.BuildMenus(); SceneWatcher.Init(); }; KeyBindLock = false; Log("Initialized"); } private void OnEnable() { TimeScale.Initialize(); } private void OnDisable() { TimeScale.Reset(); } private void OnDestroy() { TimeScale.Release(); } public DebugMod() { instance = this; } private void LoadSettings() { try { if (!Directory.Exists(ModBaseDirectory)) { Directory.CreateDirectory(ModBaseDirectory); } string path = Path.Combine(ModBaseDirectory, "Settings.json"); if (File.Exists(path)) { settings = JsonConvert.DeserializeObject(File.ReadAllText(path)); if (settings == null) { settings = new Settings(); } Log("Loaded settings"); } } catch (Exception arg) { LogError($"Error loading settings: {arg}"); } } private void SaveSettings() { settings.binds = new Dictionary(settings.binds.OrderBy((KeyValuePair pair) => pair.Key)); try { File.WriteAllText(Path.Combine(ModBaseDirectory, "Settings.json"), JsonConvert.SerializeObject((object)settings, (Formatting)1)); Log("Saved settings"); } catch (Exception arg) { LogError($"Error saving settings: {arg}"); } } public static void UpdateBind(string name, KeyCode? key) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (key.HasValue) { settings.binds[name] = key.Value; } else { settings.binds.Remove(name); } DebugMod.bindUpdated?.Invoke(name, key); } private int PlayerDamaged(int damageAmount) { int num = ((!infiniteHP) ? damageAmount : 0); if (stateOnDeath && SaveState.loadingSavestate == null && PlayerData.instance.health - num <= 0) { SaveStateManager.LoadState(SaveStateManager.GetQuickState()); LogConsole("Lethal damage prevented, savestate loading"); return 0; } return num; } [HarmonyPatch(typeof(HeroController), "HazardRespawn")] [HarmonyPostfix] private static void OnHazardRespawn(HeroController __instance, IEnumerator __result) { CurrentHazardCoro = __result; } [HarmonyPatch(typeof(HeroController), "Invulnerable")] [HarmonyPostfix] private static void OnInvulnerable(HeroController __instance, IEnumerator __result) { CurrentInvulnCoro = __result; } private void NewCharacter() { LoadCharacter(null); } private void LoadCharacter(SaveGameData saveGameData) { ConsolePanel.Instance?.Reset(); playerInvincible = false; infiniteHP = false; infiniteSilk = false; noclip = false; extraNailDamage = 0; lastHit = null; lastDamage = 0; lastScaling = null; lastScaleLevel = 0; _loadingChar = true; } private void LevelActivated(Scene sceneFrom, Scene sceneTo) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) string name = ((Scene)(ref sceneTo)).name; if (_loadingChar) { string text = TimeSpan.FromSeconds(PlayerData.instance.playTime).ToString("hh\\:mm\\:ss"); LogConsole("DebugMod " + Version + " on Silksong " + Constants.GetConstantValue("GAME_VERSION")); LogConsole($"\tSave slot: {PlayerData.instance.profileID}"); LogConsole("\tProfile playtime: " + text); LogConsole($"\tCompletion: {PlayerData.instance.completionPercentage}%"); GUIController.Instance.respawnSceneWatch = PlayerData.instance.respawnScene; _loadingChar = false; } if (Object.op_Implicit((Object)(object)GM) && GM.IsGameplayScene()) { _loadTime = Time.realtimeSinceStartup; LogConsole("New scene loaded: " + name); PlayerDeathWatcher.Reset(); VisualMaskHelper.OnSceneChange(sceneTo); } } private string OnLevelUnload(string toScene) { _unloadTime = Time.realtimeSinceStartup; return toScene; } public static string GetSceneName() { if ((Object)(object)GM == (Object)null) { LogWarn("GameManager reference is null in GetSceneName"); return ""; } return GM.GetSceneNameString(); } public static float GetLoadTime() { return (float)Math.Round(_loadTime - _unloadTime, 2); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static int Get_NailDamage(int nailDamage) { return nailDamage + extraNailDamage; } [HarmonyPatch(typeof(HealthManager), "TakeDamage")] [HarmonyPrefix] private static void TakeDamage(HealthManager __instance, HitInstance hitInstance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Invalid comparison between Unknown and I4 HitInstance val = __instance.ApplyDamageScaling(hitInstance); lastHit = val; lastDamage = (__instance.damageOverride ? 1 : Mathf.RoundToInt((float)val.DamageDealt * val.Multiplier)); lastScaling = __instance.damageScaling; int num = hitInstance.DamageScalingLevel - 1; if (hitInstance.IsUsingNeedleDamageMult) { num = PlayerData.instance.nailUpgrades; } else if (Object.op_Implicit((Object)(object)hitInstance.RepresentingTool) && (int)hitInstance.RepresentingTool.Type != 3) { num = PlayerData.instance.ToolKitUpgrades; } lastScaleLevel = num; } [HarmonyPatch(typeof(SurfaceWaterRegion), "OnTriggerEnter2D")] [HarmonyPrefix] private static void OnTriggerEnter2D_Prefix(Collider2D collision) { if (Object.op_Implicit((Object)(object)((Component)collision).gameObject.GetComponent()) && playerInvincible) { PlayerData.instance.isInvincible = false; } } [HarmonyPatch(typeof(SurfaceWaterRegion), "OnTriggerEnter2D")] [HarmonyPostfix] private static void OnTriggerEnter2D_Postfix() { if (playerInvincible) { PlayerData.instance.isInvincible = true; } } [HarmonyPatch(typeof(HeroWaterController), "TumbleOut")] [HarmonyPrefix] private static bool HeroWaterController_TumbleOut_Prefix(HeroWaterController __instance) { if (SaveState.loadingSavestate == null) { return true; } __instance.ExitedWater(true); return false; } [HarmonyPatch(typeof(HeroController), "TakeDamage")] [HarmonyPrefix] private static bool HeroController_TakeDamage(GameObject go, HazardType hazardType) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (playerInvincible && !noclip && (int)hazardType == 4 && ((Object)go).name.Contains("Lava Box")) { HeroController.instance.ShroomBounce(); return false; } return true; } [HarmonyPatch(typeof(HeroController), "TakeSilk", new Type[] { typeof(int), typeof(SilkTakeSource) })] [HarmonyPrefix] private static void TakeSilk(ref int amount) { if (infiniteSilk) { amount = 0; } } [HarmonyPatch(typeof(HeroController), "DoSpecialDamage")] [HarmonyPrefix] private static bool HeroController_DoSpecialDamage() { return !playerInvincible; } [HarmonyPatch(typeof(HeroController), "CanBeBarnacleGrabbed")] [HarmonyPrefix] private static bool HeroController_CanBeBarnacleGrabbed(ref bool __result) { if (playerInvincible) { __result = false; return false; } return true; } [PublicAPI] public static void AddToKeyBindList(Type BindableFunctionsClass) { MethodInfo[] methods = BindableFunctionsClass.GetMethods(BindingFlags.Static | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { BindableMethod customAttribute = methodInfo.GetCustomAttribute(inherit: false); if (customAttribute != null) { Log("Adding new keybind: " + customAttribute.name + " (from " + BindableFunctionsClass.Name + ")"); BindAction bindAction = new BindAction(customAttribute, methodInfo); bindActions.Add(bindAction.Name, bindAction); bindsByMethod.Add(methodInfo, bindAction); } } } [PublicAPI] public static void AddActionToKeyBindList(Action method, string name, string category) { AddActionToKeyBindList(method, name, category, allowLock: true); } [PublicAPI] public static void AddActionToKeyBindList(Action method, string name, string category, bool allowLock) { Log("Adding new keybind: " + name); BindAction bindAction = new BindAction(name, category, allowLock, method); bindActions.Add(bindAction.Name, bindAction); bindsByMethod.Add(method.Method, bindAction); } [PublicAPI] public static void AddTextToInfoPanel(string label, Func dataGenerator, InfoPanelColumn column = InfoPanelColumn.LEFT) { ((column == InfoPanelColumn.LEFT) ? InfoPanel.LeftColumnInjects : InfoPanel.RightColumnInjects).Add(new InfoPanel.InjectedInfo(label, dataGenerator)); } [PublicAPI] public static void AddTranslationSheet(string sheet) { Localization.AddSheet(sheet); } public static void LogDebug(string message) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)message); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } public static void LogWarn(string message) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)message); } public static void LogError(string message) { ((BaseUnityPlugin)instance).Logger.LogError((object)message); } public static void LogConsole(string message) { ConsolePanel.Log(message); } } [HarmonyPatch] public class GUIController : MonoBehaviour { public Vector3 hazardLocation; public string respawnSceneWatch; private static readonly HitboxViewer hitboxes = new HitboxViewer(); private KeyCode keyWarning; private Size resolution; internal LanguageCode language; private bool benchwarpShifted; private float? lastRescale; private const float RebuildDelay = 0.1f; internal float? savestatePageUpdateTime; private const float SavestatePageUpdateDelay = 2f; public GameObject canvas; private readonly Array allKeyCodes = Enum.GetValues(typeof(KeyCode)); private readonly List UnbindableKeys = new List { (KeyCode)323 }; [CompilerGenerated] private static GUIController k__BackingField; public static GUIController Instance { get { //IL_001b: 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_0030: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)k__BackingField)) { DebugMod.Log("Creating new GUIController"); GameObject val = new GameObject("GUIController"); k__BackingField = val.AddComponent(); Object.DontDestroyOnLoad((Object)val); } return k__BackingField; } } public static bool ForceHideUI() { if (DebugMod.GM.IsNonGameplayScene()) { return true; } if (SaveState.loadingSavestate != null) { return true; } return false; } public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) hazardLocation = PlayerData.instance.hazardRespawnLocation; respawnSceneWatch = PlayerData.instance.respawnScene; } public void BuildMenus() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)canvas)) { foreach (EnemyHandle item in EnemiesPanel.enemyPool) { item.DestroyUI(); } Object.Destroy((Object)(object)canvas); CanvasNode.allNodes.Clear(); } canvas = new GameObject("DebugModCanvas"); canvas.SetActive(false); canvas.AddComponent().renderMode = (RenderMode)0; canvas.AddComponent(); RectTransform component = canvas.GetComponent(); Vector2 anchorMin = (component.anchorMax = Vector2.zero); component.anchorMin = anchorMin; component.pivot = Vector2.zero; component.sizeDelta = new Vector2((float)Screen.width, (float)Screen.height); Object.DontDestroyOnLoad((Object)(object)canvas); MainPanel.BuildPanel(); EnemiesPanel.BuildPanel(); ConsolePanel.BuildPanel(); InfoPanel.BuildPanel(); SaveStatesPanel.BuildPanel(); CanvasButton.BuildHoverBorder(); KeybindDialog.BuildPanel(); ConfirmDialog.BuildPanel(); resolution = new Size(Screen.width, Screen.height); language = GetLanguage(); benchwarpShifted = false; DebugMod.LogDebug("UI built"); } catch (Exception arg) { DebugMod.LogError($"Error building UI: {arg}"); } } private LanguageCode GetLanguage() { //IL_0017: 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) if (InteropHelper.IsModInstalled(InteropHelper.I18NModId, "1.1.0")) { return I18NInterop.GetLanguage(); } return Language.CurrentLanguage(); } public void Update() { //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: 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) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)DebugMod.GM == (Object)null) { return; } Profiler.NewFrame(); if (!resolution.IsEmpty && (resolution.Width != Screen.width || resolution.Height != Screen.height)) { resolution = new Size(Screen.width, Screen.height); lastRescale = Time.realtimeSinceStartup; } if (lastRescale.HasValue && Time.realtimeSinceStartup > lastRescale + 0.1f) { DebugMod.LogDebug($"Resize complete, rebuilding for new resolution ({Screen.width}, {Screen.height})"); lastRescale = null; BuildMenus(); } if (InteropHelper.IsModInstalled(InteropHelper.BenchwarpModId)) { bool flag = GameManager.instance.IsGamePaused() && !GameManager.instance.IsNonGameplayScene(); if (flag != benchwarpShifted) { benchwarpShifted = flag; int num = UICommon.ScaleHeight(50); if (benchwarpShifted) { MainPanel.Instance.LayoutTabsSide(num); SaveStatesPanel instance = SaveStatesPanel.Instance; instance.LocalPosition += new Vector2(0f, (float)num); } else { MainPanel.Instance.LayoutTabsNormal(); SaveStatesPanel instance2 = SaveStatesPanel.Instance; instance2.LocalPosition -= new Vector2(0f, (float)num); } } } if (ForceHideUI()) { canvas.SetActive(false); } else { canvas.SetActive(true); MainPanel instance3 = MainPanel.Instance; if (instance3 != null) { instance3.ActiveSelf = DebugMod.settings.MainPanelVisible; } EnemiesPanel instance4 = EnemiesPanel.Instance; if (instance4 != null) { instance4.ActiveSelf = DebugMod.settings.EnemiesPanelVisible; } ConsolePanel instance5 = ConsolePanel.Instance; if (instance5 != null) { instance5.ActiveSelf = DebugMod.settings.ConsoleVisible; } InfoPanel instance6 = InfoPanel.Instance; if (instance6 != null) { instance6.ActiveSelf = DebugMod.settings.InfoPanelVisible; } SaveStatesPanel instance7 = SaveStatesPanel.Instance; if (instance7 != null) { instance7.ActiveSelf = SaveStatesPanel.ShouldBeVisible; } int num2 = 0; while (num2 < CanvasNode.allNodes.Count) { CanvasNode canvasNode = CanvasNode.allNodes[num2]; if (canvasNode.ActiveSelf) { canvasNode.Update(); num2++; } else { num2 += canvasNode.childCount; } } } GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject; if (Object.op_Implicit((Object)(object)currentSelectedGameObject) && Object.op_Implicit((Object)(object)currentSelectedGameObject.GetComponent()) && !Object.op_Implicit((Object)(object)currentSelectedGameObject.GetComponent())) { EventSystem.current.SetSelectedGameObject((GameObject)null); } if (DebugMod.GetSceneName() == "Menu_Title") { return; } LanguageCode val = GetLanguage(); if (language != val) { DebugMod.LogDebug($"Detected language change from {language} to {val}, rebuilding UI"); BuildMenus(); } if (!CanvasTextField.AnyFieldFocused) { HandleKeybinds(); } if (savestatePageUpdateTime.HasValue && Time.realtimeSinceStartup > savestatePageUpdateTime + 2f) { savestatePageUpdateTime = null; SaveStateManager.LoadFileStates(); SaveStatesPanel.Instance?.PageCountChanged(); } if (DebugMod.infiniteSilk && PlayerData.instance.silk < PlayerData.instance.silkMax && PlayerData.instance.health > 0 && (Object)(object)HeroController.instance != (Object)null && !HeroController.instance.cState.dead && GameManager.instance.IsGameplayScene()) { PlayerData.instance.silk = PlayerData.instance.silkMax; HeroController.instance.AddSilk(1, false); } if (DebugMod.infiniteTools && Object.op_Implicit((Object)(object)ManagerSingleton.Instance) && Object.op_Implicit((Object)(object)ManagerSingleton.Instance.toolItems)) { foreach (ToolItem item in (NamedScriptableObjectList)(object)ManagerSingleton.Instance.toolItems) { if (Object.op_Implicit((Object)(object)item)) { Data savedData = item.SavedData; int amountLeft = savedData.AmountLeft; savedData.AmountLeft = ToolItemManager.GetToolStorageAmount(item); item.SavedData = savedData; AttackToolBinding? attackToolBinding = ToolItemManager.GetAttackToolBinding(item); if (attackToolBinding.HasValue && amountLeft != savedData.AmountLeft) { ToolItemManager.ReportBoundAttackToolUpdated(attackToolBinding.Value); } } } } if (DebugMod.playerInvincible && PlayerData.instance != null) { PlayerData.instance.isInvincible = true; } if (DebugMod.noclip) { Vector3 val2 = Vector3.zero; float num3 = (Input.GetKey((KeyCode)304) ? 40f : 20f) * DebugMod.settings.NoClipSpeedModifier * Time.deltaTime; if (((OneAxisInputControl)DebugMod.IH.inputActions.Left).IsPressed) { val2 += Vector3.left * num3; } if (((OneAxisInputControl)DebugMod.IH.inputActions.Right).IsPressed) { val2 += Vector3.right * num3; } if (((OneAxisInputControl)DebugMod.IH.inputActions.Up).IsPressed) { val2 += Vector3.up * num3; } if (((OneAxisInputControl)DebugMod.IH.inputActions.Down).IsPressed) { val2 += Vector3.down * num3; } DebugMod.noclipPos += val2; if ((int)HeroController.instance.transitionState == 0 && SaveState.loadingSavestate == null) { DebugMod.RefKnight.transform.position = DebugMod.noclipPos; Rigidbody2D component = DebugMod.RefKnight.GetComponent(); component.constraints = (RigidbodyConstraints2D)(component.constraints | 3); } else { DebugMod.noclipPos = DebugMod.RefKnight.transform.position; Rigidbody2D component2 = DebugMod.RefKnight.GetComponent(); component2.constraints = (RigidbodyConstraints2D)(component2.constraints & -4); } } if (DebugMod.heroColliderDisabled) { HeroBox.Inactive = true; } if (DebugMod.cameraFollow) { DebugMod.RefCamera.isGameplayScene = false; DebugMod.RefCamera.SnapTo(DebugMod.RefKnight.transform.position.x, DebugMod.RefKnight.transform.position.y); } if (PlayerData.instance.hazardRespawnLocation != hazardLocation) { hazardLocation = PlayerData.instance.hazardRespawnLocation; DebugMod.LogConsole($"Hazard respawn location updated: {hazardLocation}"); } if (respawnSceneWatch != PlayerData.instance.respawnScene) { respawnSceneWatch = PlayerData.instance.respawnScene; DebugMod.LogConsole("Save respawn updated:"); DebugMod.LogConsole("\tNew Scene: " + PlayerData.instance.respawnScene); DebugMod.LogConsole("\tMap zone: " + GameManager.instance.GetCurrentMapZone()); DebugMod.LogConsole("\tRespawn marker: " + PlayerData.instance.respawnMarkerName); } if (HitboxViewer.State != DebugMod.settings.ShowHitBoxes) { if (DebugMod.settings.ShowHitBoxes != 0) { hitboxes.Load(); } else if (HitboxViewer.State != 0 && DebugMod.settings.ShowHitBoxes == 0) { hitboxes.Unload(); } } } private void HandleKeybinds() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Invalid comparison between Unknown and I4 //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < DebugMod.settings.binds.Count; i++) { KeyValuePair keyValuePair = DebugMod.settings.binds.ElementAt(i); string key = keyValuePair.Key; KeyCode value = keyValuePair.Value; if (!DebugMod.bindActions.ContainsKey(key)) { continue; } if ((int)value == 0) { foreach (KeyCode allKeyCode in allKeyCodes) { if (!Input.GetKeyDown(allKeyCode) || UnbindableKeys.Contains(allKeyCode)) { continue; } if (keyWarning != allKeyCode) { foreach (string key2 in DebugMod.bindActions.Keys) { if (DebugMod.settings.binds.TryGetValue(key2, out var value2) && value2 == allKeyCode) { DebugMod.LogConsole($"{(object)allKeyCode} already bound to {key2}, press again to confirm"); keyWarning = allKeyCode; } } if (keyWarning == allKeyCode) { break; } } keyWarning = (KeyCode)0; if ((int)allKeyCode == 27) { DebugMod.UpdateBind(key, null); i--; DebugMod.LogWarn("The key " + Enum.GetName(typeof(KeyCode), (object)allKeyCode) + " has been unbound from " + key); } else if ((int)allKeyCode != 27) { DebugMod.UpdateBind(key, (KeyCode?)allKeyCode); } break; } } else { if (!Input.GetKeyDown(value)) { continue; } try { if (DebugMod.bindActions.TryGetValue(key, out var value3) && (!DebugMod.KeyBindLock || (DebugMod.KeyBindLock && !value3.AllowLock))) { value3.Action(); } } catch (Exception ex) { DebugMod.LogError("Error running keybind method " + key + ":\n" + ex.ToString()); } } } } [HarmonyPatch(typeof(InputHandler), "SetCursorVisible")] [HarmonyPrefix] private static void SetCursorVisible(ref bool value) { if (DebugMod.settings.ShowCursorWhileUnpaused) { UIManager.instance.inputModule.allowMouseInput = true; value = true; } } } [HarmonyPatch] internal static class ModHooks { [CompilerGenerated] private sealed class d__37 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public IEnumerator orig; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = orig; <>1__state = 1; return true; case 1: <>1__state = -1; ModHooks.NewGameHook?.Invoke(); 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(); } } private static bool finishedLoadingModsInvoked; public static event Action AfterSavegameLoadHook; public static event Action ApplicationQuitHook; public static event Action BeforePlayerDeadHook; public static event Func BeforeSceneLoadHook; public static event Action ColliderCreateHook; public static event Action CursorHook; private static event Action finishedLoadingModsHook; public static event Action FinishedLoadingModsHook { add { finishedLoadingModsHook += value; if (finishedLoadingModsInvoked) { value(); } } remove { finishedLoadingModsHook -= value; } } public static event Action NewGameHook; public static event Func TakeHealthHook; [HarmonyPatch(typeof(GameManager), "SetLoadedGameData", new Type[] { typeof(SaveGameData), typeof(int) })] [HarmonyPostfix] private static void GameManager_SetLoadedGameData(SaveGameData saveGameData) { ModHooks.AfterSavegameLoadHook?.Invoke(saveGameData); } [HarmonyPatch(typeof(GameManager), "OnApplicationQuit")] [HarmonyPostfix] private static void GameManager_OnApplicationQuit() { ModHooks.ApplicationQuitHook?.Invoke(); } [HarmonyPatch(typeof(GameManager), "PlayerDead")] [HarmonyPrefix] private static void GameManager_PlayerDead() { ModHooks.BeforePlayerDeadHook?.Invoke(); } [HarmonyPatch(typeof(GameManager), "BeginSceneTransition")] [HarmonyPrefix] private static void GameManager_BeginSceneTransition(SceneLoadInfo info) { if (ModHooks.BeforeSceneLoadHook != null) { info.SceneName = ModHooks.BeforeSceneLoadHook(info.SceneName); } } [HarmonyPatch(typeof(GameManager), "LoadScene")] [HarmonyPrefix] private static void GameManager_LoadScene(ref string destScene) { if (ModHooks.BeforeSceneLoadHook != null) { destScene = ModHooks.BeforeSceneLoadHook(destScene); } } [HarmonyPatch(typeof(GameManager), "LoadSceneAdditive")] [HarmonyPrefix] private static void GameManager_LoadSceneAdditive(ref string destScene) { if (ModHooks.BeforeSceneLoadHook != null) { destScene = ModHooks.BeforeSceneLoadHook(destScene); } } [HarmonyPatch(typeof(PlayMakerUnity2DProxy), "Start")] [HarmonyPostfix] private static void PlayMakerUnity2DProxy_Start(PlayMakerUnity2DProxy __instance) { ModHooks.ColliderCreateHook?.Invoke(((Component)__instance).gameObject); } [HarmonyPatch(typeof(InputHandler), "Update")] [HarmonyPostfix] private static void InputHandler_Update() { ModHooks.CursorHook?.Invoke(); } [HarmonyPatch(typeof(OnScreenDebugInfo), "Awake")] [HarmonyPrefix] private static void OnScreenDebugInfo_Awake() { if (!finishedLoadingModsInvoked) { finishedLoadingModsInvoked = true; ModHooks.finishedLoadingModsHook?.Invoke(); } } [IteratorStateMachine(typeof(d__37))] [HarmonyPatch(typeof(GameManager), "LoadFirstScene")] [HarmonyPostfix] private static IEnumerator GameManager_LoadFirstScene(IEnumerator orig) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(0) { orig = orig }; } [HarmonyPatch(typeof(GameManager), "OnWillActivateFirstLevel")] [HarmonyPostfix] private static void GameManager_OnWillActivateFirstLevel() { ModHooks.NewGameHook?.Invoke(); } [HarmonyPatch(typeof(PlayerData), "TakeHealth")] [HarmonyPrefix] private static void PlayerData_TakeHealth(ref int amount) { if (ModHooks.TakeHealthHook != null) { amount = ModHooks.TakeHealthHook(amount); } } } public static class PlayerDeathWatcher { public static bool playerDead; static PlayerDeathWatcher() { ModHooks.BeforePlayerDeadHook += SetPlayerDead; } private static void SetPlayerDead() { playerDead = true; LogDeathDetails(); } public static void Reset() { playerDead = false; } public static void LogDeathDetails() { DebugMod.LogConsole("Hero death detected"); DebugMod.LogConsole($"\tGame playtime: {PlayerData.instance.playTime}"); DebugMod.LogConsole("\tRespawn scene: " + PlayerData.instance.respawnScene); DebugMod.LogConsole("\tCocoon scene: " + PlayerData.instance.HeroCorpseScene); DebugMod.LogConsole($"\tCocoon rosaries: {PlayerData.instance.HeroCorpseMoneyPool}"); } } public class Settings { private static ConfigEntry toggleAllUI; private static ConfigEntry noclipSpeedModifier; private static ConfigEntry altInfoPanel; private static ConfigEntry expandedInfoPanel; private static ConfigEntry maxSavestatePages; private static ConfigEntry numpadForSavestates; private static ConfigEntry safeSavestateLoading; [JsonProperty(ItemConverterType = typeof(StringEnumConverter))] public Dictionary binds = new Dictionary(); public bool FirstRun = true; public bool MainPanelVisible = true; public string MainPanelCurrentTab; public bool EnemiesPanelVisible = true; public bool ConsoleVisible = true; public bool InfoPanelVisible = true; public bool SaveStatePanelVisible = true; public bool SaveStatePanelExpanded; public bool NumPadForSaveStates; public int ShowHitBoxes; public int MaxSavePages = 10; public float NoClipSpeedModifier = 1f; public bool ShowCursorWhileUnpaused; public bool SafeSaveStateLoading; public bool LogUnityExceptions = true; public bool AltInfoPanel; public bool ExpandedInfoPanel; internal void InitMenu(ConfigFile config) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) config.SaveOnConfigSet = false; string toggleAllUIName = "MODUI_TOGGLEALLUI"; toggleAllUI = config.Bind("General", "Toggle All UI Keybind", (KeyCode)283, "Press this key to toggle DebugMod's UI."); toggleAllUI.Value = binds.GetValueOrDefault(toggleAllUIName, (KeyCode)0); toggleAllUI.SettingChanged += delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((int)toggleAllUI.Value == 0) { DebugMod.UpdateBind(toggleAllUIName, null); } else { DebugMod.UpdateBind(toggleAllUIName, toggleAllUI.Value); } }; DebugMod.bindUpdated += delegate(string name, KeyCode? key) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (name == toggleAllUIName) { toggleAllUI.Value = key.GetValueOrDefault(); } }; noclipSpeedModifier = config.Bind("General", "Noclip Speed Multiplier", 1f, "You can also hold shift in noclip to get an additional 2x multiplier."); noclipSpeedModifier.Value = NoClipSpeedModifier; noclipSpeedModifier.SettingChanged += delegate { NoClipSpeedModifier = noclipSpeedModifier.Value; }; altInfoPanel = config.Bind("General", "Alternate Info Panel Style", false, "Adds some decoration to the info panel."); altInfoPanel.Value = AltInfoPanel; altInfoPanel.SettingChanged += delegate { if (AltInfoPanel != altInfoPanel.Value) { AltInfoPanel = altInfoPanel.Value; InfoPanel.Instance.Destroy(); InfoPanel.BuildPanel(); } }; expandedInfoPanel = config.Bind("General", "Expanded Info Panel", false, "Shows additional niche info on the info panel."); expandedInfoPanel.Value = ExpandedInfoPanel; expandedInfoPanel.SettingChanged += delegate { if (ExpandedInfoPanel != expandedInfoPanel.Value) { ExpandedInfoPanel = expandedInfoPanel.Value; InfoPanel.Instance.Destroy(); InfoPanel.BuildPanel(); } }; maxSavestatePages = config.Bind("Savestates", "Number of Savestate Pages", 10, "The number of pages of available savestates."); maxSavestatePages.Value = MaxSavePages; maxSavestatePages.SettingChanged += delegate { if (maxSavestatePages.Value > 0) { MaxSavePages = maxSavestatePages.Value; GUIController instance = GUIController.Instance; if (instance != null) { instance.savestatePageUpdateTime = Time.realtimeSinceStartup; } } }; numpadForSavestates = config.Bind("Savestates", "Savestate Numpad Hotkeys", false, "Use the numpad keys instead of the regular number keys to select file states in the savestate panel. Takes effect on restart."); numpadForSavestates.Value = NumPadForSaveStates; numpadForSavestates.SettingChanged += delegate { NumPadForSaveStates = numpadForSavestates.Value; }; safeSavestateLoading = config.Bind("Savestates", "Safe Savestate Loading", false, "Fixes some obscure issues when using savestates, but makes loading take longer."); safeSavestateLoading.Value = SafeSaveStateLoading; safeSavestateLoading.SettingChanged += delegate { SafeSaveStateLoading = safeSavestateLoading.Value; }; } } } namespace DebugMod.UI { public class CanvasDialog : CanvasPanel { private CanvasNode anchor; private Vector2 anchorPos; private bool initialClickEnded; public CanvasDialog(string name) : base(name) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) base.ActiveSelf = false; base.OnUpdate += DoUpdate; UICommon.AddBackground(this); Get("Background").SetImage(UICommon.dialogBG); } private void DoUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (initialClickEnded && !IsMouseOver() && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))) { Hide(); } else if (anchor != null && (anchor.Position != anchorPos || !anchor.ActiveInHierarchy)) { Hide(); } if (Input.GetMouseButtonUp(0)) { initialClickEnded = true; } } protected bool TryToggle(CanvasNode anchor) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003f: 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_007c: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (base.ActiveInHierarchy && this.anchor == anchor) { Hide(); return false; } this.anchor = anchor; anchorPos = anchor.Position; initialClickEnded = false; float num = (int)(anchor.Position.x + anchor.Size.x - (float)UICommon.Margin); float num2 = num + base.Size.x - (float)(Screen.width - UICommon.Margin); if (num2 > 0f) { num -= num2; } float num3 = (int)(anchor.Position.y + anchor.Size.y - (float)UICommon.Margin); float num4 = num3 + base.Size.y - (float)(Screen.height - UICommon.Margin); if (num4 > 0f) { num3 -= num4; } base.LocalPosition = new Vector2(num, num3); base.ActiveSelf = true; return true; } public void Hide() { anchor = null; base.ActiveSelf = false; } } public class ConfirmDialog : CanvasDialog { private readonly CanvasText prompt; private Action onAccept; private Action onReject; public static int PanelWidth => UICommon.ScaleWidth(150); public static int PromptHeight => UICommon.ScaleHeight(18); public static ConfirmDialog Instance { get; private set; } public static void BuildPanel() { Instance = new ConfirmDialog(); Instance.Build(); } public ConfirmDialog() : base("ConfirmDialog") { //IL_0017: Unknown result type (might be due to invalid IL or missing references) base.Size = new Vector2((float)PanelWidth, 0f); using PanelBuilder panelBuilder = new PanelBuilder(this); panelBuilder.DynamicLength = true; panelBuilder.Padding = UICommon.Margin; prompt = panelBuilder.AppendFixed(new CanvasText("Prompt", (HorizontalWrapMode)0), PromptHeight); prompt.Alignment = (TextAnchor)4; using PanelBuilder panelBuilder2 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel("Row"), UICommon.ControlHeight)); panelBuilder2.Horizontal = true; panelBuilder2.InnerPadding = UICommon.Margin; CanvasButton canvasButton = panelBuilder2.AppendFlex(new CanvasButton("Yes")); canvasButton.Text.Text = Localization.Get("CONFIRM_YES"); canvasButton.OnClicked += delegate { onAccept(); Hide(); }; CanvasButton canvasButton2 = panelBuilder2.AppendFlex(new CanvasButton("No")); canvasButton2.Text.Text = Localization.Get("CONFIRM_NO"); canvasButton2.OnClicked += delegate { onReject(); Hide(); }; } public void Toggle(CanvasNode anchor, string prompt, Action onAccept, Action onReject) { if (TryToggle(anchor)) { this.prompt.Text = prompt; this.onAccept = onAccept; this.onReject = onReject; } } } public class ConsolePanel : CanvasPanel { public const int MAX_LINES = 15; private static readonly List history = new List(); private static readonly List messageQueue = new List(); private readonly List lines = new List(); public static ConsolePanel Instance { get; private set; } public static void BuildPanel() { Instance = new ConsolePanel(); Instance.Build(); } public static void Log(string message) { if (Instance != null) { Instance.AddLine(message); } else { messageQueue.Add(message); } } public ConsolePanel() : base("ConsolePanel") { //IL_002f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) base.LocalPosition = new Vector2((float)UICommon.ScreenMargin, (float)(Screen.height - UICommon.ScreenMargin - UICommon.ConsoleHeight)); base.Size = new Vector2((float)UICommon.LeftSideWidth, (float)UICommon.ConsoleHeight); CanvasBorder canvasBorder = Add(new CanvasBorder("Border")); canvasBorder.LocalPosition = new Vector2(0f, (float)UICommon.Margin / 2f); canvasBorder.Size = new Vector2(base.Size.x, base.Size.y - (float)UICommon.Margin); canvasBorder.Sides = BorderSides.LEFT; canvasBorder.Color = UICommon.iconColor; float num = (base.Size.y - (float)(UICommon.Margin * 2)) / 15f; for (int i = 0; i < 15; i++) { CanvasText canvasText = Add(new CanvasText(i.ToString(), (HorizontalWrapMode)0)); canvasText.LocalPosition = new Vector2((float)UICommon.Margin, (float)UICommon.Margin + num * (float)i); canvasText.Size = new Vector2(base.Size.x - (float)(UICommon.Margin * 2), num); lines.Add(canvasText); } foreach (string item in messageQueue) { AddLine(item); } messageQueue.Clear(); UpdateText(); } private void UpdateText() { int i = 0; for (int j = Math.Max(history.Count - 15, 0); j < history.Count; j++) { lines[i].Text = history[j]; i++; } for (; i < 15; i++) { lines[i].Text = ""; } } public void Reset() { history.Clear(); UpdateText(); } public void AddLine(string chatLine) { while (history.Count > 1000) { history.RemoveAt(0); } for (int num = WrapIndex(chatLine); num != -1; num = WrapIndex(chatLine)) { int num2 = chatLine.LastIndexOf(' ', num, num); if (num2 == -1) { break; } history.Add(chatLine.Substring(0, num2)); chatLine = chatLine.Substring(num2 + 1); } history.Add(chatLine); UpdateText(); } private int WrapIndex(string message) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) CanvasText canvasText = lines[0]; int num = 0; char[] array = message.ToCharArray(); CharacterInfo val = default(CharacterInfo); for (int i = 0; i < array.Length; i++) { char c = array[i]; canvasText.Font.GetCharacterInfo(c, ref val, canvasText.FontSize); num += ((CharacterInfo)(ref val)).advance; if ((float)num >= canvasText.Size.x) { return i; } } return -1; } } public class EnemiesPanel : CanvasPanel { public static readonly List enemyPool = new List(); public static bool hpBars; private readonly List listings = new List(); private readonly CanvasPanel listingsPanel; public static int ListingHeight => UICommon.ScaleHeight(16); public static EnemiesPanel Instance { get; private set; } public static void BuildPanel() { Instance = new EnemiesPanel(); Instance.Build(); } public EnemiesPanel() : base("EnemiesPanel") { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) EnemiesPanel enemiesPanel = this; base.LocalPosition = new Vector2((float)(Screen.width - UICommon.ScreenMargin - UICommon.RightSideWidth), (float)(UICommon.MainPanelHeight + UICommon.ScreenMargin * 2)); base.Size = new Vector2((float)UICommon.RightSideWidth, (float)(Screen.height - UICommon.MainPanelHeight - UICommon.ScreenMargin * 3)); base.OnUpdate += DoUpdate; UICommon.AddBackground(this); using PanelBuilder panelBuilder = new PanelBuilder(this); panelBuilder.OuterPadding = ContentMargin(UICommon.Margin); panelBuilder.InnerPadding = UICommon.Margin; CanvasScrollView canvasScrollView = panelBuilder.AppendFlex(new CanvasScrollView("ListingsScrollView")); canvasScrollView.Margin = new Vector2(-1f, -1f); listingsPanel = canvasScrollView.SetContent(new CanvasPanel("Listings")); listingsPanel.Size = canvasScrollView.Size; using PanelBuilder panelBuilder2 = new PanelBuilder(listingsPanel); panelBuilder2.DynamicLength = true; panelBuilder2.InnerPadding = UICommon.Margin; for (int i = 0; i < 100; i++) { int index = listings.Count; CanvasPanel canvasPanel = panelBuilder2.AppendFixed(new CanvasPanel($"{index + 1}"), ListingHeight); canvasPanel.CollapseMode = CollapseMode.Deny; listings.Add(canvasPanel); using PanelBuilder panelBuilder3 = new PanelBuilder(canvasPanel); panelBuilder3.Horizontal = true; CanvasText enemyName = panelBuilder3.AppendFlex(new CanvasText("EnemyName", (HorizontalWrapMode)0)); enemyName.Alignment = (TextAnchor)3; enemyName.OnUpdate += delegate { if (enemyPool.Count > index) { enemyName.Text = enemyPool[index].Name; } }; CanvasText enemyHp = panelBuilder3.AppendFixed(new CanvasText("EnemyHP", (HorizontalWrapMode)0), UICommon.ScaleWidth(80)); enemyHp.Alignment = (TextAnchor)3; enemyHp.OnUpdate += delegate { if (enemyPool.Count > index) { enemyHp.Text = $"{enemyPool[index].HP}/{enemyPool[index].MaxHP}"; } }; CanvasButton canvasButton = panelBuilder3.AppendSquare(new CanvasButton("Delete")); canvasButton.ImageOnly(UICommon.images["IconX"]); canvasButton.OnClicked += delegate { if (enemyPool.Count > index) { EnemyHandle enemyHandle3 = enemyPool[index]; Object.DestroyImmediate((Object)(object)((Component)enemyHandle3).gameObject); DebugMod.LogConsole("Destroyed " + enemyHandle3.Name); } }; panelBuilder3.AppendPadding(UICommon.Margin); CanvasButton canvasButton2 = panelBuilder3.AppendSquare(new CanvasButton("Clone")); canvasButton2.ImageOnly(UICommon.images["IconPlus"]); canvasButton2.OnClicked += delegate { //IL_002f: 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) if (enemyPool.Count > index) { EnemyHandle enemyHandle2 = enemyPool[index]; Object.Instantiate(((Component)enemyHandle2).gameObject, ((Component)enemyHandle2).transform.position, ((Component)enemyHandle2).transform.rotation); DebugMod.LogConsole("Cloned " + enemyHandle2.Name); } }; panelBuilder3.AppendPadding(UICommon.Margin); CanvasButton canvasButton3 = panelBuilder3.AppendSquare(new CanvasButton("InfiniteHealth")); canvasButton3.ImageOnly(UICommon.images["IconShield"]); canvasButton3.OnClicked += delegate { if (enemyPool.Count > index) { EnemyHandle enemyHandle = enemyPool[index]; enemyHandle.HP = 9999; DebugMod.LogConsole("Set " + enemyHandle.Name + " HP to 9999"); } }; } using PanelBuilder panelBuilder4 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel("Footer"), UICommon.ControlHeight)); panelBuilder4.Horizontal = true; panelBuilder4.AppendPadding(UICommon.Margin); CanvasText overflow = panelBuilder4.AppendFlex(new CanvasText("Overflow", (HorizontalWrapMode)0)); overflow.Alignment = (TextAnchor)3; overflow.OnUpdate += delegate { if (enemyPool.Count == 0) { overflow.Text = Localization.Get("ENEMIESPANEL_NOENEMIES"); } else if (enemyPool.Count > enemiesPanel.listings.Count) { overflow.Text = string.Format(Localization.Get("ENEMIESPANEL_OVERFLOWFORMAT"), enemyPool.Count - enemiesPanel.listings.Count); } else { overflow.Text = ""; } }; CanvasButton hpBarsButton = panelBuilder4.AppendFixed(new CanvasButton("HPBars"), UICommon.ScaleWidth(100)); hpBarsButton.Text.Text = Localization.Get("ENEMIESPANEL_HPBARS"); hpBarsButton.OnUpdate += delegate { hpBarsButton.Toggled = hpBars; }; hpBarsButton.OnClicked += BindableFunctions.ToggleEnemyHPBars; UICommon.AppendKeybindButton(panelBuilder4, DebugMod.bindActions["ENEMIES_TOGGLEHPBARS"]); } private void DoUpdate() { //IL_00a9: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) enemyPool.RemoveAll((EnemyHandle handle) => !Object.op_Implicit((Object)(object)handle) && !((Component)handle).gameObject.activeSelf); int num = (ActivelyUpdating() ? enemyPool.Count : 0); for (int i = 0; i < listings.Count; i++) { listings[i].ActiveSelf = i < num; } CanvasPanel canvasPanel = ((enemyPool.Count > 0) ? listings[enemyPool.Count - 1] : listings[0]); listingsPanel.Size = new Vector2(listingsPanel.Size.x, canvasPanel.LocalPosition.y + canvasPanel.Size.y); } public static bool ActivelyUpdating() { if (Object.op_Implicit((Object)(object)HeroController.instance) && !HeroController.instance.cState.transitioning) { return GameManager.instance.IsGameplayScene(); } return false; } } public class InfoPanel : CanvasPanel { internal record InjectedInfo { public readonly string Label; public readonly Func Generator; public InjectedInfo(string label, Func generator) { Label = label; Generator = generator; } } internal static readonly List LeftColumnInjects = new List(); internal static readonly List RightColumnInjects = new List(); private float x; private float y; private float labelWidth; private float infoWidth; private float lineGap; private int counter; private float injectedHeight; public static int ListingHeight => UICommon.ScaleHeight(20); public static InfoPanel Instance { get; private set; } public static void BuildPanel() { Instance = new InfoPanel(); Instance.Build(); } public InfoPanel() : base("InfoPanel") { //IL_002c: 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_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Unknown result type (might be due to invalid IL or missing references) //IL_0965: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) base.LocalPosition = new Vector2((float)UICommon.ScreenMargin, (float)(Screen.height - UICommon.ConsoleHeight - UICommon.InfoPanelHeight - UICommon.ScreenMargin * 2)); base.Size = new Vector2((float)UICommon.LeftSideWidth, (float)UICommon.InfoPanelHeight); x = ContentMargin(); y = ContentMargin(); labelWidth = UICommon.ScaleWidth(120); infoWidth = UICommon.ScaleWidth(160); if (DebugMod.settings.AltInfoPanel) { labelWidth = UICommon.ScaleWidth(100); infoWidth = UICommon.ScaleWidth(140); lineGap = UICommon.ScaleWidth(10); } int num = UICommon.ScaleHeight(20); AppendInfo("INFOPANEL_POSITION", (Func)GetHeroPos); AppendInfo("INFOPANEL_VELOCITY", () => HeroController.instance.current_velocity); AppendInfo("INFOPANEL_INPUTS", (Func)GetInputs); AppendInfo("INFOPANEL_HEROSTATE", () => HeroController.instance.hero_state); AppendInfo("INFOPANEL_DAMAGESTATE", () => HeroController.instance.damageMode); y += num; AppendInfo("INFOPANEL_NEEDLEBASE", () => $"{PlayerData.instance.nailDamage} (n{PlayerData.instance.nailUpgrades})"); AppendInfo("INFOPANEL_LASTDAMAGEAMOUNT", () => (!DebugMod.lastHit.HasValue) ? Localization.Get("INFOPANEL_NONE") : $"{DebugMod.lastDamage} ({DebugMod.lastHit?.DamageDealt} x {DebugMod.lastHit?.Multiplier})"); AppendInfo("INFOPANEL_LASTDAMAGETYPE", delegate { //IL_0011: 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) object obj; if (!DebugMod.lastHit.HasValue) { obj = null; } else { HitInstance valueOrDefault = DebugMod.lastHit.GetValueOrDefault(); obj = ((object)(AttackTypes)(ref valueOrDefault.AttackType)).ToString(); } if (obj == null) { obj = Localization.Get("INFOPANEL_NONE"); } return (string)obj; }); AppendInfo("INFOPANEL_LASTDAMAGESCALING", (Func)GetScaling); y += num; AppendInfo("INFOPANEL_HEALTH", () => $"{PlayerData.instance.health} / {PlayerData.instance.maxHealth}"); AppendInfo("INFOPANEL_SILK", () => $"{PlayerData.instance.silk} / {PlayerData.instance.CurrentSilkMaxBasic}"); AppendInfo("INFOPANEL_COMPLETION", () => $"{PlayerData.instance.completionPercentage}%"); AppendInfo("INFOPANEL_FLEAS", () => $"{Gameplay.FleasCollectedCount} / 30"); AppendInfo("INFOPANEL_QUESTPOINTS", (Func)GetQuestPoints); if (DebugMod.settings.ExpandedInfoPanel) { y += num; AppendInfo("INFOPANEL_SCENENAME", (Func)DebugMod.GetSceneName); AppendInfo("INFOPANEL_TRANSITIONSTATE", (Func)GetTransitionStates); AppendInfo("INFOPANEL_GAMESTATE", () => GameManager.instance.GameState); AppendInfo("INFOPANEL_UISTATE", () => HeroController.instance.ui.uiState); AppendInfo("INFOPANEL_TRANSITIONING", () => HeroController.instance.cState.transitioning); AppendInfo("INFOPANEL_ISGAMEPLAY", () => HeroController.instance.isGameplayScene); } AppendInfo(LeftColumnInjects); if (DebugMod.settings.AltInfoPanel) { CanvasBorder canvasBorder = Add(new CanvasBorder("LeftLabelColumn")); canvasBorder.Sides = BorderSides.RIGHT; canvasBorder.LocalPosition = new Vector2(x - (float)ContentMargin(), 0f); canvasBorder.Size = new Vector2(x + labelWidth + lineGap + 1f, y); canvasBorder.Thickness = 1; canvasBorder.Color = UICommon.iconColor; } x += labelWidth + infoWidth; y = ContentMargin(); AppendInfo("INFOPANEL_ATTACKING", () => HeroController.instance.cState.attacking); AppendInfo("INFOPANEL_SPRINTING", (Func)GetSprintFlags); AppendInfo("INFOPANEL_JUMPING", (Func)GetJumpFlags); AppendInfo("INFOPANEL_FALLING", () => HeroController.instance.cState.falling); AppendInfo("INFOPANEL_HARDLAND", () => HeroController.instance.cState.willHardLand); AppendInfo("INFOPANEL_SWIMMING", () => HeroController.instance.cState.swimming); AppendInfo("INFOPANEL_RECOILING", () => HeroController.instance.cState.recoiling); AppendInfo("INFOPANEL_SOARING", () => HeroController.instance.cState.superDashing); y += num; AppendInfo("INFOPANEL_WALLSTATES", (Func)GetWallState); AppendInfo("INFOPANEL_CANCAST", () => HeroController.instance.CanCast()); AppendInfo("INFOPANEL_CANSOAR", () => HeroController.instance.CanSuperJump()); AppendInfo("INFOPANEL_CANQUICKMAP", () => HeroController.instance.CanQuickMap()); AppendInfo("INFOPANEL_CANINVENTORY", () => HeroController.instance.CanOpenInventory()); y += num; if (DebugMod.settings.ExpandedInfoPanel) { AppendInfo("INFOPANEL_ACCEPTINPUT", () => HeroController.instance.acceptingInput); AppendInfo("INFOPANEL_CONTROLRELINQUISHED", () => HeroController.instance.controlReqlinquished); AppendInfo("INFOPANEL_HEROPAUSED", () => HeroController.instance.IsPaused()); AppendInfo("INFOPANEL_ATBENCH", () => PlayerData.instance.atBench); AppendInfo("INFOPANEL_INVULNERABLE", () => HeroController.instance.cState.Invulnerable); AppendInfo("INFOPANEL_INVINCIBLE", () => PlayerData.instance.isInvincible); y += num; AppendInfo("INFOPANEL_CAMERAMODE", (Func)GetCameraModes); } else { AppendInfo("INFOPANEL_SCENENAME", (Func)DebugMod.GetSceneName); } AppendInfo(RightColumnInjects); if (DebugMod.settings.AltInfoPanel) { CanvasBorder canvasBorder2 = Add(new CanvasBorder("RightLabelColumn")); canvasBorder2.Sides = BorderSides.RIGHT; canvasBorder2.LocalPosition = new Vector2(x - (float)ContentMargin(), 0f); canvasBorder2.Size = new Vector2(labelWidth + lineGap + 1f, y); canvasBorder2.Thickness = 1; canvasBorder2.Color = UICommon.iconColor; } if (Profiler.enabled) { x += labelWidth + infoWidth; y = ContentMargin(); CanvasText profilerText = Add(new CanvasText("ProfilerInfo", (HorizontalWrapMode)0)); profilerText.LocalPosition = new Vector2(x, y); profilerText.Size = new Vector2(labelWidth + infoWidth, base.Size.y); profilerText.OnUpdate += delegate { string text = Localization.Get("INFOPANEL_PROFILER") + "\n"; foreach (KeyValuePair time in Profiler.GetTimes()) { text += $"{time.Key} {time.Value * 1000f:F2}ms\n"; } profilerText.Text = text; }; } base.LocalPosition = new Vector2(base.LocalPosition.x, base.LocalPosition.y - injectedHeight); } private void AppendInfo(string label, Func info) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) CanvasText canvasText = Add(new CanvasText($"Label{counter}", (HorizontalWrapMode)0)); canvasText.LocalPosition = new Vector2(x, y); canvasText.Size = new Vector2(labelWidth, (float)ListingHeight); canvasText.Alignment = (TextAnchor)3; canvasText.Text = Localization.Get(label); CanvasText infoText = Add(new CanvasText($"Info{counter}", (HorizontalWrapMode)1)); infoText.LocalPosition = new Vector2(x + labelWidth, y + (float)ListingHeight / 10f); infoText.Size = new Vector2(infoWidth, (float)ListingHeight); infoText.Font = UICommon.trajanBold; infoText.Alignment = (TextAnchor)3; infoText.OnUpdate += delegate { infoText.Text = info(); }; if (DebugMod.settings.AltInfoPanel) { canvasText.Alignment = (TextAnchor)5; infoText.LocalPosition = new Vector2(x + labelWidth + 2f * lineGap, y + (float)ListingHeight / 10f); } counter++; y += ListingHeight; } private void AppendInfo(string label, Func info) { AppendInfo(label, () => GetStringForBool(info())); } private void AppendInfo(string label, Func info) { AppendInfo(label, () => info().ToString()); } private void AppendInfo(IReadOnlyCollection injectedInfo) { if (injectedInfo.Count == 0) { return; } float num = y; y += UICommon.ScaleHeight(20); foreach (InjectedInfo item in injectedInfo.OrderBy((InjectedInfo i) => i.Label)) { AppendInfo(item.Label, item.Generator); } injectedHeight = Mathf.Max(injectedHeight, y - num); } private static string GetHeroPos() { //IL_001d: 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) if ((Object)(object)DebugMod.RefKnight == (Object)null) { return string.Empty; } float num = DebugMod.RefKnight.transform.position.x; float num2 = DebugMod.RefKnight.transform.position.y; return $"{num:.000000#}, {num2:.000000#}"; } private static string GetQuestPoints() { QuestCompleteTotalGroup val = QuestManager.GetQuest("Soul Snare Pre").requiredCompleteTotalGroups[0]; return $"{val.CurrentValueCount} / {val.target}"; } private static string GetStringForBool(bool b) { if (!b) { return "X"; } return "✓"; } private static string GetSprintFlags() { if (HeroController.instance.cState.isSprinting) { if (!HeroController.instance.cState.dashing) { return "✓–"; } return "✓✓"; } if (!HeroController.instance.cState.dashing) { return "X"; } return "✓"; } private static string GetJumpFlags() { List list = new List(); if (HeroController.instance.cState.jumping) { list.Add("✓"); } if (HeroController.instance.cState.doubleJumping) { list.Add("◊"); } if (HeroController.instance.isUmbrellaActive.Value) { list.Add("†"); } if (list.Count != 0) { return string.Join("", list); } return "X"; } private static string GetWallState() { return (HeroController.instance.touchingWallL ? "<" : "‒") + (HeroController.instance.cState.touchingWall ? "T" : "‒") + (HeroController.instance.wallLocked ? "L" : "‒") + (HeroController.instance.cState.wallSliding ? "S" : "‒") + (HeroController.instance.queuedWallJumpInterrupt ? "Q" : "‒") + (HeroController.instance.touchingWallR ? ">" : "‒"); } private static string GetScaling() { if (DebugMod.lastScaling == null) { return Localization.Get("INFOPANEL_NONE"); } string[] array = new string[5] { $"{DebugMod.lastScaling.Level1Mult:.###}", $"{DebugMod.lastScaling.Level2Mult:.###}", $"{DebugMod.lastScaling.Level3Mult:.###}", $"{DebugMod.lastScaling.Level4Mult:.###}", $"{DebugMod.lastScaling.Level5Mult:.###}" }; int num = DebugMod.lastScaleLevel; if (num > 4) { num = 4; } if (num >= 0) { array[num] = "(" + array[num] + ")"; } return string.Join("∶", array); } private static string GetTransitionStates() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown HeroTransitionState transitionState = HeroController.instance.transitionState; return (int)transitionState switch { 0 => string.Format(Localization.Get("INFOPANEL_TRANSITIONSTATE_DONEFORMAT"), DebugMod.GetLoadTime()), 1 => Localization.Get("INFOPANEL_TRANSITIONSTATE_EXITING"), 2 => Localization.Get("INFOPANEL_TRANSITIONSTATE_WAITINGTOENTER"), 3 => Localization.Get("INFOPANEL_TRANSITIONSTATE_ENTERING"), 4 => Localization.Get("INFOPANEL_TRANSITIONSTATE_DROPPINGDOWN"), _ => Localization.Get("INFOPANEL_UNKNOWN"), }; } private static string GetCameraModes() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected I4, but got Unknown CameraMode mode = DebugMod.RefCamera.mode; return (int)mode switch { 0 => Localization.Get("INFOPANEL_CAMERAMODE_FROZEN"), 1 => Localization.Get("INFOPANEL_CAMERAMODE_FOLLOWING"), 2 => Localization.Get("INFOPANEL_CAMERAMODE_LOCKED"), 3 => Localization.Get("INFOPANEL_CAMERAMODE_PANNING"), 4 => Localization.Get("INFOPANEL_CAMERAMODE_FADEOUT"), 5 => Localization.Get("INFOPANEL_CAMERAMODE_FADEIN"), 6 => Localization.Get("INFOPANEL_CAMERAMODE_PREVIOUS"), _ => Localization.Get("INFOPANEL_UNKNOWN"), }; } private static string GetInputs() { string text = (((OneAxisInputControl)DebugMod.IH.inputActions.Left).State ? "<" : " "); string text2 = (((OneAxisInputControl)DebugMod.IH.inputActions.Up).State ? "⋀" : " "); string text3 = (((OneAxisInputControl)DebugMod.IH.inputActions.Down).State ? "⋁" : " "); string text4 = (((OneAxisInputControl)DebugMod.IH.inputActions.Right).State ? ">" : " "); string text5 = (((OneAxisInputControl)DebugMod.IH.inputActions.Jump).State ? "j" : " "); string text6 = (((OneAxisInputControl)DebugMod.IH.inputActions.Dash).State ? "s" : " "); string text7 = (((OneAxisInputControl)DebugMod.IH.inputActions.Attack).State ? "a" : " "); string text8 = (((OneAxisInputControl)DebugMod.IH.inputActions.SuperDash).State ? "h" : " "); string text9 = (((OneAxisInputControl)DebugMod.IH.inputActions.DreamNail).State ? "n" : " "); string text10 = (((OneAxisInputControl)DebugMod.IH.inputActions.QuickCast).State ? "c" : " "); string text11 = (((OneAxisInputControl)DebugMod.IH.inputActions.Cast).State ? "b" : " "); string text12 = (((OneAxisInputControl)DebugMod.IH.inputActions.Taunt).State ? "t" : " "); string text13 = (((OneAxisInputControl)DebugMod.IH.inputActions.QuickMap).State ? "m" : " "); string text14 = (((OneAxisInputControl)DebugMod.IH.inputActions.OpenInventory).State ? "i" : " "); string text15 = (((OneAxisInputControl)DebugMod.IH.inputActions.Pause).State ? "p" : " "); return text + text2 + text3 + text4 + " " + text5 + text6 + text7 + text8 + " " + text9 + text10 + text11 + text12 + " " + text13 + text14 + text15; } } public class KeybindDialog : CanvasDialog { private readonly List singlePanels = new List(); private BindAction[] actions; public static int PanelWidth => UICommon.ScaleWidth(150); public static int RowHeight => UICommon.ScaleHeight(18); public static KeybindDialog Instance { get; private set; } public static void BuildPanel() { Instance = new KeybindDialog(); Instance.Build(); } public KeybindDialog() : base("KeybindDialog") { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Get("Background").RemoveBorder(); float num = 0f; for (int i = 0; i < 3; i++) { CanvasPanel canvasPanel = BuildSinglePanel(i); canvasPanel.LocalPosition = new Vector2(0f, num); num += canvasPanel.Size.y + (float)UICommon.Margin; singlePanels.Add(canvasPanel); } num -= (float)UICommon.Margin; base.Size = new Vector2((float)PanelWidth, num); } private CanvasPanel BuildSinglePanel(int index) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = Add(new CanvasPanel(index.ToString())); canvasPanel.Size = new Vector2((float)PanelWidth, 0f); canvasPanel.CollapseMode = CollapseMode.Deny; UICommon.AddBackground(canvasPanel); canvasPanel.Get("Background").SetImage(UICommon.dialogBG); PanelBuilder panelBuilder = new PanelBuilder(canvasPanel); panelBuilder.OuterPadding = ContentMargin(UICommon.Margin); panelBuilder.InnerPadding = UICommon.Margin; panelBuilder.DynamicLength = true; CanvasText nameText = panelBuilder.AppendFixed(new CanvasText("BindName", (HorizontalWrapMode)0), RowHeight); nameText.Alignment = (TextAnchor)4; nameText.OnUpdate += delegate { nameText.Text = Localization.Get(actions[index].Name); }; using PanelBuilder panelBuilder2 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel("KeycodeRow"), RowHeight)); panelBuilder2.Horizontal = true; panelBuilder2.InnerPadding = UICommon.Margin; CanvasText keycodeText = panelBuilder2.AppendFlex(new CanvasText("Keycode", (HorizontalWrapMode)0)); keycodeText.Alignment = (TextAnchor)3; keycodeText.OnUpdate += delegate { keycodeText.Text = GetKeycodeText(actions[index].Name); }; CanvasButton canvasButton = panelBuilder2.AppendSquare(new CanvasButton("Edit")); canvasButton.ImageOnly(UICommon.images["IconDotCircled"]); canvasButton.OnClicked += delegate { DebugMod.UpdateBind(actions[index].Name, (KeyCode)0); }; CanvasButton canvasButton2 = panelBuilder2.AppendSquare(new CanvasButton("Clear")); canvasButton2.ImageOnly(UICommon.images["IconX"]); canvasButton2.OnClicked += delegate { DebugMod.UpdateBind(actions[index].Name, null); }; panelBuilder.Build(); return canvasPanel; } public static string GetKeycodeText(string action) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (DebugMod.settings.binds.TryGetValue(action, out var value)) { if ((int)value != 0) { return ((object)(KeyCode)(ref value)).ToString(); } return Localization.Get("KEYBIND_REBINDPROMPT"); } return Localization.Get("KEYBIND_UNBOUND"); } public void Toggle(CanvasNode anchor, params BindAction[] actions) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (TryToggle(anchor)) { this.actions = actions; for (int i = 0; i < singlePanels.Count; i++) { singlePanels[i].ActiveSelf = actions.Length > i; } float num = singlePanels[0].Size.y * (float)actions.Length + (float)(UICommon.Margin * (actions.Length - 1)); Get("Background").Size = new Vector2((float)PanelWidth, num); if (Mathf.Approximately(base.Position.y + base.Size.y + (float)UICommon.Margin, (float)Screen.height)) { base.LocalPosition = new Vector2(base.LocalPosition.x, base.LocalPosition.y - base.Size.y + num); } } } } public record struct ToolDef { public string IconKey; public ToolItem Item; public ToolDef(string IconKey, ToolItem Item) { this.IconKey = IconKey; this.Item = Item; } [CompilerGenerated] public readonly void Deconstruct(out string IconKey, out ToolItem Item) { IconKey = this.IconKey; Item = this.Item; } } public class MainPanel : CanvasPanel { private static readonly List keybindCategoryOrder = new List(12) { "CATEGORY_CHEATS", "CATEGORY_SAVESTATES", "CATEGORY_MODUI", "CATEGORY_TIME", "CATEGORY_ENEMIES", "CATEGORY_SKILLS", "CATEGORY_UPGRADES", "CATEGORY_TOOLS", "CATEGORY_CONSUMABLES", "CATEGORY_MASKSANDSPOOLS", "CATEGORY_VISUAL", "CATEGORY_MISC" }; private readonly List tabs = new List(); private readonly List tabButtons = new List(); private PanelBuilder currentTab; private CanvasPanel currentRow; private int rowCounter; private int[] rowPositions; private int[] rowWidths; private int rowIndex; private int lastRowCount; public static int TabButtonHeight => UICommon.ScaleHeight(20); public static int ScrollbarWidth => UICommon.ScaleWidth(11); public static int SectionEndPadding => UICommon.ScaleHeight(20); public static int SectionHeaderFontSize => UICommon.ScaleHeight(30); public static int SectionHeaderHeight => UICommon.ScaleHeight(30); public static int KeybindHeaderFontSize => UICommon.ScaleHeight(20); public static int ListingHeight => UICommon.ScaleHeight(16); public static MainPanel Instance { get; private set; } public static void BuildPanel() { Instance = new MainPanel(); Instance.Build(); } public MainPanel() : base("MainPanel") { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_1631: Unknown result type (might be due to invalid IL or missing references) //IL_1637: Unknown result type (might be due to invalid IL or missing references) //IL_2afa: Unknown result type (might be due to invalid IL or missing references) //IL_2b00: Unknown result type (might be due to invalid IL or missing references) //IL_2b4e: Unknown result type (might be due to invalid IL or missing references) //IL_2b54: Unknown result type (might be due to invalid IL or missing references) //IL_2ba2: Unknown result type (might be due to invalid IL or missing references) //IL_2ba8: Unknown result type (might be due to invalid IL or missing references) base.LocalPosition = new Vector2((float)(Screen.width - UICommon.ScreenMargin - UICommon.RightSideWidth), (float)UICommon.ScreenMargin); base.Size = new Vector2((float)UICommon.RightSideWidth, (float)UICommon.MainPanelHeight); base.OnUpdate += DoUpdate; AddTab("MAINPANEL_TAB_GAMEPLAY"); AppendSectionHeader("CATEGORY_CHEATS"); AppendRow(1, 1, 1); AppendToggleControl("CHEATS_NOCLIP", () => DebugMod.noclip, BindableFunctions.ToggleNoclip); AppendToggleControl("CHEATS_INVINCIBILITY", () => DebugMod.playerInvincible, BindableFunctions.ToggleInvincibility); AppendToggleControl("CHEATS_INFINITEJUMP", () => PlayerData.instance.infiniteAirJump, BindableFunctions.ToggleInfiniteJump); AppendRow(1, 1, 1); AppendToggleControl("CHEATS_INFINITEHP", () => DebugMod.infiniteHP, BindableFunctions.ToggleInfiniteHP); AppendToggleControl("CHEATS_INFINITESILK", () => DebugMod.infiniteSilk, BindableFunctions.ToggleInfiniteSilk); AppendToggleControl("CHEATS_INFINITETOOLS", () => DebugMod.infiniteTools, BindableFunctions.ToggleInfiniteTools); AppendRow(2, 1); AppendToggleControl("CHEATS_TOGGLEHEROCOLLIDER", () => DebugMod.heroColliderDisabled, BindableFunctions.ToggleHeroCollider); AppendBasicControl("CHEATS_KILLALL", BindableFunctions.KillAll); AppendSectionHeader("CATEGORY_MODUI"); AppendRow(1, 1); AppendToggleControl("MODUI_TOGGLEALLUI", () => true, BindableFunctions.ToggleAllPanels); AppendToggleControl("MODUI_TOGGLEMAINPANEL", () => DebugMod.settings.MainPanelVisible, BindableFunctions.ToggleMainPanel); AppendRow(1, 1); AppendToggleControl("MODUI_TOGGLEENEMIESPANEL", () => DebugMod.settings.EnemiesPanelVisible, BindableFunctions.ToggleEnemiesPanel); AppendToggleControl("MODUI_TOGGLECONSOLEPANEL", () => DebugMod.settings.ConsoleVisible, BindableFunctions.ToggleConsolePanel); AppendRow(1, 1); AppendToggleControl("MODUI_TOGGLESAVESTATESPANEL", () => DebugMod.settings.SaveStatePanelVisible, BindableFunctions.ToggleSaveStatePanel); AppendToggleControl("MODUI_EXPANDCOLLAPSESAVESTATES", () => DebugMod.settings.SaveStatePanelExpanded, BindableFunctions.ToggleExpandedSaveStatePanel); AppendRow(1, 1); AppendToggleControl("MODUI_TOGGLEINFOPANEL", () => DebugMod.settings.InfoPanelVisible, BindableFunctions.ToggleInfoPanel); AppendToggleControl("MODUI_ALWAYSSHOWCURSOR", () => DebugMod.settings.ShowCursorWhileUnpaused, BindableFunctions.ToggleAlwaysShowCursor); AppendSectionHeader("CATEGORY_TIME"); AppendRow(1); AppendNumericControl("TIME_TIMESCALE", () => TimeScale.CustomTimeScale, 1f, delegate(float f) { if (f >= 0f) { TimeScale.CustomTimeScale = f; } }, BindableFunctions.TimescaleUp, BindableFunctions.TimescaleDown, BindableFunctions.TimescaleReset); AppendRow(1, 1); AppendToggleControl("TIME_FREEZEGAME", () => TimeScale.Frozen, BindableFunctions.PauseGameNoUI); AppendBasicControl("TIME_ADVANCEFRAME", BindableFunctions.AdvanceFrame); AppendRow(1, 1); AppendToggleControl("TIME_FORCEPAUSE", () => DebugMod.forcePaused && GameManager.instance.isPaused, BindableFunctions.ForcePause); AppendBasicControl("TIME_RESETFRAMECOUNTER", BindableFunctions.ResetFrameCounter); AppendSectionHeader("CATEGORY_VISUAL"); AppendRow(1, 1); AppendToggleControl("VISUAL_TOGGLEHITBOXES", () => DebugMod.settings.ShowHitBoxes != 0, BindableFunctions.ShowHitboxes); AppendToggleControl("VISUAL_FORCECAMERAFOLLOW", () => DebugMod.cameraFollow, BindableFunctions.ForceCameraFollow); AppendRow(1, 1); AppendToggleControl("VISUAL_PREVIEWCOCOONPOSITION", CocoonPreviewToggled, BindableFunctions.PreviewCocoonPosition); AppendToggleControl("VISUAL_TOGGLEHEROLIGHT", HeroLightToggled, BindableFunctions.ToggleHeroLight); AppendRow(1, 1, 1); AppendToggleControl("VISUAL_TOGGLEHUD", HUDToggled, BindableFunctions.ToggleHUD); AppendToggleControl("VISUAL_TOGGLEVIGNETTE", () => VisualMaskHelper.vignetteDisabled, BindableFunctions.ToggleVignette); AppendToggleControl("VISUAL_HIDEHERO", HideHeroToggled, BindableFunctions.HideHero); AppendRow(1, 1); AppendToggleControl("VISUAL_TOGGLECAMERASHAKE", CameraShakeToggled, BindableFunctions.ToggleCameraShake); AppendToggleControl("VISUAL_DEACTIVATEVISUALMASKS", () => VisualMaskHelper.masksDisabled, BindableFunctions.DoDeactivateVisualMasks); AppendRow(1); AppendNumericControl("VISUAL_ZOOM", () => GameCameras.instance.tk2dCam.zoomFactor, 1f, delegate(float f) { if (f > 0f) { GameCameras.instance.tk2dCam.zoomFactor = f; ZoomHelper.UpdateCameraFOV(); } }, BindableFunctions.ZoomIn, BindableFunctions.ZoomOut, BindableFunctions.ResetZoom); AppendSectionHeader("CATEGORY_MISC"); AppendRow(1, 1); AppendBasicControl("MISC_SETHAZARDRESPAWN", BindableFunctions.SetHazardRespawn); AppendBasicControl("MISC_HAZARDRESPAWN", BindableFunctions.Respawn); AppendRow(1, 1, 1); AppendBasicControl("MISC_DAMAGESELF", BindableFunctions.SelfDamage); AppendBasicControl("MISC_KILLSELF", BindableFunctions.KillSelf); AppendBasicControl("MISC_BREAKCOCOON", BindableFunctions.BreakCocoon); AppendRow(1, 1); AppendBasicControl("MISC_RESETCURRENTSCENEDATA", BindableFunctions.ResetCurrentScene); AppendBasicControl("MISC_BLOCKSCENEDATACHANGES", BindableFunctions.BlockCurrentSceneChanges); AppendRow(1, 1, 1); AppendToggleControl("MISC_TOGGLEACT3", () => PlayerData.instance.blackThreadWorld, BindableFunctions.ToggleAct3); AppendToggleControl("MISC_LOCKKEYBINDS", () => DebugMod.KeyBindLock, BindableFunctions.ToggleLockKeyBinds); AppendBasicControl("MISC_RESETALL", BindableFunctions.Reset); AddTab("MAINPANEL_TAB_ITEMS"); AppendSectionHeader("CATEGORY_SKILLS"); AppendRow(1); AppendBasicControl("SKILLS_ALLSKILLS", BindableFunctions.GiveAllSkills); AppendTileRow(5); AppendLabeledTile("SKILLS_SWIFTSTEP", () => PlayerData.instance.hasDash, BindableFunctions.ToggleSwiftStep, "Skill_SwiftStep"); AppendLabeledTile("SKILLS_CLINGGRIP", () => PlayerData.instance.hasWalljump, BindableFunctions.ToggleClingGrip, "Skill_ClingGrip"); AppendLabeledTile("SKILLS_NEEDOLIN", () => PlayerData.instance.hasNeedolin, BindableFunctions.ToggleNeedolin, "Skill_Needolin"); AppendLabeledTile("SKILLS_CLAWLINE", () => PlayerData.instance.hasHarpoonDash, BindableFunctions.ToggleClawline, "Skill_Clawline"); AppendLabeledTile("SKILLS_SILKSOAR", () => PlayerData.instance.hasSuperJump, BindableFunctions.ToggleSilkSoar, "Skill_SilkSoar"); AppendTileRow(5); AppendLabeledTile("SKILLS_DRIFTERSCLOAK", () => PlayerData.instance.hasBrolly, BindableFunctions.ToggleDriftersCloak, "Skill_DriftersCloak"); AppendLabeledTile("SKILLS_FAYDOWNCLOAK", () => PlayerData.instance.hasDoubleJump, BindableFunctions.ToggleFaydownCloak, "Skill_FaydownCloak"); AppendLabeledTile("SKILLS_NEEDLESTRIKE", () => PlayerData.instance.hasChargeSlash, BindableFunctions.ToggleNeedleStrike, "Skill_NeedleStrike"); AppendLabeledTile("SKILLS_BEASTLINGCALL", () => PlayerData.instance.UnlockedFastTravelTeleport, BindableFunctions.ToggleBeastlingCall, "Skill_BeastlingCall"); AppendLabeledTile("SKILLS_ELEGYOFTHEDEEP", () => PlayerData.instance.hasNeedolinMemoryPowerup, BindableFunctions.ToggleElegyOfTheDeep, "Skill_Elegy"); AppendSectionHeader("CATEGORY_UPGRADES"); AppendTileRow(2); AppendIncrementTile("UPGRADES_NEEDLEDAMAGE", () => PlayerData.instance.nailDamage, SetNailDamage, "Inv_Needle", BindableFunctions.IncreaseNeedleDamage, BindableFunctions.DecreaseNeedleDamage); AppendIncrementTile("UPGRADES_SILKHEARTS", () => PlayerData.instance.silkRegenMax, delegate(int value) { PlayerData.instance.silkRegenMax = value; }, "Inv_SilkHeart", null, null, 1, 0, 3, wrap: true); AppendTileRow(2); AppendIncrementTile("UPGRADES_CRAFTINGKIT", () => PlayerData.instance.ToolKitUpgrades, delegate(int value) { PlayerData.instance.ToolKitUpgrades = value; }, "Inv_CraftingKit", null, null, 1, 0, 4, wrap: true); AppendIncrementTile("UPGRADES_TOOLPOUCH", () => PlayerData.instance.ToolPouchUpgrades, delegate(int value) { PlayerData.instance.ToolPouchUpgrades = value; }, "Inv_ToolPouch", null, null, 1, 0, 4, wrap: true); AppendRow(1, 1); AppendBasicControl("UPGRADES_ALLMAPS", BindableFunctions.UnlockAllMaps); AppendBasicControl("UPGRADES_ALLFASTTRAVEL", BindableFunctions.UnlockAllFastTravel); AppendSectionHeader("CATEGORY_MASKSANDSPOOLS"); AppendTileRow(2); AppendIncrementTile("MASKSANDSPOOLS_MASKS", () => PlayerData.instance.maxHealth, SetMaxHealth, "Inv_Mask", null, null, 1, 1, 10); AppendIncrementTile("MASKSANDSPOOLS_SPOOLS", () => PlayerData.instance.silkMax, SetMaxSilk, "Inv_Spool", null, null, 1, 9, 18); AppendTileRow(3); AppendIncrementTile("MASKSANDSPOOLS_HEALTH", () => PlayerData.instance.health, SetHealth, "Inv_Health", null, null, 1, 1, 10); AppendIncrementTile("MASKSANDSPOOLS_SILK", () => PlayerData.instance.silk, SetSilk, "Inv_Silk"); AppendWideTile("MASKSANDSPOOLS_LIFEBLOOD", BuildLifebloodTile, "Inv_Lifeblood"); AppendSectionHeader("CATEGORY_CRESTS"); AppendRow(1); AppendBasicControl("CRESTS_UNLOCKALLCRESTS", BindableFunctions.UnlockAllCrests); AppendRow(1, 1); AppendToggleControl("CRESTS_TOGGLECURSED", () => ((ToolBase)Gameplay.CursedCrest).IsEquipped, BindableFunctions.ToggleCursed); AppendToggleControl("CRESTS_TOGGLECLOAKLESS", () => ((ToolBase)Gameplay.CloaklessCrest).IsEquipped, BindableFunctions.ToggleCloakless); List hunterTiers = new List(3) { "Hunter", "Hunter_v2", "Hunter_v3" }; ToolCrest hunterCrest = ToolItemManager.GetCrestByName(hunterTiers[0]); CanvasPanel hunterTile = null; hunterTile = AppendLabeledTile("CRESTS_HUNTER", delegate { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) for (int num3 = hunterTiers.Count - 1; num3 >= 0; num3--) { if (ToolItemManager.GetCrestByName(hunterTiers[num3]).IsUnlocked) { hunterTile.Get("Icon").SetImage(UICommon.images["Crest_" + hunterTiers[num3]]); return true; } } hunterTile.Get("Icon").SetImage(UICommon.images["Crest_Hunter"]); return false; }, delegate { ToolCrest crest3 = null; bool flag = true; foreach (string item12 in hunterTiers) { ToolCrest crestByName = ToolItemManager.GetCrestByName(item12); if (!crestByName.IsUnlocked) { ToggleCrest(crestByName); crest3 = crestByName; flag = false; break; } static void ToggleCrest(ToolCrest crest) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) if (crest.IsUnlocked) { Data saveData = crest.SaveData; saveData.IsUnlocked = false; crest.SaveData = saveData; if (PlayerData.instance.CurrentCrestID == crest.name) { Utils.AutoEquipCrest(null, removeTools: false); } } else { crest.Unlock(); } } } if (flag) { foreach (string item13 in hunterTiers) { ToggleCrest(ToolItemManager.GetCrestByName(item13)); } ToggleCrest(hunterCrest); crest3 = hunterCrest; } if (PlayerData.instance.CurrentCrestID.StartsWith("Hunter")) { Utils.AutoEquipCrest(crest3, removeTools: false); } }, "IconX", includeLabel: false, 4); foreach (var item14 in new List<(string, string)>(6) { ("Reaper", "CRESTS_REAPER"), ("Wanderer", "CRESTS_WANDERER"), ("Warrior", "CRESTS_BEAST"), ("Witch", "CRESTS_WITCH"), ("Toolmaster", "CRESTS_ARCHITECT"), ("Spell", "CRESTS_SHAMAN") }) { string item3 = item14.Item1; string item4 = item14.Item2; ToolCrest crest2 = ToolItemManager.GetCrestByName(item3); AppendLabeledTile(item4, () => crest2.IsUnlocked, delegate { MainPanel.<.ctor>g__ToggleCrest|29_59(crest2); }, "IconX", includeLabel: false, 4).Get("Icon").SetImage(UICommon.images["Crest_" + item3]); } CanvasPanel vesticrestTile = null; vesticrestTile = AppendLabeledTile("CRESTS_VESTICREST", delegate { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) vesticrestTile.Get("Icon")?.SetImage(PlayerData.instance.UnlockedExtraBlueSlot ? UICommon.images["Inv_Vesticrest2"] : UICommon.images["Inv_Vesticrest"]); return PlayerData.instance.UnlockedExtraYellowSlot; }, delegate { if (!PlayerData.instance.UnlockedExtraYellowSlot) { PlayerData.instance.UnlockedExtraYellowSlot = true; } else if (!PlayerData.instance.UnlockedExtraBlueSlot) { PlayerData.instance.UnlockedExtraBlueSlot = true; } else { PlayerData.instance.UnlockedExtraYellowSlot = false; PlayerData.instance.UnlockedExtraBlueSlot = false; } }, "Inv_Vesticrest", includeLabel: false, 4); AppendSectionHeader("CATEGORY_TOOLS"); AppendRow(1, 1); AppendBasicControl("TOOLS_UNLOCKALLTOOLS", BindableFunctions.UnlockAllTools); AppendBasicControl("TOOLS_CRAFTTOOLS", BindableFunctions.CraftTools); foreach (var (key2, toolDefs2) in new Dictionary> { { "Silk Spear", new List(1) { new ToolDef("Spell_SilkSpear", ToolItemManager.GetToolByName("Silk Spear")) } }, { "Thread Sphere", new List(1) { new ToolDef("Spell_ThreadStorm", ToolItemManager.GetToolByName("Thread Sphere")) } }, { "Parry", new List(1) { new ToolDef("Spell_CrossStitch", ToolItemManager.GetToolByName("Parry")) } }, { "Silk Charge", new List(1) { new ToolDef("Spell_Sharpdart", ToolItemManager.GetToolByName("Silk Charge")) } }, { "Silk Bomb", new List(1) { new ToolDef("Spell_RuneRage", ToolItemManager.GetToolByName("Silk Bomb")) } }, { "Silk Boss Needle", new List(1) { new ToolDef("Spell_PaleNails", ToolItemManager.GetToolByName("Silk Boss Needle")) } }, { "Straight Pin", new List(1) { new ToolDef("Tool_StraightPin", ToolItemManager.GetToolByName("Straight Pin")) } }, { "Tri Pin", new List(1) { new ToolDef("Tool_ThreefoldPin", ToolItemManager.GetToolByName("Tri Pin")) } }, { "Sting Shard", new List(1) { new ToolDef("Tool_StingShard", ToolItemManager.GetToolByName("Sting Shard")) } }, { "Tack", new List(1) { new ToolDef("Tool_Tacks", ToolItemManager.GetToolByName("Tack")) } }, { "Harpoon", new List(1) { new ToolDef("Tool_Longpin", ToolItemManager.GetToolByName("Harpoon")) } }, { "Curve Claws", new List(2) { new ToolDef("Tool_Curveclaw", ToolItemManager.GetToolByName("Curve Claws")), new ToolDef("Tool_Curveclaw2", ToolItemManager.GetToolByName("Curve Claws Upgraded")) } }, { "Shakra Ring", new List(1) { new ToolDef("Tool_ThrowingRing", ToolItemManager.GetToolByName("Shakra Ring")) } }, { "Pimpilo", new List(1) { new ToolDef("Tool_Pimpillo", ToolItemManager.GetToolByName("Pimpilo")) } }, { "Conch Drill", new List(1) { new ToolDef("Tool_Conchcutter", ToolItemManager.GetToolByName("Conch Drill")) } }, { "WebShot", new List(3) { new ToolDef("Tool_Silkshot_Weaver", ToolItemManager.GetToolByName("WebShot Weaver")), new ToolDef("Tool_Silkshot_Forge", ToolItemManager.GetToolByName("WebShot Forge")), new ToolDef("Tool_Silkshot_Architect", ToolItemManager.GetToolByName("WebShot Architect")) } }, { "Screw Attack", new List(1) { new ToolDef("Tool_DelversDrill", ToolItemManager.GetToolByName("Screw Attack")) } }, { "Cogwork Saw", new List(1) { new ToolDef("Tool_CogworkWheel", ToolItemManager.GetToolByName("Cogwork Saw")) } }, { "Cogwork Flier", new List(1) { new ToolDef("Tool_Cogfly", ToolItemManager.GetToolByName("Cogwork Flier")) } }, { "Rosary Cannon", new List(1) { new ToolDef("Tool_RosaryCannon", ToolItemManager.GetToolByName("Rosary Cannon")) } }, { "Lightning Rod", new List(1) { new ToolDef("Tool_Voltvessels", ToolItemManager.GetToolByName("Lightning Rod")) } }, { "Flintstone", new List(1) { new ToolDef("Tool_Flintslate", ToolItemManager.GetToolByName("Flintstone")) } }, { "Silk Snare", new List(1) { new ToolDef("Tool_SnareSetter", ToolItemManager.GetToolByName("Silk Snare")) } }, { "Flea Brew", new List(1) { new ToolDef("Tool_FleaBrew", ToolItemManager.GetToolByName("Flea Brew")) } }, { "Lifeblood Syringe", new List(1) { new ToolDef("Tool_PlasmiumPhial", ToolItemManager.GetToolByName("Lifeblood Syringe")) } }, { "Extractor", new List(1) { new ToolDef("Tool_NeedlePhial", ToolItemManager.GetToolByName("Extractor")) } }, { "Mosscreep Tool", new List(2) { new ToolDef("Tool_DruidsEye", ToolItemManager.GetToolByName("Mosscreep Tool 1")), new ToolDef("Tool_DruidsEye2", ToolItemManager.GetToolByName("Mosscreep Tool 2")) } }, { "Lava Charm", new List(1) { new ToolDef("Tool_MagmaBell", ToolItemManager.GetToolByName("Lava Charm")) } }, { "Bell Bind", new List(1) { new ToolDef("Tool_WardingBell", ToolItemManager.GetToolByName("Bell Bind")) } }, { "Poison Pouch", new List(1) { new ToolDef("Tool_PollipPouch", ToolItemManager.GetToolByName("Poison Pouch")) } }, { "Fractured Mask", new List(1) { new ToolDef("Tool_FracturedMask", ToolItemManager.GetToolByName("Fractured Mask")) } }, { "Multibind", new List(1) { new ToolDef("Tool_Multibinder", ToolItemManager.GetToolByName("Multibind")) } }, { "White Ring", new List(1) { new ToolDef("Tool_Weavelight", ToolItemManager.GetToolByName("White Ring")) } }, { "Brolly Spike", new List(1) { new ToolDef("Tool_SawtoothCirclet", ToolItemManager.GetToolByName("Brolly Spike")) } }, { "Quickbind", new List(1) { new ToolDef("Tool_InjectorBand", ToolItemManager.GetToolByName("Quickbind")) } }, { "Spool Extender", new List(1) { new ToolDef("Tool_SpoolExtender", ToolItemManager.GetToolByName("Spool Extender")) } }, { "Reserve Bind", new List(1) { new ToolDef("Tool_ReserveBind", ToolItemManager.GetToolByName("Reserve Bind")) } }, { "Dazzle Bind", new List(2) { new ToolDef("Tool_ClawMirror", ToolItemManager.GetToolByName("Dazzle Bind")), new ToolDef("Tool_ClawMirror2", ToolItemManager.GetToolByName("Dazzle Bind Upgraded")) } }, { "Revenge Crystal", new List(1) { new ToolDef("Tool_MemoryCrystal", ToolItemManager.GetToolByName("Revenge Crystal")) } }, { "Thief Claw", new List(1) { new ToolDef("Tool_SnitchPick", ToolItemManager.GetToolByName("Thief Claw")) } }, { "Zap Imbuement", new List(1) { new ToolDef("Tool_VoltFilament", ToolItemManager.GetToolByName("Zap Imbuement")) } }, { "Quick Sling", new List(1) { new ToolDef("Tool_QuickSling", ToolItemManager.GetToolByName("Quick Sling")) } }, { "Maggot Charm", new List(1) { new ToolDef("Tool_WreathOfPurity", ToolItemManager.GetToolByName("Maggot Charm")) } }, { "Longneedle", new List(1) { new ToolDef("Tool_Longclaw", ToolItemManager.GetToolByName("Longneedle")) } }, { "Wisp Lantern", new List(1) { new ToolDef("Tool_WispfireLantern", ToolItemManager.GetToolByName("Wisp Lantern")) } }, { "Flea Charm", new List(1) { new ToolDef("Tool_EggOfFlealia", ToolItemManager.GetToolByName("Flea Charm")) } }, { "Pinstress Tool", new List(1) { new ToolDef("Tool_PinBadge", ToolItemManager.GetToolByName("Pinstress Tool")) } }, { "Compass", new List(1) { new ToolDef("Tool_Compass", ToolItemManager.GetToolByName("Compass")) } }, { "Bone Necklace", new List(1) { new ToolDef("Tool_ShardPendant", ToolItemManager.GetToolByName("Bone Necklace")) } }, { "Rosary Magnet", new List(1) { new ToolDef("Tool_MagnetiteBrooch", ToolItemManager.GetToolByName("Rosary Magnet")) } }, { "Weighted Anklet", new List(1) { new ToolDef("Tool_WeightedBelt", ToolItemManager.GetToolByName("Weighted Anklet")) } }, { "Barbed Wire", new List(1) { new ToolDef("Tool_BarbedBracelet", ToolItemManager.GetToolByName("Barbed Wire")) } }, { "Dead Mans Purse", new List(2) { new ToolDef("Tool_DeadBugsPurse", ToolItemManager.GetToolByName("Dead Mans Purse")), new ToolDef("Tool_ShellSatchel", ToolItemManager.GetToolByName("Shell Satchel")) } }, { "Magnetite Dice", new List(1) { new ToolDef("Tool_MagnetiteDice", ToolItemManager.GetToolByName("Magnetite Dice")) } }, { "Scuttlebrace", new List(1) { new ToolDef("Tool_Scuttlebrace", ToolItemManager.GetToolByName("Scuttlebrace")) } }, { "Wallcling", new List(1) { new ToolDef("Tool_AscendantsGrip", ToolItemManager.GetToolByName("Wallcling")) } }, { "Musician Charm", new List(1) { new ToolDef("Tool_SpiderStrings", ToolItemManager.GetToolByName("Musician Charm")) } }, { "Sprintmaster", new List(1) { new ToolDef("Tool_SilkspeedAnklets", ToolItemManager.GetToolByName("Sprintmaster")) } }, { "Thief Charm", new List(1) { new ToolDef("Tool_ThiefsMark", ToolItemManager.GetToolByName("Thief Charm")) } } }) { AppendToolTile(key2, toolDefs2, 6); void AppendToolTile(string key, List toolDefs, int width) { if (toolDefs.Count == 1) { ToolDef tool2 = toolDefs[0]; AppendLabeledTile(key, () => tool2.Item.IsUnlockedNotHidden, delegate { ToggleTool(tool2.Item); static void ToggleTool(ToolItem tool) { if (tool.IsUnlockedNotHidden) { tool.Lock(); } else { tool.Unlock((Action)null, (PopupFlags)0); } } }, tool2.IconKey, includeLabel: false, width); } else { ToolDef firstTool = toolDefs[0]; CanvasPanel tile = null; tile = AppendLabeledTile(key, delegate { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) foreach (ToolDef toolDef in toolDefs) { if (toolDef.Item.IsUnlockedNotHidden) { tile.Get("Icon").SetImage(UICommon.images[toolDef.IconKey]); return true; } } tile.Get("Icon").SetImage(UICommon.images[firstTool.IconKey]); return false; }, delegate { for (int i = 0; i < toolDefs.Count; i++) { ToolItem item11 = toolDefs[i].Item; if (item11.IsUnlockedNotHidden) { MainPanel.<.ctor>g__ToggleTool|29_66(item11); if (i < toolDefs.Count - 1) { MainPanel.<.ctor>g__ToggleTool|29_66(toolDefs[i + 1].Item); } return; } } MainPanel.<.ctor>g__ToggleTool|29_66(firstTool.Item); }, "IconX", includeLabel: false, width); } } } AppendSectionHeader("CATEGORY_ITEMS"); AppendLabeledTile("ITEMS_ARCHITECTSMELODY", () => PlayerData.instance.HasMelodyArchitect, delegate { PlayerData.instance.HasMelodyArchitect = !PlayerData.instance.HasMelodyArchitect; }, "Inv_MelodyArchitect"); AppendLabeledTile("ITEMS_VAULTKEEPERSMELODY", () => PlayerData.instance.HasMelodyLibrarian, delegate { PlayerData.instance.HasMelodyLibrarian = !PlayerData.instance.HasMelodyLibrarian; }, "Inv_MelodyVaultkeeper"); AppendLabeledTile("ITEMS_CONDUCTORSMELODY", () => PlayerData.instance.HasMelodyConductor, delegate { PlayerData.instance.HasMelodyConductor = !PlayerData.instance.HasMelodyConductor; }, "Inv_MelodyConductor"); CanvasPanel quillTile = AppendLabeledTile("ITEMS_QUILL", () => PlayerData.instance.hasQuill, delegate { if (!PlayerData.instance.hasQuill) { PlayerData.instance.hasQuill = true; PlayerData.instance.QuillState = 1; } else if (PlayerData.instance.QuillState >= 3) { PlayerData.instance.hasQuill = false; } else { PlayerData instance = PlayerData.instance; instance.QuillState++; } CollectableItemManager.IncrementVersion(); }); quillTile.OnUpdate += delegate { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) string key3 = ((!PlayerData.instance.hasQuill || PlayerData.instance.QuillState <= 1) ? "Inv_Quill" : ((PlayerData.instance.QuillState != 2) ? "Inv_PurpleQuill" : "Inv_RedQuill")); quillTile.Get("Icon").SetImage(UICommon.images[key3]); }; AppendLabeledTile("ITEMS_FARSIGHT", () => PlayerData.instance.ConstructedFarsight, delegate { PlayerData.instance.ConstructedFarsight = !PlayerData.instance.ConstructedFarsight; }, "Inv_Farsight"); AddItemsLabeledTiles(new List<(string, string, string)>(5) { ("Coral Heart", "ITEMS_HEARTOFMIGHT", "Inv_HeartCoral"), ("Flower Heart", "ITEMS_HEARTOFTHEWOODS", "Inv_HeartFlower"), ("Hunter Heart", "ITEMS_HEARTOFTHEWILD", "Inv_HeartAnt"), ("Clover Heart", "ITEMS_CONJOINEDHEART", "Inv_HeartJoined"), ("White Flower", "ITEMS_EVERBLOOM", "Inv_Everbloom") }); AppendLabeledTile("ITEMS_KEYOFINDOLENT", () => PlayerData.instance.HasSlabKeyA, delegate { PlayerData.instance.HasSlabKeyA = !PlayerData.instance.HasSlabKeyA; CollectableItemManager.IncrementVersion(); }, "Inv_KeyIndolent"); AppendLabeledTile("ITEMS_KEYOFHERETIC", () => PlayerData.instance.HasSlabKeyB, delegate { PlayerData.instance.HasSlabKeyB = !PlayerData.instance.HasSlabKeyB; CollectableItemManager.IncrementVersion(); }, "Inv_KeyHeretic"); AppendLabeledTile("ITEMS_KEYOFAPOSTATE", () => PlayerData.instance.HasSlabKeyC, delegate { PlayerData.instance.HasSlabKeyC = !PlayerData.instance.HasSlabKeyC; CollectableItemManager.IncrementVersion(); }, "Inv_KeyApostate"); AddItemsLabeledTiles(new List<(string, string, string)>(6) { ("Ward Key", "ITEMS_WHITEKEY", "Inv_WhiteKey"), ("Ward Boss Key", "ITEMS_SURGEONSKEY", "Inv_SurgeonsKey"), ("Architect Key", "ITEMS_ARCHITECTSKEY", "Inv_ArchitectKey"), ("Dock Key", "ITEMS_DIVINGBELLKEY", "Inv_DockKey"), ("Belltown House Key", "ITEMS_BELLHOMEKEY", "Inv_BellhomeKey"), ("Craw Summons", "ITEMS_CRAWSUMMONS", "Inv_CrawSummons") }); AppendSectionHeader("CATEGORY_CONSUMABLES"); AppendRow(1); AppendBasicControl("CONSUMABLES_GIVEQUESTITEMS", BindableFunctions.GiveQuestItems); AppendTileRow(2); AppendIncrementTile("CONSUMABLES_ROSARIES", () => PlayerData.instance.geo, delegate(int value) { HeroController.instance.AddGeo(value - PlayerData.instance.geo); }, "Inv_Rosaries", null, null, 100); AppendIncrementTile("CONSUMABLES_SHELLSHARDS", () => PlayerData.instance.ShellShards, delegate(int value) { HeroController.instance.AddShards(value - PlayerData.instance.ShellShards); }, "Inv_ShellShards", null, null, 100); foreach (var item15 in new List<(string, string, string)>(14) { ("Simple Key", "CONSUMABLES_SIMPLEKEY", "Inv_SimpleKey"), ("Crest Socket Unlocker", "CONSUMABLES_MEMORYLOCKET", "Inv_MemoryLocket"), ("Tool Metal", "CONSUMABLES_CRAFTMETAL", "Inv_Craftmetal"), ("Pale_Oil", "CONSUMABLES_PALEOIL", "Inv_PaleOil"), ("Rosary_Set_Frayed", "CONSUMABLES_FRAYEDROSARYSTRING", "Inv_RosaryString1"), ("Silk Grub", "CONSUMABLES_SILKEATER", "Inv_Silkeater"), ("Rosary_Set_Small", "CONSUMABLES_ROSARYSTRING", "Inv_RosaryString2"), ("Fixer Idol", "CONSUMABLES_HORNETSTATUETTE", "Inv_ShardStatue"), ("Rosary_Set_Medium", "CONSUMABLES_ROSARYNECKLACE", "Inv_RosaryString3"), ("Shard Pouch", "CONSUMABLES_SHARDBUNDLE", "Inv_ShardBundle"), ("Rosary_Set_Large", "CONSUMABLES_HEAVYROSARYNECKLACE", "Inv_RosaryString4"), ("Great Shard", "CONSUMABLES_BEASTSHARD", "Inv_ShardBeast"), ("Rosary_Set_Huge_White", "CONSUMABLES_PALEROSARYNECKLACE", "Inv_RosaryString5"), ("Pristine Core", "CONSUMABLES_PRISTINECORE", "Inv_ShardCore") }) { string name2 = item15.Item1; string item5 = item15.Item2; string item6 = item15.Item3; CollectableItem item2 = CollectableItemManager.GetItemByName(name2); AppendIncrementTile(item5, () => item2.CollectedAmount, delegate(int value) { SetCollectableAmount(name2, (int _) => value); static void SetCollectableAmount(string name, Func affector) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (CollectableItemManager.IsInHiddenMode()) { ManagerSingleton.Instance.AffectItemData(name, (ItemAffectingDelegate)delegate(ref Data data) { data.AmountWhileHidden = affector(data.AmountWhileHidden); }); } else { ManagerSingleton.Instance.AffectItemData(name, (ItemAffectingDelegate)delegate(ref Data data) { data.Amount = affector(data.Amount); }); } } }, item6); } AddTab("MAINPANEL_TAB_KEYBINDS"); Dictionary> dictionary = new Dictionary>(); foreach (string item16 in keybindCategoryOrder) { dictionary.Add(item16, new List()); } foreach (BindAction value in DebugMod.bindActions.Values) { if (!dictionary.ContainsKey(value.Category)) { keybindCategoryOrder.Add(value.Category); dictionary.Add(value.Category, new List()); } dictionary[value.Category].Add(value); } foreach (string item17 in keybindCategoryOrder) { CanvasText canvasText = AppendSectionHeader(item17); canvasText.FontSize = KeybindHeaderFontSize; canvasText.Alignment = (TextAnchor)3; foreach (BindAction action in dictionary[item17]) { using PanelBuilder panelBuilder = new PanelBuilder(currentTab.AppendFixed(new CanvasPanel(action.Name), ListingHeight)); panelBuilder.Horizontal = true; CanvasText canvasText2 = panelBuilder.AppendFlex(new CanvasText("KeybindName", (HorizontalWrapMode)0)); canvasText2.Text = Localization.Get(action.Name); canvasText2.Alignment = (TextAnchor)3; CanvasText keycode = panelBuilder.AppendFlex(new CanvasText("Keycode", (HorizontalWrapMode)0)); keycode.Alignment = (TextAnchor)3; keycode.Text = KeybindDialog.GetKeycodeText(action.Name); DebugMod.bindUpdated += delegate(string name, KeyCode? _) { if (name == action.Name) { keycode.Text = KeybindDialog.GetKeycodeText(action.Name); } }; CanvasButton canvasButton = panelBuilder.AppendSquare(new CanvasButton("Edit")); canvasButton.ImageOnly(UICommon.images["IconDotCircled"]); canvasButton.OnClicked += delegate { DebugMod.UpdateBind(action.Name, (KeyCode)0); }; panelBuilder.AppendPadding(UICommon.Margin); CanvasButton canvasButton2 = panelBuilder.AppendSquare(new CanvasButton("Clear")); canvasButton2.ImageOnly(UICommon.images["IconX"]); canvasButton2.OnClicked += delegate { DebugMod.UpdateBind(action.Name, null); }; panelBuilder.AppendPadding(UICommon.Margin); CanvasButton canvasButton3 = panelBuilder.AppendSquare(new CanvasButton("Run")); canvasButton3.ImageOnly(UICommon.images["IconRun"]); canvasButton3.OnClicked += action.Action; } } void AddItemsLabeledTiles(List<(string, string, string)> items) { foreach (var item18 in items) { string item8 = item18.Item1; string item9 = item18.Item2; string item10 = item18.Item3; CollectableItem item7 = CollectableItemManager.GetItemByName(item8); AppendLabeledTile(item9, () => item7.IsVisible, delegate { ToggleItem(item7); static void ToggleItem(CollectableItem item) { if (item.CollectedAmount == 0) { item.Collect(1, false); } else { item.Take(1, false); } } }, item10); } } static void BuildLifebloodTile(CanvasPanel controlRow) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) CanvasButton canvasButton4 = controlRow.Add(new CanvasButton("Button")); canvasButton4.Size = controlRow.Size; canvasButton4.Text.Text = Localization.Get("ITEMS_ADD"); canvasButton4.OnClicked += BindableFunctions.Lifeblood; } static bool CameraShakeToggled() { PlayMakerFSM cameraShakeFSM = GameCameras.instance.cameraShakeFSM; if (!Object.op_Implicit((Object)(object)cameraShakeFSM)) { return false; } return !((Behaviour)cameraShakeFSM).enabled; } static bool CocoonPreviewToggled() { CocoonPreviewer component3 = ((Component)GameManager.instance).GetComponent(); if (!Object.op_Implicit((Object)(object)component3)) { return false; } return component3.previewEnabled; } static bool HUDToggled() { PlayMakerFSM hudCanvasSlideOut = GameCameras.instance.hudCanvasSlideOut; if (!Object.op_Implicit((Object)(object)hudCanvasSlideOut)) { return false; } return !((Component)hudCanvasSlideOut).gameObject.activeInHierarchy; } static bool HeroLightToggled() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) GameObject refKnight2 = DebugMod.RefKnight; if (!Object.op_Implicit((Object)(object)refKnight2)) { return false; } Transform val = refKnight2.transform.Find("HeroLight"); if (!Object.op_Implicit((Object)(object)val)) { return false; } SpriteRenderer component2 = ((Component)val).GetComponent(); if (!Object.op_Implicit((Object)(object)component2)) { return false; } return Math.Abs(component2.color.a) == 0f; } static bool HideHeroToggled() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) GameObject refKnight = DebugMod.RefKnight; if (!Object.op_Implicit((Object)(object)refKnight)) { return false; } tk2dSprite component = refKnight.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return false; } return Math.Abs(((tk2dBaseSprite)component).color.a) == 0f; } static void SetHealth(int value) { if (!HeroController.instance.cState.dead && GameManager.instance.IsGameplayScene()) { HeroController.instance.AddHealth(value - PlayerData.instance.health); HudHelper.RefreshMasks(); } } static void SetMaxHealth(int value) { bool num = value > PlayerData.instance.maxHealth; PlayerData.instance.maxHealth = value; PlayerData.instance.maxHealthBase = value; if (num) { HeroController.instance.MaxHealth(); } else { PlayerData.instance.health = Math.Min(PlayerData.instance.health, PlayerData.instance.maxHealth); } HudHelper.RefreshMasks(); } static void SetMaxSilk(int value) { PlayerData.instance.silkMax = value; PlayerData.instance.silk = Math.Min(PlayerData.instance.silk, PlayerData.instance.silkMax); HudHelper.RefreshSpool(); if (PlayerData.instance.IsSilkSpoolBroken && value > 9) { PlayerData.instance.IsSilkSpoolBroken = false; EventRegister.SendEvent("SPOOL UNBROKEN", (GameObject)null); } } static void SetNailDamage(int value) { int num2 = Math.Clamp((value - 5) / 4, 0, 4); PlayerData.instance.nailUpgrades = num2; DebugMod.extraNailDamage = value - (num2 * 4 + 5); } static void SetSilk(int value) { if (value > PlayerData.instance.silk) { HeroController.instance.AddSilk(value - PlayerData.instance.silk, true); } else if (value < PlayerData.instance.silk) { HeroController.instance.TakeSilk(PlayerData.instance.silk - value); } } } private PanelBuilder AddTab(string name) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = Add(new CanvasPanel(name)); canvasPanel.LocalPosition = new Vector2(0f, (float)(TabButtonHeight - 1)); canvasPanel.Size = new Vector2((float)UICommon.RightSideWidth, (float)UICommon.MainPanelHeight - canvasPanel.LocalPosition.y); canvasPanel.CollapseMode = CollapseMode.Deny; UICommon.AddBackground(canvasPanel); tabs.Add(canvasPanel); CanvasScrollView canvasScrollView = canvasPanel.Add(new CanvasScrollView("ScrollView")); canvasScrollView.LocalPosition = new Vector2((float)canvasPanel.ContentMargin(), (float)canvasPanel.ContentMargin()); canvasScrollView.Size = new Vector2(canvasPanel.Size.x - (float)(canvasPanel.ContentMargin() * 2) - (float)UICommon.Margin - (float)ScrollbarWidth, canvasPanel.Size.y - (float)(canvasPanel.ContentMargin() * 2)); CanvasScrollbar canvasScrollbar = canvasPanel.Add(new CanvasScrollbar("Scrollbar")); canvasScrollbar.LocalPosition = new Vector2((float)canvasPanel.ContentMargin() + canvasScrollView.Size.x, (float)canvasPanel.ContentMargin(UICommon.Margin)); canvasScrollbar.Size = new Vector2((float)ScrollbarWidth, canvasPanel.Size.y - (float)(canvasPanel.ContentMargin(UICommon.Margin) * 2)); canvasScrollbar.ScrollView = canvasScrollView; CanvasPanel canvasPanel2 = canvasScrollView.SetContent(new CanvasPanel("Panel")); canvasPanel2.Size = canvasScrollView.Size; PanelBuilder panelBuilder = new PanelBuilder(canvasPanel2); panelBuilder.DynamicLength = true; panelBuilder.Padding = UICommon.Margin; currentTab?.Build(); currentTab = panelBuilder; rowCounter = 0; return panelBuilder; } private void SetupRow(CanvasPanel row, params int[] widths) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) int num = (int)row.Size.x; int num2 = widths.Sum(); int num3 = (num - UICommon.Margin * (num2 - 1)) / num2; if (num2 != lastRowCount || rowIndex != widths.Length) { int[] array = rowPositions; int[] array2 = rowWidths; int num4 = 0; rowPositions = new int[widths.Length]; rowWidths = new int[widths.Length]; for (int i = 0; i < widths.Length; i++) { rowPositions[i] = num4; rowWidths[i] = num3 * widths[i] + UICommon.Margin * (widths[i] - 1); num4 += rowWidths[i] + UICommon.Margin; } rowWidths[widths.Length - 1] = num - rowPositions[widths.Length - 1]; if (lastRowCount > 1 && num2 > lastRowCount && num2 % lastRowCount == 0) { int num5 = num2 / lastRowCount; for (int j = 0; j < lastRowCount; j++) { int num6 = (j + 1) * num5 - 1; int num7 = array[j] + array2[j]; int num8 = rowPositions[num6] + rowWidths[num6]; if (num7 != num8) { rowWidths[num6] += num7 - num8; for (int k = num6 + 1; k < widths.Length; k++) { rowPositions[k] += num7 - num8; } } } rowWidths[widths.Length - 1] = num - rowPositions[widths.Length - 1]; } } currentRow = row; rowCounter++; rowIndex = 0; lastRowCount = num2; } private void ResetRow() { currentRow = null; } private CanvasPanel AppendRow(params int[] widths) { CanvasPanel canvasPanel = currentTab.AppendFixed(new CanvasPanel(rowCounter.ToString()), UICommon.ControlHeight); canvasPanel.CollapseMode = CollapseMode.AllowNoRenaming; SetupRow(canvasPanel, widths); return canvasPanel; } private CanvasPanel AppendTileRow(int count) { CanvasPanel canvasPanel = currentTab.AppendLazy(new CanvasPanel(rowCounter.ToString())); canvasPanel.CollapseMode = CollapseMode.AllowNoRenaming; SetupRow(canvasPanel, Enumerable.Repeat(1, count).ToArray()); return canvasPanel; } private CanvasText AppendSectionHeader(string name) { currentTab.AppendPadding(SectionEndPadding); CanvasText canvasText = currentTab.AppendFixed(new CanvasText(name, (HorizontalWrapMode)0), SectionHeaderHeight); canvasText.Text = Localization.Get(name); canvasText.Font = UICommon.trajanBold; canvasText.FontSize = SectionHeaderFontSize; canvasText.Alignment = (TextAnchor)4; ResetRow(); return canvasText; } private CanvasPanel AppendRowElement(string name) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = currentRow.Add(new CanvasPanel(name)); canvasPanel.LocalPosition = new Vector2((float)rowPositions[rowIndex], 0f); canvasPanel.Size = new Vector2((float)rowWidths[rowIndex], currentRow.Size.y); rowIndex++; if (rowIndex == rowPositions.Length) { ResetRow(); } return canvasPanel; } private CanvasPanel AppendButtonControl(string name, Action effect, Action update) { if (currentRow == null) { currentRow = AppendRow(1); } CanvasPanel canvasPanel = AppendRowElement(name); PanelBuilder panelBuilder = new PanelBuilder(canvasPanel); panelBuilder.Horizontal = true; CanvasButton button = panelBuilder.AppendFlex(new CanvasButton("Button")); button.Text.Text = Localization.Get(name); button.OnClicked += delegate { try { effect(); } catch (Exception arg) { DebugMod.LogError($"Error clicking button {button.GetQualifiedName()}: {arg}"); } }; if (update != null) { button.OnUpdate += delegate { update(button); }; } if (DebugMod.bindsByMethod.TryGetValue(effect.Method, out var value)) { UICommon.AppendKeybindButton(panelBuilder, value); } panelBuilder.Build(); return canvasPanel; } private CanvasPanel AppendBasicControl(string name, Action effect) { return AppendButtonControl(name, effect, null); } private CanvasPanel AppendToggleControl(string name, Func getter, Action effect) { return AppendButtonControl(name, effect, delegate(CanvasButton button) { button.Toggled = getter(); }); } private CanvasPanel AppendNumericControl(string name, Func getter, float defaultValue, Action setter, Action increase, Action decrease, Action reset) { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) if (currentRow == null) { currentRow = AppendRow(1); } CanvasPanel canvasPanel = AppendRowElement(name); PanelBuilder panelBuilder = new PanelBuilder(canvasPanel) { Horizontal = true, InnerPadding = -1f }; CanvasButton label = panelBuilder.AppendFlex(new CanvasButton("Label")); label.Text.Text = Localization.Get(name); label.RemoveHoverBorder(); label.OnUpdate += delegate { //IL_002c: 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) label.SetImage(Mathf.Approximately(getter(), defaultValue) ? UICommon.panelBG : UICommon.panelStrongBG); }; List list = new List(); if (DebugMod.bindsByMethod.TryGetValue(increase.Method, out var value)) { list.Add(value); } if (DebugMod.bindsByMethod.TryGetValue(decrease.Method, out value)) { list.Add(value); } if (DebugMod.bindsByMethod.TryGetValue(reset.Method, out value)) { list.Add(value); } if (list.Count > 0) { panelBuilder.AppendPadding((0f - panelBuilder.InnerPadding) * 2f); UICommon.AppendKeybindButton(panelBuilder, list.ToArray()); } int num = UICommon.ScaleWidth(70); panelBuilder.AppendPadding((0f - panelBuilder.InnerPadding) * 2f); CanvasPanel canvasPanel2 = panelBuilder.AppendFixed(new CanvasPanel("Connector1"), num); canvasPanel2.CollapseMode = CollapseMode.Deny; CanvasBorder canvasBorder = canvasPanel2.Add(new CanvasBorder("Border")); canvasBorder.LocalPosition = new Vector2(0f, (float)(int)(panelBuilder.ChildBreadth() / 2f)); canvasBorder.Sides = BorderSides.TOP; CanvasButton canvasButton = panelBuilder.AppendSquare(new CanvasButton("Decrease")); canvasButton.SetImage(UICommon.images["IconMinusMin"]); canvasButton.RemoveText(); canvasButton.OnClicked += decrease; CanvasButton canvasButton2 = panelBuilder.AppendFlex(new CanvasButton("Button")); canvasButton2.SetImage(UICommon.clearBG); canvasButton2.Border.Sides &= ~BorderSides.LEFT; CanvasTextField textField = canvasButton2.SetTextField(); textField.OnUpdate += delegate { textField.UpdateDefaultText(getter().ToString(CultureInfo.CurrentCulture)); }; textField.OnSubmit += delegate(string text) { if (float.TryParse(text, out var result)) { setter(result); } }; CanvasButton canvasButton3 = panelBuilder.AppendSquare(new CanvasButton("Increase")); canvasButton3.SetImage(UICommon.images["IconPlusMin"]); canvasButton3.RemoveText(); canvasButton3.OnClicked += increase; canvasButton3.Border.Sides &= ~BorderSides.LEFT; panelBuilder.AppendPadding((0f - panelBuilder.InnerPadding) * 2f); CanvasPanel canvasPanel3 = panelBuilder.AppendFixed(new CanvasPanel("Connector2"), num); canvasPanel3.CollapseMode = CollapseMode.Deny; CanvasBorder canvasBorder2 = canvasPanel3.Add(new CanvasBorder("Border")); canvasBorder2.LocalPosition = new Vector2(0f, (float)(int)(panelBuilder.ChildBreadth() / 2f)); canvasBorder2.Sides = BorderSides.TOP; CanvasPanel canvasPanel4 = panelBuilder.AppendSquare(new CanvasPanel("Reset")); canvasPanel4.CollapseMode = CollapseMode.Deny; UICommon.AddBackground(canvasPanel4); CanvasButton canvasButton4 = canvasPanel4.Add(new CanvasButton("Button")); canvasButton4.Size = canvasPanel4.Size; canvasButton4.SetImage(UICommon.images["IconReset"]); canvasButton4.RemoveText(); canvasButton4.OnClicked += reset; panelBuilder.Build(); return canvasPanel; } private CanvasPanel AppendLabeledTile(string name, Func getter, Action effect, string image = "IconX", bool includeLabel = true, int defaultRowWidth = 5) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = currentRow ?? AppendTileRow(defaultRowWidth); CanvasPanel canvasPanel2 = AppendRowElement(name); canvasPanel2.CollapseMode = CollapseMode.Deny; CanvasButton button = canvasPanel2.Add(new CanvasButton("Button")); button.OnUpdate += delegate { button.Toggled = getter(); }; button.OnClicked += effect; PanelBuilder panelBuilder = new PanelBuilder(canvasPanel2); panelBuilder.Padding = (float)UICommon.Margin / 2f; panelBuilder.DynamicLength = true; panelBuilder.AppendFixed(new CanvasImage("Icon"), (float)rowWidths[0] - panelBuilder.OuterPadding * 2f).SetImage(UICommon.images[image]); if (includeLabel) { CanvasText canvasText = panelBuilder.AppendFixed(new CanvasText("Label", (HorizontalWrapMode)0), ListingHeight * 2); canvasText.Alignment = (TextAnchor)4; canvasText.Text = Localization.Get(name); } panelBuilder.Build(); button.Size = canvasPanel2.Size; canvasPanel.Size = new Vector2(canvasPanel.Size.x, Mathf.Max(canvasPanel.Size.y, canvasPanel2.Size.y)); return canvasPanel2; } private CanvasPanel AppendWideTile(string name, Action controlBuilder, string image = "IconX") { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = currentRow ?? AppendTileRow(2); int num = rowWidths[0] / 3; CanvasPanel canvasPanel2 = AppendRowElement(name); canvasPanel2.CollapseMode = CollapseMode.Deny; UICommon.AddBackground(canvasPanel2); canvasPanel2.Size = new Vector2(canvasPanel2.Size.x, (float)(num + UICommon.Margin * 2)); PanelBuilder panelBuilder = new PanelBuilder(canvasPanel2); panelBuilder.Horizontal = true; panelBuilder.InnerPadding = UICommon.Margin; panelBuilder.OuterPadding = canvasPanel2.ContentMargin(UICommon.Margin); panelBuilder.AppendSquare(new CanvasImage("Icon")).SetImage(UICommon.images[image]); PanelBuilder panelBuilder2 = new PanelBuilder(panelBuilder.AppendFlex(new CanvasPanel("Container"))); panelBuilder2.AppendFlexPadding(); CanvasText obj = panelBuilder2.AppendFixed(length: (rowWidths.Length > 2) ? ListingHeight : (ListingHeight * 2), element: new CanvasText("Label", (HorizontalWrapMode)0)); obj.Alignment = (TextAnchor)4; obj.Text = Localization.Get(name); panelBuilder2.AppendFlexPadding(); panelBuilder2.AppendPadding(UICommon.Margin); CanvasPanel obj2 = panelBuilder2.AppendFixed(length: (rowWidths.Length > 2) ? UICommon.ScaleHeight(20) : UICommon.ControlHeight, element: new CanvasPanel("ControlRow")); panelBuilder.Build(); panelBuilder2.Build(); controlBuilder(obj2); canvasPanel.Size = new Vector2(canvasPanel.Size.x, Mathf.Max(canvasPanel.Size.y, canvasPanel2.Size.y)); return canvasPanel2; } private CanvasPanel AppendIncrementTile(string name, Func getter, Action setter, string image = "IconX", Action customAdd = null, Action customRemove = null, int step = 1, int min = 0, int max = int.MaxValue, bool wrap = false) { return AppendWideTile(name, Builder, image); void Builder(CanvasPanel controlRow) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) PanelBuilder obj = new PanelBuilder(controlRow) { Horizontal = true, InnerPadding = -1f }; CanvasButton canvasButton = obj.AppendSquare(new CanvasButton("Decrement")); canvasButton.SetImage(UICommon.images["IconMinusMin"]); canvasButton.RemoveText(); canvasButton.OnClicked += customRemove ?? ((Action)delegate { ValueUpdate(getter() - step); }); CanvasButton canvasButton2 = obj.AppendFlex(new CanvasButton("Value")); canvasButton2.SetImage(UICommon.clearBG); canvasButton2.Border.Sides &= ~BorderSides.LEFT; CanvasTextField textField = canvasButton2.SetTextField(); textField.OnUpdate += delegate { textField.UpdateDefaultText(getter().ToString()); }; textField.OnSubmit += delegate(string text) { if (int.TryParse(text, out var result)) { if (result < min) { result = min; } if (result > max) { result = max; } setter(result); } }; CanvasButton canvasButton3 = obj.AppendSquare(new CanvasButton("Increment")); canvasButton3.SetImage(UICommon.images["IconPlusMin"]); canvasButton3.RemoveText(); canvasButton3.OnClicked += customAdd ?? ((Action)delegate { ValueUpdate(getter() + step); }); canvasButton3.Border.Sides &= ~BorderSides.LEFT; obj.Build(); } void ValueUpdate(int value) { if (value < min) { value = (wrap ? max : min); } if (value > max) { value = (wrap ? min : max); } setter(value); } } public override void Build() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) currentTab?.Build(); float num = (base.Size.x - (float)(UICommon.Margin * (tabs.Count - 1))) / (float)tabs.Count; foreach (CanvasPanel tab in tabs) { CanvasButton button = Add(new CanvasButton(tab.Name + "TabButton")); button.Size = new Vector2(num, (float)TabButtonHeight); button.SetImage(UICommon.panelBG); button.Text.Text = Localization.Get(tab.Name); button.OnClicked += delegate { DebugMod.settings.MainPanelCurrentTab = tab.Name; }; button.OnUpdate += delegate { button.Toggled = DebugMod.settings.MainPanelCurrentTab == tab.Name; }; tabButtons.Add(button); } LayoutTabsNormal(); base.Build(); } internal void LayoutTabsNormal() { //IL_0023: 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) float num = 0f; foreach (CanvasButton tabButton in tabButtons) { tabButton.LocalPosition = new Vector2(num, 0f); num += tabButton.Size.x + (float)UICommon.Margin; } } internal void LayoutTabsSide(float offset) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) float num = offset; foreach (CanvasButton tabButton in tabButtons) { tabButton.LocalPosition = new Vector2(0f - tabButton.Size.x + 1f, num); num += tabButton.Size.y + (float)UICommon.Margin; } } private void DoUpdate() { bool flag = true; foreach (CanvasPanel tab in tabs) { if (DebugMod.settings.MainPanelCurrentTab == tab.Name) { tab.ActiveSelf = true; flag = false; } else { tab.ActiveSelf = false; } } if (flag) { DebugMod.settings.MainPanelCurrentTab = tabs[0].Name; tabs[0].ActiveSelf = true; } } } public class SaveStatesPanel : CanvasPanel { private SelectOperation selectStateOperation; private int currentPage; public static int QuickSlotButtonWidth => UICommon.ScaleWidth(90); public static int FileSlotButtonWidth => UICommon.ScaleWidth(60); public static int IconPadding => UICommon.ScaleHeight(4); public static SaveStatesPanel Instance { get; private set; } public static bool ShouldBeVisible { get { if (!DebugMod.settings.SaveStatePanelVisible) { return InSelectState; } return true; } } public static bool ShouldBeExpanded { get { if (!DebugMod.settings.SaveStatePanelExpanded) { return InSelectState; } return true; } } public static bool InSelectState { get { if (Instance != null) { return Instance.selectStateOperation != SelectOperation.None; } return false; } } public static void BuildPanel() { Instance = new SaveStatesPanel(); Instance.Build(); } public SaveStatesPanel() : base("SaveStatesPanel") { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) base.LocalPosition = new Vector2((float)Screen.width / 2f - (float)UICommon.SaveStatePanelWidth / 2f, (float)UICommon.ScreenMargin); base.Size = new Vector2((float)UICommon.SaveStatePanelWidth, 0f); base.OnUpdate += DoUpdate; CanvasImage expandedBackground = UICommon.AddBackground(this); base.OnUpdate += delegate { expandedBackground.ActiveSelf = ShouldBeExpanded; }; CanvasPanel canvasPanel = Add(new CanvasPanel("Collapsed")); canvasPanel.Size = base.Size; canvasPanel.CollapseMode = CollapseMode.Deny; PanelBuilder panelBuilder = new PanelBuilder(canvasPanel) { DynamicLength = true, OuterPadding = ContentMargin(UICommon.Margin), InnerPadding = UICommon.Margin }; using (PanelBuilder panelBuilder2 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel("Quickslot"), UICommon.ControlHeight))) { panelBuilder2.Horizontal = true; CanvasText quickslotLabel = panelBuilder2.AppendFlex(new CanvasText("Label", (HorizontalWrapMode)0)); quickslotLabel.Alignment = (TextAnchor)3; quickslotLabel.OnUpdate += delegate { quickslotLabel.Text = string.Format(Localization.Get("SAVESTATEPANEL_QUICKSLOTFORMAT"), SaveStateManager.GetQuickState()); }; CanvasButton canvasButton = panelBuilder2.AppendFixed(new CanvasButton("Load"), QuickSlotButtonWidth - UICommon.ControlHeight); canvasButton.Text.Text = Localization.Get("SAVESTATEPANEL_QUICKSLOTLOAD"); canvasButton.OnClicked += delegate { CancelSelectState(leavePanelOpen: true); SaveStateManager.LoadState(SaveStateManager.GetQuickState()); }; UICommon.AppendKeybindButton(panelBuilder2, DebugMod.bindActions["SAVESTATES_QUICKSLOTLOAD"]); panelBuilder2.AppendPadding(UICommon.Margin); CanvasButton canvasButton2 = panelBuilder2.AppendFixed(new CanvasButton("Save"), QuickSlotButtonWidth - UICommon.ControlHeight); canvasButton2.Text.Text = Localization.Get("SAVESTATEPANEL_QUICKSLOTSAVE"); canvasButton2.OnClicked += delegate { CancelSelectState(leavePanelOpen: true); SaveStateManager.SetQuickState(SaveStateManager.SaveNewState()); }; UICommon.AppendKeybindButton(panelBuilder2, DebugMod.bindActions["SAVESTATES_QUICKSLOTSAVE"]); panelBuilder2.AppendPadding(UICommon.Margin); CanvasPanel canvasPanel2 = panelBuilder2.AppendSquare(new CanvasPanel("ToggleViewWrapper")); canvasPanel2.CollapseMode = CollapseMode.AllowNoRenaming; using PanelBuilder panelBuilder3 = new PanelBuilder(canvasPanel2); panelBuilder3.Padding = IconPadding; CanvasButton toggleViewButton = panelBuilder3.AppendFlex(new CanvasButton("ToggleView")); toggleViewButton.ImageOnly(UICommon.images["IconPlus"]); toggleViewButton.OnUpdate += delegate { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) toggleViewButton.SetImage(ShouldBeExpanded ? UICommon.images["IconMinus"] : UICommon.images["IconPlus"]); }; toggleViewButton.OnClicked += ToggleView; } panelBuilder.Build(); CanvasImage collapsedBackground = UICommon.AddBackground(canvasPanel); base.OnUpdate += delegate { collapsedBackground.ActiveSelf = !ShouldBeExpanded; }; CanvasPanel expanded = Add(new CanvasPanel("Expanded")); expanded.Size = base.Size; expanded.CollapseMode = CollapseMode.Deny; base.OnUpdate += delegate { expanded.ActiveSelf = ShouldBeExpanded; }; panelBuilder = new PanelBuilder(expanded); panelBuilder.DynamicLength = true; panelBuilder.OuterPadding = ContentMargin(UICommon.Margin); panelBuilder.InnerPadding = UICommon.Margin; panelBuilder.AppendPadding((float)(int)canvasPanel.Size.y - panelBuilder.OuterPadding * 2f); using (PanelBuilder panelBuilder4 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel("Page"), UICommon.ScaleHeight(15)))) { panelBuilder4.Horizontal = true; CanvasText pageText = panelBuilder4.AppendFixed(new CanvasText("Current", (HorizontalWrapMode)0), UICommon.ScaleWidth(85)); pageText.Alignment = (TextAnchor)3; pageText.OnUpdate += delegate { pageText.Text = string.Format(Localization.Get("SAVESTATEPANEL_PAGEFORMAT"), currentPage + 1, SaveStateManager.NumPages); }; CanvasButton canvasButton3 = panelBuilder4.AppendSquare(new CanvasButton("Prev")); canvasButton3.ImageOnly(UICommon.images["IconMinus"]); canvasButton3.OnClicked += PrevPage; panelBuilder4.AppendPadding(UICommon.Margin); CanvasButton canvasButton4 = panelBuilder4.AppendSquare(new CanvasButton("Next")); canvasButton4.ImageOnly(UICommon.images["IconPlus"]); canvasButton4.OnClicked += NextPage; CanvasText currentOperation = panelBuilder4.AppendFlex(new CanvasText("CurrentOperation", (HorizontalWrapMode)0)); currentOperation.Alignment = (TextAnchor)5; currentOperation.OnUpdate += delegate { currentOperation.Text = PrettyPrintSelectOperation(selectStateOperation); }; } for (int i = 0; i < 10; i++) { int index = i; using PanelBuilder panelBuilder5 = new PanelBuilder(panelBuilder.AppendFixed(new CanvasPanel(index.ToString()), UICommon.ControlHeight)); panelBuilder5.Horizontal = true; CanvasText number = panelBuilder5.AppendFixed(new CanvasText("Number", (HorizontalWrapMode)0), UICommon.ScaleWidth(30)); number.Alignment = (TextAnchor)3; number.Text = index.ToString(); number.OnUpdate += delegate { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) number.Color = (InSelectState ? UICommon.highlightColor : UICommon.textColor); }; CanvasTextField name = panelBuilder5.AppendFlex(new CanvasTextField("Name")); name.Alignment = (TextAnchor)3; name.OnUpdate += delegate { name.UpdateDefaultText(SaveStateManager.GetFileState(currentPage, index).ToString()); }; name.OnSubmit += delegate(string text) { SaveStateManager.RenameFileState(currentPage, index, text); }; CanvasPanel canvasPanel3 = panelBuilder5.AppendSquare(new CanvasPanel("RenameWrapper")); canvasPanel3.CollapseMode = CollapseMode.AllowNoRenaming; using PanelBuilder panelBuilder6 = new PanelBuilder(canvasPanel3); panelBuilder6.Padding = IconPadding; CanvasButton canvasButton5 = panelBuilder6.AppendFlex(new CanvasButton("Rename")); canvasButton5.ImageOnly(UICommon.images["IconEditText"]); canvasButton5.OnClicked += delegate { CancelSelectState(leavePanelOpen: true); name.Activate(); }; panelBuilder5.AppendPadding(UICommon.Margin); CanvasButton read = panelBuilder5.AppendFixed(new CanvasButton("Read"), FileSlotButtonWidth); read.Text.Text = Localization.Get("SAVESTATEPANEL_FILESLOTREAD"); read.OnUpdate += delegate { //IL_0024: 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) read.Border.Color = (IsReadOperation() ? UICommon.highlightColor : UICommon.borderColor); }; read.OnClicked += delegate { if (IsReadOperation()) { DoSelectOperation(index); } else if (InSelectState) { CancelSelectState(leavePanelOpen: true); } else { SaveStateManager.SetQuickState(SaveStateManager.GetFileState(currentPage, index)); } }; panelBuilder5.AppendPadding(UICommon.Margin); CanvasButton write = panelBuilder5.AppendFixed(new CanvasButton("Write"), FileSlotButtonWidth); write.Text.Text = Localization.Get("SAVESTATEPANEL_FILESLOTWRITE"); write.OnUpdate += delegate { //IL_0024: 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) write.Border.Color = (IsWriteOperation() ? UICommon.highlightColor : UICommon.borderColor); }; write.OnClicked += delegate { if (InSelectState && !IsWriteOperation()) { CancelSelectState(leavePanelOpen: true); } else if (selectStateOperation != SelectOperation.SaveToFile && !SaveStateManager.GetQuickState().IsSet()) { DebugMod.LogConsole("Save a state to the quickslot before copying to a file slot"); } else { Action action = (InSelectState ? ((Action)delegate { DoSelectOperation(index); }) : ((Action)delegate { SaveStateManager.SetFileState(SaveStateManager.GetQuickState(), currentPage, index); })); if (SaveStateManager.GetFileState(currentPage, index).IsSet()) { ConfirmDialog.Instance.Toggle(write, Localization.Get("SAVESTATEPANEL_OVERWRITEPROMPT"), action, delegate { CancelSelectState(leavePanelOpen: true); }); } else { action(); } } }; } panelBuilder.Build(); base.Size = expanded.Size; } private static string PrettyPrintSelectOperation(SelectOperation operation) { return operation switch { SelectOperation.QuickslotToFile => Localization.Get("SAVESTATEPANEL_OPERATION_QUICKSLOTTOFILE"), SelectOperation.FileToQuickslot => Localization.Get("SAVESTATEPANEL_OPERATION_FILETOQUICKSLOT"), SelectOperation.SaveToFile => Localization.Get("SAVESTATEPANEL_OPERATION_SAVETOFILE"), SelectOperation.LoadFromFile => Localization.Get("SAVESTATEPANEL_OPERATION_LOADFROMFILE"), _ => null, }; } private bool IsReadOperation() { SelectOperation selectOperation = selectStateOperation; if (selectOperation == SelectOperation.FileToQuickslot || selectOperation == SelectOperation.LoadFromFile) { return true; } return false; } private bool IsWriteOperation() { SelectOperation selectOperation = selectStateOperation; if (selectOperation == SelectOperation.QuickslotToFile || selectOperation == SelectOperation.SaveToFile) { return true; } return false; } private void DoUpdate() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!InSelectState || CanvasTextField.AnyFieldFocused) { return; } foreach (KeyValuePair item in DebugMod.alphaKeyDict) { if (Input.GetKeyDown(item.Key)) { DoSelectOperation(item.Value); break; } } } public void ToggleView() { if (InSelectState) { DebugMod.settings.SaveStatePanelExpanded = false; CancelSelectState(); } else { DebugMod.settings.SaveStatePanelExpanded = !DebugMod.settings.SaveStatePanelExpanded; } } private void DoSelectOperation(int index) { switch (selectStateOperation) { case SelectOperation.QuickslotToFile: SaveStateManager.SetFileState(SaveStateManager.GetQuickState(), currentPage, index); break; case SelectOperation.FileToQuickslot: SaveStateManager.SetQuickState(SaveStateManager.GetFileState(currentPage, index)); break; case SelectOperation.SaveToFile: SaveStateManager.SetFileState(SaveStateManager.SaveNewState(), currentPage, index); break; case SelectOperation.LoadFromFile: SaveStateManager.LoadState(SaveStateManager.GetFileState(currentPage, index)); break; } CancelSelectState(); } public void NextPage() { if (ShouldBeVisible && ShouldBeExpanded) { currentPage++; if (currentPage >= SaveStateManager.NumPages) { currentPage -= SaveStateManager.NumPages; } } } public void PrevPage() { if (ShouldBeVisible && ShouldBeExpanded) { currentPage--; if (currentPage < 0) { currentPage += SaveStateManager.NumPages; } } } public void EnterSelectState(SelectOperation operation) { if (selectStateOperation == operation) { CancelSelectState(); } else { selectStateOperation = operation; } } public void CancelSelectState(bool leavePanelOpen = false) { if (InSelectState && leavePanelOpen) { DebugMod.settings.SaveStatePanelVisible = true; DebugMod.settings.SaveStatePanelExpanded = true; } selectStateOperation = SelectOperation.None; } internal void PageCountChanged() { if (currentPage >= SaveStateManager.NumPages) { currentPage = 0; } } } public enum SelectOperation { None, QuickslotToFile, FileToQuickslot, SaveToFile, LoadFromFile } public static class UICommon { public const int BORDER_THICKNESS = 1; public static readonly Color baseColor = RGB(36, 39, 58); public static readonly Color strongColor = RGB(73, 77, 100); public static readonly Color borderColor = RGB(202, 211, 245); public static readonly Color accentColor = RGB(138, 173, 244); public static readonly Color highlightColor = RGB(245, 169, 127); public static readonly Color textColor = Color.white; public static readonly Color iconColor = MakeGrayscale(borderColor); public static readonly Texture2D panelBG = SolidColor(baseColor, 100); public static readonly Texture2D panelStrongBG = SolidColor(strongColor, 220); public static readonly Texture2D dialogBG = SolidColor(baseColor); public static readonly Texture2D clearBG = SolidColor(baseColor, 0); public static Font trajanBold; public static Font trajanNormal; public static Font arial; public static readonly Dictionary images = new Dictionary(); public static int RightSideWidth => ScaleWidth(450); public static int LeftSideWidth => ScaleWidth(450); public static int MainPanelHeight => ScaleHeight(650); public static int ConsoleHeight => ScaleHeight(250); public static int InfoPanelExpandedHeight => ScaleHeight(470); public static int InfoPanelBaseHeight => ScaleHeight(350); public static int InfoPanelHeight { get { if (!DebugMod.settings.ExpandedInfoPanel) { return InfoPanelBaseHeight; } return InfoPanelExpandedHeight; } } public static int SaveStatePanelWidth => ScaleWidth(500); public static int Margin => ScaleHeight(6); public static int ScreenMargin => ScaleHeight(10); public static int ControlHeight => ScaleHeight(25); public static int FontSize => ScaleHeight(13); public static int ScaleWidth(int unscaled) { return (int)((float)(unscaled * Screen.width) / 1920f); } public static int ScaleHeight(int unscaled) { return (int)((float)(unscaled * Screen.height) / 1080f); } private static Color RGB(int r, int g, int b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color((float)r / 255f, (float)g / 255f, (float)b / 255f); } private static Color RGBA(int r, int g, int b, int a) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) return new Color((float)r / 255f, (float)g / 255f, (float)b / 255f, (float)a / 255f); } private static Color WithAlpha(Color color, int a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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) Color result = color; result.a = (float)a / 255f; return result; } private static Color MakeGrayscale(Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(color, ref num, ref num2, ref num3); return new Color(num3, num3, num3); } private static Texture2D SolidColor(Color color, int a = 255) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown color = WithAlpha(color, a); Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } public static CanvasImage AddBackground(CanvasPanel panel) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) CanvasImage canvasImage = panel.Add(new CanvasImage("Background")); canvasImage.IsBackground = true; canvasImage.SetImage(panelBG); canvasImage.AddBorder(); return canvasImage; } public static CanvasButton AppendKeybindButton(PanelBuilder builder, params BindAction[] actions) { //IL_0074: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) CanvasPanel canvasPanel = builder.AppendFixed(new CanvasPanel(actions[0].Name + " Keybind"), builder.ChildBreadth() - 1f); canvasPanel.CollapseMode = CollapseMode.Deny; AddBackground(canvasPanel).RemoveBorder(); CanvasButton keybindButton = canvasPanel.Add(new CanvasButton("Button")); keybindButton.LocalPosition = new Vector2(-1f, 0f); keybindButton.Size = canvasPanel.Size - keybindButton.LocalPosition; keybindButton.RemoveText(); keybindButton.Border.Sides &= ~BorderSides.LEFT; keybindButton.OnClicked += delegate { KeybindDialog.Instance.Toggle(keybindButton, actions); }; UpdateImage(); DebugMod.bindUpdated += delegate { UpdateImage(); }; return keybindButton; void UpdateImage() { //IL_0067: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) BindAction[] array = actions; foreach (BindAction bindAction in array) { if (DebugMod.settings.binds.TryGetValue(bindAction.Name, out var value) && (int)value != 0) { keybindButton.SetImage(images["IconDot"]); break; } keybindButton.SetImage(images["IconDotOutline"]); } } } public static void LoadResources() { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown Font[] array = Resources.FindObjectsOfTypeAll(); foreach (Font val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Bold") { trajanBold = val; } if ((Object)(object)val != (Object)null && ((Object)val).name == "TrajanPro-Regular") { trajanNormal = val; } if ((Object)(object)val != (Object)null && ((Object)val).name == "ARIAL") { arial = val; } } Font obj = arial; if (obj != null) { obj.RequestCharactersInTexture("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/? ", 13); } if ((Object)(object)trajanBold == (Object)null || (Object)(object)trajanNormal == (Object)null || (Object)(object)arial == (Object)null) { DebugMod.LogError("Could not find game fonts"); } string[] manifestResourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.StartsWith("DebugMod.Images.")) { continue; } try { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); byte[] array2 = new byte[manifestResourceStream.Length]; for (int j = 0; j < array2.Length; j += manifestResourceStream.Read(array2, j, array2.Length - j)) { } Texture2D val2 = new Texture2D(1, 1); ImageConversion.LoadImage(val2, array2.ToArray()); string text2 = text.Split('.')[^2]; images.Add(text2, val2); DebugMod.LogDebug("Loaded image: " + text2); } catch (Exception arg) { DebugMod.LogError($"Failed to load image: {text}\n{arg}"); } } } } } namespace DebugMod.UI.Canvas { public class CanvasBorder : CanvasNode { private record struct Args(Vector2 size, int thickness, Color color, BorderSides sides) { [CompilerGenerated] private readonly bool PrintMembers(StringBuilder builder) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) builder.Append("size = "); Vector2 val = size; builder.Append(((object)(Vector2)(ref val)).ToString()); builder.Append(", thickness = "); builder.Append(thickness.ToString()); builder.Append(", color = "); Color val2 = color; builder.Append(((object)(Color)(ref val2)).ToString()); builder.Append(", sides = "); builder.Append(sides.ToString()); return true; } } private static readonly Dictionary spriteCache = new Dictionary(); private Args args = new Args(Vector2.zero, 1, UICommon.borderColor, BorderSides.ALL); public int Thickness { get { return args.thickness; } set { if (args.thickness != value) { args.thickness = value; DrawTexture(); } } } public Color Color { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return args.color; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (args.color != value) { args.color = value; DrawTexture(); } } } public BorderSides Sides { get { return args.sides; } set { if (args.sides != value) { args.sides = value; DrawTexture(); } } } public CanvasBorder(string name) : base(name) { }//IL_0001: 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) protected override void OnUpdateSize() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.OnUpdateSize(); if (args.size != base.Size) { args.size = base.Size; DrawTexture(); } } protected override void OnUpdateParent() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) base.OnUpdateParent(); base.LocalPosition = Vector2.zero; TruncatePosition(); } private void TruncatePosition() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0036: 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_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) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)(int)base.Position.x, (float)(int)base.Position.y); if (base.Position != val) { base.LocalPosition += val - base.Position; } } public override void Build() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00c2: 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) TruncatePosition(); if ((base.Size.x == 0f || base.Size.y == 0f) && base.Parent != null) { base.Size = base.Parent.Size; } if (base.Size.x <= 0f || base.Size.y <= 0f) { DebugMod.LogWarn("Non-positive size for border " + GetQualifiedName() + ", clamped to 1"); base.Size = new Vector2 { x = Math.Max(base.Size.x, 1f), y = Math.Max(base.Size.y, 1f) }; } base.Build(); DrawTexture(); } private void DrawTexture() { //IL_0028: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)gameObject)) { return; } Texture2D tex; Color[] colors; if (!spriteCache.TryGetValue(args, out var value)) { tex = new Texture2D((int)base.Size.x, (int)base.Size.y, (TextureFormat)4, false); ((Texture)tex).filterMode = (FilterMode)0; colors = (Color[])(object)new Color[((Texture)tex).width * ((Texture)tex).height]; tex.SetPixels(colors); if ((Sides & BorderSides.LEFT) != 0) { FillRect(0, 0, Thickness, ((Texture)tex).height); } if ((Sides & BorderSides.RIGHT) != 0) { FillRect(((Texture)tex).width - Thickness, 0, Thickness, ((Texture)tex).height); } if ((Sides & BorderSides.TOP) != 0) { FillRect(0, ((Texture)tex).height - Thickness, ((Texture)tex).width, Thickness); } if ((Sides & BorderSides.BOTTOM) != 0) { FillRect(0, 0, ((Texture)tex).width, Thickness); } tex.Apply(); value = Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), Vector2.zero); spriteCache.Add(args, value); } (gameObject.GetComponent() ?? gameObject.AddComponent()).sprite = value; void FillRect(int x, int y, int width, int height) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) colors = (Color[])(object)new Color[width * height]; Array.Fill(colors, Color); tex.SetPixels(x, y, width, height, colors); } } } [Flags] public enum BorderSides { ALL = 0xF, LEFT = 1, RIGHT = 2, TOP = 4, BOTTOM = 8 } public class CanvasButton : CanvasImage { [CompilerGenerated] private sealed class d__20 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; public CanvasButton <>4__this; private IEnumerator <>7__wrap1; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; CanvasButton canvasButton = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = ((CanvasImage)canvasButton).ChildList().GetEnumerator(); <>1__state = -3; goto IL_0076; case 1: <>1__state = -3; goto IL_0076; case 2: <>1__state = -1; goto IL_00c1; case 3: { <>1__state = -1; break; } IL_0076: if (<>7__wrap1.MoveNext()) { CanvasNode current = <>7__wrap1.Current; <>2__current = current; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = null; if (hoverBorder?.Parent == canvasButton) { <>2__current = hoverBorder; <>1__state = 2; return true; } goto IL_00c1; IL_00c1: if (canvasButton.text != null) { <>2__current = canvasButton.text; <>1__state = 3; return true; } break; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__20 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__20(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } internal static CanvasBorder hoverBorder; private CanvasText text; private bool toggled; private bool useHoverBorder = true; public CanvasText Text => text; public bool Toggled { get { return toggled; } set { if (toggled != value) { toggled = value; UpdateToggled(); } } } protected override bool Interactable => true; public event Action OnClicked; internal static void BuildHoverBorder() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) hoverBorder = new CanvasBorder("HoverBorder"); hoverBorder.Size = new Vector2(1f, 1f); hoverBorder.Color = UICommon.accentColor; hoverBorder.ActiveSelf = false; hoverBorder.OnUpdate += delegate { if (hoverBorder.Parent == null || !hoverBorder.Parent.ActiveInHierarchy) { hoverBorder.ActiveSelf = false; } }; hoverBorder.Build(); } public CanvasButton(string name) : base(name) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SetImage(UICommon.panelBG); AddBorder(); text = new CanvasText("ButtonText", (HorizontalWrapMode)0); text.Parent = this; text.Alignment = (TextAnchor)4; } public CanvasTextField SetTextField() { CanvasTextField canvasTextField = new CanvasTextField("ButtonTextField"); canvasTextField.Parent = this; canvasTextField.Alignment = (TextAnchor)4; text = canvasTextField; return canvasTextField; } public void RemoveText() { text = null; } public void RemoveHoverBorder() { useHoverBorder = false; } public void ImageOnly(Texture2D tex, Rect subSprite = default(Rect)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetImage(tex, subSprite); RemoveText(); RemoveBorder(); RemoveHoverBorder(); } [IteratorStateMachine(typeof(d__20))] protected override IEnumerable ChildList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(-2) { <>4__this = this }; } protected override void OnUpdateSize() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (text != null) { text.Size = base.Size; } base.OnUpdateSize(); } public override void Build() { base.Build(); AddEventTrigger((EventTriggerType)2, delegate { this.OnClicked?.Invoke(); }); if (!useHoverBorder) { return; } AddEventTrigger((EventTriggerType)0, delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) hoverBorder.Parent = this; hoverBorder.Size = base.Size; hoverBorder.ActiveSelf = IsMouseOver(); GameObject val = ((base.Border != null) ? base.Border.GameObject : base.GameObject); hoverBorder.GameObject.transform.SetSiblingIndex(val.transform.GetSiblingIndex() + 1); base.OnUpdate += UpdateHoverBorder; }); AddEventTrigger((EventTriggerType)1, delegate { if (hoverBorder.Parent == this) { hoverBorder.ActiveSelf = false; } base.OnUpdate -= UpdateHoverBorder; }); } private void UpdateToggled() { //IL_0017: 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) SetImage(toggled ? UICommon.panelStrongBG : UICommon.panelBG); } private void UpdateHoverBorder() { if (hoverBorder.Parent == this) { hoverBorder.ActiveSelf = IsMouseOver(); } } } public class CanvasImage : CanvasNode { [CompilerGenerated] private sealed class d__17 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; public CanvasImage <>4__this; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; CanvasImage canvasImage = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (canvasImage.border != null) { <>2__current = canvasImage.border; <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } 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(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__17 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__17(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private Texture2D tex; private Rect subSprite; private Sprite sprite; private CanvasBorder border; public CanvasBorder Border => border; public bool IsBackground { get; set; } protected override bool Interactable => false; public CanvasImage(string name) : base(name) { } public void SetImage(Texture2D tex, Rect subSprite = default(Rect)) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) if (((Rect)(ref subSprite)).width == 0f || ((Rect)(ref subSprite)).height == 0f) { ((Rect)(ref subSprite))..ctor(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height); } if (!((Object)(object)this.tex == (Object)(object)tex) || !(this.subSprite == subSprite)) { this.tex = tex; this.subSprite = subSprite; sprite = null; if (Object.op_Implicit((Object)(object)gameObject)) { UpdateSprite(); } } } public void SetImage(Sprite sprite) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)this.sprite == (Object)(object)sprite)) { this.sprite = sprite; tex = null; subSprite = sprite.rect; if (Object.op_Implicit((Object)(object)gameObject)) { UpdateSprite(); } } } public CanvasBorder AddBorder() { if (border == null) { border = new CanvasBorder("Border"); } border.Parent = this; return border; } public void RemoveBorder() { border = null; } [IteratorStateMachine(typeof(d__17))] protected override IEnumerable ChildList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(-2) { <>4__this = this }; } protected override void OnUpdateSize() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) base.OnUpdateSize(); if (border != null) { border.Size = base.Size; } } public override void Build() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (IsBackground && base.Parent != null) { base.Size = base.Parent.Size; } base.Build(); if (IsBackground && !Interactable) { gameObject.GetComponent().blocksRaycasts = true; } gameObject.AddComponent(); UpdateSprite(); } private void UpdateSprite() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) Image component = gameObject.GetComponent(); component.sprite = (Object.op_Implicit((Object)(object)sprite) ? sprite : Sprite.Create(tex, new Rect(((Rect)(ref subSprite)).x, (float)((Texture)tex).height - ((Rect)(ref subSprite)).height - ((Rect)(ref subSprite)).y, ((Rect)(ref subSprite)).width, ((Rect)(ref subSprite)).height), Vector2.zero)); ((Graphic)component).color = UICommon.iconColor; } } public abstract class CanvasNode { [CompilerGenerated] private sealed class d__37 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>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(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__37(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__38 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; public CanvasNode <>4__this; private IEnumerator <>7__wrap1; private IEnumerator <>7__wrap2; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__38(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || num == 2) { try { if (num == -4 || num == 2) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>7__wrap2 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; CanvasNode canvasNode = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = canvasNode; <>1__state = 1; return true; case 1: <>1__state = -1; <>7__wrap1 = canvasNode.ChildList().GetEnumerator(); <>1__state = -3; goto IL_00ce; case 2: { <>1__state = -4; goto IL_00b4; } IL_00ce: if (<>7__wrap1.MoveNext()) { CanvasNode current = <>7__wrap1.Current; <>7__wrap2 = current.Subtree().GetEnumerator(); <>1__state = -4; goto IL_00b4; } <>m__Finally1(); <>7__wrap1 = null; return false; IL_00b4: if (<>7__wrap2.MoveNext()) { CanvasNode current2 = <>7__wrap2.Current; <>2__current = current2; <>1__state = 2; return true; } <>m__Finally2(); <>7__wrap2 = null; goto IL_00ce; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } private void <>m__Finally2() { <>1__state = -3; if (<>7__wrap2 != null) { <>7__wrap2.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__38 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__38(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } internal static readonly List allNodes = new List(); private CanvasNode parent; private Vector2 localPosition; private Vector2 size; private bool activeSelf = true; protected GameObject gameObject; protected RectTransform transform; protected EventTrigger eventTrigger; internal int childCount = 1; public string Name { get; set; } public CanvasNode Parent { get { return parent; } set { if (parent != value) { parent = value; OnUpdateParent(); } } } public Vector2 LocalPosition { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return localPosition; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (localPosition != value) { localPosition = value; OnUpdateLocalPosition(); } } } public Vector2 Position => LocalPosition + (Parent?.Position ?? Vector2.zero); public Vector2 Size { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return size; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (size != value) { size = value; OnUpdateSize(); } } } public bool ActiveSelf { get { return activeSelf; } set { if (activeSelf != value) { activeSelf = value; OnUpdateActive(); } } } public bool ActiveInHierarchy { get { if (ActiveSelf) { return Parent?.ActiveInHierarchy ?? true; } return false; } } public GameObject GameObject => gameObject; protected virtual bool Interactable => true; public event Action OnUpdate; protected CanvasNode(string name) { Name = name; } [IteratorStateMachine(typeof(d__37))] protected virtual IEnumerable ChildList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(-2); } [IteratorStateMachine(typeof(d__38))] public IEnumerable Subtree() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__38(-2) { <>4__this = this }; } protected virtual void OnUpdateLocalPosition() { if (Object.op_Implicit((Object)(object)gameObject)) { UpdateAnchoredPosition(); } } protected virtual void OnUpdateSize() { if (Object.op_Implicit((Object)(object)gameObject)) { UpdateSizeDelta(); } } protected virtual void OnUpdateActive() { if (Object.op_Implicit((Object)(object)gameObject)) { gameObject.SetActive(ActiveSelf); } } protected virtual void OnUpdateParent() { if (Object.op_Implicit((Object)(object)gameObject)) { gameObject.transform.SetParent(GetParentTransform(), false); UpdateClipRect(); } OnUpdateActive(); } public virtual void Build() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) gameObject = new GameObject(Name); gameObject.transform.SetParent(GetParentTransform()); gameObject.AddComponent(); transform = gameObject.AddComponent(); RectTransform obj = transform; RectTransform obj2 = transform; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); obj2.anchorMax = val; obj.anchorMin = val; transform.pivot = new Vector2(0f, 1f); if (!Interactable) { CanvasGroup obj3 = gameObject.AddComponent(); obj3.interactable = false; obj3.blocksRaycasts = false; } gameObject.AddComponent().node = this; gameObject.SetActive(ActiveSelf); UpdateAnchoredPosition(); UpdateSizeDelta(); UpdateClipRect(); allNodes.Add(this); foreach (CanvasNode item in ChildList()) { item.Build(); childCount += item.childCount; } } private Transform GetParentTransform() { if (Parent != null) { return Parent.GameObject.transform; } return GUIController.Instance.canvas.transform; } private void UpdateAnchoredPosition() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) transform.anchoredPosition = new Vector2(LocalPosition.x, 0f - LocalPosition.y); } protected void UpdateSizeDelta() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) transform.sizeDelta = Size; } private void UpdateClipRect() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) CanvasRenderer component = gameObject.GetComponent(); component.DisableRectClipping(); if (ShouldClip(out var clipRect)) { component.EnableRectClipping(clipRect); } } public void Update() { try { this.OnUpdate?.Invoke(); } catch (Exception arg) { DebugMod.LogError($"Error updating node {GetQualifiedName()}: {arg}"); } } public virtual void Destroy() { foreach (CanvasNode item in ChildList()) { item.Destroy(); } if (Object.op_Implicit((Object)(object)gameObject)) { Object.Destroy((Object)(object)gameObject); for (CanvasNode canvasNode = Parent; canvasNode != null; canvasNode = canvasNode.Parent) { canvasNode.childCount -= childCount; } } ActiveSelf = false; allNodes.Remove(this); } protected virtual bool GetClipRect(out Rect clipRect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) clipRect = default(Rect); return false; } protected bool ShouldClip(out Rect clipRect) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0032: Unknown result type (might be due to invalid IL or missing references) bool clipRect2 = GetClipRect(out clipRect); if (Parent != null && Parent.ShouldClip(out var clipRect3)) { clipRect = (clipRect2 ? Intersect(clipRect, clipRect3) : clipRect3); return true; } return clipRect2; } public bool IsMouseOver() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_002c: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Rect a = default(Rect); ((Rect)(ref a))..ctor(Position.x, (float)Screen.height - Position.y - Size.y, Size.x, Size.y); if (ShouldClip(out var clipRect)) { ((Rect)(ref clipRect))..ctor(((Rect)(ref clipRect)).position + new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f), ((Rect)(ref clipRect)).size); a = Intersect(a, clipRect); } float x = ((Rect)(ref a)).x; ((Rect)(ref a)).x = x - 1f; x = ((Rect)(ref a)).y; ((Rect)(ref a)).y = x - 1f; ((Rect)(ref a)).width = ((Rect)(ref a)).width + 2f; ((Rect)(ref a)).height = ((Rect)(ref a)).height + 2f; return ((Rect)(ref a)).Contains(Input.mousePosition); } private static Rect Intersect(Rect a, Rect b) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(((Rect)(ref a)).xMin, ((Rect)(ref b)).xMin); float num2 = Mathf.Max(((Rect)(ref a)).yMin, ((Rect)(ref b)).yMin); float num3 = Mathf.Min(((Rect)(ref a)).xMax, ((Rect)(ref b)).xMax); float num4 = Mathf.Min(((Rect)(ref a)).yMax, ((Rect)(ref b)).yMax); if (num > num3) { float num5 = num3; num3 = num; num = num5; } if (num2 > num4) { float num6 = num4; num4 = num2; num2 = num6; } return new Rect(num, num2, num3 - num, num4 - num2); } public void AddEventTrigger(EventTriggerType type, Action callback) where T : BaseEventData { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //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) if (!Object.op_Implicit((Object)(object)gameObject)) { DebugMod.LogError("Cannot add event triggers before building"); return; } if ((Object)(object)eventTrigger == (Object)null) { eventTrigger = gameObject.AddComponent(); } Entry val = new Entry(); val.eventID = type; ((UnityEvent)(object)val.callback).AddListener((UnityAction)delegate(BaseEventData data) { callback((T)(object)data); }); eventTrigger.triggers.Add(val); } public void AddEventTrigger(EventTriggerType type, Action callback) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) this.AddEventTrigger(type, callback); } internal string GetQualifiedName() { return Parent?.GetQualifiedName() + ":" + Name; } } public class CanvasPanel : CanvasNode { protected readonly List elements = new List(); protected readonly Dictionary byName = new Dictionary(); public CollapseMode CollapseMode { get; set; } public CanvasPanel(string name) : base(name) { } protected override IEnumerable ChildList() { return elements; } public T Add(T element) where T : CanvasNode { element.Parent = this; elements.Add(element); byName.Add(element.Name, element); return element; } public T Get(string name) where T : CanvasNode { return byName.GetValueOrDefault(name) as T; } public void Remove(string name) { elements.RemoveAll((CanvasNode node) => node.Name == name); byName.Remove(name); } public int ContentMargin(int baseMargin = 0) { CanvasImage canvasImage = Get("Background"); if (canvasImage != null && canvasImage.IsBackground && canvasImage.Border != null) { return baseMargin + canvasImage.Border.Thickness; } return baseMargin; } public override void Build() { Collapse(); base.Build(); } public void Collapse() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (CanvasNode element in elements) { if (element is CanvasPanel canvasPanel && canvasPanel.CollapseMode != CollapseMode.Deny) { list.Add(canvasPanel); } } foreach (CanvasPanel item in list) { item.Collapse(); foreach (CanvasNode element2 in item.elements) { if (item.CollapseMode == CollapseMode.Allow) { element2.Name = item.Name + element2.Name; } Add(element2); element2.LocalPosition += item.LocalPosition; } item.elements.Clear(); item.byName.Clear(); Remove(item.Name); } } } public enum CollapseMode { Allow, AllowNoRenaming, Deny } public class CanvasScrollbar : CanvasNode { [CompilerGenerated] private sealed class d__10 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; public CanvasScrollbar <>4__this; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; CanvasScrollbar canvasScrollbar = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = canvasScrollbar.trackUpper; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = canvasScrollbar.trackLower; <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = canvasScrollbar.grip; <>1__state = 3; return true; case 3: <>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(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__10 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__10(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private readonly CanvasButton grip; private readonly CanvasImage trackUpper; private readonly CanvasImage trackLower; public static int MIN_GRIP_HEIGHT => UICommon.ScaleHeight(30); public CanvasScrollView ScrollView { get; set; } public CanvasScrollbar(string name) : base(name) { base.OnUpdate += DoUpdate; grip = new CanvasButton("Grip"); grip.Parent = this; grip.RemoveText(); grip.RemoveHoverBorder(); trackUpper = new CanvasImage("TrackUpper"); trackUpper.Parent = this; trackLower = new CanvasImage("TrackLower"); trackLower.Parent = this; } [IteratorStateMachine(typeof(d__10))] protected override IEnumerable ChildList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(-2) { <>4__this = this }; } public override void Build() { //IL_0002: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) base.Size = new Vector2((float)((int)((base.Size.x - 1f) / 2f) * 2 + 1), base.Size.y); CanvasImage canvasImage = trackUpper; CanvasImage canvasImage2 = trackLower; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(base.Size.x, 0f); canvasImage2.Size = val; canvasImage.Size = val; Texture2D val2 = new Texture2D((int)base.Size.x, 1); Color[] array = (Color[])(object)new Color[((Texture)val2).width]; Array.Fill(array, Color.clear); array[((Texture)val2).width / 2] = UICommon.borderColor; val2.SetPixels(array); val2.Apply(); trackUpper.SetImage(val2); trackLower.SetImage(val2); float num = base.Size.y * ScrollView.Size.y / ScrollView.Content.Size.y; num = Mathf.Clamp(num, (float)MIN_GRIP_HEIGHT, base.Size.y); grip.Size = new Vector2(base.Size.x, (float)(int)num); base.Build(); grip.AddEventTrigger((EventTriggerType)5, delegate(PointerEventData eventData) { //IL_0006: 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_0024: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) float num2 = grip.LocalPosition.y - eventData.delta.y; num2 = Mathf.Clamp(num2, 0f, base.Size.y - grip.Size.y); ScrollView.SetScrollPercentage(num2 / (base.Size.y - grip.Size.y)); UpdateGripPosition(num2); }); } private void DoUpdate() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) float y = Mathf.Clamp01((0f - ScrollView.Content.LocalPosition.y) / ScrollView.GetScrollableHeight()) * (base.Size.y - grip.Size.y); UpdateGripPosition(y); } private void UpdateGripPosition(float y) { //IL_000c: 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_002d: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) grip.LocalPosition = new Vector2(grip.LocalPosition.x, y); trackUpper.Size = new Vector2(trackUpper.Size.x, y); trackLower.LocalPosition = new Vector2(trackLower.LocalPosition.x, y + grip.Size.y); trackLower.Size = new Vector2(trackLower.Size.x, base.Size.y - y - grip.Size.y); } } public class CanvasScrollView : CanvasNode { [CompilerGenerated] private sealed class d__12 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private CanvasNode <>2__current; private int <>l__initialThreadId; public CanvasScrollView <>4__this; CanvasNode IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; CanvasScrollView canvasScrollView = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (canvasScrollView.content != null) { <>2__current = canvasScrollView.content; <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } 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(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__12 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__12(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private CanvasNode content; private float contentHeight; public static int ScrollSpeed => UICommon.ScaleHeight(40); public CanvasNode Content => content; public Vector2 Margin { get; set; } = new Vector2(1f, 1f); public CanvasScrollView(string name) : base(name) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) base.OnUpdate += DoUpdate; } public T SetContent(T content) where T : CanvasNode { this.content = content; content.Parent = this; return content; } [IteratorStateMachine(typeof(d__12))] protected override IEnumerable ChildList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(-2) { <>4__this = this }; } protected override bool GetClipRect(out Rect clipRect) { //IL_0002: 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_0032: 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_004a: 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_0061: 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_007e: 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) clipRect = new Rect(base.Position.x - (float)Screen.width / 2f + Margin.x, (float)Screen.height / 2f - base.Position.y - base.Size.y + Margin.y, base.Size.x - Margin.x * 2f, base.Size.y - Margin.y * 2f); return true; } private void DoUpdate() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0036: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!Mathf.Approximately(content.Size.y, contentHeight)) { if (GetScrollableHeight() < 0f) { content.LocalPosition = new Vector2(content.LocalPosition.x, 0f); } else { float num = Mathf.Max(content.LocalPosition.y, 0f - GetScrollableHeight()); content.LocalPosition = new Vector2(content.LocalPosition.x, num); } } contentHeight = content.Size.y; if (!Mathf.Approximately(Input.mouseScrollDelta.y, 0f) && IsMouseOver()) { float num2 = content.LocalPosition.y + Input.mouseScrollDelta.y * (float)ScrollSpeed; num2 = Mathf.Clamp(num2, Mathf.Min(0f - GetScrollableHeight(), 0f), 0f); content.LocalPosition = new Vector2(content.LocalPosition.x, Mathf.Round(num2)); } } public void SetScrollPercentage(float percentage) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) percentage = Mathf.Clamp01(percentage); content.LocalPosition = new Vector2(content.LocalPosition.x, Mathf.Round((0f - percentage) * GetScrollableHeight())); } public float GetScrollableHeight() { //IL_0006: 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) return content.Size.y - base.Size.y; } } public class CanvasText : CanvasNode { protected Text t; private string text; private Font font = UICommon.arial; private int fontSize = UICommon.FontSize; private FontStyle fontStyle; private TextAnchor alignment; private Color color = UICommon.textColor; private HorizontalWrapMode overflow; public string Text { get { return text; } set { text = value; if (Object.op_Implicit((Object)(object)t)) { t.text = text; } } } public Font Font { get { return font; } set { font = value; if (Object.op_Implicit((Object)(object)t)) { t.font = font; } } } public int FontSize { get { return fontSize; } set { fontSize = value; if (Object.op_Implicit((Object)(object)t)) { t.fontSize = fontSize; } } } public FontStyle FontStyle { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return fontStyle; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) fontStyle = value; if (Object.op_Implicit((Object)(object)t)) { t.fontStyle = fontStyle; } } } public TextAnchor Alignment { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return alignment; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) alignment = value; if (Object.op_Implicit((Object)(object)t)) { t.alignment = alignment; } } } public Color Color { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return color; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) color = value; if (Object.op_Implicit((Object)(object)t)) { ((Graphic)t).color = color; } } } protected override bool Interactable => false; public CanvasText(string name, HorizontalWrapMode overflow = 0) : base(name) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) this.overflow = overflow; } protected override void OnUpdateLocalPosition() { base.OnUpdateLocalPosition(); if (Object.op_Implicit((Object)(object)base.GameObject)) { RoundPosition(); } } private void RoundPosition() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0028: Unknown result type (might be due to invalid IL or missing references) Vector2 anchoredPosition = transform.anchoredPosition; transform.anchoredPosition = new Vector2(Mathf.Round(anchoredPosition.x), Mathf.Round(anchoredPosition.y)); } public override void Build() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) base.Build(); RoundPosition(); t = gameObject.AddComponent(); t.horizontalOverflow = overflow; t.text = text; t.font = font; t.fontSize = fontSize; t.fontStyle = fontStyle; t.alignment = alignment; ((Graphic)t).color = color; } } [HarmonyPatch] public class CanvasTextField : CanvasText { [CompilerGenerated] private sealed class <>c__DisplayClass12_0 { public CanvasTextField <>4__this; public Color selectionColor; } private InputField inputField; public static bool AnyFieldFocused { get; private set; } protected override bool Interactable => true; public event Action OnSubmit; public CanvasTextField(string name) : base(name, (HorizontalWrapMode)0) { } public override void Build() { base.Build(); inputField = gameObject.AddComponent(); inputField.textComponent = t; ((Selectable)inputField).transition = (Transition)0; ((Behaviour)inputField).enabled = false; ((UnityEvent)(object)inputField.onSubmit).AddListener((UnityAction)delegate(string text) { base.Text = text; this.OnSubmit?.Invoke(text); }); ((UnityEvent)(object)inputField.onEndEdit).AddListener((UnityAction)delegate { ((Behaviour)inputField).enabled = false; t.text = base.Text; AnyFieldFocused = false; InputManager.enabled = true; }); AddEventTrigger((EventTriggerType)2, delegate { if (!IsFocused()) { Activate(); } }); } public void Activate() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass12_0 CS$<>8__locals0 = new <>c__DisplayClass12_0(); CS$<>8__locals0.<>4__this = this; if (Object.op_Implicit((Object)(object)inputField)) { inputField.text = t.text; ((Behaviour)inputField).enabled = true; ((Selectable)inputField).Select(); AnyFieldFocused = true; InputManager.enabled = false; CS$<>8__locals0.selectionColor = inputField.selectionColor; inputField.selectionColor = Color.clear; ((MonoBehaviour)inputField).StartCoroutine(DeselectRoutine()); } [IteratorStateMachine(typeof(<>c__DisplayClass12_0.<g__DeselectRoutine|0>d))] IEnumerator DeselectRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass12_0.<g__DeselectRoutine|0>d(0) { <>4__this = CS$<>8__locals0 }; } } public void UpdateDefaultText(string text) { if (!IsFocused()) { base.Text = text; inputField.text = text; } } public bool IsFocused() { if (Object.op_Implicit((Object)(object)inputField)) { return ((Behaviour)inputField).enabled; } return false; } [HarmonyPatch(typeof(HollowKnightInputModule), "ProcessMove")] [HarmonyPrefix] private static void Prefix(HollowKnightInputModule __instance, ref bool __state) { __state = __instance.focusOnMouseHover; if (AnyFieldFocused) { __instance.focusOnMouseHover = false; } } [HarmonyPatch(typeof(HollowKnightInputModule), "ProcessMove")] [HarmonyPostfix] private static void Postfix(HollowKnightInputModule __instance, ref bool __state) { __instance.focusOnMouseHover = __state; } } public class PanelBuilder : IDisposable { private class Entry { public readonly CanvasNode element; public readonly LengthType type; public readonly float length; public Entry(CanvasNode element, LengthType type, float length) { this.element = element; this.type = type; this.length = length; } } private enum LengthType { Fixed, Square, Flex, Lazy } private readonly CanvasPanel panel; private readonly List entries = new List(); public bool Horizontal { get; set; } public bool DynamicLength { get; set; } public float OuterPadding { get; set; } public float InnerPadding { get; set; } public float Padding { set { OuterPadding = value; InnerPadding = value; } } public PanelBuilder(CanvasPanel panel) { this.panel = panel; } private T Append(T element, LengthType type, float length = 0f) where T : CanvasNode { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) entries.Add(new Entry(element, type, length)); if (element != null) { if (type == LengthType.Fixed && length <= 0f) { throw new Exception("Fixed elements must have a positive length"); } panel.Add(element); float num = ChildBreadth(); if (type == LengthType.Square) { length = num; } if (element != null) { element.Size = (Horizontal ? new Vector2(length, num) : new Vector2(num, length)); } } return element; } public T AppendFixed(T element, float length) where T : CanvasNode { return Append(element, LengthType.Fixed, length); } public T AppendSquare(T element) where T : CanvasNode { return Append(element, LengthType.Square); } public T AppendFlex(T element) where T : CanvasNode { return Append(element, LengthType.Flex); } public T AppendLazy(T element) where T : CanvasNode { return Append(element, LengthType.Lazy); } public void AppendPadding(float length) { Append(null, LengthType.Fixed, length); } public void AppendFlexPadding() { Append(null, LengthType.Flex); } public void Build() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) float num = OuterPadding * 2f + InnerPadding * (float)(entries.Count - 1); int num2 = 0; foreach (Entry entry in entries) { switch (entry.type) { case LengthType.Fixed: num += entry.length; break; case LengthType.Square: num += ChildBreadth(); break; case LengthType.Flex: num2++; break; case LengthType.Lazy: num += (Horizontal ? entry.element.Size.x : entry.element.Size.y); break; } } if (DynamicLength && num2 != 0) { throw new Exception("Flex elements are not supported for a dynamic-length PanelBuilder"); } float num3 = (Length() - num) / (float)num2; if (Length() < num && num2 != 0) { DebugMod.LogWarn(panel.GetQualifiedName() + " has no room for flex elements, assigning 0 width"); num3 = 0f; } float num4 = OuterPadding; foreach (Entry entry2 in entries) { float num5 = entry2.type switch { LengthType.Square => ChildBreadth(), LengthType.Flex => num3, LengthType.Lazy => Horizontal ? entry2.element.Size.x : entry2.element.Size.y, _ => entry2.length, }; if (entry2.element != null) { float num6 = OuterPadding; float num7 = num4; float num8 = ChildBreadth(); float num9 = num5; if (Horizontal) { float num10 = num7; float num11 = num6; float num12 = num9; num9 = num8; num8 = num12; num7 = num11; num6 = num10; } entry2.element.LocalPosition = new Vector2(num6, num7); entry2.element.Size = new Vector2(num8, num9); } num4 += num5 + InnerPadding; } num4 -= InnerPadding; num4 += OuterPadding; if (DynamicLength) { panel.Size = (Horizontal ? new Vector2(num4, panel.Size.y) : new Vector2(panel.Size.x, num4)); } } public float GetCurrentLength() { float num = OuterPadding * 2f + InnerPadding * (float)(entries.Count - 1); foreach (Entry entry in entries) { switch (entry.type) { case LengthType.Fixed: num += entry.length; break; case LengthType.Square: num += ChildBreadth(); break; case LengthType.Flex: throw new Exception("Current length is meaningless if the panel contains flex elements"); } } return num; } public float Length() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Horizontal) { return panel.Size.y; } return panel.Size.x; } public float Breadth() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Horizontal) { return panel.Size.x; } return panel.Size.y; } public float ChildBreadth() { return Breadth() - OuterPadding * 2f; } public void Dispose() { Build(); } } } namespace DebugMod.SaveStates { [HarmonyPatch] public static class RoomSpecific { [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public string goName; public string fsmName; public Action action; } [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string scene; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; string text = scene; if (text == null) { break; } int length = text.Length; if (length <= 12) { if (length == 7) { char c = text[6]; if (c != '4') { if (c != '6' || !(text == "Hang_06")) { break; } } else if (!(text == "Hang_04")) { break; } Extensions.SetPositionX(((Component)GameCameras.instance).gameObject.FindChildObject("Roar Wave Emitter").transform, 100f); break; } if (length != 10) { if (length != 12 || !(text == "Bone_East_08")) { break; } <>2__current = (object)new WaitUntil((Func)(() => !GameManager.instance.isLoading)); <>1__state = 1; return true; } if (!(text == "Memory_Red")) { break; } } else if (length != 15) { if (length != 26) { if (length != 27) { break; } char c = text[18]; if (c != 'B') { if (c != 'L' || !(text == "Memory_Silk_Heart_LaceTower")) { break; } } else if (!(text == "Memory_Silk_Heart_BellBeast")) { break; } } else if (!(text == "Memory_Silk_Heart_WardBoss")) { break; } } else if (!(text == "Memory_Needolin")) { break; } ((MonoBehaviour)GameManager.instance).StartCoroutine(MemoryFixes()); break; } case 1: <>1__state = -1; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__5 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string scene; public string options; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; if (scene == "Cog_Dancers") { DoCogworkDancers(int.Parse(options)); return false; } if (scene == "Memory_Ant_Queen") { DoKarmelita(); return false; } if (scene == "Memory_Red") { DoRedMemory(options); return false; } string[] array = options.Split('|'); if (array[0] == "BattleScene") { DoBattleScene(scene, array[1], int.Parse(array[2])); return false; } if (options == scene) { return false; } DebugMod.LogConsole("Invalid room-specific options for " + scene + ": " + options); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; HeroController.instance.SetSilkRegenBlocked(true); DarknessRegion.SetDarknessLevel(0); Utils.FindFSM("Memory Control", "Memory Control").SendEvent("DOOR GET UP FINISHED"); <>2__current = (object)new WaitUntil((Func)(() => Object.op_Implicit((Object)(object)((Component)GameCameras.instance.hudCanvasSlideOut).gameObject))); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(1f); <>1__state = 2; return true; case 2: <>1__state = -1; GameCameras.instance.hudCanvasSlideOut.SendEvent("OUT"); 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(); } } internal static string SaveRoomSpecific(string scene) { switch (scene) { case "Cog_Dancers": return SaveCogworkDancers(); case "Memory_Ant_Queen": return SaveKarmelita(); case "Memory_Red": return SaveRedMemory(); default: { BattleScene[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (BattleScene val in array) { if (val.started) { return SaveBattleScene(val); } } return ""; } } } internal static string SaveCogworkDancers() { int value = Utils.FindFSM("Dancer Control", "Control").FsmVariables.FindFsmInt("Phase").Value; if (value > 1) { return value.ToString(); } return ""; } internal static string SaveKarmelita() { if (Object.FindAnyObjectByType().completed) { return "SkipArena"; } return ""; } internal static string SaveRedMemory() { GameObject parent = Utils.FindGameObjectByPath("Scenery Groups"); if (parent.FindChildObject("End Scenery").activeSelf) { return "3"; } if (parent.FindChildObject("Hive Scenery").activeSelf) { return "2"; } if (parent.FindChildObject("Deepnest Scenery").activeSelf) { return "1"; } return "0"; } internal static string SaveBattleScene(BattleScene battleScene) { return $"BattleScene|{((Object)((Component)battleScene).gameObject).name}|{battleScene.currentWave}"; } [IteratorStateMachine(typeof(d__5))] internal static IEnumerator DoRoomSpecific(string scene, string options) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { scene = scene, options = options }; } private static void ModifyFSM(string goName, string fsmName, Action action) { <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0(); CS$<>8__locals0.goName = goName; CS$<>8__locals0.fsmName = fsmName; CS$<>8__locals0.action = action; ((MonoBehaviour)DebugMod.instance).StartCoroutine(Routine()); [IteratorStateMachine(typeof(<>c__DisplayClass6_0.<g__Routine|0>d))] IEnumerator Routine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass6_0.<g__Routine|0>d(0) { <>4__this = CS$<>8__locals0 }; } } internal static void DoCogworkDancers(int phase) { ModifyFSM("Dancer Control", "Control", delegate(PlayMakerFSM fsm) { FsmTransition transition = fsm.GetState("Beat Start").GetTransition(0); transition.ToState = phase switch { 2 => "Set Phase 2", 3 => "Set Phase 3", 4 => "Dancer Death", _ => transition.ToState, }; transition.ToFsmState = fsm.GetState(transition.ToState); if (phase == 4) { string text = ((Random.value < 0.5f) ? "Dancer A" : "Dancer B"); fsm.FsmVariables.GetFsmGameObject("Stunned Dancer").Value = GameObject.Find(text); } }); ModifyFSM("Dancer Control", "Music Control", delegate(PlayMakerFSM fsm) { List range = fsm.GetState("P1 Music").Actions.ToList().GetRange(0, 2); FsmState? state = fsm.GetState(phase switch { 2 => "P2 Music", 3 => "P3 Music", 4 => "P4 Music", _ => "", }); List list = state.Actions.ToList(); list.InsertRange(0, range); state.Actions = list.ToArray(); }); ModifyFSM("Dancer A", "Control", ModifyDancer); ModifyFSM("Dancer B", "Control", ModifyDancer); static void ModifyDancer(PlayMakerFSM fsm) { fsm.FsmVariables.GetFsmBool("Did First Windup").Value = true; fsm.FsmVariables.GetFsmBool("Did Roar").Value = true; } } internal static void DoKarmelita() { ModifyFSM("Hunter Queen Boss", "Control", delegate(PlayMakerFSM fsm) { FsmState state = fsm.GetState("Battle Dance"); FsmStateAction[] actions = state.Actions; foreach (FsmStateAction val in actions) { if (val is SendMessage || val is Wait) { val.Enabled = false; } } FsmTransition[] transitions = state.Transitions; foreach (FsmTransition val2 in transitions) { if (val2.EventName == "BATTLE END") { val2.FsmEvent = FsmEvent.Finished; } } }); } internal static void DoRedMemory(string options) { int num = int.Parse(options); GameObject parent = Utils.FindGameObjectByPath("Scenery Groups"); parent.FindChildObject(num switch { 0 => "Entry Scenery", 1 => "Deepnest Scenery", 2 => "Hive Scenery", 3 => "End Scenery", _ => null, }).SetActive(true); FadeOutFadeGroup("Memory Control/Weaver_Memory_Lighting"); FadeOutFadeGroup("Memory Control/Beast_Memory_Lighting"); FadeOutFadeGroup("Memory Control/Hive_Memory_Lighting"); static void FadeOutFadeGroup(string path) { ((NestedFadeGroupBase)Utils.FindGameObjectByPath(path).GetComponent()).FadeTo(0f, 0f, (AnimationCurve)null, false, (Action)null); } } internal static void DoBattleScene(string scene, string objectName, int wave) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if (SceneAdditiveLoadConditional.ShouldLoadBoss) { GameManager.instance.OnLoadedBoss += new BossLoad(StartBattle); } else { StartBattle(); } void StartBattle() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameManager.instance.OnLoadedBoss -= new BossLoad(StartBattle); BattleScene component = GameObject.Find(objectName).GetComponent(); component.currentWave = wave; if (scene == "Library_02") { PlayMakerFSM.BroadcastEvent("DO BATTLE START"); } else { component.StartBattle(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable DoStartBattle(IEnumerable instructions) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)typeof(BattleScene).GetMethod("StartWave"), (string)null) }); val.RemoveInstruction(); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)typeof(BattleScene).GetField("currentWave")) }); return val.InstructionEnumeration(); } [IteratorStateMachine(typeof(d__12))] internal static IEnumerator DoGenericFixes(string scene) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { scene = scene }; } [IteratorStateMachine(typeof(d__13))] internal static IEnumerator MemoryFixes() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0); } internal static void BackwardsCompat(string scene, ref string options) { if (scene == "Memory_Red" && string.IsNullOrEmpty(options)) { options = "0"; } } } [HarmonyPatch] public class SaveState { private class DebugModSaveStateSceneLoadInfo : SceneLoadInfo { } [Serializable] public class SaveStateData { public string saveStateIdentifier; public string saveScene; public PlayerData savedPd; public SceneData savedSd; public SerializableBoolData[] semiPersistentBools; public SerializableIntData[] semiPersistentInts; public Vector3 savePos; public bool facingLeft; public bool facingRight; public bool isKinematized; public int evoState; public bool isMaggoted; public List toolAmountsOverride; public string[] loadedScenes; public string[] loadedSceneActiveScenes; public string roomSpecificOptions; [SerializeField] private List customDataList; [NonSerialized] public Dictionary customData; internal SaveStateData() { } internal SaveStateData(SaveStateData _data) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) saveStateIdentifier = _data.saveStateIdentifier; saveScene = _data.saveScene; savedPd = _data.savedPd; savedSd = _data.savedSd; savePos = _data.savePos; facingLeft = _data.facingLeft; facingRight = _data.facingRight; isKinematized = _data.isKinematized; evoState = _data.evoState; isMaggoted = _data.isMaggoted; roomSpecificOptions = _data.roomSpecificOptions; if (_data.toolAmountsOverride != null) { toolAmountsOverride = new List(_data.toolAmountsOverride); } if (_data.semiPersistentBools != null) { semiPersistentBools = (SerializableBoolData[])(object)new SerializableBoolData[_data.semiPersistentBools.Length]; Array.Copy(_data.semiPersistentBools, semiPersistentBools, _data.semiPersistentBools.Length); } if (_data.semiPersistentInts != null) { semiPersistentInts = (SerializableIntData[])(object)new SerializableIntData[_data.semiPersistentInts.Length]; Array.Copy(_data.semiPersistentInts, semiPersistentInts, _data.semiPersistentInts.Length); } if (_data.loadedScenes != null) { loadedScenes = new string[_data.loadedScenes.Length]; Array.Copy(_data.loadedScenes, loadedScenes, _data.loadedScenes.Length); } else { loadedScenes = new string[1] { saveScene }; } loadedSceneActiveScenes = new string[loadedScenes.Length]; if (_data.loadedSceneActiveScenes != null) { Array.Copy(_data.loadedSceneActiveScenes, loadedSceneActiveScenes, loadedSceneActiveScenes.Length); } else { for (int i = 0; i < loadedScenes.Length; i++) { loadedSceneActiveScenes[i] = loadedScenes[i]; } } if (_data.customData != null) { customData = new Dictionary(_data.customData); } } public void BeforeSerialize() { if (customData == null) { customData = new Dictionary(); } customDataList = new List(); foreach (KeyValuePair customDatum in customData) { customDataList.Add(customDatum.Key + ":::" + customDatum.Value); } } public void AfterDeserialize() { if (customDataList == null) { customDataList = new List(); } customData = new Dictionary(); foreach (string customData in customDataList) { string[] array = customData.Split(":::"); this.customData[array[0]] = array[1]; } } public SaveStateData DeepCopy() { return new SaveStateData(this); } } [CompilerGenerated] private sealed class <>c__DisplayClass24_0 { public string dummyScene; internal bool b__5() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).name == dummyScene; } } [CompilerGenerated] private sealed class d__23 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SaveState <>4__this; private Stopwatch 5__2; private IEnumerator 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown int num = <>1__state; SaveState saveState = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (!saveState.IsSet()) { DebugMod.LogError("Attempted to load unset savestate"); return false; } if (loadingSavestate != null && !DebugMod.overrideLoadLockout) { DebugMod.LogConsole("Attempted to load savestate in " + saveState.data.saveScene + " while another is already loading, cancelling"); return false; } DebugMod.LogDebug("Loading savestate: " + saveState.data.saveStateIdentifier); 5__2 = new Stopwatch(); 5__2.Start(); loadingSavestate = saveState; 5__3 = saveState.LoadImpl(); goto IL_00b7; case 1: <>1__state = -1; goto IL_00b7; case 2: <>1__state = -1; <>2__current = null; <>1__state = 3; return true; case 3: { <>1__state = -1; saveState.HUDFixes(); RestBench[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (RestBench val in array) { if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { ((Component)val).gameObject.SetActive(false); ((Component)val).gameObject.SetActive(true); } } SurfaceWaterRegion[] array2 = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (SurfaceWaterRegion val2 in array2) { if (Physics2D.IsTouching(((Component)HeroController.instance).GetComponent(), ((Component)val2).GetComponent())) { <>2__current = (object)new WaitUntil((Func)(() => GameManager.instance.sceneLoad == null)); <>1__state = 4; return true; } } break; } case 4: { <>1__state = -1; HeroController.instance.transform.position = saveState.data.savePos; ((Behaviour)((Component)HeroController.instance).GetComponent()).enabled = false; ((Behaviour)((Component)HeroController.instance).GetComponent()).enabled = true; break; } IL_011b: loadingSavestate = null; 5__2.Stop(); DebugMod.LogConsole("Loaded savestate in " + 5__2.Elapsed.ToString("ss\\.fff") + "s"); <>2__current = (object)new WaitUntil((Func)(() => Object.op_Implicit((Object)(object)((Component)GameCameras.instance.hudCanvasSlideOut).gameObject))); <>1__state = 2; return true; IL_00b7: try { if (!5__3.MoveNext()) { goto IL_011b; } } catch (Exception arg) { DebugMod.LogError($"Error loading savestate: {arg}"); DebugMod.LogConsole("Critical error loading savestate, please create a bug report"); TimeScale.Frozen = false; loadingSavestate = null; return false; } <>2__current = 5__3.Current; <>1__state = 1; return true; } if (DebugMod.GetSceneName().StartsWith("Bone_East_08")) { HeroController.instance.transform.position = saveState.data.savePos; DebugMod.noclipPos = HeroController.instance.transform.position; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SaveState <>4__this; private bool 5__2; private string 5__3; private SceneWatcher.LoadedSceneInfo[] 5__4; private CinematicPlayer[] <>7__wrap4; private int <>7__wrap5; private SceneTransitionZoneBase[] <>7__wrap6; private List.Enumerator <>7__wrap7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 4) { try { } finally { <>m__Finally1(); } } 5__3 = null; 5__4 = null; <>7__wrap4 = null; <>7__wrap6 = null; <>7__wrap7 = default(List.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_0be7: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Unknown result type (might be due to invalid IL or missing references) //IL_0c00: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Invalid comparison between Unknown and I4 //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Expected O, but got Unknown //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_0866: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Expected O, but got Unknown //IL_0a52: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown try { int num = <>1__state; SaveState CS$<>8__locals0 = <>4__this; SlideSurface[] array; switch (num) { default: return false; case 0: <>1__state = -1; TimeScale.Frozen = true; Time.fixedDeltaTime = 0.02f; SaveState.BeforeLoad?.Invoke(CS$<>8__locals0); 5__2 = DebugMod.settings.SafeSaveStateLoading || LoadDuped; if (DebugMod.CurrentHazardCoro != null) { ((MonoBehaviour)HeroController.instance).StopCoroutine(DebugMod.CurrentHazardCoro); } if (DebugMod.CurrentInvulnCoro != null) { ((MonoBehaviour)HeroController.instance).StopCoroutine(DebugMod.CurrentInvulnCoro); } if (HeroController.instance.hazardRespawnRoutine != null) { ((MonoBehaviour)HeroController.instance).StopCoroutine(HeroController.instance.hazardRespawnRoutine); } DebugMod.CurrentHazardCoro = null; DebugMod.CurrentInvulnCoro = null; HeroController.instance.hazardRespawnRoutine = null; HeroController.instance.hazardInvulnRoutine = null; HeroController.instance.CancelDamageRecoil(); ((Component)HeroController.instance).GetComponent().StopInvulnerablePulse(); HeroController.instance.cState.hazardDeath = false; EventRegister.SendEvent("INVENTORY CANCEL", (GameObject)null); DialogueBox.EndConversation(true, (Action)null); DialogueBox.HideInstant(); DialogueYesNoBox.ForceClose(); QuestYesNoBox.ForceClose(); <>7__wrap4 = Object.FindObjectsByType((FindObjectsSortMode)0); <>7__wrap5 = 0; goto IL_01b7; case 1: <>1__state = -1; goto IL_01a9; case 2: <>1__state = -1; goto IL_02a3; case 3: <>1__state = -1; <>7__wrap7 = ScenePreloader._forceEndedOperations.GetEnumerator(); <>1__state = -3; goto IL_03ca; case 4: <>1__state = -3; goto IL_03ca; case 5: <>1__state = -1; goto IL_0481; case 6: <>1__state = -1; JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)CS$<>8__locals0.data.savedPd), (object)PlayerData.instance); PlayerData.instance.ResetCutsceneBools(); if (CS$<>8__locals0.data.toolAmountsOverride != null) { PlayerData.instance.toolAmountsOverride = new Dictionary(); foreach (string item in CS$<>8__locals0.data.toolAmountsOverride) { string[] array2 = item.Split(':'); PlayerData.instance.toolAmountsOverride[array2[0]] = int.Parse(array2[1]); } } else { PlayerData.instance.toolAmountsOverride = null; } 5__4 = CS$<>8__locals0.data.loadedScenes.Zip(CS$<>8__locals0.data.loadedSceneActiveScenes, (string name, string gameplay) => new SceneWatcher.LoadedSceneInfo(name, gameplay)).ToArray(); 5__4[0].LoadHook(); GameManager.instance.BeginSceneTransition((SceneLoadInfo)(object)new DebugModSaveStateSceneLoadInfo { SceneName = CS$<>8__locals0.data.saveScene, HeroLeaveDirection = (GatePosition)5, EntryGateName = "dreamGate", EntryDelay = 0f, PreventCameraFadeOut = true, WaitForSceneTransitionCameraFade = false, Visualization = (SceneLoadVisualizations)0, AlwaysUnloadUnusedAssets = 5__2 }); <>2__current = (object)new WaitUntil((Func)delegate { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).name == CS$<>8__locals0.data.saveScene; }); <>1__state = 7; return true; case 7: <>1__state = -1; if (LoadDuped) { <>2__current = (object)new WaitUntil((Func)(() => !GameManager.instance.IsInSceneTransition)); <>1__state = 8; return true; } goto IL_08eb; case 8: <>1__state = -1; <>7__wrap5 = 1; goto IL_08ce; case 9: <>1__state = -1; goto IL_07df; case 10: <>1__state = -1; SceneWatcher.LoadedSceneInfo.activeInfo = null; GameManager.instance.RefreshTilemapInfo(5__4[<>7__wrap5].name); GameManager.instance.cameraCtrl.SceneInit(); goto IL_08bc; case 11: <>1__state = -1; goto IL_094d; case 12: <>1__state = -1; DebugMod.settings.ShowHitBoxes = <>7__wrap5; goto IL_0a82; case 13: <>1__state = -1; goto IL_0b54; case 14: <>1__state = -1; CS$<>8__locals0.SaveStateGlitchFixes(); SaveState.AfterLoad?.Invoke(CS$<>8__locals0); <>2__current = (object)new WaitUntil((Func)(() => !GameManager.instance.isLoading)); <>1__state = 15; return true; case 15: { <>1__state = -1; HeroController.instance.transform.position = CS$<>8__locals0.data.savePos; DebugMod.noclipPos = HeroController.instance.transform.position; if (GameManager.instance.isPaused) { GameManager.instance.FadeSceneIn(); GameManager.instance.isPaused = false; GameCameras.instance.ResumeCameraShake(); if ((Object)(object)HeroController.SilentInstance != (Object)null) { HeroController.instance.UnPause(); } MenuButtonList.ClearAllLastSelected(); TimeManager.TimeScale = 1f; } TimeScale.Frozen = false; return false; } IL_01b7: if (<>7__wrap5 < <>7__wrap4.Length) { CinematicPlayer val = <>7__wrap4[<>7__wrap5]; if ((int)val.videoType == 2) { val.actCard = null; <>2__current = val.FinishInGameVideo(); <>1__state = 1; return true; } goto IL_01a9; } <>7__wrap4 = null; <>7__wrap6 = Object.FindObjectsByType((FindObjectsSortMode)0); <>7__wrap5 = 0; goto IL_02b1; IL_01a9: <>7__wrap5++; goto IL_01b7; IL_03ca: if (<>7__wrap7.MoveNext()) { SceneLoadOp current = <>7__wrap7.Current; <>2__current = Addressables.UnloadSceneAsync(current.Operation, true); <>1__state = 4; return true; } <>m__Finally1(); <>7__wrap7 = default(List.Enumerator); ScenePreloader._forceEndedOperations.Clear(); 5__3 = GameManager.instance.GetSceneNameString(); GameManager.instance.entryGateName = "dreamGate"; GameManager.instance.startedOnThisScene = true; if (5__2) { <>c__DisplayClass24_0 CS$<>8__locals1 = new <>c__DisplayClass24_0 { dummyScene = "Demo Start" }; Addressables.LoadSceneAsync((object)("Scenes/" + CS$<>8__locals1.dummyScene), (LoadSceneMode)0, true, 100, (SceneReleaseMode)0); <>2__current = (object)new WaitUntil((Func)delegate { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene2 = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene2)).name == CS$<>8__locals1.dummyScene; }); <>1__state = 5; return true; } goto IL_0481; IL_08ce: if (<>7__wrap5 < 5__4.Length) { goto IL_07df; } GameManager.instance.BeginScene(); goto IL_08eb; IL_0481: JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)CS$<>8__locals0.data.savedSd), (object)SceneData.instance); GameManager.instance.ResetSemiPersistentItems(); SaveState.RestoreSemiPersistent(CS$<>8__locals0.data.semiPersistentBools, (PersistentItemDataCollection)(object)SceneData.instance.persistentBools); SaveState.RestoreSemiPersistent(CS$<>8__locals0.data.semiPersistentInts, (PersistentItemDataCollection)(object)SceneData.instance.persistentInts); StaticVariableList.ClearSceneTransitions(); GameManager.ReportUnload(5__3); <>2__current = null; <>1__state = 6; return true; IL_07df: while (SceneManager.loadedSceneCount > <>7__wrap5) { DebugMod.LogDebug(string.Format("{0} scenes loaded, expected {1} ({2})", SceneManager.loadedSceneCount, <>7__wrap5, GeneralExtensions.Join((IEnumerable)SceneWatcher.LoadedScenes, (Func)((SceneWatcher.LoadedSceneInfo lsi) => lsi.name ?? ""), ", "))); if (SceneWatcher.LoadedScenes[<>7__wrap5].name == 5__4[<>7__wrap5].name) { DebugMod.LogDebug($"Extra scene matches state, skipping load {<>7__wrap5} ({5__4[<>7__wrap5].name})"); <>7__wrap5++; continue; } AsyncOperation val2 = SceneManager.UnloadSceneAsync(SceneWatcher.LoadedScenes[<>7__wrap5].sceneObject.Value); <>2__current = val2; <>1__state = 9; return true; } if (<>7__wrap5 < 5__4.Length) { SceneWatcher.LoadedSceneInfo.activeInfo = 5__4[<>7__wrap5]; DebugMod.LogDebug($"Loading scene {<>7__wrap5}: {5__4[<>7__wrap5].name}"); AsyncOperationHandle val3 = Addressables.LoadSceneAsync((object)("Scenes/" + 5__4[<>7__wrap5].name), (LoadSceneMode)1, true, 100, (SceneReleaseMode)0); <>2__current = val3; <>1__state = 10; return true; } goto IL_08bc; IL_02b1: if (<>7__wrap5 < <>7__wrap6.Length) { SceneTransitionZoneBase val4 = <>7__wrap6[<>7__wrap5]; if (val4.respawnRoutine != null) { ((MonoBehaviour)val4).StopCoroutine(val4.respawnRoutine); GameManager.instance.BeginSceneTransition((SceneLoadInfo)(object)new DebugModSaveStateSceneLoadInfo { SceneName = val4.TargetScene, EntryGateName = val4.TargetGate, EntryDelay = 0f, PreventCameraFadeOut = true, WaitForSceneTransitionCameraFade = false, Visualization = (SceneLoadVisualizations)0, AlwaysUnloadUnusedAssets = 5__2 }); <>2__current = (object)new WaitUntil((Func)(() => !GameManager.instance.isLoading)); <>1__state = 2; return true; } goto IL_02a3; } <>7__wrap6 = null; EventRegister.SendEvent("REST AREA MUSIC STOP", (GameObject)null); ToolItemManager.SetIsInCutscene(false); CameraBlurPlane.Spacing = 0f; CameraBlurPlane.Vibrancy = 0f; CameraBlurPlane.MaskLerp = 0f; ScreenFaderUtils.Fade(ScreenFaderUtils.GetColour(), Color.clear, 0f); array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (SlideSurface val5 in array) { if (val5.isHeroAttached) { val5.Detach(false); } } HeroController.instance.ResetSilkRegen(); HeroController.instance.ElevatorReset(); <>2__current = ScenePreloader.ForceEndPendingOperations(); <>1__state = 3; return true; IL_0a82: HeroController.instance.SetLockStates((HeroLockStates)0); ((Renderer)((Component)HeroController.instance).GetComponent()).enabled = true; ((Behaviour)DebugMod.RefHeroCollider).enabled = !DebugMod.heroColliderDisabled; HeroBox.Inactive = DebugMod.heroColliderDisabled; ((Component)HeroController.instance).gameObject.layer = 9; HeroController.instance.FinishedEnteringScene(true, false); RoomSpecific.BackwardsCompat(CS$<>8__locals0.data.saveScene, ref CS$<>8__locals0.data.roomSpecificOptions); if (!string.IsNullOrEmpty(CS$<>8__locals0.data.roomSpecificOptions)) { DebugMod.LogConsole("Performing room specific option " + CS$<>8__locals0.data.roomSpecificOptions); <>2__current = RoomSpecific.DoRoomSpecific(CS$<>8__locals0.data.saveScene, CS$<>8__locals0.data.roomSpecificOptions); <>1__state = 13; return true; } goto IL_0b54; IL_08bc: <>7__wrap5++; goto IL_08ce; IL_02a3: <>7__wrap5++; goto IL_02b1; IL_0b54: <>2__current = RoomSpecific.DoGenericFixes(CS$<>8__locals0.data.saveScene); <>1__state = 14; return true; IL_08eb: HeroController.instance.CharmUpdate(); QuestManager.IncrementVersion(); CollectableItemManager.IncrementVersion(); PlayMakerFSM.BroadcastEvent("CHARM INDICATOR CHECK"); PlayMakerFSM.BroadcastEvent("TOOL EQUIPS CHANGED"); PlayMakerFSM.BroadcastEvent("UPDATE NAIL DAMAGE"); EventRegister.SendEvent("END FOLLOWERS INSTANT", (GameObject)null); if (5__2) { <>2__current = null; <>1__state = 11; return true; } goto IL_094d; IL_094d: HeroController.instance.transform.position = CS$<>8__locals0.data.savePos; DebugMod.noclipPos = HeroController.instance.transform.position; HeroController.instance.transitionState = (HeroTransitionState)0; if (CS$<>8__locals0.data.isKinematized) { ((Component)HeroController.instance).GetComponent().bodyType = (RigidbodyType2D)1; } if (CS$<>8__locals0.data.facingLeft) { HeroController.instance.FaceLeft(); } else if (CS$<>8__locals0.data.facingRight) { HeroController.instance.FaceRight(); } try { GameManager.instance.cameraCtrl.PositionToHeroInstant(false); GameManager.instance.cameraCtrl.isGameplayScene = true; GameManager.instance.UpdateUIStateFromGameState(); } catch (NullReferenceException) { } if (LoadDuped && DebugMod.settings.ShowHitBoxes > 0) { <>7__wrap5 = DebugMod.settings.ShowHitBoxes; DebugMod.settings.ShowHitBoxes = 0; <>2__current = (object)new WaitUntil((Func)(() => HitboxViewer.State == 0)); <>1__state = 12; return true; } goto IL_0a82; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap7).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [SerializeField] public SaveStateData data; public static SaveState loadingSavestate { get; private set; } public static bool LoadDuped { get; set; } public static event Action OnSave; public static event Action BeforeLoad; public static event Action AfterLoad; internal SaveState() { data = new SaveStateData(); } public bool Save() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Invalid comparison between Unknown and I4 GameManager.instance.SaveLevelState(); data.saveScene = GameManager.instance.GetSceneNameString(); data.saveStateIdentifier = $"{data.saveScene}-{DateTime.Now:H:mm_d-MMM}"; try { data.roomSpecificOptions = RoomSpecific.SaveRoomSpecific(data.saveScene); } catch (Exception ex) { DebugMod.LogError(ex.Message); } data.savedPd = JsonUtility.FromJson(JsonUtility.ToJson((object)PlayerData.instance)); data.savedSd = JsonUtility.FromJson(JsonUtility.ToJson((object)SceneData.instance)); data.semiPersistentBools = SaveSemiPersistent((PersistentItemDataCollection)(object)SceneData.instance.persistentBools); data.semiPersistentInts = SaveSemiPersistent((PersistentItemDataCollection)(object)SceneData.instance.persistentInts); data.savePos = ((Component)HeroController.instance).gameObject.transform.position; data.facingLeft = !HeroController.instance.cState.facingRight; data.facingRight = HeroController.instance.cState.facingRight; data.isKinematized = (int)((Component)HeroController.instance).GetComponent().bodyType == 1; data.evoState = HeroController.instance.hunterUpgState.CurrentMeterHits; data.isMaggoted = HeroController.instance.cState.isMaggoted; if (PlayerData.instance.toolAmountsOverride != null) { data.toolAmountsOverride = new List(); foreach (KeyValuePair item in PlayerData.instance.toolAmountsOverride) { data.toolAmountsOverride.Add($"{item.Key}:{item.Value}"); } } ReadOnlyCollection loadedScenes = SceneWatcher.LoadedScenes; data.loadedScenes = loadedScenes.Select((SceneWatcher.LoadedSceneInfo s) => s.name).ToArray(); data.loadedSceneActiveScenes = loadedScenes.Select((SceneWatcher.LoadedSceneInfo s) => s.activeSceneWhenLoaded).ToArray(); data.customData = new Dictionary(); SaveState.OnSave?.Invoke(this); DebugMod.LogConsole("Created savestate"); return true; } private static TContainer[] SaveSemiPersistent(PersistentItemDataCollection collection) where TContainer : SerializableItemData, new() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (Dictionary> value in collection.scenes.Values) { foreach (PersistentItemData value2 in value.Values) { if (value2.IsSemiPersistent) { TContainer val = new TContainer(); ((SerializableItemData)val).SceneName = value2.SceneName; ((SerializableItemData)val).ID = value2.ID; ((SerializableItemData)val).Value = value2.Value; ((SerializableItemData)val).Mutator = value2.Mutator; TContainer item = val; list.Add(item); } } } return list.ToArray(); } [IteratorStateMachine(typeof(d__23))] public IEnumerator Load() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__23(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__24))] private IEnumerator LoadImpl() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this }; } private static void RestoreSemiPersistent(TContainer[] list, PersistentItemDataCollection collection) where TContainer : SerializableItemData, new() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (list == null) { return; } foreach (TContainer val in list) { if (!collection.scenes.ContainsKey(((SerializableItemData)val).SceneName)) { collection.scenes.Add(((SerializableItemData)val).SceneName, new Dictionary>()); } collection.scenes[((SerializableItemData)val).SceneName][((SerializableItemData)val).ID] = new PersistentItemData { SceneName = ((SerializableItemData)val).SceneName, ID = ((SerializableItemData)val).ID, Value = ((SerializableItemData)val).Value, Mutator = ((SerializableItemData)val).Mutator, IsSemiPersistent = true }; } } private void SaveStateGlitchFixes() { Rigidbody2D component = ((Component)HeroController.instance).GetComponent(); HeroController.instance.AffectedByGravity(true); component.gravityScale = 0.79f; FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Roar and Wound States").FsmVariables.FindFsmBool("Force Roar Lock").Value = false; HeroController.instance.cState.invulnerable = false; component.bodyType = (RigidbodyType2D)0; GameManager.instance.SetPlayerDataBool("atBench", false); if ((Object)(object)HeroController.SilentInstance != (Object)null) { if (HeroController.instance.cState.onConveyor || HeroController.instance.cState.onConveyorV || HeroController.instance.cState.inConveyorZone) { ConveyorMovementHero component2 = ((Component)HeroController.instance).GetComponent(); if (component2 != null) { component2.StopConveyorMove(); } HeroController.instance.cState.inConveyorZone = false; HeroController.instance.cState.onConveyor = false; HeroController.instance.cState.onConveyorV = false; } HeroController.instance.cState.nearBench = false; } if (Object.op_Implicit((Object)(object)HeroController.instance.currentDownspike)) { HeroController.instance.currentDownspike.CancelAttack(); } } private void HUDFixes() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) InventoryPaneList obj = Object.FindAnyObjectByType(); if (obj != null) { GameObject gameObject = ((Component)obj).gameObject; if (gameObject != null) { PlayMakerFSM obj2 = FSMUtility.LocateMyFSM(gameObject, "Inventory Control"); if (obj2 != null) { obj2.SetState("Close"); } } } if (CurrencyCounter._currencyCounters.TryGetValue((CurrencyType)0, out var value)) { foreach (CurrencyCounter item in value) { ((CurrencyCounterBase)item).geoTextMesh.Text = data.savedPd.geo.ToString(); } } if (CurrencyCounter._currencyCounters.TryGetValue((CurrencyType)1, out value)) { foreach (CurrencyCounter item2 in value) { ((CurrencyCounterBase)item2).geoTextMesh.Text = data.savedPd.ShellShards.ToString(); } } PlayerData.instance.health = data.savedPd.health; HeroController.instance.ClearEffects(); if (data.isMaggoted) { HeroController.instance.cState.isMaggoted = true; HeroController.instance.SetIsMaggoted(true); Utils.FindFSM("Maggots", "Maggot Effect").SetState("Is Maggoted?"); } HeroController.instance.hunterUpgState = new HunterUpgCrestStateInfo { CurrentMeterHits = data.evoState }; if (ToolItemManager.IsToolEquipped("Sprintmaster")) { FSMUtility.LocateMyFSM(((Component)HeroController.instance).gameObject, "Sprint Silk Usage").SetState("Reset Timer"); } HeroController.instance.SetFrostAmount(0f); PlayerData.instance.healthBlue = 0; EventRegister.SendEvent("HEALTH UPDATE", (GameObject)null); HudHelper.RefreshMasks(); HudHelper.RefreshSpool(); EventRegister.SendEvent("LAST HP ADDED", (GameObject)null); BindOrbHudFrame val = Object.FindAnyObjectByType(); if (Object.op_Implicit((Object)(object)val)) { val.isActive = true; val.currentFrameCrest = null; val.Refresh(true, false); } } public bool IsSet() { return !string.IsNullOrEmpty(data.saveStateIdentifier); } public override string ToString() { if (!IsSet()) { return Localization.Get("SAVESTATEPANEL_EMPTY"); } return data.saveStateIdentifier; } [HarmonyPatch(typeof(GameManager), "FindEntryPoint")] [HarmonyPrefix] private static bool FindEntryPoint(GameManager __instance, ref Vector2? __result, string entryPointName) { //IL_0025: 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) if (entryPointName == "dreamGate" && !__instance.RespawningHero) { __result = Vector2.op_Implicit(((Component)HeroController.instance).gameObject.transform.position); return false; } return true; } [HarmonyPatch(typeof(GameManager), "SaveLevelState")] [HarmonyPrefix] private static bool SaveLevelState() { return loadingSavestate == null; } } public static class SaveStateManager { public const int STATES_PER_PAGE = 10; private static readonly string saveStatesBaseDirectory = Path.Combine(DebugMod.ModBaseDirectory, "Savestates 1.0"); private static readonly Dictionary fileStates = new Dictionary(); private static SaveState quickState; public static int NumPages { get; private set; } internal static void Initialize() { quickState = new SaveState(); LoadFileStates(); } public static SaveState GetQuickState() { return quickState; } public static SaveState GetFileState(int page, int index) { return fileStates[page][index]; } public static void SetQuickState(SaveState state) { if (state.IsSet()) { quickState.data = state.data.DeepCopy(); } } public static void SetFileState(SaveState state, int page, int index) { if (state.IsSet()) { fileStates[page][index].data = state.data.DeepCopy(); SaveToFile(state.data, page, index); } } private static string GetFilePath(int page, int index) { return Path.Combine(saveStatesBaseDirectory, page.ToString(), $"savestate{index}.json"); } public static SaveState SaveNewState() { if (SaveTest()) { SaveState saveState = new SaveState(); saveState.Save(); return saveState; } return new SaveState(); } private static bool SaveTest() { if (SaveState.loadingSavestate != null) { if (!DebugMod.overrideLoadLockout) { DebugMod.LogConsole("Cannot save a savestate while another savestate is loading"); return false; } DebugMod.LogConsole("Overriding savestate lockout"); } return true; } private static void SaveToFile(SaveState.SaveStateData data, int page, int index) { try { data.BeforeSerialize(); File.WriteAllText(GetFilePath(page, index), JsonUtility.ToJson((object)data, true)); } catch (Exception ex) { DebugMod.LogDebug(ex.Message); throw; } } public static void RenameFileState(int page, int index, string name) { if (fileStates[page][index].IsSet()) { if (!string.IsNullOrWhiteSpace(name)) { fileStates[page][index].data.saveStateIdentifier = name; SaveToFile(fileStates[page][index].data, page, index); } else { DebugMod.LogConsole("Invalid name for savestate"); } } } public static void LoadState(SaveState state) { bool flag = LoadLockout(); if (!flag && DebugMod.overrideLoadLockout) { DebugMod.LogConsole("Overriding savestate lockout"); flag = true; } if (state.IsSet() && flag) { ((MonoBehaviour)GameManager.instance).StartCoroutine(state.Load()); } } private static bool LoadLockout() { if (PlayerDeathWatcher.playerDead) { DebugMod.LogConsole("Savestates cannot be loaded when dead"); return false; } if (HeroController.instance.cState.transitioning) { DebugMod.LogConsole("Savestates cannot be loaded when transitioning"); return false; } if (SaveState.loadingSavestate != null) { DebugMod.LogConsole("Cannot load a savestate while another savestate is loading"); return false; } return true; } public static void LoadFileStates() { try { if (DebugMod.settings.MaxSavePages <= 0) { DebugMod.settings.MaxSavePages = 1; } NumPages = DebugMod.settings.MaxSavePages; fileStates.Clear(); for (int i = 0; i < NumPages; i++) { fileStates.Add(i, new SaveState[10]); for (int j = 0; j < 10; j++) { fileStates[i][j] = new SaveState(); } } if (!Directory.Exists(saveStatesBaseDirectory)) { string text = Path.Combine(DebugMod.ModBaseDirectory, "Savestates Current Patch"); if (Directory.Exists(text)) { DebugMod.LogWarn("Legacy savestates directory detected. Renaming..."); Directory.Move(text, saveStatesBaseDirectory); } else { Directory.CreateDirectory(saveStatesBaseDirectory); } } foreach (string item in Directory.EnumerateDirectories(saveStatesBaseDirectory)) { if (!int.TryParse(Path.GetFileName(item), out var result) || result < 0 || result >= NumPages) { try { Directory.Delete(item); } catch { } } } for (int k = 0; k < NumPages; k++) { string path = Path.Combine(saveStatesBaseDirectory, k.ToString()); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); continue; } string[] files = Directory.GetFiles(path); foreach (string path2 in files) { try { int num = int.Parse(Regex.Match(Path.GetFileName(path2), "^savestate(\\d+).json$").Groups[1].Value); if (num >= 0 && num < 10) { fileStates[k][num].data = LoadFromFile(k, num); } } catch (Exception ex) { DebugMod.LogError(ex.ToString()); } } } } catch (Exception ex2) { DebugMod.LogError(ex2.ToString()); throw; } } private static SaveState.SaveStateData LoadFromFile(int page, int index) { try { string filePath = GetFilePath(page, index); if (File.Exists(filePath)) { SaveState.SaveStateData saveStateData = JsonUtility.FromJson(File.ReadAllText(filePath)); saveStateData.AfterDeserialize(); return saveStateData; } } catch (Exception ex) { DebugMod.LogDebug(ex.Message); throw; } return new SaveState.SaveStateData(); } } [HarmonyPatch] public static class SceneWatcher { [HarmonyPatch] public class LoadedSceneInfo { private static int counter; public static LoadedSceneInfo activeInfo; public readonly string name; public readonly int id; public readonly Scene? sceneObject; public string activeSceneWhenLoaded { get; internal set; } public LoadedSceneInfo(string name, string activeSceneName) { this.name = name; id = counter++; activeSceneWhenLoaded = activeSceneName; } public LoadedSceneInfo(Scene scene) : this(((Scene)(ref scene)).name, ((Scene)(ref scene)).name) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) sceneObject = scene; } public void LoadHook() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown activeInfo = this; GameManager.instance.OnFinishedSceneTransition += new SceneTransitionFinishEvent(FinishedSceneTransitionHook); } private void FinishedSceneTransitionHook() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameManager.instance.OnFinishedSceneTransition -= new SceneTransitionFinishEvent(FinishedSceneTransitionHook); activeInfo = null; } [HarmonyPatch(typeof(GameManager), "UpdateSceneName")] [HarmonyPrefix] public static bool UpdateSceneNameOverride(GameManager __instance) { if (activeInfo != null) { if (activeInfo.activeSceneWhenLoaded != __instance.sceneName) { __instance.lastSceneName = __instance.sceneName; } __instance.sceneName = activeInfo.activeSceneWhenLoaded; __instance.rawSceneName = activeInfo.activeSceneWhenLoaded; __instance.sceneNameHash = activeInfo.activeSceneWhenLoaded.GetHashCode(); return false; } return true; } } private static List scenes; private static Dictionary scenesWithManager; public static ReadOnlyCollection LoadedScenes => scenes.AsReadOnly(); private static void AddScene(Scene scene, LoadSceneMode mode, bool checkSceneManager = true) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((int)mode == 0) { scenes.Clear(); } LoadedSceneInfo loadedSceneInfo = new LoadedSceneInfo(scene); scenes.Add(loadedSceneInfo); if (checkSceneManager && Object.FindObjectsByType((FindObjectsSortMode)0).Any((CustomSceneManager m) => ((Component)m).gameObject.scene == scene)) { scenesWithManager.Add(scene, loadedSceneInfo.id); } } public static void Init() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) scenesWithManager = new Dictionary(); scenes = new List(); for (int i = 0; i < SceneManager.sceneCount; i++) { AddScene(SceneManager.GetSceneAt(i), (LoadSceneMode)1, checkSceneManager: false); } SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) AddScene(scene, mode); }; SceneManager.sceneUnloaded += delegate(Scene s) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) int num = scenes.FindIndex((LoadedSceneInfo d) => d.name == ((Scene)(ref s)).name); if (num != -1) { scenes.RemoveAt(num); } }; } [HarmonyPatch(typeof(CustomSceneManager), "Start")] [HarmonyPostfix] private static void OnCustomSceneManagerStart(CustomSceneManager __instance) { //IL_0018: 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_0062: Unknown result type (might be due to invalid IL or missing references) if (scenesWithManager != null && scenesWithManager.ContainsKey(((Component)__instance).gameObject.scene)) { int id = scenesWithManager[((Component)__instance).gameObject.scene]; LoadedSceneInfo loadedSceneInfo = scenes.FirstOrDefault((LoadedSceneInfo i) => i.id == id); scenesWithManager.Remove(((Component)__instance).gameObject.scene); if (loadedSceneInfo != null) { loadedSceneInfo.activeSceneWhenLoaded = GameManager.instance.sceneName; } } } } } namespace DebugMod.MonoBehaviours { public class CocoonPreviewer : MonoBehaviour { public bool previewEnabled; private GameObject cocoon; private GameObject compass; public void Update() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) Vector2 position; bool atHeroCorpseMarker; if (!previewEnabled || !Object.op_Implicit((Object)(object)HeroController.instance)) { Object.Destroy((Object)(object)cocoon); } else if (CalculatePosition(out position, out atHeroCorpseMarker)) { if (!Object.op_Implicit((Object)(object)cocoon)) { GameObject heroCorpsePrefab = Object.FindAnyObjectByType().heroCorpsePrefab; cocoon = Object.Instantiate(heroCorpsePrefab, new Vector3(position.x, position.y, heroCorpsePrefab.transform.position.z), Quaternion.identity); Object.Destroy((Object)(object)cocoon.GetComponent()); Object.Destroy((Object)(object)cocoon.GetComponent()); Object.Destroy((Object)(object)cocoon.GetComponent()); Object.Destroy((Object)(object)cocoon.GetComponent()); Object.Destroy((Object)(object)cocoon.GetComponent()); compass = new GameObject("Compass", new Type[1] { typeof(SpriteRenderer) }); compass.transform.parent = cocoon.transform; Texture2D val = UICommon.images["Arrow"]; Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 64f); SpriteRenderer component = compass.GetComponent(); component.sprite = sprite; ((Renderer)component).sortingOrder = 32767; Transform transform = compass.transform; transform.localScale *= 2f; } SpriteRenderer[] componentsInChildren = cocoon.GetComponentsInChildren(); foreach (SpriteRenderer val2 in componentsInChildren) { if (((Object)((Component)val2).gameObject).name != "Compass") { val2.color = new Color(0.8f, 1f, 1f, 0.4f); } } RepositionFromWalls component2 = cocoon.GetComponent(); if (atHeroCorpseMarker) { ((Behaviour)component2).enabled = false; cocoon.transform.position = new Vector3(position.x, position.y, cocoon.transform.position.z); } else { ((Behaviour)component2).enabled = true; component2.Reposition(); } Vector2 val3 = Vector2.op_Implicit(HeroController.instance.transform.position + new Vector3(0f, 2f, 0f)); Vector2 val4 = position - val3; compass.transform.position = Vector2.op_Implicit(val3); compass.transform.rotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(val4.y, val4.x) * 57.29578f); } else { Object.Destroy((Object)(object)cocoon); } } private bool CalculatePosition(out Vector2 position, out bool atHeroCorpseMarker) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)HeroCorpseMarkerProxy.Instance)) { position = HeroCorpseMarkerProxy.Instance.TargetScenePos; atHeroCorpseMarker = HeroCorpseMarkerProxy.Instance.TargetGuid != null; return HeroCorpseMarkerProxy.Instance.TargetSceneName == GameManager.instance.GetSceneNameString(); } HeroCorpseMarker closest = HeroCorpseMarker.GetClosest(Vector2.op_Implicit(HeroController.instance.transform.position)); if (Object.op_Implicit((Object)(object)closest)) { position = closest.Position; atHeroCorpseMarker = true; } else { position = Vector2.op_Implicit(HeroController.instance.transform.position); atHeroCorpseMarker = false; } return true; } } [HarmonyPatch] public class EnemyHandle : MonoBehaviour { private HealthManager hm; private tk2dSprite? sprite; private BoxCollider2D collider; private CanvasPanel? hpBar; private Texture2D? barTexture; private int maxHP; private PlayMakerFSM? staggerFsm; private static int BarWidth => UICommon.ScaleWidth(150); private static int BarHeight => UICommon.ScaleHeight(40); public int HP { get { return hm.hp; } set { hm.hp = value; } } public int MaxHP => maxHP; public string Name => ((Object)((Component)this).gameObject).name; public void Awake() { hm = ((Component)this).GetComponent(); sprite = ((Component)this).GetComponent(); collider = ((Component)this).GetComponent(); staggerFsm = ((Component)this).gameObject.GetTemplatedFsm("stun_control"); if (!EnemiesPanel.enemyPool.Contains(this)) { EnemiesPanel.enemyPool.Add(this); } } public void OnDestroy() { EnemiesPanel.enemyPool.Remove(this); DestroyUI(); } public void OnEnable() { Awake(); } public void OnDisable() { OnDestroy(); } public void DestroyUI() { hpBar?.Destroy(); hpBar = null; } public void Update() { //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) if (!EnemiesPanel.ActivelyUpdating()) { CanvasPanel? canvasPanel = hpBar; if (canvasPanel != null) { canvasPanel.ActiveSelf = false; } return; } if (maxHP < hm.hp && hm.hp > 0) { maxHP = hm.hp; } if (EnemiesPanel.hpBars) { if (hpBar == null) { barTexture = new Texture2D(1, 1); barTexture.SetPixel(0, 0, Helper.SetAlpha(Color.red, 0.5f)); barTexture.Apply(); hpBar = new CanvasPanel(((Object)((Component)this).gameObject).name + " HP Bar"); hpBar.Size = new Vector2((float)BarWidth, (float)BarHeight); hpBar.Add(new CanvasImage("Bar")).SetImage(barTexture); CanvasBorder canvasBorder = hpBar.Add(new CanvasBorder("Border")); canvasBorder.Size = hpBar.Size; canvasBorder.Thickness = 2; CanvasText canvasText = hpBar.Add(new CanvasText("HP", (HorizontalWrapMode)0)); canvasText.Size = hpBar.Size; canvasText.FontSize = UICommon.ScaleHeight(20); canvasText.Alignment = (TextAnchor)4; if ((Object)(object)staggerFsm != (Object)null) { CanvasText canvasText2 = hpBar.Add(new CanvasText("Combo", (HorizontalWrapMode)0)); canvasText2.Text = GetStaggerText(); canvasText2.FontSize = 18; canvasText2.Size = hpBar.Size; canvasText2.Alignment = (TextAnchor)8; } hpBar.Build(); foreach (CanvasNode item in hpBar.Subtree().Reverse()) { if (item != null) { item.GameObject.transform.SetAsFirstSibling(); } } } Vector2 val = Vector2.op_Implicit(((Component)this).transform.position); tk2dSprite? obj = sprite; ? val2; if (obj == null) { BoxCollider2D obj2 = collider; val2 = ((obj2 != null) ? ((Collider2D)obj2).bounds : new Bounds(((Component)this).transform.position, new Vector3(1f, 1f, 0f))); } else { val2 = ((tk2dBaseSprite)obj).GetBounds(); } Bounds val3 = (Bounds)val2; val.y += (((Bounds)(ref val3)).max.y - ((Bounds)(ref val3)).min.y) / 2f; if (Object.op_Implicit((Object)(object)Camera.main)) { val = Vector2.op_Implicit(Camera.main.WorldToScreenPoint(Vector2.op_Implicit(val))); } val.x -= (float)BarWidth / 2f; val.y = (float)Screen.height - val.y - hpBar.Size.y; hpBar.LocalPosition = val; hpBar.Get("Bar").Size = new Vector2((float)BarWidth * Mathf.Clamp01((float)HP / (float)MaxHP), (float)BarHeight); hpBar.Get("HP").LocalPosition = Vector2.zero; hpBar.Get("HP").Text = $"{HP}/{MaxHP}"; if ((Object)(object)staggerFsm != (Object)null) { hpBar.Get("Combo").LocalPosition = new Vector2(0f, (float)(-BarHeight)); hpBar.Get("Combo").Text = GetStaggerText(); } } CanvasPanel? canvasPanel2 = hpBar; if (canvasPanel2 != null) { canvasPanel2.ActiveSelf = EnemiesPanel.hpBars; } } private string GetStaggerText() { if ((Object)(object)staggerFsm == (Object)null) { return "Stun disabled"; } FsmInt fsmInt = staggerFsm.FsmVariables.GetFsmInt("Stun Hit Max"); FsmFloat fsmFloat = staggerFsm.FsmVariables.GetFsmFloat("Hits Total"); FsmState state = staggerFsm.GetState("In Combo"); if (!state.Actions[3].Active) { return $"{GetStunControlPrefix()} {fsmFloat.Value:0.##}/{(float)fsmInt.Value + 0.1f}"; } FsmInt fsmInt2 = staggerFsm.FsmVariables.GetFsmInt("Stun Combo"); FsmFloat fsmFloat2 = staggerFsm.FsmVariables.GetFsmFloat("Combo Counter"); FsmFloat fsmFloat3 = staggerFsm.FsmVariables.GetFsmFloat("Combo Time"); string text = ((staggerFsm.ActiveStateName == "In Combo") ? fsmFloat2.Value.ToString() : "_"); Wait firstActionOrDefault = state.GetFirstActionOrDefault(); float num = fsmFloat3.Value - firstActionOrDefault.timer; return $"{GetStunControlPrefix()} {num:.0} ({text}/{fsmInt2.Value}) {((fsmFloat != null) ? new float?(fsmFloat.Value) : null):0.##}/{(float?)((fsmInt != null) ? new int?(fsmInt.Value) : null) + 0.1f}"; } private string GetStunControlPrefix() { if ((Object)(object)staggerFsm == (Object)null) { return ""; } if (!(staggerFsm.ActiveStateName == "Stop")) { return ""; } return "NoStun"; } [HarmonyPatch(typeof(HealthManager), "Start")] [HarmonyPostfix] private static void HealthManager_Start(HealthManager __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { ((Component)__instance).gameObject.AddComponent(); } } } public class NodeRef : MonoBehaviour { public CanvasNode node; } [HarmonyPatch] public static class TimeScale { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ScaleFreeze; } private static TimeControlInstance tFreeze = new TimeControlInstance(1f, (Type)0); private static TimeControlInstance tScale = new TimeControlInstance(1f, (Type)0); private static bool overrideIsCheatsEnabled = false; private static bool hooksActive = false; private static ILHook[] _coroutineHooks; private static readonly MethodInfo[] FreezeCoroutines = (from method in typeof(GameManager).GetMethods() where method.Name.StartsWith("FreezeMoment") || method.Name.StartsWith("SetTimeScale") where method.ReturnType == typeof(IEnumerator) select method.GetCustomAttribute() into attr select attr.StateMachineType into type select type.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.NonPublic)).ToArray(); private static float CustomTimeScaleIncludingFreeze => CustomTimeScale * tFreeze.TimeScale; public static float CustomTimeScale { get { return tScale.timeScale; } set { float customTimeScale = CustomTimeScale; if (value != customTimeScale && !(value < 0f)) { tScale.TimeScale = value; string arg = ((value > customTimeScale) ? "increased" : "decreased"); DebugMod.LogConsole($"Timescale {arg} to {CustomTimeScale:0.0}"); CheckHookRequirement(); } } } private static bool IsScalingTime => !Mathf.Approximately(CustomTimeScaleIncludingFreeze, 1f); private static bool IsUsingSpedUpTime => CustomTimeScaleIncludingFreeze > 1f; public static bool Frozen { get { return tFreeze.TimeScale == 0f; } set { if (value == Frozen) { return; } tFreeze.TimeScale = (value ? 0f : 1f); bool flag = (Object)(object)GameManager.UnsafeInstance != (Object)null && (Object)(object)GameCameras.instance != (Object)null && !GameManager.instance.isPaused; if (value) { if (flag) { GameCameras.instance.StopCameraShake(); } } else if (flag) { GameCameras.instance.ResumeCameraShake(); } CheckHookRequirement(); } } public static void Reset() { TimeControlInstance obj = tFreeze; if (obj != null) { obj.TimeScale = 1f; } TimeControlInstance obj2 = tScale; if (obj2 != null) { obj2.TimeScale = 1f; } } internal static void Initialize() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if (tFreeze == null) { tFreeze = new TimeControlInstance(1f, (Type)0); } if (tScale == null) { tScale = new TimeControlInstance(1f, (Type)0); } } internal static void Release() { TimeControlInstance obj = tFreeze; if (obj != null) { obj.Release(); } TimeControlInstance obj2 = tScale; if (obj2 != null) { obj2.Release(); } } [HarmonyPrefix] [HarmonyPatch(typeof(TimeManager), "UpdateTimeScale")] public static void UpdateTimeScalePrefix() { overrideIsCheatsEnabled = IsUsingSpedUpTime; } [HarmonyPostfix] [HarmonyPatch(typeof(TimeManager), "UpdateTimeScale")] public static void UpdateTimeScalePostfix() { overrideIsCheatsEnabled = false; } [HarmonyPostfix] [HarmonyPatch(typeof(CheatManager), "IsCheatsEnabled")] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void IsCheatsEnabledPostfix(ref bool __result) { if (overrideIsCheatsEnabled) { __result = true; } } private static void CheckHookRequirement() { if (!hooksActive && IsScalingTime) { HookFreezeCoroutines(); } else if (hooksActive && !IsScalingTime) { UnhookFreezeCoroutines(); } } private static void HookFreezeCoroutines() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown hooksActive = true; _coroutineHooks = (ILHook[])(object)new ILHook[FreezeCoroutines.Length]; foreach (var item3 in FreezeCoroutines.Select((MethodInfo mi, int idx) => (mi, idx))) { MethodInfo item = item3.Item1; int item2 = item3.Item2; ILHook[] coroutineHooks = _coroutineHooks; object obj = <>O.<0>__ScaleFreeze; if (obj == null) { Manipulator val = ScaleFreeze; <>O.<0>__ScaleFreeze = val; obj = (object)val; } coroutineHooks[item2] = new ILHook((MethodBase)item, (Manipulator)obj); } } private static void UnhookFreezeCoroutines() { if (hooksActive) { hooksActive = false; ILHook[] coroutineHooks = _coroutineHooks; for (int i = 0; i < coroutineHooks.Length; i++) { coroutineHooks[i].Dispose(); } } } private static void ScaleFreeze(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); FieldReference val2 = default(FieldReference); val.GotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchCall