using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; // Token: 0x020008F7 RID: 2295 public partial class ConsoleUI : UIGameObjectWindow, IGameUIListener, IGameUIGetter { // Token: 0x060032DA RID: 13018 RVA: 0x000E8214 File Offset: 0x000E6414 protected void Update() { if (Keyboard.current == null && Gamepad.current == null) { return; } // Check for F12 or Gamepad activation if ((Keyboard.current != null && Keyboard.current.f12Key.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.leftStickButton.wasPressedThisFrame && Gamepad.current.rightStickButton.wasPressedThisFrame)) { if (this.m_panel.activeSelf) { base.Close(); // Close the console UI } else { this.Open(); // Open the console UI this.PlayerGameUI.Player.GetComponent().SetConsoleActive(true); this.m_input.FixedSelect(); // Focus the input field } } // Close console with Escape or Gamepad Button East if (((Keyboard.current != null && Keyboard.current.escapeKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.buttonEast.wasPressedThisFrame)) && this.m_panel.activeSelf) { base.Close(); } // Navigate suggestions with Tab or Gamepad D-Pad Up if (this.IsOpen && ((Keyboard.current != null && Keyboard.current.tabKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.dpad.up.wasPressedThisFrame)) && this.m_suggestedWords.Count > 0) { if (this.m_selectedSuggestion != -1) { this.m_suggestionItems[this.m_selectedSuggestion].GetComponent().color = Color.white; } this.m_selectedSuggestion = (this.m_selectedSuggestion + 1) % this.m_suggestedWords.Count; this.m_suggestionItems[this.m_selectedSuggestion].GetComponent().color = Color.blue; } // Apply suggestion with Shift or Gamepad D-Pad Right if (this.IsOpen && ((Keyboard.current != null && Keyboard.current.leftShiftKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.dpad.right.wasPressedThisFrame)) && this.m_selectedSuggestion != -1) { this.m_suggestionItems[this.m_selectedSuggestion].GetComponent().color = Color.white; this.ApplyLatestSuggestion(); } // Command history navigation with Up Arrow or Gamepad D-Pad Down if (this.m_input.isFocused) { if (((Keyboard.current != null && Keyboard.current.upArrowKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.dpad.down.wasPressedThisFrame)) && this.m_commandHistory.Count > 0) { this.m_historyIndex--; if (this.m_historyIndex < 0) { this.m_historyIndex = this.m_commandHistory.Count - 1; } this.m_input.text = this.m_commandHistory[this.m_historyIndex]; } // Clear input with Gamepad D-Pad Left if (Gamepad.current != null && Gamepad.current.dpad.left.wasPressedThisFrame) { this.m_input.text = string.Empty; } // Remove backquote character if typed if (Keyboard.current != null && Keyboard.current.backquoteKey.wasPressedThisFrame) { this.m_input.text = this.m_input.text.Replace("`", ""); } } // Execute command with Enter or Gamepad Button South if (this.IsOpen && ((Keyboard.current != null && Keyboard.current.enterKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.buttonSouth.wasPressedThisFrame))) { if (this.m_selectedSuggestion != -1) { this.m_suggestionItems[this.m_selectedSuggestion].GetComponent().color = Color.white; this.ApplyLatestSuggestion(); } this.DoCommand(); } } } ``` //--- Modified `DamageUtil` Class --- //```csharp using System; using System.Linq; using Unity.Mathematics; using Unity.VisualScripting; using UnityEngine; // Token: 0x02000A09 RID: 2569 [Inspectable] public class DamageUtil { public static float CalcDamageToWorldObject(PlayerController player, int2 targetTile, InventoryItem tool) { if (tool == null) { return 0f; } TileData data = player.Level.GetData(targetTile); HealthData healthData = (data != null) ? data.GetCustomData() : null; if (healthData == null) { return 0f; } TileData data2 = player.Level.GetData(targetTile); if (data2 == null) { return 0f; } float result; if (data2.Type.Classification.Contains("Mineable")) { result = DamageUtil.GetMineableDamage(data2.Type, healthData, tool); } else if (data2.Type.Classification.Contains("Tree")) { result = DamageUtil.GetTreeDamage(data2.Type, healthData, player, targetTile, tool); } else { result = ToolUpgradeConstants.GetUpgradedToolDamage(tool, data2.Type) * 5f; } return result; } private static float GetMineableDamage(WorldItemsData worldItemTarget, HealthData health, InventoryItem tool) { float num = ToolUpgradeConstants.GetUpgradedToolDamage(tool, worldItemTarget); return num * 5f; } private static float GetTreeDamage(WorldItemsData worldItemTarget, HealthData health, PlayerController player, int2 targetTile, InventoryItem tool) { float num = ToolUpgradeConstants.GetUpgradedToolDamage(tool, worldItemTarget); num *= DamageUtil.GetTreeAgeMultiplier(player.Level, targetTile); return num * 5f; } private static float GetTreeAgeMultiplier(Level level, int2 targetTile) { TileData data = level.GetData(targetTile); if (data == null) { return 1f; } TreeData customData = data.GetCustomData(); if (customData == null) { return 1f; } float t = (float)customData.GrowthDays / 8f; return Mathf.Lerp(5f, 1f, t); } } ``` //Save this code as a `.txt` file to keep it for future reference. Each class section is clearly separated for easier navigation. //LocalPlayer using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading; using Cysharp.Threading.Tasks; using GameLogic; using Unity.Mathematics; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Localization; // Token: 0x0200047B RID: 1147 public partial class LocalPlayerController : PlayerController, IUnlockReceiver, IControlMode { private GameObject consoleUI; // Token: 0x0600457A RID: 17786 private new void Start() { GameObject localPlayer = this.FindLocalPlayer(); if (localPlayer != null) { Transform transform = localPlayer.transform.Find("GameUI/Console/Panel"); this.consoleUI = transform != null ? transform.gameObject : null; } if (this.consoleUI == null) { Debug.LogError("ConsoleUI GameObject not found. Ensure the hierarchy and paths are correct."); } else { Debug.Log("ConsoleUI successfully found."); } if (this.Input != null) { // Original Toggle Button this.Input.actions["UI/ToggleConsole"].performed += delegate (InputAction.CallbackContext ctx) { this.ToggleConsoleUI(); }; // Additional Hardcoded F12 Toggle Button InputSystem.onEvent += (InputEventPtr eventPtr, InputDevice device) => { if (Keyboard.current != null && Keyboard.current.f12Key.wasPressedThisFrame) { this.ToggleConsoleUI(); } }; } } private GameObject FindLocalPlayer() { foreach (GameObject obj in GameObject.FindObjectsOfType()) { if (obj.GetComponent() != null && obj.name.StartsWith("LocalPlayer")) { Debug.Log($"LocalPlayer found: {obj.name}"); return obj; } } Debug.LogError("LocalPlayer not found in the scene."); return null; } private void ToggleConsoleUI() { if (consoleUI != null) { consoleUI.SetActive(!consoleUI.activeSelf); Debug.Log($"ConsoleUI is now {(consoleUI.activeSelf ? "visible" : "hidden")}."); } else { Debug.LogError("ConsoleUI reference is null. Cannot toggle visibility."); } } } // ConsoleUI Class // This is the modified code for the ConsoleUI class to allow it to run without restrictions in non-editor or non-debug builds. using System; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using TMPro; using UnityEngine; using UnityEngine.Events; public partial class ConsoleUI : UIGameObjectWindow, IGameUIListener, IGameUIGetter { protected override void Awake() { ConsoleUI.IsIgnoringCosts = false; base.Awake(); // Removed restriction for non-editor or non-debug builds // if (!Application.isEditor && !Debug.isDebugBuild) // { // base.enabled = false; // return; // } this.m_commands.Add("help", new Action(this.Help)); this.m_commands.Add("explore", new Action(this.Explore)); this.m_commands.Add("freestuff", new Action(this.FreeStuff)); this.m_commands.Add("alchemy", new Action(this.Alchemy)); this.m_commands.Add("begin", new Action(this.Begin)); this.m_commands.Add("tools", new Action(this.Tools)); this.m_commands.Add("coppertools", new Action(this.CopperTools)); this.m_commands.Add("irontools", new Action(this.IronTools)); this.m_commands.Add("moonstonetools", new Action(this.MoonstoneTools)); this.m_commands.Add("volcanictools", new Action(this.VolcanicTools)); this.m_commands.Add("giveitem", new Action(this.GiveItem)); this.m_commands.Add("gi", new Action(this.GiveItem)); this.m_commands.Add("ti", new Action(this.TakeItem)); this.m_commands.Add("giveallitems", new Action(this.GiveAllItems)); this.m_commands.Add("givemoney", new Action(this.GiveMoney)); this.m_commands.Add("gm", new Action(this.GiveMoney)); this.m_commands.Add("endday", new Action(this.EndDay)); this.m_commands.Add("unlockblueprint", new Action(this.UnlockBlueprint)); this.m_commands.Add("unlockrecipe", new Action(this.UnlockRecipe)); this.m_commands.Add("unlockall", new Action(this.UnlockAll)); this.m_commands.Add("unlockalldrawings", new Action(this.UnlockAllDrawings)); this.m_commands.Add("unlockallrecipes", new Action(this.UnlockAllRecipes)); this.m_commands.Add("unlockallshops", new Action(this.UnlockAllShopItems)); this.m_commands.Add("lockrecipe", new Action(this.LockRecipe)); this.m_commands.Add("freeblueprints", new Action(this.FreeBlueprints)); this.m_commands.Add("settime", new Action(this.SetTime)); this.m_commands.Add("givetokens", new Action(this.GiveTokens)); this.m_commands.Add("startminigame", new Action(this.StartMinigame)); this.m_commands.Add("growforest", new Action(this.GrowForest)); this.m_commands.Add("growgrass", new Action(this.GrowGrass)); this.m_commands.Add("cleargrass", new Action(this.ClearGrass)); this.m_commands.Add("flipinstances", new Action(this.FlipInstances)); this.m_commands.Add("getlightamount", new Action(this.GetLightAmount)); this.m_commands.Add("rebakenavmesh", new Action(this.RebakeNavmesh)); this.m_commands.Add("listunlockedrecipes", new Action(this.ListUnlockedRecipes)); this.m_commands.Add("clear", new Action(this.ClearLog)); this.m_commands.Add("setrtpc", new Action(this.SetRTPC)); this.m_commands.Add("setglobalstate", new Action(this.SetGlobalState)); this.m_commands.Add("getglobalstate", new Action(this.GetGlobalState)); this.m_commands.Add("setplayerstate", new Action(this.SetPlayerState)); this.m_commands.Add("getplayerstate", new Action(this.GetPlayerState)); this.m_commands.Add("xpbomb", new Action(this.XPBomb)); this.m_commands.Add("dropxp", new Action(this.DropXP)); this.m_commands.Add("givexp", new Action(this.GiveXP)); this.m_commands.Add("resetcaves", new Action(this.ResetCaves)); this.m_commands.Add("resetcave", new Action(this.ResetCave)); this.m_commands.Add("startdanger", new Action(this.StartDanger)); this.m_commands.Add("setsimulationspeed", new Action(this.SetSimulationSpeed)); this.m_commands.Add("setgamespeed", new Action(this.SetGameSpeed)); this.m_commands.Add("freeseeds", new Action(this.FreeSeeds)); this.m_commands.Add("growcrops", new Action(this.GrowCrops)); this.m_commands.Add("spawnasloot", new Action(this.SpawnAsLoot)); this.m_commands.Add("moneyasloot", new Action(this.MoneyAsLoot)); this.m_commands.Add("teleport", new Action(this.Teleport)); this.m_commands.Add("startcutscene", new Action(this.StartCutscene)); this.m_commands.Add("godmode", new Action(this.EnableGodMode)); this.m_commands.Add("disablegodmode", new Action(this.DisableGodMode)); this.m_commands.Add("addtally", new Action(this.AddTally)); this.m_commands.Add("fillinventory", new Action(this.FillPlayerInventory)); this.m_commands.Add("clearinventory", new Action(this.ClearPlayerInventory)); this.m_commands.Add("startquest", new Action(this.StartQuest)); this.m_commands.Add("startquestlocal", new Action(this.StartQuestLocal)); this.m_commands.Add("startallquestslocal", new Action(this.StartAllQuestsLocal)); this.m_commands.Add("forcecompletetask", new Action(this.ForceCompleteTask)); this.m_commands.Add("forcecompletetasklocal", new Action(this.ForceCompleteTaskLocal)); this.m_commands.Add("forceskiptoendofquest", new Action(this.ForceSkipToEndOfQuest)); this.m_commands.Add("forcecompletetrackedtask", new Action(this.ForceCompleteTrackedTask)); this.m_commands.Add("forceallcompletetasklocal", new Action(this.ForceAllCompleteTaskLocal)); this.m_commands.Add("givealllumas", new Action(this.GiveAllLumas)); this.m_commands.Add("upgradetool", new Action(this.UpgradeTool)); this.m_commands.Add("ascendtool", new Action(this.AscendTool)); this.m_commands.Add("setday", new Action(this.SetDay)); this.m_commands.Add("hide", new Action(this.HideUI)); this.m_commands.Add("show", new Action(this.ShowUI)); this.m_commands.Add("hidegameui", new Action(this.HideGameUI)); this.m_commands.Add("showgameui", new Action(this.ShowGameUI)); this.m_commands.Add("hideworldui", new Action(this.HideWorldUI)); this.m_commands.Add("showworldui", new Action(this.ShowWorldUI)); this.m_commands.Add("showwindow", new Action(this.ShowWindow)); this.m_commands.Add("hidewindow", new Action(this.HideWindow)); this.m_commands.Add("coords", new Action(this.PrintCoords)); this.m_commands.Add("next", new Action(this.NextTempleRoom)); this.m_commands.Add("ignorecost", new Action(this.IgnoreCost)); this.m_commands.Add("spider", new Action(this.SpawnSpiderInCave)); this.m_commands.Add("setprof", new Action(this.SetProfession)); this.m_commands.Add("allprofs", new Action(this.AllProfessions)); this.m_commands.Add("chestcheat", new Action(this.ChestCheat)); this.m_commands.Add("resetchests", new Action(this.ResetChests)); this.m_commands.Add("setcraftingspeed", new Action(this.SetCraftingSpeed)); this.m_commands.Add("setcropspeed", new Action(this.SetCropSpeed)); this.m_commands.Add("spawnspider", new Action(this.SpawnSpider)); this.m_commands.Add("spawnbee", new Action(this.SpawnBee)); this.m_commands.Add("killspiders", new Action(this.KillSpiders)); this.m_commands.Add("killbear", new Action(this.KillBear)); this.m_commands.Add("spawnghost", new Action(this.SpawnGhost)); this.m_commands.Add("spawnblueprint", new Action(this.SpawnBlueprint)); this.m_commands.Add("unstuck", new Action(this.Unstuck)); this.m_commands.Add("teleporttotile", new Action(this.TeleportPlayerToTile)); this.m_commands.Add("bait", new Action(this.AddBait)); this.m_commands.Add("printwindowstate", new Action(this.PrintWindowState)); this.m_commands.Add("enablewindowlog", new Action(this.EnableWindowLog)); this.m_commands.Add("disablewindowlog", new Action(this.DisableWindowLog)); this.m_commands.Add("nuke", new Action(this.Nuke)); this.m_commands.Add("loadlevel", new Action(this.AdditiveLoadLevel)); this.m_input.onValueChanged.AddListener(new UnityAction(this.UpdateSuggestions)); TMP_InputField input = this.m_input; input.onValidateInput = (TMP_InputField.OnValidateInput)Delegate.Combine(input.onValidateInput, new TMP_InputField.OnValidateInput(this.IgnoreBackquote)); } }