using 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 _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("General", "ToggleKey", new KeyboardShortcut((KeyCode)289, Array.Empty()), "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