Decompiled source of MyLittleUI v1.2.3
MyLittleUI.dll
Decompiled 2 weeks ago
            The result has been truncated due to the large size, download it to view full contents!
        
        
        using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using AzuExtendedPlayerInventory; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ExtraSlotsAPI; using GUIFramework; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; 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: AssemblyTitle("My Little UI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("My Little UI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("345181bf-e9ed-4c88-a4f4-38450f53cc41")] [assembly: AssemblyFileVersion("1.2.3")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.3.0")] [module: UnverifiableCode] namespace MyLittleUI { internal class AmmoCountIcon { public class ElementExtraData { public TMP_Text m_ammo; public Image m_icon; public Image m_bait; public Image m_mead; public ItemData m_item; public void UpdateState(ElementData elementData) { if (m_item == null) { TMP_Text ammo = m_ammo; if (ammo != null) { ((Component)ammo).gameObject.SetActive(false); } Image icon = m_icon; if (icon != null) { ((Component)icon).gameObject.SetActive(false); } Image bait = m_bait; if (bait != null) { ((Component)bait).gameObject.SetActive(false); } Image mead = m_mead; if (mead != null) { ((Component)mead).gameObject.SetActive(false); } return; } ItemData currentAmmo = GetCurrentAmmo(); int num = ((currentAmmo != null) ? ((Humanoid)Player.m_localPlayer).GetInventory().CountItems(currentAmmo.m_shared.m_name, -1, true) : 0); TMP_Text ammo2 = m_ammo; if (ammo2 != null) { ((Component)ammo2).gameObject.SetActive(MyLittleUI.ammoCountEnabled.Value && num > 0); } if (num > 0) { TMP_Text ammo3 = m_ammo; if (ammo3 != null) { ammo3.SetText(num.ToString()); } } Sprite val = ((currentAmmo != null) ? currentAmmo.GetIcon() : null); Image icon2 = m_icon; if (icon2 != null) { ((Component)icon2).gameObject.SetActive(MyLittleUI.ammoIconEnabled.Value && (Object)(object)val != (Object)null); } if ((Object)(object)val != (Object)null && (Object)(object)m_icon != (Object)null) { m_icon.overrideSprite = val; } ItemData currentBait = GetCurrentBait(); Sprite val2 = ((currentBait != null) ? currentBait.GetIcon() : null); Image bait2 = m_bait; if (bait2 != null) { ((Component)bait2).gameObject.SetActive(MyLittleUI.baitIconEnabled.Value && (Object)(object)val2 != (Object)null); } if ((Object)(object)val2 != (Object)null && (Object)(object)m_bait != (Object)null) { m_bait.overrideSprite = val2; } int num2 = ((currentBait != null) ? ((Humanoid)Player.m_localPlayer).GetInventory().CountItems(currentBait.m_shared.m_name, -1, true) : 0); if (num2 > 0 && MyLittleUI.baitCountEnabled.Value && !((Component)elementData.m_amount).gameObject.activeSelf) { ((Component)elementData.m_amount).gameObject.SetActive(true); elementData.m_amount.SetText(num2.ToString()); } ItemData currentMead = GetCurrentMead(); Sprite val3 = ((currentMead != null) ? currentMead.GetIcon() : null); Image mead2 = m_mead; if (mead2 != null) { ((Component)mead2).gameObject.SetActive(MyLittleUI.meadIconEnabled.Value && (Object)(object)val3 != (Object)null); } if ((Object)(object)val3 != (Object)null && (Object)(object)m_mead != (Object)null) { m_mead.overrideSprite = val3; } } private ItemData GetCurrentAmmo() { if (m_item == null || Utility.IsNullOrWhiteSpace(m_item.m_shared.m_ammoType) || IsBaitAmmo() || IsAmmo() || IsMeadAmmo()) { return null; } ItemData ammoItem = ((Humanoid)Player.m_localPlayer).GetAmmoItem(); if (ammoItem == null || ammoItem.m_shared.m_ammoType != m_item.m_shared.m_ammoType || !((Humanoid)Player.m_localPlayer).GetInventory().ContainsItem(ammoItem)) { ammoItem = ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(m_item.m_shared.m_ammoType, (string)null); } return ammoItem; } private ItemData GetCurrentBait() { if (m_item == null || Utility.IsNullOrWhiteSpace(m_item.m_shared.m_ammoType) || !IsBaitAmmo() || IsAmmo()) { return null; } ItemData ammoItem = ((Humanoid)Player.m_localPlayer).GetAmmoItem(); if (ammoItem == null || ammoItem.m_shared.m_ammoType != m_item.m_shared.m_ammoType || !((Humanoid)Player.m_localPlayer).GetInventory().ContainsItem(ammoItem)) { ammoItem = ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(m_item.m_shared.m_ammoType, (string)null); } return ammoItem; } private ItemData GetCurrentMead() { if (m_item == null || Utility.IsNullOrWhiteSpace(m_item.m_shared.m_ammoType) || IsBaitAmmo() || IsAmmo() || !IsMeadAmmo()) { return null; } return ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(m_item.m_shared.m_ammoType, (string)null); } private bool IsAmmo() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 return (int)m_item.m_shared.m_itemType == 9 || (int)m_item.m_shared.m_itemType == 23 || (int)m_item.m_shared.m_itemType == 2; } private bool IsBaitAmmo() { return m_item.m_shared.m_ammoType == "$item_fishingbait"; } private bool IsMeadAmmo() { return m_item.m_shared.m_ammoType == "mead"; } } [HarmonyPatch(typeof(HotkeyBar), "OnEnable")] public static class HotkeyBar_OnEnable_AddCustomElementsToHotkeyPrefab { private static void FillFields(RectTransform rtSource, RectTransform rtDestination) { //IL_0003: 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) rtDestination.anchoredPosition = rtSource.anchoredPosition; rtDestination.sizeDelta = rtSource.sizeDelta; } public static void Postfix(HotkeyBar __instance) { if (!((Object)(object)__instance.m_elementPrefab == (Object)null)) { isDirty[__instance] = false; elementPrefab = __instance.m_elementPrefab; int num = __instance.m_elementPrefab.transform.Find("icon").GetSiblingIndex() + 1; Transform obj = __instance.m_elementPrefab.transform.Find("MLUI_AmmoAmount"); ammoCount = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)ammoCount == (Object)null) { GameObject gameObject = ((Component)__instance.m_elementPrefab.transform.Find("amount")).gameObject; ammoCount = Object.Instantiate<GameObject>(gameObject); ((Object)ammoCount).name = "MLUI_AmmoAmount"; ammoCount.transform.SetParent(__instance.m_elementPrefab.transform); ammoCount.transform.SetSiblingIndex(num); num++; ammoCount.SetActive(false); FillFields(gameObject.GetComponent<RectTransform>(), ammoCount.GetComponent<RectTransform>()); } Transform obj2 = __instance.m_elementPrefab.transform.Find("MLUI_AmmoIcon"); ammoIcon = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)ammoIcon == (Object)null) { GameObject gameObject2 = ((Component)__instance.m_elementPrefab.transform.Find("icon")).gameObject; ammoIcon = Object.Instantiate<GameObject>(gameObject2); ((Object)ammoIcon).name = "MLUI_AmmoIcon"; ammoIcon.transform.SetParent(__instance.m_elementPrefab.transform); ammoIcon.transform.SetSiblingIndex(num); num++; ammoIcon.SetActive(false); FillFields(gameObject2.GetComponent<RectTransform>(), ammoIcon.GetComponent<RectTransform>()); } Transform obj3 = __instance.m_elementPrefab.transform.Find("MLUI_AmmoBait"); ammoBait = ((obj3 != null) ? ((Component)obj3).gameObject : null); if ((Object)(object)ammoBait == (Object)null) { GameObject gameObject3 = ((Component)__instance.m_elementPrefab.transform.Find("icon")).gameObject; ammoBait = Object.Instantiate<GameObject>(gameObject3); ((Object)ammoBait).name = "MLUI_AmmoBait"; ammoBait.transform.SetParent(__instance.m_elementPrefab.transform); ammoBait.transform.SetSiblingIndex(num); num++; ammoBait.SetActive(false); FillFields(gameObject3.GetComponent<RectTransform>(), ammoBait.GetComponent<RectTransform>()); } Transform obj4 = __instance.m_elementPrefab.transform.Find("MLUI_AmmoMead"); ammoMead = ((obj4 != null) ? ((Component)obj4).gameObject : null); if ((Object)(object)ammoMead == (Object)null) { GameObject gameObject4 = ((Component)__instance.m_elementPrefab.transform.Find("icon")).gameObject; ammoMead = Object.Instantiate<GameObject>(gameObject4); ((Object)ammoMead).name = "MLUI_AmmoMead"; ammoMead.transform.SetParent(__instance.m_elementPrefab.transform); ammoMead.transform.SetSiblingIndex(num); num++; ammoMead.SetActive(false); FillFields(gameObject4.GetComponent<RectTransform>(), ammoMead.GetComponent<RectTransform>()); } UpdateVisibility(); } } } [HarmonyPatch(typeof(HotkeyBar), "Update")] public static class HotkeyBar_Update_UpdateAmmoIconCountDirtyState { [HarmonyPriority(0)] [HarmonyBefore(new string[] { "Azumatt.AzuExtendedPlayerInventory", "shudnal.ExtraSlots" })] public static void Prefix(HotkeyBar __instance) { if (MyLittleUI.modEnabled.Value && GeneralExtensions.GetValueSafe<HotkeyBar, bool>(isDirty, __instance)) { isDirty[__instance] = false; if (__instance.m_elements.Count > 0) { __instance.m_items.Clear(); __instance.UpdateIcons((Player)null); } } } } [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] public static class HotkeyBar_UpdateIcons_UpdateAmmoCountAndIcon { [HarmonyPriority(0)] [HarmonyAfter(new string[] { "Azumatt.AzuExtendedPlayerInventory", "shudnal.ExtraSlots" })] public static void Postfix(HotkeyBar __instance, Player player) { if (!MyLittleUI.modEnabled.Value) { return; } if (!elementExtraDatas.ContainsKey(__instance)) { elementExtraDatas.Add(__instance, new Dictionary<ElementData, ElementExtraData>()); } Dictionary<ElementData, ElementExtraData> dictionary = elementExtraDatas[__instance]; if (!Object.op_Implicit((Object)(object)player) || ((Character)player).IsDead()) { dictionary.Clear(); return; } if (dictionary.Count != __instance.m_elements.Count) { dictionary.Clear(); } if (dictionary.Count > 0 && __instance.m_elements.Count > 0 && !dictionary.ContainsKey(__instance.m_elements[0])) { dictionary.Clear(); } if (dictionary.Count == 0) { for (int i = 0; i < __instance.m_elements.Count; i++) { ElementData val = __instance.m_elements[i]; ElementExtraData value = new ElementExtraData { m_ammo = ((Component)val.m_go.transform.Find("MLUI_AmmoAmount")).GetComponent<TMP_Text>(), m_icon = ((Component)val.m_go.transform.Find("MLUI_AmmoIcon")).GetComponent<Image>(), m_bait = ((Component)val.m_go.transform.Find("MLUI_AmmoBait")).GetComponent<Image>(), m_mead = ((Component)val.m_go.transform.Find("MLUI_AmmoMead")).GetComponent<Image>() }; dictionary.Add(val, value); } } int num = 0; for (int j = 0; j < __instance.m_elements.Count; j++) { ElementData val2 = __instance.m_elements[j]; ElementExtraData elementExtraData = dictionary[val2]; if (elementExtraData == null) { continue; } if (!val2.m_used || num > __instance.m_items.Count) { elementExtraData.m_item = null; } else { elementExtraData.m_item = __instance.m_items[num]; if ((Object)(object)elementExtraData.m_item.GetIcon() != (Object)(object)val2.m_icon.sprite) { elementExtraData.m_item = null; } num++; } elementExtraData.UpdateState(val2); } } } internal const string objectAmmoName = "MLUI_AmmoAmount"; internal const string objectIconName = "MLUI_AmmoIcon"; internal const string objectBaitName = "MLUI_AmmoBait"; internal const string objectMeadName = "MLUI_AmmoMead"; internal static GameObject elementPrefab; internal static GameObject ammoCount; internal static GameObject ammoIcon; internal static GameObject ammoBait; internal static GameObject ammoMead; internal static readonly Dictionary<HotkeyBar, bool> isDirty = new Dictionary<HotkeyBar, bool>(); internal static readonly Dictionary<HotkeyBar, Dictionary<ElementData, ElementExtraData>> elementExtraDatas = new Dictionary<HotkeyBar, Dictionary<ElementData, ElementExtraData>>(); public static void UpdateVisibility() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) RectTransform component = ammoCount.GetComponent<RectTransform>(); component.anchoredPosition = MyLittleUI.ammoCountPosition.Value; TMP_Text component2 = ammoCount.GetComponent<TMP_Text>(); component2.fontSize = MyLittleUI.ammoCountFontSize.Value; ((Graphic)component2).color = ((MyLittleUI.ammoCountColor.Value == Color.clear) ? ((Graphic)((Component)elementPrefab.transform.Find("amount")).GetComponent<TMP_Text>()).color : MyLittleUI.ammoCountColor.Value); component2.horizontalAlignment = MyLittleUI.ammoCountAlignment.Value; RectTransform component3 = ammoIcon.GetComponent<RectTransform>(); component3.anchoredPosition = MyLittleUI.ammoIconPosition.Value; component3.sizeDelta = MyLittleUI.ammoIconSize.Value; RectTransform component4 = ammoBait.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0.5f, 0f); component4.anchorMax = new Vector2(1f, 0.5f); RectTransform component5 = ammoMead.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.6f, 0.6f); component5.anchorMax = new Vector2(1f, 1f); foreach (HotkeyBar item in isDirty.Keys.ToList()) { isDirty[item] = true; } } } internal class ChestItem { public int m_stack; public int m_value; public string m_name; public float m_weight; public ItemType m_itemType; public ChestItem(ItemData itemData) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) m_name = itemData.m_shared.m_name; m_itemType = itemData.m_shared.m_itemType; } } internal static class ChestHoverText { [HarmonyPatch(typeof(Container), "OnContainerChanged")] private static class Container_OnContainerChanged_HoverCacheReset { private static void Postfix(Container __instance) { if (MyLittleUI.modEnabled.Value) { ResetCache(__instance); } } } [HarmonyPatch(typeof(Container), "GetHoverText")] private static class Container_GetHoverText_Duration { private static readonly StringBuilder result = new StringBuilder(); private static void ReorderItemList(ref List<ChestItem> itemsInChest) { if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Position) { return; } if (MyLittleUI.chestContentSortDir.Value == MyLittleUI.ContentSortDir.Desc) { if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Name) { itemsInChest = itemsInChest.OrderByDescending((ChestItem item) => item.m_name).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Weight) { itemsInChest = itemsInChest.OrderByDescending((ChestItem item) => item.m_weight).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Amount) { itemsInChest = itemsInChest.OrderByDescending((ChestItem item) => item.m_stack).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Value) { itemsInChest = itemsInChest.OrderByDescending((ChestItem item) => item.m_value).ToList(); } } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Name) { itemsInChest = itemsInChest.OrderBy((ChestItem item) => item.m_name).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Weight) { itemsInChest = itemsInChest.OrderBy((ChestItem item) => item.m_weight).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Amount) { itemsInChest = itemsInChest.OrderBy((ChestItem item) => item.m_stack).ToList(); } else if (MyLittleUI.chestContentSortType.Value == MyLittleUI.ContentSortType.Value) { itemsInChest = itemsInChest.OrderBy((ChestItem item) => item.m_value).ToList(); } } private static void AddChestContent(Container container) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected I4, but got Unknown if (container.GetInventory().NrOfItems() == 0) { return; } result.Append("\n"); List<ChestItem> itemsInChest = new List<ChestItem>(); foreach (ItemData itemData in container.GetInventory().GetAllItemsInGridOrder()) { ChestItem chestItem = itemsInChest.Find((ChestItem item) => item.m_name == itemData.m_shared.m_name); if (chestItem == null) { chestItem = new ChestItem(itemData); itemsInChest.Add(chestItem); } chestItem.m_stack += itemData.m_stack; chestItem.m_value += itemData.GetValue(); chestItem.m_weight += itemData.GetWeight(-1); } ReorderItemList(ref itemsInChest); string itemFormat = "<color=#" + ColorUtility.ToHtmlStringRGBA(MyLittleUI.chestContentItemColor.Value) + ">{0}</color>"; string amountFormat = "<color=#" + ColorUtility.ToHtmlStringRGBA(MyLittleUI.chestContentAmountColor.Value) + ">{0}</color>"; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; for (int i = 0; i < itemsInChest.Count; i++) { ChestItem chestItem2 = itemsInChest[i]; if (i < MyLittleUI.chestContentLinesToShow.Value) { AddItemLine(chestItem2.m_name, chestItem2.m_stack); continue; } ItemType itemType = chestItem2.m_itemType; ItemType val = itemType; switch (val - 1) { case 1: num3++; break; case 0: num5++; break; case 2: case 3: case 4: case 13: case 14: case 18: case 19: case 21: num4++; break; case 5: case 6: case 9: case 10: case 11: case 16: case 17: num2++; break; default: num++; break; } } if (num + num2 + num3 + num4 + num5 != 0) { result.Append("\n+"); if (num4 != 0) { AddItemLine("$radial_handitems", num4); } if (num2 != 0) { AddItemLine("$radial_armor_utility", num2); } if (num3 != 0) { AddItemLine("$radial_consumables", num3); } if (num5 != 0) { AddItemLine("$hud_crafting", num5); } if (num != 0) { AddItemLine("$hud_misc", num); } } void AddItemLine(string itemName, int amount) { result.AppendFormat("\n" + MyLittleUI.chestContentEntryFormat.Value, string.Format(itemFormat, itemName), string.Format(amountFormat, amount)); } } private static void Postfix(Container __instance, ref string __result, bool ___m_checkGuardStone, string ___m_name, Inventory ___m_inventory) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (!MyLittleUI.modEnabled.Value || (MyLittleUI.chestHoverName.Value == MyLittleUI.ChestNameHover.Vanilla && MyLittleUI.chestHoverItems.Value == MyLittleUI.ChestItemsHover.Vanilla) || (Object)(object)__instance.m_nview == (Object)null || !__instance.m_nview.IsValid() || (___m_checkGuardStone && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false))) { return; } string key = ((object)__instance.m_nview.GetZDO()).ToString(); if (hoverTextCache.TryGetValue(key, out var value)) { __result = value; return; } result.Clear(); string @string = __instance.m_nview.GetZDO().GetString(ZDOVars.s_text, ""); if (MyLittleUI.chestHoverName.Value == MyLittleUI.ChestNameHover.Vanilla || !MyLittleUI.chestCustomName.Value || Utility.IsNullOrWhiteSpace(@string)) { result.Append(___m_name); } else if (MyLittleUI.chestHoverName.Value == MyLittleUI.ChestNameHover.CustomName) { result.Append(@string); } else if (MyLittleUI.chestHoverName.Value == MyLittleUI.ChestNameHover.TypeThenCustomName) { result.Append(___m_name); result.Append(" ("); result.Append(@string); result.Append(")"); } else if (MyLittleUI.chestHoverName.Value == MyLittleUI.ChestNameHover.CustomNameThenType) { result.Append(@string); result.Append(" ("); result.Append(___m_name); result.Append(")"); } if (__instance.CheckAccess(Game.instance.GetPlayerProfile().GetPlayerID())) { result.Append(" "); if (MyLittleUI.chestHoverItems.Value == MyLittleUI.ChestItemsHover.Percentage) { result.Append($"{___m_inventory.SlotsUsedPercentage():F0}%"); } else if (MyLittleUI.chestHoverItems.Value == MyLittleUI.ChestItemsHover.FreeSlots) { result.Append($"{___m_inventory.GetEmptySlots()}"); } else if (MyLittleUI.chestHoverItems.Value == MyLittleUI.ChestItemsHover.ItemsMaxRoom) { result.Append($"{___m_inventory.NrOfItems()}/{___m_inventory.GetWidth() * ___m_inventory.GetHeight()}"); } else if (___m_inventory.NrOfItems() == 0) { result.Append("( $piece_container_empty )"); } result.Append("\n[<color=#ffff00ff><b>$KEY_Use</b></color>] $piece_container_open"); if (MyLittleUI.chestShowHoldToStack.Value) { result.Append(" $msg_stackall_hover"); } if (MyLittleUI.chestShowRename.Value) { if (!ZInput.IsNonClassicFunctionality() || !ZInput.IsGamepadActive()) { result.Append("\n[<color=#ffff00ff><b>$KEY_AltPlace + $KEY_Use</b></color>] $hud_rename"); } else { result.Append("\n[<color=#ffff00ff><b>$KEY_JoyAltKeys + $KEY_Use</b></color>] $hud_rename"); } } if (MyLittleUI.chestContentEnabled.Value) { AddChestContent(__instance); } } __result = Localization.instance.Localize(result.ToString()); hoverTextCache.Add(key, __result); } } [HarmonyPatch(typeof(Container), "Interact")] private class Container_Interact_ChestRename { private static bool Prefix(Container __instance, Humanoid character, bool hold, bool alt, bool ___m_checkGuardStone) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!MyLittleUI.modEnabled.Value) { return true; } if (!MyLittleUI.chestCustomName.Value) { return true; } if (!alt) { return true; } if (hold) { return true; } if (___m_checkGuardStone && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, true, false)) { ((Character)character).Message((MessageType)2, "$piece_noaccess", 0, (Sprite)null); return true; } long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); if (!__instance.CheckAccess(playerID)) { ((Character)character).Message((MessageType)2, "$piece_noaccess", 0, (Sprite)null); return true; } textInputForContainer = __instance; TextInput.instance.Show("$hud_rename " + __instance.m_name, __instance.m_nview.GetZDO().GetString(ZDOVars.s_text, ""), 32); return false; } } [HarmonyPatch(typeof(TextInput), "setText")] private class TextInput_setText_ChestRename { private static void Postfix(string text) { if (MyLittleUI.modEnabled.Value && !((Object)(object)textInputForContainer == (Object)null)) { textInputForContainer.m_nview.GetZDO().Set(ZDOVars.s_text, text); textInputForContainer.OnContainerChanged(); textInputForContainer = null; } } } [HarmonyPatch(typeof(TextInput), "Hide")] private class TextInput_Hide_ChestRename { private static void Postfix() { if (MyLittleUI.modEnabled.Value && !((Object)(object)textInputForContainer == (Object)null)) { textInputForContainer = null; } } } private static Container textInputForContainer; private static readonly Dictionary<string, string> hoverTextCache = new Dictionary<string, string>(); internal static void ResetCache(Container container) { if (!((Object)(object)container == (Object)null) && !((Object)(object)container.m_nview == (Object)null) && container.m_nview.IsValid()) { hoverTextCache.Remove(((object)container.m_nview.GetZDO()).ToString()); } } internal static void ResetHoverCache() { hoverTextCache.Clear(); } } public static class CookingStationRemoveItem { [HarmonyPatch(typeof(CookingStation), "RPC_AddItem")] public static class CookingStation_RPC_AddItem_SetItemAuthor { public static long author; public static void Prefix(long sender) { author = sender; } public static void Postfix() { author = 0L; } } [HarmonyPatch(typeof(CookingStation), "SetSlot")] public static class CookingStation_SetSlot_RemoveLastItem { public static void Postfix(CookingStation __instance, int slot) { if (__instance.m_nview.IsValid() && CookingStation_RPC_AddItem_SetItemAuthor.author != 0) { __instance.m_nview.GetZDO().Set(ZDOSlotAuthor(slot), CookingStation_RPC_AddItem_SetItemAuthor.author); } } } [HarmonyPatch(typeof(CookingStation), "Interact")] public static class CookingStation_Interact_RemoveLastItem { public static bool Prefix(CookingStation __instance, Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)__instance.m_addFoodSwitch != (Object)null || !alt) { return true; } RemoveLastItemFromStation(__instance, user); return false; } } [HarmonyPatch(typeof(Switch), "Interact")] public static class Switch_Interact_RemoveLastItem { public static bool Prefix(Switch __instance, Humanoid character, bool hold, bool alt) { if (hold || !alt || !MyLittleUI.hoverCookingRemoveLastItem.Value) { return true; } if (__instance.m_onUse != null) { CookingStation componentInParent = ((Component)__instance).GetComponentInParent<CookingStation>(); if (componentInParent != null && (Object)(object)componentInParent.m_addFoodSwitch == (Object)(object)__instance) { RemoveLastItemFromStation(componentInParent, character); return false; } } return true; } } [HarmonyPatch(typeof(ZoneSystem), "Start")] public static class ZoneSystem_Start_Taxi { private static void Postfix() { ZRoutedRpc.instance.Register<ZDOID, Vector3>("RPC_MLUI_RemoveLastUncookedItem", (Action<long, ZDOID, Vector3>)RPC_MLUI_RemoveLastUncookedItem); ZRoutedRpc.instance.Register("RPC_MLUI_UndoCookingSkillRaise", (Action<long>)RPC_MLUI_UndoCookingSkillRaise); } } private static string ZDOSlotAuthor(int slot) { return "slotauthor" + slot; } private static long GetCurrentAuthor(CookingStation __instance, int slot) { return __instance.m_nview.GetZDO().GetLong(ZDOSlotAuthor(slot), 0L); } public static int GetSlotToRemove(CookingStation station, out string itemName, out long author) { float num2 = default(float); Status val = default(Status); for (int num = station.m_slots.Length - 1; num >= 0; num--) { station.GetSlot(num, ref itemName, ref num2, ref val); if (!(itemName == "") && !station.IsItemDone(itemName)) { author = GetCurrentAuthor(station, num); return num; } } author = 0L; itemName = ""; return -1; } public static void RPC_MLUI_RemoveLastUncookedItem(long sender, ZDOID targetZDO, Vector3 userPoint) { //IL_0013: 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) if (((ZDOID)(ref targetZDO)).IsNone()) { return; } ZDO zDO = ZDOMan.instance.GetZDO(targetZDO); if (zDO == null) { return; } ZNetView val = ZNetScene.instance.FindInstance(zDO); if ((Object)(object)val != (Object)null && val.IsValid() && val.IsOwner()) { CookingStation componentInParent = ((Component)val).GetComponentInParent<CookingStation>(); if (componentInParent != null) { RemoveLastItem(sender, componentInParent, userPoint); } } } internal static void RemoveLastItem(long sender, CookingStation station, Vector3 userPoint) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) string itemName; long author; int slotToRemove = GetSlotToRemove(station, out itemName, out author); if (slotToRemove != -1) { station.SpawnItem(itemName, slotToRemove, userPoint); station.SetSlot(slotToRemove, "", 0f, (Status)0); station.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetSlotVisual", new object[2] { slotToRemove, "" }); if (author != 0) { ZRoutedRpc.instance.InvokeRoutedRPC(author, "RPC_MLUI_UndoCookingSkillRaise", Array.Empty<object>()); } } } internal static void RPC_MLUI_UndoCookingSkillRaise(long sender) { ((Character)Player.m_localPlayer).RaiseSkill((SkillType)105, -0.4f); } private static void RemoveLastItemFromStation(CookingStation station, Humanoid user) { //IL_004e: 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) if ((Object)(object)station.m_nview != (Object)null && station.m_nview.IsValid()) { ZRoutedRpc.instance.InvokeRoutedRPC(station.m_nview.GetZDO().GetOwner(), "RPC_MLUI_RemoveLastUncookedItem", new object[2] { station.m_nview.GetZDO().m_uid, ((Component)user).transform.position }); } } } public static class CraftFilter { [HarmonyPatch(typeof(InventoryGui), "Awake")] public static class StoreGui_Awake_InitializePanel { [HarmonyPriority(800)] private static void Postfix() { InitFilterField(); UpdateVisibility(); } } [HarmonyPatch(typeof(InventoryGui), "Show")] public static class InventoryGui_Show_ClearCache { public static void Postfix() { ClearText(); } } [HarmonyPatch(typeof(InventoryGui), "OnDestroy")] public static class InventoryGui_OnDestroy_ClearCache { public static void Postfix() { recipeCache.Clear(); } } [HarmonyPatch(typeof(Chat), "HasFocus")] public static class Chat_HasFocus_FocusOverride { public static void Postfix(ref bool __result) { __result = __result || (IsCraftingFilterEnabled && ((TMP_InputField)playerFilter).isFocused); } } [HarmonyPatch(typeof(Player), "GetAvailableRecipes")] public static class Player_GetAvailableRecipes_FilterRecipeList { [HarmonyPriority(0)] public static void Postfix(ref List<Recipe> available) { if (IsCraftingFilterEnabled && applyFilter) { Stopwatch stopwatch = Stopwatch.StartNew(); CollectionExtensions.Do<Recipe>((IEnumerable<Recipe>)available, (Action<Recipe>)CacheRecipe); MyLittleUI.LogInfo($"Recipe cache: verified {recipeCache.Count} in {(double)stopwatch.ElapsedTicks / (double)Stopwatch.Frequency * 1000.0:F2} ms"); stopwatch.Reset(); MyLittleUI.LogInfo($"Recipe filter: removed {available.RemoveAll((Recipe recipe) => !FitsFilterString(recipe))} in {(double)stopwatch.ElapsedTicks / (double)Stopwatch.Frequency * 1000.0:F2} ms"); stopwatch.Stop(); } } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] public static class InventoryGui_UpdateRecipe_HandleFieldFocus { public static void Postfix() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 if (!IsCraftingFilterEnabled) { return; } bool flag = (int)ZInput.InputLayout == 1; bool button = ZInput.GetButton("JoyLBumper"); bool button2 = ZInput.GetButton("JoyLTrigger"); if (((TMP_InputField)playerFilter).isFocused) { if (ZInput.GetButtonDown("Chat") || ZInput.GetButtonDown("Block") || ZInput.GetButtonDown("Console") || ZInput.GetButtonDown("Escape") || ZInput.GetButtonDown("Inventory") || (ZInput.GetButtonDown("JoyChat") && ZInput.GetButton("JoyAltKeys") && !(flag && button2) && !(!flag && button))) { ((TMP_InputField)playerFilter).DeactivateInputField(false); } } else if ((Object)(object)Player.m_localPlayer != (Object)null && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible() && (ZInput.GetButtonDown("Chat") || (ZInput.GetButtonDown("JoyChat") && ZInput.GetButton("JoyAltKeys") && !(flag && button2) && !(!flag && button)))) { playerFilter.ActivateInputField(); } } } private const float fieldHeight = 32f; private static Vector2 listAnchorMin = new Vector2(-1f, -1f); private static readonly Dictionary<Recipe, string> recipeCache = new Dictionary<Recipe, string>(); private static GuiInputField playerFilter; private static string[] filterString = Array.Empty<string>(); private static bool applyFilter; private static readonly StringBuilder sb = new StringBuilder(); private static readonly StringBuilder sbItem = new StringBuilder(); public static bool IsCraftingFilterEnabled => MyLittleUI.modEnabled.Value && MyLittleUI.craftingFilterEnabled.Value && !MyLittleUI.AAA_Crafting && !MyLittleUI.ZenUI; private static void InitFilterField() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) //IL_00cc: 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_0170: Expected O, but got Unknown //IL_0185: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) if (!MyLittleUI.AAA_Crafting && !MyLittleUI.ZenUI) { Transform parent = ((Component)InventoryGui.instance.m_recipeListScroll).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); GameObject val2 = Object.Instantiate<GameObject>(((Component)TextInput.instance.m_inputField).gameObject, ((Transform)val).parent); ((Object)val2).name = "MLUI_FilterField"; val2.transform.SetSiblingIndex(((Transform)val).GetSiblingIndex() + 1); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.zero; Rect rect = val.rect; component.sizeDelta = new Vector2(((Rect)(ref rect)).width, 32f); component.anchoredPosition = new Vector2(val.anchoredPosition.x, 4f); component.pivot = Vector2.zero; playerFilter = val2.GetComponent<GuiInputField>(); playerFilter.VirtualKeyboardTitle = "$menu_filter"; ((Component)((Component)playerFilter).transform.Find("Text Area/Placeholder")).GetComponent<TMP_Text>().SetText(Localization.instance.Localize("$menu_filter")); ((TMP_InputField)playerFilter).restoreOriginalTextOnEscape = false; Button val3 = Object.Instantiate<Button>(InventoryGui.instance.m_splitOkButton, val2.transform); ((Object)val3).name = "ClearTextButton"; ((UnityEventBase)val3.onClick).RemoveAllListeners(); ((UnityEvent)val3.onClick).AddListener(new UnityAction(ClearText)); RectTransform component2 = ((Component)val3).GetComponent<RectTransform>(); component2.anchorMin = new Vector2(1f, 0.5f); component2.anchorMax = new Vector2(1f, 0.5f); component2.sizeDelta = Vector2.one * 28f; component2.anchoredPosition = new Vector2(-16f, 0f); TextMeshProUGUI component3 = ((Component)((Component)val3).transform.Find("Text")).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component3).SetText("✖"); ((TMP_Text)component3).margin = Vector4.one * -2f; ((Component)val3).transform.Find("gamepad_hint").localPosition = new Vector3(-0.75f, 23.8f, 0f); ((UnityEvent<string>)(object)((TMP_InputField)playerFilter).onValueChanged).AddListener((UnityAction<string>)delegate { UpdateFilterString(); StartPanelUpdate(); }); } } public static void UpdateVisibility() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (MyLittleUI.AAA_Crafting || MyLittleUI.ZenUI) { return; } GuiInputField obj = playerFilter; if (obj != null) { GameObject gameObject = ((Component)obj).gameObject; if (gameObject != null) { gameObject.SetActive(IsCraftingFilterEnabled); } } if (Object.op_Implicit((Object)(object)InventoryGui.instance.m_recipeListScroll)) { Transform parent = ((Component)InventoryGui.instance.m_recipeListScroll).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (listAnchorMin.x == -1f) { listAnchorMin = val.anchorMin; } GuiInputField obj2 = playerFilter; val.anchorMin = ((obj2 != null && ((Behaviour)obj2).isActiveAndEnabled) ? (listAnchorMin + new Vector2(0f, 0.05f)) : listAnchorMin); } } public static void UpdateFilterString() { GuiInputField obj = playerFilter; if (applyFilter = !string.IsNullOrWhiteSpace((obj != null) ? ((TMP_InputField)obj).text : null)) { GuiInputField obj2 = playerFilter; filterString = ((obj2 != null) ? ((TMP_InputField)obj2).text.ToLower().Split(new char[1] { ' ' }, StringSplitOptions.None) : null); } } public static void ClearText() { applyFilter = false; if (Object.op_Implicit((Object)(object)playerFilter)) { ((TMP_InputField)playerFilter).text = ""; } } private static string GetItemFullString(ItemDrop itemDrop) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) sbItem.Clear(); sbItem.Append(((Object)itemDrop).name); sbItem.Append(' '); sbItem.Append(itemDrop.m_itemData.m_shared.m_itemType); sbItem.Append(' '); sbItem.Append(itemDrop.m_itemData.m_shared.m_setName); sbItem.Append(' '); sbItem.Append(itemDrop.m_itemData.m_shared.m_name); sbItem.Append(' '); sbItem.Append(Localization.instance.Localize(itemDrop.m_itemData.m_shared.m_name)); sbItem.Append(' '); sbItem.Append(itemDrop.m_itemData.GetTooltip(-1)); return sbItem.ToString(); } private static void CacheRecipe(Recipe recipe) { if (!recipeCache.ContainsKey(recipe)) { sb.Clear(); sb.Append(((Object)recipe).name); sb.Append(' '); sb.Append(GetItemFullString(recipe.m_item)); sb.Append(' '); CollectionExtensions.Do<Requirement>((IEnumerable<Requirement>)recipe.m_resources, (Action<Requirement>)delegate(Requirement req) { sb.Append(GetItemFullString(req.m_resItem)); sb.Append(' '); }); recipeCache[recipe] = sb.ToString().ToLower(); } } private static bool FitsFilterString(Recipe recipe) { return recipeCache.ContainsKey(recipe) && filterString.All((string substr) => recipeCache[recipe].Contains(substr)); } private static void StartPanelUpdate() { ((MonoBehaviour)MyLittleUI.instance).CancelInvoke("UpdateCraftingPanel"); ((MonoBehaviour)MyLittleUI.instance).Invoke("UpdateCraftingPanel", ((float)recipeCache.Count == 0f) ? 0.4f : 0.2f); } public static void UpdateCraftingPanel() { //IL_0034: 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) if (Object.op_Implicit((Object)(object)InventoryGui.instance)) { InventoryGui.instance.UpdateCraftingPanel(true); InventoryGui.instance.m_moveItemEffects.Create(((Component)Player.m_localPlayer).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } } } public static class CraftSort { public class FilteringPanel { public string name; public RectTransform panel; public RectTransform selectedFrame; public List<FilteringState> filters; public bool enabled; public int enabledFilters; public override string ToString() { return name; } public FilteringPanel(string name) { this.name = name; ref RectTransform reference = ref panel; Transform repairPanel = InventoryGui.instance.m_repairPanel; reference = Object.Instantiate<RectTransform>((RectTransform)(object)((repairPanel is RectTransform) ? repairPanel : null), (Transform)(object)sortPanel); ((Object)panel).name = "MLUI_SortingPanel_" + name; if (Object.op_Implicit((Object)(object)InventoryGui.instance.m_repairPanelSelection)) { ref RectTransform reference2 = ref selectedFrame; Transform repairPanelSelection = InventoryGui.instance.m_repairPanelSelection; reference2 = Object.Instantiate<RectTransform>((RectTransform)(object)((repairPanelSelection is RectTransform) ? repairPanelSelection : null), ((Component)InventoryGui.instance.m_repairPanelSelection).transform.parent); ((Object)selectedFrame).name = "selected (" + ((Object)panel).name + ")"; } filters = new List<FilteringState>(); panels.Add(this); } public void AddFilter(FilteringState filter) { filters.Add(filter); } public void UpdatePosition(ref int height) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.CeilToInt((float)enabledFilters / 3f); int num2 = 34 * num - 2 + 12; int num3 = 0; if (enabledFilters == 2) { num3 = 34; } else if (enabledFilters == 1) { num3 = 68; } panel.sizeDelta = new Vector2(120f - (float)num3, (float)num2); height += num2; panel.anchoredPosition = new Vector2(0f, (float)(-height)); if (Object.op_Implicit((Object)(object)selectedFrame)) { selectedFrame.sizeDelta = panel.sizeDelta + new Vector2(4f, 4f); selectedFrame.anchoredPosition = panel.anchoredPosition - new Vector2(panel.sizeDelta.x + 2f, 202f); } } public void UpdateVisibility() { RectTransform obj = panel; if (obj != null) { ((Component)obj).gameObject.SetActive(enabled); } RectTransform obj2 = selectedFrame; if (obj2 != null) { ((Component)obj2).gameObject.SetActive(enabled); } } public void ClearPanel() { enabled = false; enabledFilters = 0; CollectionExtensions.Do<FilteringState>((IEnumerable<FilteringState>)filters, (Action<FilteringState>)delegate(FilteringState state) { state.ClearFiltering(); }); UpdateVisibility(); } } public class FilteringState { public int position; public bool selectable; public bool enabled; public bool selected; public bool lastSelected; public string category; public string tooltip; public Sprite icon; public string name; public Color imageColor; public bool unique = true; public RectTransform element; public Button button; public Image image; public GameObject active; public GameObject select; public FilteringPanel panel; public Comparison<RecipeDataPair> sort; public Func<ItemData, bool> filter; public FilteringState() { filteringStates.Add(this); } public void CreateElement() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)element)) { element = Object.Instantiate<RectTransform>(elementPrefab, (Transform)(object)panel.panel); ((Object)element).name = name; ((Component)element).gameObject.SetActive(true); ((Component)element).GetComponent<UITooltip>().m_text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Localization.instance.Localize(tooltip)); image = ((Component)((Transform)element).Find("icon")).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)image)) { image.overrideSprite = icon; ((Graphic)image).color = ((imageColor != Color.clear) ? imageColor : Color.white); Transform transform = ((Component)image).transform; transform.localScale *= 0.9f; } button = ((Component)element).GetComponent<Button>(); Transform obj = ((Transform)element).Find("active"); active = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = ((Transform)element).Find("selected"); select = ((obj2 != null) ? ((Component)obj2).gameObject : null); ((UnityEvent)button.onClick).AddListener(new UnityAction(OnClick)); UpdateElementPosition(); } } public void UpdateElementPosition() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)element)) { element.anchoredPosition = new Vector2(8f + (float)(position % 3) * 34f, -6f - (float)(position / 3) * 34f); } } public void UpdatePosition(ref int currentPosition) { position = currentPosition; if (selectable) { currentPosition++; } UpdateElementPosition(); } public void UpdateEnabled() { GameObject obj = active; if (obj != null) { obj.SetActive(enabled); } } public void UpdateSelectable() { RectTransform obj = element; if (obj != null) { GameObject gameObject = ((Component)obj).gameObject; if (gameObject != null) { gameObject.SetActive(selectable); } } } public void UpdateSelect() { GameObject obj = select; if (obj != null) { obj.SetActive(selected); } } public void SetSelected(bool selected) { this.selected = selected; if (selected) { lastSelected = true; CollectionExtensions.DoIf<FilteringState>((IEnumerable<FilteringState>)filteringStates, (Func<FilteringState, bool>)((FilteringState fs) => fs != this), (Action<FilteringState>)delegate(FilteringState fs) { fs.lastSelected = false; }); } } public void ClearFiltering() { selectable = false; enabled = false; selected = false; position = 0; UpdateEnabled(); UpdateSelectable(); UpdateSelect(); } public bool IsSelectable(ItemData item) { return filter != null && filter(item); } public void OnClick() { enabled = !enabled; UpdateEnabled(); if (unique) { CollectionExtensions.DoIf<FilteringState>((IEnumerable<FilteringState>)filteringStates, (Func<FilteringState, bool>)((FilteringState fs) => fs != this), (Action<FilteringState>)delegate(FilteringState fs) { fs.enabled = false; fs.UpdateEnabled(); }); } InventoryGui.instance.UpdateCraftingPanel(true); } } [HarmonyPatch(typeof(Game), "SpawnPlayer")] public static class Game_SpawnPlayer_InitializePanel { public static void Postfix() { CheckPanels(); } } [HarmonyPatch(typeof(InventoryGui), "Update")] public static class InventoryGui_Update_SortingPanelVisibility { public static void Postfix() { UpdateVisibility(); } } [HarmonyPatch(typeof(InventoryGui), "Show")] public static class InventoryGui_Show_ClearFiltersState { public static void Prefix() { ClearPanels(); } } [HarmonyPatch(typeof(InventoryGui), "OnDestroy")] public static class InventoryGui_OnDestroy_ClearData { public static void Prefix() { filteringStates.Clear(); tempEnabledStates.Clear(); panels.Clear(); sortPanel = null; elementPrefab = null; foodSprite = null; } } [HarmonyPatch(typeof(InventoryGui), "UpdateCraftingPanel")] [HarmonyPatch(typeof(InventoryGui), "Update")] public static class InventoryGui_UpdateCraftingPanel_HideWithOtherMods { [HarmonyPriority(0)] public static void Postfix(InventoryGui __instance) { if (!__instance.InCraftTab() && !__instance.InUpradeTab()) { ClearPanels(); } } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")] public static class InventoryGui_UpdateRecipeList_FilteringAndSorting { [HarmonyPriority(800)] [HarmonyAfter(new string[] { "ZenDragon.ZenUI" })] public static void Prefix(InventoryGui __instance, List<Recipe> recipes) { FilterRecipes(recipes, __instance.InCraftTab(), __instance.InUpradeTab()); } [HarmonyPriority(800)] [HarmonyAfter(new string[] { "ZenDragon.ZenUI" })] public static void Postfix() { SortRecipes(); } } [HarmonyPatch(typeof(InventoryGui), "Update")] public static class InventoryGui_Update_GamepadControls { public static FilteringState GetSelectedFilter() { return filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable && fs.selected); } [HarmonyPriority(800)] public static void Prefix(InventoryGui __instance) { if (!IsCraftingFilterEnabled || !InventoryGui.IsVisible() || !__instance.m_inventoryGroup.IsActive || __instance.m_activeGroup != 3) { return; } if (!ZInput.IsGamepadActive() || ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyLStickUp") || ((MyLittleUI.ZenUI || MyLittleUI.AAA_Crafting) ? ZInput.GetButtonDown("JoyRStickRight") : ZInput.GetButtonDown("JoyLStickRight"))) { CollectionExtensions.Do<FilteringState>((IEnumerable<FilteringState>)filteringStates, (Action<FilteringState>)delegate(FilteringState fs) { fs.SetSelected(selected: false); }); return; } string text = ((MyLittleUI.ZenUI || MyLittleUI.AAA_Crafting) ? "JoyRStickLeft" : "JoyLStickLeft"); if (ZInput.GetButtonDown(text)) { FilteringState filteringState = filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable && fs.enabled); if (filteringState != null) { filteringState.SetSelected(selected: true); ZInput.ResetButtonStatus(text); } else if (panels.Count > 0) { FilteringState selectedFilter = GetSelectedFilter(); selectedFilter = filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable && fs.lastSelected) ?? filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable); if (selectedFilter != null) { selectedFilter.SetSelected(selected: true); ZInput.ResetButtonStatus(text); } } } else if (ZInput.GetButtonDown("JoyDPadLeft")) { FilteringState selectedFilter2 = GetSelectedFilter(); if (selectedFilter2 != null) { for (int num = selectedFilter2.panel.filters.IndexOf(selectedFilter2) - 1; num >= 0; num--) { if (selectedFilter2.panel.filters[num].selectable) { selectedFilter2.SetSelected(selected: false); selectedFilter2.panel.filters[num].SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadLeft"); return; } } int num2 = panels.IndexOf(selectedFilter2.panel); for (int num3 = num2 - 1; num3 >= 0; num3--) { FilteringState filteringState2 = panels[num3].filters.LastOrDefault((FilteringState fs) => fs.selectable); if (filteringState2 != null) { selectedFilter2.SetSelected(selected: false); filteringState2.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadLeft"); return; } } FilteringState filteringState3 = filteringStates.LastOrDefault((FilteringState fs) => fs.selectable); if (filteringState3 != null) { selectedFilter2.SetSelected(selected: false); filteringState3.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadLeft"); } return; } if (!MyLittleUI.AAA_Crafting) { FilteringState filteringState4 = filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable && fs.enabled); if (filteringState4 != null) { filteringState4.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadLeft"); return; } } if (!MyLittleUI.AAA_Crafting && panels.Count > 0) { selectedFilter2 = filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable && fs.lastSelected) ?? filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable); if (selectedFilter2 != null) { selectedFilter2.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadLeft"); } } } else if (ZInput.GetButtonDown("JoyDPadRight")) { FilteringState selectedFilter3 = GetSelectedFilter(); if (selectedFilter3 == null) { return; } for (int i = selectedFilter3.panel.filters.IndexOf(selectedFilter3) + 1; i < selectedFilter3.panel.filters.Count; i++) { if (selectedFilter3.panel.filters[i].selectable) { selectedFilter3.SetSelected(selected: false); selectedFilter3.panel.filters[i].SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadRight"); return; } } int num4 = panels.IndexOf(selectedFilter3.panel); for (int j = num4 + 1; j < panels.Count; j++) { FilteringState filteringState5 = panels[j].filters.FirstOrDefault((FilteringState fs) => fs.selectable); if (filteringState5 != null) { selectedFilter3.SetSelected(selected: false); filteringState5.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadRight"); return; } } FilteringState filteringState6 = filteringStates.FirstOrDefault((FilteringState fs) => fs.selectable); if (filteringState6 != null) { selectedFilter3.SetSelected(selected: false); filteringState6.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadRight"); } } else if (ZInput.GetButtonDown("JoyDPadUp")) { FilteringState selectedFilter4 = GetSelectedFilter(); if (selectedFilter4 == null) { return; } int num5 = 0; for (int num6 = selectedFilter4.panel.filters.IndexOf(selectedFilter4); num6 >= 0; num6--) { if (selectedFilter4.panel.filters[num6].selectable) { if (num5 >= 3) { selectedFilter4.SetSelected(selected: false); selectedFilter4.panel.filters[num6].SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadUp"); return; } num5++; } } int num7 = panels.IndexOf(selectedFilter4.panel); List<FilteringState> list2 = selectedFilter4.panel.filters.Where((FilteringState fs) => fs.selectable).ToList(); int column2 = list2.IndexOf(selectedFilter4) % 3; if (list2.Count == 2) { column2++; } else if (list2.Count == 1) { column2 += 2; } for (int num8 = num7 + panels.Count - 1; num8 > num7; num8--) { FilteringPanel filteringPanel = panels[num8 % panels.Count]; list2 = filteringPanel.filters.Where((FilteringState fs) => fs.selectable).ToList(); if (list2.Count == 2) { column2 = Math.Max(0, column2 - 1); } else if (list2.Count == 1) { column2 = Math.Max(0, column2 - 2); } FilteringState filteringState7 = list2.LastOrDefault((FilteringState fs) => list2.IndexOf(fs) % 3 == column2) ?? filteringPanel.filters.LastOrDefault((FilteringState fs) => fs.selectable); if (filteringState7 != null) { selectedFilter4.SetSelected(selected: false); filteringState7.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadUp"); break; } } } else if (ZInput.GetButtonDown("JoyDPadDown")) { FilteringState selectedFilter5 = GetSelectedFilter(); if (selectedFilter5 == null) { return; } int num9 = 0; for (int k = selectedFilter5.panel.filters.IndexOf(selectedFilter5); k < selectedFilter5.panel.filters.Count; k++) { if (selectedFilter5.panel.filters[k].selectable) { if (num9 >= 3) { selectedFilter5.SetSelected(selected: false); selectedFilter5.panel.filters[k].SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadDown"); return; } num9++; } } int num10 = panels.IndexOf(selectedFilter5.panel); List<FilteringState> list = selectedFilter5.panel.filters.Where((FilteringState fs) => fs.selectable).ToList(); int column = list.IndexOf(selectedFilter5) % 3; if (list.Count == 2) { column++; } else if (list.Count == 1) { column += 2; } for (int l = num10 + 1; l < panels.Count + num10; l++) { FilteringPanel filteringPanel2 = panels[l % panels.Count]; list = filteringPanel2.filters.Where((FilteringState fs) => fs.selectable).ToList(); if (list.Count == 2) { column = Math.Max(0, column - 1); } else if (list.Count == 1) { column = Math.Max(0, column - 2); } FilteringState filteringState8 = list.FirstOrDefault((FilteringState fs) => list.IndexOf(fs) % 3 == column) ?? filteringPanel2.filters.FirstOrDefault((FilteringState fs) => fs.selectable); if (filteringState8 != null) { selectedFilter5.SetSelected(selected: false); filteringState8.SetSelected(selected: true); ZInput.ResetButtonStatus("JoyDPadDown"); break; } } } else if (ZInput.GetButtonDown("JoyRStick")) { FilteringState selectedFilter6 = GetSelectedFilter(); if (selectedFilter6 != null) { selectedFilter6.OnClick(); ZInput.ResetButtonStatus("JoyRStick"); } } else if (ZInput.GetButtonDown("JoyJump")) { FilteringState selectedFilter7 = GetSelectedFilter(); if (selectedFilter7 != null) { selectedFilter7.OnClick(); ZInput.ResetButtonStatus("JoyJump"); } } } public static void Postfix() { CollectionExtensions.Do<FilteringState>((IEnumerable<FilteringState>)filteringStates, (Action<FilteringState>)delegate(FilteringState fs) { fs.UpdateSelect(); }); } } public static readonly List<FilteringPanel> panels = new List<FilteringPanel>(); public static readonly List<FilteringState> filteringStates = new List<FilteringState>(); public static readonly List<FilteringState> tempEnabledStates = new List<FilteringState>(); public static readonly List<string> tempUnfitItems = new List<string>(); public static RectTransform sortPanel; public static RectTransform elementPrefab; public static Sprite foodSprite; public static bool IsCraftingFilterEnabled => MyLittleUI.modEnabled.Value && MyLittleUI.craftingSortingEnabled.Value; public static void UpdateVisibility() { RectTransform obj = sortPanel; if (obj != null) { ((Component)obj).gameObject.SetActive(IsCraftingFilterEnabled); } } internal static void InitElementPrefab(Transform parent) { //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)elementPrefab)) { return; } elementPrefab = Object.Instantiate<GameObject>(InventoryGui.instance.m_playerGrid.m_elementPrefab, parent).GetComponent<RectTransform>(); for (int num = ((Transform)elementPrefab).childCount - 1; num >= 0; num--) { Transform child = ((Transform)elementPrefab).GetChild(num); ((Component)child).gameObject.SetActive(false); switch (((Object)child).name) { case "foodicon": if (foodSprite == null) { foodSprite = ((Component)child).GetComponent<Image>().sprite; } Object.DestroyImmediate((Object)(object)((Component)child).gameObject); break; case "amount": case "durability": case "binding": case "quality": case "noteleport": case "equiped": Object.DestroyImmediate((Object)(object)((Component)child).gameObject); break; case "icon": ((Component)child).gameObject.SetActive(true); break; case "queued": ((Object)child).name = "active"; break; } } ((Object)elementPrefab).name = "filterElement"; elementPrefab.sizeDelta = Vector2.one * 32f; ((Component)elementPrefab).gameObject.SetActive(false); ((Component)elementPrefab).GetComponent<UITooltip>().m_tooltipPrefab = ((Component)InventoryGui.instance.m_repairButton).GetComponent<UITooltip>().m_tooltipPrefab; ((UnityEventBase)((Component)elementPrefab).GetComponent<Button>().onClick).RemoveAllListeners(); } internal static void InitSortingPanel() { //IL_00d7: 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) if (IsCraftingFilterEnabled && Object.op_Implicit((Object)(object)InventoryGui.instance) && !Object.op_Implicit((Object)(object)sortPanel) && Object.op_Implicit((Object)(object)InventoryGui.instance.m_repairPanel) && Object.op_Implicit((Object)(object)InventoryGui.instance.m_repairButton) && Object.op_Implicit((Object)(object)InventoryGui.instance.m_playerGrid.m_elementPrefab)) { Transform repairPanel = InventoryGui.instance.m_repairPanel; sortPanel = Object.Instantiate<RectTransform>((RectTransform)(object)((repairPanel is RectTransform) ? repairPanel : null), ((Component)InventoryGui.instance.m_repairPanel).transform.parent); ((Object)sortPanel).name = "MLUI_SortingPanels"; ((Transform)sortPanel).SetSiblingIndex(InventoryGui.instance.m_repairPanel.GetSiblingIndex() + 1); sortPanel.anchoredPosition = new Vector2(0f, -200f); sortPanel.sizeDelta = new Vector2(0f, 0f); ((Component)sortPanel).gameObject.SetActive(false); panels.Clear(); filteringStates.Clear(); InitElementPrefab((Transform)(object)sortPanel); InitFoodCategory(); InitArmorCategory(); InitSkillsCategory(); InitBowsCategory(); InitCrossbowsCategory(); InitMagicCategory(); InitToolsCategory(); filteringStates.ForEach(delegate(FilteringState fs) { fs.CreateElement(); }); } } private static void InitFoodCategory() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) FilteringPanel filteringPanel = new FilteringPanel("Food"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "food", category = "$hud_food", tooltip = "$item_food_health", icon = foodSprite, imageColor = InventoryGui.instance.m_playerGrid.m_foodHealthColor, unique = true, sort = delegate(RecipeDataPair a, RecipeDataPair b) { float num3 = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_food ?? ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_food; float value3 = ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_food ?? ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_food; return num3.CompareTo(value3); }, filter = (ItemData item) => (item.m_shared.m_appendToolTip?.m_itemData.m_shared.m_food ?? item.m_shared.m_food) > 0f }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "food_stamina", category = "$hud_food", tooltip = "$item_food_stamina", icon = foodSprite, imageColor = InventoryGui.instance.m_playerGrid.m_foodStaminaColor, unique = true, sort = delegate(RecipeDataPair a, RecipeDataPair b) { float num2 = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodStamina ?? ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_foodStamina; float value2 = ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodStamina ?? ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_foodStamina; return num2.CompareTo(value2); }, filter = (ItemData item) => (item.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodStamina ?? item.m_shared.m_foodStamina) > 0f }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "food_eitr", category = "$hud_food", tooltip = "$item_food_eitr", icon = foodSprite, imageColor = InventoryGui.instance.m_playerGrid.m_foodEitrColor, unique = true, sort = delegate(RecipeDataPair a, RecipeDataPair b) { float num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodEitr ?? ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_foodEitr; float value = ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodEitr ?? ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_foodEitr; return num.CompareTo(value); }, filter = (ItemData item) => (item.m_shared.m_appendToolTip?.m_itemData.m_shared.m_foodEitr ?? item.m_shared.m_foodEitr) > 0f }); } private static void InitArmorCategory() { FilteringPanel filteringPanel = new FilteringPanel("Armor"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_helmet", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("HelmetBronze").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByArmor, filter = (ItemData item) => (int)item.m_shared.m_itemType == 6 || (int)item.m_shared.m_attachOverride == 6 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_chest", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("ArmorIronChest").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByArmor, filter = (ItemData item) => (int)item.m_shared.m_itemType == 7 || (int)item.m_shared.m_attachOverride == 7 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_legs", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("ArmorIronLegs").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByArmor, filter = (ItemData item) => (int)item.m_shared.m_itemType == 11 || (int)item.m_shared.m_attachOverride == 11 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_cape", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("CapeDeerHide").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = SortCape, filter = (ItemData item) => (int)item.m_shared.m_itemType == 17 || (int)item.m_shared.m_attachOverride == 17 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_utility", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("Demister").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByArmor, filter = (ItemData item) => (int)item.m_shared.m_itemType == 18 || (int)item.m_shared.m_attachOverride == 18 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "armor_trinket", category = "Armor", tooltip = "$radial_armor_utility", icon = ObjectDB.instance.GetItemPrefab("TrinketBronzeHealth").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByAdrenaline, filter = (ItemData item) => (int)item.m_shared.m_itemType == 24 || (int)item.m_shared.m_attachOverride == 24 }); } private static void InitSkillsCategory() { FilteringPanel panel = new FilteringPanel("Skills"); Skills skills2 = ((Character)Player.m_localPlayer).GetSkills(); AddMelee(skills2, (SkillType)1); AddMelee(skills2, (SkillType)2); AddMelee(skills2, (SkillType)3); AddMelee(skills2, (SkillType)4); AddMelee(skills2, (SkillType)5); AddMelee(skills2, (SkillType)7); AddMelee(skills2, (SkillType)11); AddMelee(skills2, (SkillType)12); panel.AddFilter(new FilteringState { panel = panel, name = "skill_shields", category = "Melee", tooltip = "$skill_shields", icon = skills2.GetSkillDef((SkillType)6).m_icon, sort = SortShield, filter = (ItemData item) => (int)item.m_shared.m_skillType == 6 }); void AddMelee(Skills skills, SkillType skill) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) panel.AddFilter(new FilteringState { panel = panel, name = "skill_" + ((object)(SkillType)(ref skill)).ToString().ToLower(), category = "Melee", tooltip = "$skill_" + ((object)(SkillType)(ref skill)).ToString().ToLower(), icon = skills.GetSkillDef(skill).m_icon, sort = ByTotalDamage, filter = (ItemData item) => item.m_shared.m_skillType == skill && item.m_shared.m_attack.m_attackAnimation != "" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); } } private static void InitBowsCategory() { FilteringPanel filteringPanel = new FilteringPanel("Bows"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "skill_bows", category = "Bows", tooltip = "$skill_bows", icon = ((Character)Player.m_localPlayer).GetSkills().GetSkillDef((SkillType)8).m_icon, sort = ByTotalDamage, filter = (ItemData item) => (int)item.m_shared.m_skillType == 8 && item.m_shared.m_attack.m_attackAnimation != "" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "ammo_arrows", category = "Bows", tooltip = "$ammo_arrows", icon = ObjectDB.instance.GetItemPrefab("ArrowIron").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByTotalDamage, filter = (ItemData item) => (int)item.m_shared.m_skillType == 8 && item.m_shared.m_attack.m_attackAnimation == "" && item.m_shared.m_ammoType == "$ammo_arrows" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); } private static void InitCrossbowsCategory() { FilteringPanel filteringPanel = new FilteringPanel("Crossbows"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "skill_crossbows", category = "Crossbows", tooltip = "$skill_crossbows", icon = ((Character)Player.m_localPlayer).GetSkills().GetSkillDef((SkillType)14).m_icon, sort = ByTotalDamage, filter = (ItemData item) => (int)item.m_shared.m_skillType == 14 && item.m_shared.m_attack.m_attackAnimation != "" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "ammo_arrows", category = "Crossbows", tooltip = "$ammo_bolts", icon = ObjectDB.instance.GetItemPrefab("BoltIron").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByTotalDamage, filter = (ItemData item) => (int)item.m_shared.m_skillType == 14 && item.m_shared.m_attack.m_attackAnimation == "" && item.m_shared.m_ammoType == "$ammo_bolts" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); } private static void InitMagicCategory() { FilteringPanel filteringPanel = new FilteringPanel("Magic"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "skill_elementalmagic", category = "Magic", tooltip = "$skill_elementalmagic", icon = ((Character)Player.m_localPlayer).GetSkills().GetSkillDef((SkillType)9).m_icon, sort = ByTotalDamage, filter = (ItemData item) => (int)item.m_shared.m_skillType == 9 && item.m_shared.m_attack.m_attackAnimation != "" && ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() > 0f }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "skill_bloodmagic", category = "Magic", tooltip = "$skill_bloodmagic", icon = ((Character)Player.m_localPlayer).GetSkills().GetSkillDef((SkillType)10).m_icon, sort = ByDefault, filter = (ItemData item) => (int)item.m_shared.m_skillType == 10 && item.m_shared.m_attack.m_attackAnimation != "" }); } private static void InitToolsCategory() { FilteringPanel filteringPanel = new FilteringPanel("Tools"); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "tools_crafting", category = "Tools", tooltip = "$radial_weapons_tools", icon = ((Character)Player.m_localPlayer).GetSkills().GetSkillDef((SkillType)107).m_icon, sort = ByDefault, filter = (ItemData item) => (int)item.m_shared.m_itemType == 19 || item.m_shared.m_attack.m_attackAnimation == "throw_bomb" || (int)item.m_shared.m_skillType == 106 || item.m_shared.m_ammoType == "mead" }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "tools_consumables", category = "Tools", tooltip = "$radial_consumables", icon = ObjectDB.instance.GetItemPrefab("MeadBaseTasty").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByDefault, filter = (ItemData item) => ((int)item.m_shared.m_itemType == 2 && (Object)(object)item.m_shared.m_consumeStatusEffect != (Object)null) || ((int)item.m_shared.m_itemType == 1 && (Object)(object)item.m_shared.m_consumeStatusEffect != (Object)null) }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "tools_material", category = "Tools", tooltip = "$skill_crafting", icon = ObjectDB.instance.GetItemPrefab("Bronze").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByDefault, filter = (ItemData item) => ((int)item.m_shared.m_itemType == 1 && (Object)(object)item.m_shared.m_appendToolTip == (Object)null && (Object)(object)item.m_shared.m_consumeStatusEffect == (Object)null && !item.m_shared.m_name.StartsWith("$jc_")) || (int)item.m_shared.m_itemType == 23 }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "skill_fishing", category = "Tools", tooltip = "$skill_fishing", icon = ObjectDB.instance.GetItemPrefab("FishingRod").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByDefault, filter = (ItemData item) => (int)item.m_shared.m_skillType == 104 || item.m_shared.m_name == "$item_helmet_fishinghat" || item.m_shared.m_ammoType == "$item_fishingbait" }); filteringPanel.AddFilter(new FilteringState { panel = filteringPanel, name = "tools_misc", category = "Tools", tooltip = "$hud_misc", icon = ObjectDB.instance.GetItemPrefab("BoneFragments").GetComponent<ItemDrop>().m_itemData.GetIcon(), sort = ByDefault, filter = (ItemData item) => tempUnfitItems.Contains(item.m_shared.m_name) || (((int)item.m_shared.m_itemType == 16 || (int)item.m_shared.m_attachOverride == 16 || (int)item.m_shared.m_itemType > 25) && !item.m_shared.m_name.StartsWith("$jc_")) }); if (!MyLittleUI.Jewelcrafting) { return; } FilteringState filteringState = new FilteringState { panel = filteringPanel, name = "tools_jewelcrafting", category = "Tools", tooltip = "$jc_jewelcrafting_skill_name" }; FilteringState filteringState2 = filteringState; object obj = MyLittleUI.GetJewelcraftingIcon(); if (obj == null) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("GemstoneRed"); if (itemPrefab == null) { obj = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if (component == null) { obj = null; } else { ItemData itemData = component.m_itemData; obj = ((itemData != null) ? itemData.GetIcon() : null); } } } filteringState2.icon = (Sprite)obj; filteringState.sort = ByName; filteringState.filter = (ItemData item) => (int)item.m_shared.m_itemType != 18 && item.m_shared.m_name.StartsWith("$jc_"); filteringPanel.AddFilter(filteringState); } private static int ByAdrenaline(RecipeDataPair a, RecipeDataPair b) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) int num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_maxAdrenaline.CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_maxAdrenaline); if (num == 0) { num = ByName(a, b); } return num; } private static int SortCape(RecipeDataPair a, RecipeDataPair b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_004f: Unknown result type (might be due to invalid IL or missing references) int num = ByArmor(a, b); if (num == 0) { num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.GetMaxDurability().CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.GetMaxDurability()); } if (num == 0) { num = ByName(a, b); } return num; } private static int SortShield(RecipeDataPair a, RecipeDataPair b) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) int num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.GetBaseBlockPower().CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.GetBaseBlockPower()); if (num == 0) { num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_timedBlockBonus.CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_timedBlockBonus); } if (num == 0) { num = ByName(a, b); } return num; } private static int ByArmor(RecipeDataPair a, RecipeDataPair b) { //IL_007b: 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) int num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.GetArmor().CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.GetArmor()); if (num == 0) { num = ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.GetMaxDurability().CompareTo(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.GetMaxDurability()); } if (num == 0) { num = ByName(a, b); } return num; } private static int ByTotalDamage(RecipeDataPair a, RecipeDataPair b) { return ((DamageTypes)(ref ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_damages)).GetTotalDamage().CompareTo(((DamageTypes)(ref ((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_damages)).GetTotalDamage()); } private static int ByName(RecipeDataPair a, RecipeDataPair b) { return Localization.instance.Localize(((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_name).CompareTo(Localization.instance.Localize(((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_name)); } private static int ByDefault(RecipeDataPair a, RecipeDataPair b) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) int num = ((RecipeDataPair)(ref a)).Recipe.m_listSortWeight.CompareTo(((RecipeDataPair)(ref b)).Recipe.m_listSortWeight); if (num == 0) { num = ((Enum)(ItemType)(ref ((RecipeDataPair)(ref b)).Recipe.m_item.m_itemData.m_shared.m_itemType)).CompareTo((object?)((RecipeDataPair)(ref a)).Recipe.m_item.m_itemData.m_shared.m_itemType); } if (num == 0) { num = ByName(a, b); } return num; } internal static void FilterRecipes(List<Recipe> recipes, bool inCraftTab, bool inUpradeTab) { tempEnabledStates.Clear(); int height = 0; foreach (FilteringPanel panel in panels) { int currentPosition = 0; panel.enabled = false; panel.enabledFilters = 0; if (IsCraftingFilterEnabled) { foreach (FilteringState state in panel.filters) { if (inCraftTab) { state.selectable = recipes.Any((Recipe recipe) => state.IsSelectable(recipe.m_item.m_itemData)); } else if (inUpradeTab) { state.selectable = recipes.Any((Recipe recipe) => state.IsSelectable(recipe.m_item.m_itemData) && recipe.m_item.m_itemData.m_shared.m_maxQuality > 1 && ((Humanoid)Player.m_localPlayer).GetInventory().GetItem(recipe.m_item.m_itemData.m_shared.m_name, -1, false) != null); } else { state.selectable = false; } state.enabled = state.enabled && state.selectable; state.UpdateSelectable(); if (state.enabled) { tempEnabledStates.Add(state); } state.UpdatePosition(ref currentPosition); if (state.selectable) { panel.enabledFilters++; panel.enabled = true; } } } if (panel.enabled) { panel.UpdatePosition(ref height); } panel.UpdateVisibility(); } tempUnfitItems.Clear(); tempUnfitItems.AddRange(from rec in recipes where !filteringStates.Any((FilteringState fs) => fs.IsSelectable(rec.m_item.m_itemData)) select rec.m_item.m_itemData.m_shared.m_name); if (tempEnabledStates.Count <= 0) { return; } recipes.RemoveAll(delegate(Recipe recipe) { bool flag = false; foreach (FilteringState tempEnabledState in tempEnabledStates) { if (tempEnabledState.filter(recipe.m_item.m_itemData)) { flag = true; break; } } return !flag; }); } internal static void SortRecipes() { if (tempEnabledStates.Count == 0) { return; } InventoryGui.instance.m_availableRecipes.Sort(delegate(RecipeDataPair a, RecipeDataPair b) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) foreach (FilteringState tempEnabledState in tempEnabledStates) { int num = tempEnabledState.sort(a, b); if (num != 0) { return num; } } return 0; }); SortAvailableRecipes(); } public static void SortAvailableRecipes() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < InventoryGui.instance.m_availableRecipes.Count; i++) { RecipeDataPair val = InventoryGui.instance.m_availableRecipes[i]; GameObject interfaceElement = ((RecipeDataPair)(ref val)).InterfaceElement; Transform obj = ((interfaceElement != null) ? interfaceElement.transform : null); RectTransform val2 = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (val2 != null) { val2.anchoredPosition = new Vector2(0f, (float)i * (0f - InventoryGui.instance.m_recipeListSpace)); } } } internal static void ClearPanels() { CollectionExtensions.Do<FilteringPanel>((IEnumerable<FilteringPanel>)panels, (Action<FilteringPanel>)delegate(FilteringPanel panel) { panel.ClearPanel(); }); } public static void CheckPanels() { InitSortingPanel(); UpdateVisibility(); } } internal static class HoldToFuel { [HarmonyPatch(typeof(Switch), "Interact")] public static class Switch_Interact_HoldToRepeat { public static bool Prefix() { return worker == null; } public static void Postfix(Switch __instance, Humanoid character, bool hold, bool __runOriginal) { if (MyLittleUI.hoverSmelterHoldToAddSeveral.Value && hold && __runOriginal && __instance.m_onUse != null) { Smelter componentInParent = ((Component)__instance).GetComponentInParent<Smelter>(); if (componentInParent != null) { worker = AddOnHold(__instance, componentInParent, character); ((MonoBehaviour)MyLittleUI.instance).StartCoroutine(worker); } } } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass3_0 { public Switch addOreFuelSwitch; public Smelter smelter; } [CompilerGenerated] private sealed class <AddOnHold>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Switch addOreFuelSwitch; public Smelter smelter; public Humanoid human; private <>c__DisplayClass3_0 <>8__1; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AddOnHold>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = default(<>c__DisplayClass3_0); <>1__state = -2; } private bool MoveNext() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1.addOreFuelSwitch = addOreFuelSwitch; <>8__1.smelter = smelter; <>2__current = (object)new WaitForSeconds(0.4f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Object.op_Implicit((Object)(object)<>8__1.smelter)) { worker = null; return false; } if (!<>8__1.smelter.m_nview.IsOwner()) { <>8__1.smelter.m_nview.ClaimOwnership(); <i>5__2 = 0; goto IL_0123; } break; case 2: <>1__state = -1; goto IL_0110; case 3: { <>1__state = -1; break; } IL_0110: <i>5__2++; goto IL_0123; IL_0123: if (<i>5__2 < 5) { if (!<>8__1.smelter.m_nview.IsOwner()) { <>2__current = wait; <>1__state = 2; return true; } goto IL_0110; } if (!Object.op_Implicit((Object)(object)<>8__1.smelter) || !<>8__1.smelter.m_nview.IsOwner()) { MyLittleUI.LogInfo($"Still not the owner: {<>8__1.smelter}"); worker = null; return false; } break; } if (ZInput.GetButtonPressedTimer("Use") >= 0.4f && Object.op_Implicit((Object)(object)<>8__1.smelter) && <AddOnHold>g__HaveRoomForOreFuel|3_0(ref <>8__1) && (Object)(object)((Humanoid)Player.m_localPlayer).GetHoverObject() == (Object)(object)((Component)<>8__1.addOreFuelSwitch).gameObject) { <>8__1.addOreFuelSwitch.m_onUse.Invoke(<>8__1.addOreFuelSwitch, human, (ItemData)null); MyLittleUI.LogInfo($"used {<>8__1.addOreFuelSwitch}"); <>2__current = wait; <>1__state = 3; return true; } worker = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly WaitForSeconds wait = new WaitForSeconds(0.1f); private const float delay = 0.4f; private static IEnumerator worker; [IteratorStateMachine(typeof(<AddOnHold>d__3))] public static IEnumerator AddOnHold(Switch addOreFuelSwitch, Smelter smelter, Humanoid human) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AddOnHold>d__3(0) { addOreFuelSwitch = addOreFuelSwitch, smelter = smelter, human = human }; } [CompilerGenerated] internal static bool <AddOnHold>g__HaveRoomForOreFuel|3_0(ref <>c__DisplayClass3_0 P_0) { return ((Object)(object)P_0.addOreFuelSwitch == (Object)(object)P_0.smelter.m_addOreSwitch && P_0.smelter.GetQueueSize() < P_0.smelter.m_maxOre) || ((Object)(object)P_0.addOreFuelSwitch == (Object)(object)P_0.smelter.m_addWoodSwitch && P_0.smelter.GetFuel() < (float)P_0.smelter.m_maxFuel); } } internal static class InfoBlocks { [HarmonyPatch(typeof(EnvMan), "UpdateTriggers")] public static class EnvMan_UpdateTriggers_UpdateDayTime { private static int Fraction(float dayFraction) { return (int)(dayFraction * (float)((MyLittleUI.clockTimeType.Value == MyLittleUI.ClockTimeType.Fuzzy && fuzzyTime != null && fuzzyTime.Length != 0) ? 40 : 1000)); } public static void Postfix(float oldDayFraction, float newDayFraction, Biome biome) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (MyLittleUI.modEnabled.Value && !((Object)(object)Player.m_localPlayer == (Object)null) && (int)biome != 0 && (Fraction(oldDayFraction) != Fraction(newDayFraction) || newDayFraction < oldDayFraction)) { UpdateClock(); } } } [HarmonyPatch(typeof(Hud), "Awake")] public static class Hud_Awake_AddInfoBlocks { [HarmonyAfter(new string[] { "Azumatt.MinimalUI", "org.bepinex.plugins.passivepowers" })] public static void Postfix(Hud __instance) { if (MyLittleUI.modEnabled.Value) { if (!Object.op_Implicit((Object)(object)__instance.m_rootObject.transform.Find("MyLittleUI_Parent"))) { AddInfoBlocks(__instance.m_rootObject.transform); InventoryPanel.AddBlock(parentObject); } UpdateVisibility(); } } } [HarmonyPatch(typeof(Hud), "OnDestroy")] public static class Hud_OnDestroy_Clear { public static void Postfix() { if (MyLittleUI.modEnabled.Value) { WeatherForecast.windList.Clear(); WeatherForecast.winds.Clear(); WeatherForecast.windsTransition.Clear(); parentObject = null; clockObject = null; clockDayObject = null; clockTimeObject = null; dayText = null; timeText = null; forecastObject = null; windsObject = null; windTemplate = null; windsProgress = null; windsProgressRect = null; windsObjectRect = null; weatherText = null; } } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class Player_OnSpawned_UpdateInfoBlocksVisibility { public static void Postfix() { if (MyLittleUI.modEnabled.Value) { UpdateVisibility(); } } } [HarmonyPatch(typeof(Minimap), "SetMapMode")] public static class Minimap_SetMapMode_UpdateInfoBlocksVisibility { public static void Postfix() { if (MyLittleUI.modEnabled.Value) { UpdateInfoBlocksVisibility(); } } } private const string objectRootName = "MyLittleUI_Parent"; private const string objectClockName = "Clock"; private const string objectClockDayName = "Day"; private const string objectClockTimeName = "Time"; private const string objectForecastName = "Forecast"; private const string objectForecastWeatherText = "weather_text"; private const string objectForecastWeatherIcon = "weather_icon"; private const string objectWindsName = "Winds"; private const string objectWindsTemplateName = "WindElement"; private const string objectWindsProgressName = "WindProgress"; public static GameObject parentObject; public static GameObject clockObject; public static GameObject clockDayObject; public static GameObject clockTimeObject; public static TMP_Text dayText; public static TMP_Text timeText; private static Image minimapBackground; private static Image clockBackground; private static Image forecastBackground; private static Image windsBackground; private static Image windsProgressBackground; public static GameObject forecastObject; public static GameObject windsObject; public static GameObject windTemplate; private static GameObject windsProgress; public static RectTransform windsProgressRect; public static RectTransform windsObjectRect; public static TMP_Text weatherText; public static Image weatherIcon; private static string[] fuzzyTime; private static void AddInfoBlocks(Transform parentTransform) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_007b: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_01ed: 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_0203: Expected O, but got Unknown //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)Minimap.instance?.m_biomeNameSmall)) { MyLittleUI.LogInfo("Minimap is not initialized, skipping clock init"); return; } parentObject = new GameObject("MyLittleUI_Parent", new Type[1] { typeof(RectTransform) }) { layer = MyLittleUI.layerUI }; parentObject.transform.SetParent(parentTransform, false); RectTransform component = parentObject.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; clockObject = new GameObject("Clock", new Type[1] { typeof(RectTransform) }) { layer = MyLittleUI.layerUI }; clockObject.transform.SetParent(parentObject.transform, false); UpdateDayTimeBackground(); clockDayObject = Object.Instantiate<GameObject>(((Component)Minimap.instance.m_biomeNameSmall).gameObject, clockObject.transform); ((Object)clockDayObject).name = "Day"; dayText = clockDayObject.GetComponent<TMP_Text>(); dayText.text = "Day 0"; dayText.textWrappingMode = (TextWrappingModes)0; dayText.verticalAlignment = (VerticalAlignmentOptions)512; clockTimeObject = Object.Instantiate<GameObject>(((Component)Minimap.instance.m_biomeNameSmall).gameObject, clockObject.transform); ((Object)clockTimeObject).name = "Time"; timeText = clockTimeObject.GetComponent<TMP_Text>(); timeText.text = "Time"; timeText.textWrappingMode = (TextWrappingModes)0; timeText.verticalAlignment =