Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HexDevTools v1.0.0
Plugins/HexDevTools.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Jotunn; using Jotunn.Managers; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HexDevTools")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HexDevTools")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("baf6dd8e-8466-4ff0-b61c-9cc9e48cc9ed")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HexDevTools; internal static class Constants { internal static class DevCommands { internal const string EnableDevCommands = "devcommands"; internal const string EnableDebugMode = "debugmode"; internal const string NoBuildCost = "nocost"; internal const string Fly = "fly"; internal const string DayTime = "tod 0.5"; internal const string NightTime = "tod 0"; internal const string Spawn = "spawn"; internal const string God = "god"; internal const string FreeFly = "freefly"; } internal static class HexDevToolsGuiText { internal const string Title = "Dev Tools"; internal const string EnableDevCommands = "Enable Devcommands"; internal const string DevCommands = "Dev Commands"; internal const string Spawn = "Spawn"; internal const string Close = "Close"; internal const string NoBuildCost = "No Build Cost"; internal const string DayTime = "Day Time"; internal const string NightTime = "Night Time"; internal const string Fly = "Fly"; internal const string God = "God Mode"; internal const string FreeFly = "Free Fly"; internal const string SpawnPlaceholder = "prefabName argument1 argument2"; } } [BepInPlugin("hex.devtools", "HexDevTools", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string PluginGuid = "hex.devtools"; private const string PluginName = "HexDevTools"; private const string PluginVersion = "1.0.0"; private ConfigEntry<KeyboardShortcut> _toggleKey; private bool _uiVisible; private bool _devCommandsEnabled; private GameObject _mainPanel; private GameObject _devCommandPanel; private GameObject _devCommandButtonArea; private GameObject _spawnPanel; private Button _enableDevCommandsButton; internal static Plugin Instance { get; private set; } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) Instance = this; _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Toggle Dev Tools UI"); _toggleKey.SettingChanged += delegate { //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) KeyboardShortcut value = _toggleKey.Value; Logger.LogInfo((object)("Toggle key changed to: " + ((object)(KeyboardShortcut)(ref value)).ToString())); }; GUIManager.OnCustomGUIAvailable += OnCustomGUIAvailable; Logger.LogInfo((object)"HexDevTools loaded."); } private void Update() { //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) if (_toggleKey != null) { KeyboardShortcut value = _toggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { SetPanelVisible(!_uiVisible); } } } private void OnDestroy() { GUIManager.OnCustomGUIAvailable -= OnCustomGUIAvailable; GUIManager.BlockInput(false); Instance = null; } private void OnCustomGUIAvailable() { Logger.LogInfo((object)"Custom GUI is available."); if (GUIManager.Instance == null) { Logger.LogError((object)"GUIManager instance is null."); return; } if ((Object)(object)GUIManager.CustomGUIFront == (Object)null) { Logger.LogError((object)"CustomGUIFront is null."); return; } CreateMainPanel(); CreateHeader(); CreateEnableDevCommandsButton(); CreateDevCommandPanel(); CreateSpawnPanel(); CreateCloseButton(); ResetDevCommandUiState(); _mainPanel.SetActive(false); } private void CreateMainPanel() { //IL_001a: 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_0038: Unknown result type (might be due to invalid IL or missing references) _mainPanel = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), 430f, 620f, true); } private void CreateHeader() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0059: Unknown result type (might be due to invalid IL or missing references) GUIManager.Instance.CreateText("Dev Tools", _mainPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -45f), GUIManager.Instance.AveriaSerifBold, 30, GUIManager.Instance.ValheimOrange, true, Color.black, 300f, 40f, false); } private void CreateEnableDevCommandsButton() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0093: Expected O, but got Unknown GameObject val = GUIManager.Instance.CreateButton("Enable Devcommands", _mainPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -95f), 180f, 30f); Button button = val.GetComponent<Button>(); _enableDevCommandsButton = button; ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { if (!_devCommandsEnabled) { RunConsoleCommand("devcommands"); RunConsoleCommand("debugmode"); _devCommandsEnabled = true; ((Selectable)button).interactable = false; ShowHudMessage("Devcommands enabled."); _devCommandPanel.SetActive(true); _spawnPanel.SetActive(true); } }); } private void CreateDevCommandPanel() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0081: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) _devCommandPanel = GUIManager.Instance.CreateWoodpanel(_mainPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -260f), 330f, 290f, false); GUIManager.Instance.CreateText("Dev Commands", _devCommandPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -25f), GUIManager.Instance.AveriaSerifBold, 16, GUIManager.Instance.ValheimOrange, true, Color.black, 200f, 30f, false); CreateDevCommandButtonArea(); CreateDevCommandButton("No Build Cost", "nocost"); CreateDevCommandButton("Fly", "fly"); CreateDevCommandButton("Free Fly", "freefly"); CreateDevCommandButton("God Mode", "god"); CreateDevCommandButton("Day Time", "tod 0.5"); CreateDevCommandButton("Night Time", "tod 0"); } private void CreateDevCommandButtonArea() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0042: 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_006c: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown _devCommandButtonArea = new GameObject("HexDevToolsDevCommandButtonArea"); _devCommandButtonArea.transform.SetParent(_devCommandPanel.transform, false); RectTransform obj = _devCommandButtonArea.AddComponent<RectTransform>(); obj.anchorMin = new Vector2(0.5f, 1f); obj.anchorMax = new Vector2(0.5f, 1f); obj.anchoredPosition = new Vector2(0f, -150f); obj.sizeDelta = new Vector2(260f, 220f); VerticalLayoutGroup obj2 = _devCommandButtonArea.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)obj2).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 6f; ((LayoutGroup)obj2).padding = new RectOffset(0, 0, 0, 0); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; } private void CreateDevCommandButton(string text, string command) { //IL_0028: 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_003c: 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: Expected O, but got Unknown ((UnityEvent)GUIManager.Instance.CreateButton(text, _devCommandButtonArea.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), Vector2.zero, 180f, 28f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { RunConsoleCommand(command); }); } private void CreateSpawnPanel() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown _spawnPanel = GUIManager.Instance.CreateWoodpanel(_mainPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -510f), 330f, 115f, false); GUIManager.Instance.CreateText("Spawn", _spawnPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -25f), GUIManager.Instance.AveriaSerifBold, 16, GUIManager.Instance.ValheimOrange, true, Color.black, 200f, 25f, false); GameObject val = GUIManager.Instance.CreateInputField(_spawnPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(-45f, -70f), (ContentType)0, "prefabName argument1 argument2", 14, 190f, 30f); InputField inputField = val.GetComponent<InputField>(); ((UnityEvent)GUIManager.Instance.CreateButton("Spawn", _spawnPanel.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(105f, -70f), 80f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { ExecuteSpawnInput(inputField); }); } private void CreateCloseButton() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown ((UnityEvent)GUIManager.Instance.CreateButton("Close", _mainPanel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 35f), 140f, 30f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { SetPanelVisible(visible: false); Logger.LogInfo((object)"Dev panel closed via button."); }); } private void ResetDevCommandUiState() { if ((Object)(object)_enableDevCommandsButton != (Object)null) { ((Selectable)_enableDevCommandsButton).interactable = !_devCommandsEnabled; } bool devCommandsEnabled = _devCommandsEnabled; if ((Object)(object)_devCommandPanel != (Object)null) { _devCommandPanel.SetActive(devCommandsEnabled); } if ((Object)(object)_spawnPanel != (Object)null) { _spawnPanel.SetActive(devCommandsEnabled); } } private void SetPanelVisible(bool visible) { _uiVisible = visible; if ((Object)(object)_mainPanel != (Object)null) { _mainPanel.SetActive(_uiVisible); GUIManager.BlockInput(_uiVisible); } Logger.LogInfo((object)("UI Visible: " + _uiVisible)); } private static void ExecuteSpawnInput(InputField spawnInput) { if ((Object)(object)spawnInput == (Object)null) { Logger.LogWarning((object)"Spawn input field is null."); return; } string text = spawnInput.text; if (string.IsNullOrEmpty(text)) { ShowHudMessage("Enter a prefab name and optional spawn arguments."); return; } text = text.Trim(); if (string.IsNullOrEmpty(text)) { ShowHudMessage("Enter a prefab name and optional spawn arguments."); } else { RunConsoleCommand("spawn " + text); } } private static void ShowHudMessage(string message) { if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.LogWarning((object)("Player.m_localPlayer is null. Could not show HUD message: " + message)); } else { ((Character)Player.m_localPlayer).Message((MessageType)1, message, 0, (Sprite)null); } } private static void RunConsoleCommand(string command) { if ((Object)(object)Console.instance == (Object)null) { Logger.LogWarning((object)("Console.instance is null. Could not run command: " + command)); return; } ((Terminal)Console.instance).TryRunCommand(command, false, false); Logger.LogInfo((object)("Ran command: " + command)); } }