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 CustomizableToolbarForkOfAedenthorn v0.1.0
CustomizableToolbar.dll
Decompiled a year agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+84ecdf67601019596bca6ee59e7c1b3bb50936f4")] [assembly: AssemblyVersion("1.0.0.0")] namespace CustomizableToolbar; [BepInPlugin("aedenthorn.CustomizableToolbar", "Customizable Toolbar", "0.3.0")] public class BepInExPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] private static class HotkeyBar_Update_Patch { private static void Postfix(HotkeyBar __instance) { //IL_0043: 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) //IL_005d: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } int childCount = ((Component)__instance).transform.childCount; if (childCount != ((Humanoid)Player.m_localPlayer).GetInventory().GetWidth()) { return; } Vector3 mousePosition = Input.mousePosition; if (!modEnabled.Value) { lastMousePos = mousePosition; return; } float num = (float)itemSize * itemScale.Value; for (int i = 0; i < childCount; i++) { int num2 = i % itemsPerRow.Value; int num3 = i / itemsPerRow.Value; Transform child = ((Component)__instance).transform.GetChild(i); ((Component)child).GetComponent<RectTransform>().anchoredPosition = new Vector2(num * (float)num2, (0f - num) * (float)num3); ((Transform)((Component)child).GetComponent<RectTransform>()).localScale = new Vector3(itemScale.Value, itemScale.Value, 1f); } if (BepInExPlugin.toolbarX.Value == -9999f) { BepInExPlugin.toolbarX.Value = ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMin.x * (float)Screen.width; } if (BepInExPlugin.toolbarY.Value == -9999f) { BepInExPlugin.toolbarY.Value = ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMax.y * (float)Screen.height; } ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMax = new Vector2(((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMax.x, BepInExPlugin.toolbarY.Value / (float)Screen.height); ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMin = new Vector2(BepInExPlugin.toolbarX.Value / (float)Screen.width, ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMin.y); if (lastMousePos == Vector3.zero) { lastMousePos = mousePosition; } if (CheckKeyHeld(modKeyOne.Value) && CheckKeyHeld(modKeyTwo.Value)) { Rect val = default(Rect); ((Rect)(ref val))..ctor(((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMin.x * (float)Screen.width + 47f, ((Component)__instance).gameObject.GetComponent<RectTransform>().anchorMax.y * (float)Screen.height - (float)Mathf.CeilToInt(8f / (float)itemsPerRow.Value) * num * 1.5f - 44f, (float)itemsPerRow.Value * num * 1.5f, (float)Mathf.CeilToInt(8f / (float)itemsPerRow.Value) * num * 1.5f); if (((Rect)(ref val)).Contains(lastMousePos)) { ConfigEntry<float> toolbarX = BepInExPlugin.toolbarX; toolbarX.Value += mousePosition.x - lastMousePos.x; ConfigEntry<float> toolbarY = BepInExPlugin.toolbarY; toolbarY.Value += mousePosition.y - lastMousePos.y; } } lastMousePos = mousePosition; } } [HarmonyPatch(typeof(Terminal), "InputText")] private static class InputText_Patch { private static bool Prefix(Terminal __instance) { if (!modEnabled.Value) { return true; } string text = ((TMP_InputField)__instance.m_input).text; if (text.ToLower().Equals(typeof(BepInExPlugin).Namespace.ToLower() + " reset")) { ((BaseUnityPlugin)context).Config.Reload(); ((BaseUnityPlugin)context).Config.Save(); __instance.AddString(text); __instance.AddString(((BaseUnityPlugin)context).Info.Metadata.Name + " config reloaded"); return false; } return true; } } private static readonly bool isDebug = true; private static BepInExPlugin context; private Harmony harmony; public static ConfigEntry<bool> modEnabled; public static ConfigEntry<float> toolbarX; public static ConfigEntry<float> toolbarY; public static ConfigEntry<float> itemScale; public static ConfigEntry<string> modKeyOne; public static ConfigEntry<string> modKeyTwo; public static ConfigEntry<int> itemsPerRow; public static ConfigEntry<int> nexusID; public static int itemSize = 70; private static Vector3 lastMousePos; public static void Dbgl(string str = "", bool pref = true) { if (isDebug) { Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str)); } } private void Awake() { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown context = this; modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod"); itemsPerRow = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ItemsPerRow", 8, "Number of items per row in the toolbar"); toolbarX = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ToolbarX", -9999f, "Current X of toolbar"); toolbarY = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ToolbarY", -9999f, "Current Y of toolbar"); itemScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ItemScale", 1f, "Item scale"); modKeyOne = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ModKeyOne", "mouse 0", "First modifier key. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html format."); modKeyTwo = ((BaseUnityPlugin)this).Config.Bind<string>("General", "ModKeyTwo", "left ctrl", "Second modifier key. Use https://docs.unity3d.com/Manual/ConventionalGameInput.html format."); nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 569, "Nexus mod ID for updates"); itemsPerRow.Value = Mathf.Clamp(itemsPerRow.Value, 1, 8); if (modEnabled.Value) { harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); harmony.PatchAll(); } } private void OnDestroy() { if (modEnabled.Value) { Dbgl("Destroying plugin"); harmony.UnpatchAll((string)null); } } private static bool CheckKeyHeld(string value) { try { return Input.GetKey(value.ToLower()); } catch { return false; } } }