Please disclose if your mod was created primarily 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 Aedenthorn Custom UI v0.8.1
plugins/CustomUI.dll
Decompiled 3 months 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; using UnityEngine.UI; [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+0d3a68cc3093072d4161198fe3adb85b4a5c9f87")] [assembly: AssemblyVersion("1.0.0.0")] namespace CustomUI; [BepInPlugin("aedenthorn.CustomUI", "Custom UI", "0.8.0")] public class BepInExPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] public static class HotkeyBar_UpdateIcons_Patch { public static void Postfix(HotkeyBar __instance) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (modEnabled.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && !(((Object)__instance).name != "HotKeyBar")) { int childCount = ((Component)__instance).transform.childCount; float num = __instance.m_elementSpace * toolbarItemScale.Value; for (int i = 0; i < childCount; i++) { int num2 = i % toolbarItemsPerRow.Value; int num3 = i / toolbarItemsPerRow.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(toolbarItemScale.Value, toolbarItemScale.Value, 1f); } } } } [HarmonyPatch(typeof(Hud), "Update")] public static class Hud_Update_Patch { public static void Postfix(Hud __instance) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0699: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0841: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08cc: Unknown result type (might be due to invalid IL or missing references) //IL_1052: Unknown result type (might be due to invalid IL or missing references) //IL_1053: Unknown result type (might be due to invalid IL or missing references) //IL_09ca: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e3: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a3c: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Unknown result type (might be due to invalid IL or missing references) //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0abe: Unknown result type (might be due to invalid IL or missing references) //IL_0ad7: Unknown result type (might be due to invalid IL or missing references) //IL_0adc: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Unknown result type (might be due to invalid IL or missing references) //IL_0b08: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0b32: Unknown result type (might be due to invalid IL or missing references) //IL_0b4f: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) //IL_099b: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) //IL_0b93: Unknown result type (might be due to invalid IL or missing references) //IL_0bb6: Unknown result type (might be due to invalid IL or missing references) //IL_0c75: Unknown result type (might be due to invalid IL or missing references) //IL_0c24: Unknown result type (might be due to invalid IL or missing references) //IL_0c49: Unknown result type (might be due to invalid IL or missing references) //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0cb9: Unknown result type (might be due to invalid IL or missing references) //IL_0cde: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_0e34: Unknown result type (might be due to invalid IL or missing references) //IL_0de3: Unknown result type (might be due to invalid IL or missing references) //IL_0e08: Unknown result type (might be due to invalid IL or missing references) //IL_0e78: Unknown result type (might be due to invalid IL or missing references) //IL_0e9d: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_0f23: Unknown result type (might be due to invalid IL or missing references) //IL_0f48: Unknown result type (might be due to invalid IL or missing references) //IL_0f85: Unknown result type (might be due to invalid IL or missing references) //IL_101b: Unknown result type (might be due to invalid IL or missing references) //IL_1021: Unknown result type (might be due to invalid IL or missing references) //IL_0fc9: Unknown result type (might be due to invalid IL or missing references) //IL_0fee: Unknown result type (might be due to invalid IL or missing references) if (!modEnabled.Value || (Object)(object)Player.m_localPlayer == (Object)null || InventoryGui.IsVisible()) { return; } float scaleFactor = ((Component)__instance).GetComponent<CanvasScaler>().scaleFactor; int num = healthbarRotation.Value / 90 % 4 * 90; Vector3 mousePosition = Input.mousePosition; if (!modEnabled.Value) { lastMousePos = mousePosition; return; } SetElementPositions(); if (lastMousePos == Vector3.zero) { lastMousePos = mousePosition; } Transform val = ((Component)Hud.instance).transform.Find("hudroot"); Rect zero = Rect.zero; switch (num) { case 0: ((Rect)(ref zero))..ctor(((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor - ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value); break; case 90: ((Rect)(ref zero))..ctor(((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value); break; case 180: ((Rect)(ref zero))..ctor(((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor - ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value); break; case 270: ((Rect)(ref zero))..ctor(((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor - ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor - ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * healthbarScale.Value, ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * healthbarScale.Value); break; } if (Object.op_Implicit((Object)(object)val.Find("healthpanel").Find("Health").Find("QuickSlotsHotkeyBar"))) { val.Find("healthpanel").Find("Health").Find("QuickSlotsHotkeyBar") .SetParent(val); RectTransform component = ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>(); component.anchoredPosition += new Vector2(((Rect)(ref zero)).x, ((Rect)(ref zero)).y); ((Transform)((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>()).localEulerAngles = new Vector3(0f, 0f, 0f); } if (CheckKeyHeld(modKeyOne.Value) && CheckKeyHeld(modKeyTwo.Value)) { Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMin.x * (float)Screen.width + ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor, ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMax.y * (float)Screen.height + ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor - ((Component)val.Find("HotKeyBar")).GetComponent<HotkeyBar>().m_elementSpace * scaleFactor * toolbarItemScale.Value * (float)(7 / toolbarItemsPerRow.Value + 1), ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * toolbarItemScale.Value * ((float)toolbarItemsPerRow.Value / 8f), ((Component)val.Find("HotKeyBar")).GetComponent<HotkeyBar>().m_elementSpace * scaleFactor * toolbarItemScale.Value * (float)(7 / toolbarItemsPerRow.Value + 1)); float x = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().anchoredPosition.x; Rect rect = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().rect; float num2 = (x + ((Rect)(ref rect)).x * guardianScale.Value) * scaleFactor; float y = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().anchoredPosition.y; rect = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().rect; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num2, (y + ((Rect)(ref rect)).y * guardianScale.Value) * scaleFactor, ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * guardianScale.Value, ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * guardianScale.Value); float num3 = Screen.width; float x2 = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().anchoredPosition.x; rect = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().rect; float num4 = num3 + (x2 + ((Rect)(ref rect)).x * statusScale.Value) * scaleFactor; float num5 = Screen.height; float y2 = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().anchoredPosition.y; rect = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().rect; Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(num4, num5 + (y2 + ((Rect)(ref rect)).y * statusScale.Value) * scaleFactor, ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * statusScale.Value, ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * statusScale.Value); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor((((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().anchoredPosition.x - ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().sizeDelta.x * mapScale.Value) * scaleFactor + (float)Screen.width, (((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().anchoredPosition.y - ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().sizeDelta.y * mapScale.Value) * scaleFactor + (float)Screen.height, ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * mapScale.Value, ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * mapScale.Value); Rect zero2 = Rect.zero; Transform obj = val.Find("QuickSlotsHotkeyBar"); if ((Object)(object)((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null) != (Object)null) { ((Rect)(ref zero2))..ctor(((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().anchoredPosition.x * scaleFactor, ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().anchoredPosition.y * scaleFactor + (float)Screen.height - ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * quickSlotsScale.Value, ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().sizeDelta.x * scaleFactor * quickSlotsScale.Value * 0.375f, ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().sizeDelta.y * scaleFactor * quickSlotsScale.Value); } float num6 = Screen.width; float x3 = ((Terminal)Chat.instance).m_chatWindow.anchoredPosition.x; rect = ((Terminal)Chat.instance).m_chatWindow.rect; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num6 + (x3 + ((Rect)(ref rect)).x * chatScale.Value) * scaleFactor, ((Terminal)Chat.instance).m_chatWindow.anchoredPosition.y * scaleFactor, ((Terminal)Chat.instance).m_chatWindow.sizeDelta.x * scaleFactor * chatScale.Value, ((Terminal)Chat.instance).m_chatWindow.sizeDelta.y * scaleFactor * chatScale.Value); float num7 = Screen.width / 2; float x4 = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().anchoredPosition.x; rect = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().rect; float num8 = num7 + (x4 + ((Rect)(ref rect)).x * buildingScale.Value) * scaleFactor; float num9 = Screen.height / 2; float y3 = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().anchoredPosition.y; rect = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().rect; float num10 = num9 + (y3 + ((Rect)(ref rect)).y * buildingScale.Value) * scaleFactor; rect = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().rect; float num11 = ((Rect)(ref rect)).width * scaleFactor * buildingScale.Value; rect = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().rect; Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num8, num10, num11, ((Rect)(ref rect)).height * scaleFactor * buildingScale.Value); if (((Rect)(ref val2)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "HotKeyBar")) { ConfigEntry<float> toolbarX = BepInExPlugin.toolbarX; toolbarX.Value += mousePosition.x - lastMousePos.x; ConfigEntry<float> toolbarY = BepInExPlugin.toolbarY; toolbarY.Value += mousePosition.y - lastMousePos.y; currentlyDragging = "HotKeyBar"; } else if (((Rect)(ref zero)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "healthpanel")) { ConfigEntry<float> healthbarX = BepInExPlugin.healthbarX; healthbarX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> healthbarY = BepInExPlugin.healthbarY; healthbarY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "healthpanel"; } else if (((Rect)(ref val3)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "GuardianPower")) { ConfigEntry<float> guardianX = BepInExPlugin.guardianX; guardianX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> guardianY = BepInExPlugin.guardianY; guardianY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "GuardianPower"; } else if (((Rect)(ref val5)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "MiniMap")) { ConfigEntry<float> mapX = BepInExPlugin.mapX; mapX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> mapY = BepInExPlugin.mapY; mapY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "MiniMap"; } else if (((Rect)(ref val4)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "StatusEffects")) { ConfigEntry<float> statusX = BepInExPlugin.statusX; statusX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> statusY = BepInExPlugin.statusY; statusY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "StatusEffects"; } else if (((Rect)(ref zero2)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "QuickSlots")) { ConfigEntry<float> quickSlotsX = BepInExPlugin.quickSlotsX; quickSlotsX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> quickSlotsY = BepInExPlugin.quickSlotsY; quickSlotsY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "QuickSlots"; } else if (((Component)((Terminal)Chat.instance).m_chatWindow).gameObject.activeInHierarchy && ((Rect)(ref val6)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "Chat")) { ConfigEntry<float> chatX = BepInExPlugin.chatX; chatX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> chatY = BepInExPlugin.chatY; chatY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "Chat"; } else if (Hud.instance.m_pieceSelectionWindow.activeSelf && ((Rect)(ref val7)).Contains(lastMousePos) && (currentlyDragging == "" || currentlyDragging == "Building")) { ConfigEntry<float> buildingX = BepInExPlugin.buildingX; buildingX.Value += (mousePosition.x - lastMousePos.x) / scaleFactor; ConfigEntry<float> buildingY = BepInExPlugin.buildingY; buildingY.Value += (mousePosition.y - lastMousePos.y) / scaleFactor; currentlyDragging = "Building"; } else { Dbgl($"mouse {mousePosition} build rect {val7} game scale {scaleFactor}"); currentlyDragging = ""; } } else { currentlyDragging = ""; } lastMousePos = mousePosition; } } [HarmonyPatch(typeof(Terminal), "InputText")] public static class InputText_Patch { public 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; } } public static readonly bool isDebug = true; public static BepInExPlugin context; public Harmony harmony; public static ConfigEntry<bool> modEnabled; public static ConfigEntry<float> toolbarX; public static ConfigEntry<float> toolbarY; public static ConfigEntry<float> toolbarItemScale; public static ConfigEntry<int> toolbarItemsPerRow; public static ConfigEntry<int> healthbarRotation; public static ConfigEntry<float> healthbarX; public static ConfigEntry<float> healthbarY; public static ConfigEntry<float> healthbarScale; public static ConfigEntry<float> guardianX; public static ConfigEntry<float> guardianY; public static ConfigEntry<float> guardianScale; public static ConfigEntry<float> mapX; public static ConfigEntry<float> mapY; public static ConfigEntry<float> mapScale; public static ConfigEntry<float> statusX; public static ConfigEntry<float> statusY; public static ConfigEntry<float> statusScale; public static ConfigEntry<float> quickSlotsX; public static ConfigEntry<float> quickSlotsY; public static ConfigEntry<float> quickSlotsScale; public static ConfigEntry<float> buildingX; public static ConfigEntry<float> buildingY; public static ConfigEntry<float> buildingScale; public static ConfigEntry<float> chatX; public static ConfigEntry<float> chatY; public static ConfigEntry<float> chatScale; public static ConfigEntry<string> modKeyOne; public static ConfigEntry<string> modKeyTwo; public static ConfigEntry<int> nexusID; public static int itemSize = 48; public static Vector3 lastMousePos; public static string currentlyDragging; public static void Dbgl(string str = "", bool pref = true) { if (isDebug) { Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str)); } } public void Awake() { //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Expected O, but got Unknown context = this; nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 625, "Nexus mod ID for updates"); modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod"); 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."); toolbarItemsPerRow = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ToolbarItemsPerRow", 8, "Number of items per row in the toolbar"); toolbarItemsPerRow = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ToolbarItemsPerRow", 8, "Number of items per row in the toolbar"); healthbarRotation = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HealthbarRotation", 0, "Rotation of healthbar. Must be a multiple of 90."); toolbarItemScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "ToolbarItemScale", 1f, "Toolbar item scale"); healthbarScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "HealthbarScale", 1f, "Healthbar scale"); guardianScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "GuardianScale", 1f, "Guardian power scale"); mapScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "MapScale", 1f, "map scale"); statusScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "StatusScale", 1f, "status scale"); quickSlotsScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "QuickSlotsScale", 1f, "Quick slots scale"); buildingScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "BuildingScale", 1f, "Building scale"); chatScale = ((BaseUnityPlugin)this).Config.Bind<float>("Scale", "ChatScale", 1f, "Chat scale"); toolbarX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "ToolbarX", 9999f, "Current X of toolbar"); toolbarY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "ToolbarY", 9999f, "Current Y of toolbar"); healthbarX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "HealthbarX", 9999f, "Current X of healthbar"); healthbarY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "HealthbarY", 9999f, "Current Y of healthbar"); guardianX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "GuardianX", 9999f, "Current X of guardian power"); guardianY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "GuardianY", 9999f, "Current Y of guardian power"); mapX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "MapX", 9999f, "Current X of map"); mapY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "MapY", 9999f, "Current Y of map"); quickSlotsX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "QuickSlotsX", 9999f, "Current X of Quick Slots"); quickSlotsY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "QuickSlotsY", 9999f, "Current Y of Quick Slots"); statusX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "StatusX", 9999f, "Current X of status"); statusY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "StatusY", 9999f, "Current Y of status"); chatX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "ChatX", 9999f, "Current X of chat"); chatY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "ChatY", 9999f, "Current Y of chat"); buildingX = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "BuildingX", 9999f, "Current X of building"); buildingY = ((BaseUnityPlugin)this).Config.Bind<float>("ZCurrentPositions", "BuildingY", 9999f, "Current Y of building"); toolbarItemsPerRow.Value = Mathf.Clamp(toolbarItemsPerRow.Value, 1, 8); harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); harmony.PatchAll(); } public void OnDestroy() { Dbgl("Destroying plugin"); harmony.UnpatchAll((string)null); } public static bool CheckKeyHeld(string value) { try { return Input.GetKey(value.ToLower()); } catch { return false; } } public static void SetElementPositions() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_01c7: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)Hud.instance).transform.Find("hudroot"); int num = healthbarRotation.Value / 90 % 4 * 90; if (toolbarX.Value == 9999f) { toolbarX.Value = ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMin.x * (float)Screen.width; } if (toolbarY.Value == 9999f) { toolbarY.Value = ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMax.y * (float)Screen.height; } if (healthbarX.Value == 9999f) { healthbarX.Value = ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.x; } if (healthbarY.Value == 9999f) { healthbarY.Value = ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition.y; } if (guardianX.Value == 9999f) { guardianX.Value = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().anchoredPosition.x; } if (guardianY.Value == 9999f) { guardianY.Value = ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().anchoredPosition.y; } if (statusX.Value == 9999f) { statusX.Value = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().anchoredPosition.x; } if (statusY.Value == 9999f) { statusY.Value = ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().anchoredPosition.y; } if (mapX.Value == 9999f) { mapX.Value = ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().anchoredPosition.x; } if (mapY.Value == 9999f) { mapY.Value = ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().anchoredPosition.y; } if (chatX.Value == 9999f) { chatX.Value = ((Terminal)Chat.instance).m_chatWindow.anchoredPosition.x; } if (chatY.Value == 9999f) { chatY.Value = ((Terminal)Chat.instance).m_chatWindow.anchoredPosition.y; } if (buildingX.Value == 9999f) { buildingX.Value = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().anchoredPosition.x; } if (buildingY.Value == 9999f) { buildingY.Value = Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().anchoredPosition.y; } ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMax = new Vector2(((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMax.x, toolbarY.Value / (float)Screen.height); ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMin = new Vector2(toolbarX.Value / (float)Screen.width, ((Component)val.Find("HotKeyBar")).GetComponent<RectTransform>().anchorMin.y); ((Component)val.Find("healthpanel")).GetComponent<RectTransform>().anchoredPosition = new Vector2(healthbarX.Value, healthbarY.Value); ((Transform)((Component)val.Find("healthpanel")).GetComponent<RectTransform>()).localEulerAngles = new Vector3(0f, 0f, (float)num); ((Transform)((Component)val.Find("healthpanel").Find("Health").Find("fast") .Find("bar") .Find("HealthText")).GetComponent<RectTransform>()).eulerAngles = Vector3.zero; ((Transform)((Component)val.Find("healthpanel").Find("food0")).GetComponent<RectTransform>()).eulerAngles = Vector3.zero; ((Transform)((Component)val.Find("healthpanel").Find("food1")).GetComponent<RectTransform>()).eulerAngles = Vector3.zero; ((Transform)((Component)val.Find("healthpanel").Find("food2")).GetComponent<RectTransform>()).eulerAngles = Vector3.zero; ((Component)val.Find("GuardianPower")).GetComponent<RectTransform>().anchoredPosition = new Vector2(guardianX.Value, guardianY.Value); ((Component)val.Find("StatusEffects")).GetComponent<RectTransform>().anchoredPosition = new Vector2(statusX.Value, statusY.Value); ((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>().anchoredPosition = new Vector2(mapX.Value, mapY.Value); ((Transform)((Component)val.Find("healthpanel")).GetComponent<RectTransform>()).localScale = new Vector3(healthbarScale.Value, healthbarScale.Value, 1f); ((Transform)((Component)val.Find("GuardianPower")).GetComponent<RectTransform>()).localScale = new Vector3(guardianScale.Value, guardianScale.Value, 1f); ((Transform)((Component)val.Find("StatusEffects")).GetComponent<RectTransform>()).localScale = new Vector3(statusScale.Value, statusScale.Value, 1f); ((Transform)((Component)val.Find("MiniMap").Find("small")).GetComponent<RectTransform>()).localScale = new Vector3(mapScale.Value, mapScale.Value, 1f); ((Terminal)Chat.instance).m_chatWindow.anchoredPosition = new Vector2(chatX.Value, chatY.Value); ((Transform)((Terminal)Chat.instance).m_chatWindow).localScale = new Vector3(chatScale.Value, chatScale.Value, 1f); Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>().anchoredPosition = new Vector2(buildingX.Value, buildingY.Value); ((Transform)Hud.instance.m_pieceSelectionWindow.GetComponent<RectTransform>()).localScale = new Vector3(buildingScale.Value, buildingScale.Value, 1f); Transform obj = val.Find("QuickSlotsHotkeyBar"); if ((Object)(object)((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null) != (Object)null) { if (quickSlotsX.Value == 9999f) { quickSlotsX.Value = ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().anchoredPosition.x; } if (quickSlotsY.Value == 9999f) { quickSlotsY.Value = ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().anchoredPosition.y; } ((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>().anchoredPosition = new Vector2(quickSlotsX.Value, quickSlotsY.Value); ((Transform)((Component)val.Find("QuickSlotsHotkeyBar")).GetComponent<RectTransform>()).localScale = new Vector3(quickSlotsScale.Value, quickSlotsScale.Value, 1f); } } }