using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 const string ResetTimeOfDayToDefault = "tod -1"; } 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 ResetTimeOfDayToDefault = "Reset Time of Day"; internal const string SpawnPlaceholder = "prefabName arg1 arg2"; } } [BepInPlugin("hex.devtools", "HexDevTools", "1.2.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.2.0"; private readonly PrefabSearchService _prefabSearchService = new PrefabSearchService(); private ConfigEntry _toggleKey; private bool _uiVisible; private bool _devCommandsEnabled; private GameObject _uiRoot; private GameObject _clickOutsideBackground; private GameObject _mainPanel; private GameObject _devCommandPanel; private GameObject _devCommandButtonArea; private GameObject _spawnPanel; private Button _enableDevCommandsButton; private InputField _spawnInputField; private Text _spawnSuggestionsText; private List _spawnMatches = new List(); private int _spawnMatchIndex = -1; private bool _spawnPrefabSelected; 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) Logger.LogInfo((object)("Toggle key changed to: " + ((object)_toggleKey.Value/*cast due to .constrained prefix*/).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); return; } } if (_uiVisible && Input.GetKeyDown((KeyCode)27)) { SetPanelVisible(visible: false); } else if ((Object)(object)_spawnInputField != (Object)null && _spawnInputField.isFocused && !_spawnPrefabSelected && Input.GetKeyDown((KeyCode)9)) { bool reverse = Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307); CycleSpawnSuggestion(reverse); } } private void OnDestroy() { GUIManager.OnCustomGUIAvailable -= OnCustomGUIAvailable; GUIManager.BlockInput(false); Instance = null; } private void OnCustomGUIAvailable() { _prefabSearchService.CachePrefabNames(); CreateUiRoot(); CreateClickOutsideBackground(); CreateMainPanel(); CreateHeader(); CreateEnableDevCommandsButton(); CreateDevCommandPanel(); CreateSpawnPanel(); CreateCloseButton(); ResetDevCommandUiState(); ResetSpawnAutocomplete(); _uiVisible = false; _uiRoot.SetActive(false); } private void CreateUiRoot() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0037: 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_004d: 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) _uiRoot = new GameObject("HexDevToolsRoot"); _uiRoot.transform.SetParent(GUIManager.CustomGUIFront.transform, false); RectTransform obj = _uiRoot.AddComponent(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; } private void CreateClickOutsideBackground() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0038: 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_004e: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown _clickOutsideBackground = new GameObject("ClickOutsideBackground"); _clickOutsideBackground.transform.SetParent(_uiRoot.transform, false); RectTransform obj = _clickOutsideBackground.AddComponent(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Image obj2 = _clickOutsideBackground.AddComponent(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.001f); ((Graphic)obj2).raycastTarget = true; Button obj3 = _clickOutsideBackground.AddComponent