Decompiled source of ZenUI v0.5.5
plugins\ZenUI.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using GUIFramework; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.PostProcessing; using UnityEngine.UI; using Zen.Config; using Zen.Lib; using Zen.Logging; using ZenUI.Compatibility; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ZenUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ZenUI")] [assembly: AssemblyCopyright("Copyright \ufffd 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ZenUI { [HarmonyPatch] internal static class AmmoCountIcon { private class ElementExtraData { [CompilerGenerated] private TMP_Text <text>P; [CompilerGenerated] private Image <icon>P; [CompilerGenerated] private Image <bait>P; public ItemData? Item; public ElementExtraData(TMP_Text text, Image icon, Image bait) { <text>P = text; <icon>P = icon; <bait>P = bait; base..ctor(); } public void UpdateState(ElementData elementData) { if (Item == null) { ((Component)<text>P).gameObject.SetActive(false); ((Component)<icon>P).gameObject.SetActive(false); ((Component)<bait>P).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); ((Component)<text>P).gameObject.SetActive(Configs.EnableAmmoCount.Value && num > 0); if (num > 0) { <text>P.SetText(num.ToString()); } Sprite val = ((currentAmmo != null) ? currentAmmo.GetIcon() : null); ((Component)<icon>P).gameObject.SetActive(Configs.EnableAmmoCount.Value && Object.op_Implicit((Object)(object)val)); if (Object.op_Implicit((Object)(object)val)) { <icon>P.overrideSprite = val; } ItemData currentBait = GetCurrentBait(); Sprite val2 = ((currentBait != null) ? currentBait.GetIcon() : null); ((Component)<bait>P).gameObject.SetActive(Object.op_Implicit((Object)(object)val2)); if (Object.op_Implicit((Object)(object)val2)) { <bait>P.overrideSprite = val2; } int num2 = ((currentBait != null) ? ((Humanoid)Player.m_localPlayer).GetInventory().CountItems(currentBait.m_shared.m_name, -1, true) : 0); if (num2 > 0 && !((Component)elementData.m_amount).gameObject.activeSelf) { ((Component)elementData.m_amount).gameObject.SetActive(true); elementData.m_amount.SetText(num2.ToString()); } } private ItemData? GetCurrentAmmo() { if (Item == null || Utility.IsNullOrWhiteSpace(Item.m_shared.m_ammoType) || IsBaitAmmo() || IsAmmo()) { return null; } ItemData ammoItem = ((Humanoid)Player.m_localPlayer).GetAmmoItem(); if (ammoItem == null || ammoItem.m_shared.m_ammoType != Item.m_shared.m_ammoType || !((Humanoid)Player.m_localPlayer).GetInventory().ContainsItem(ammoItem)) { ammoItem = ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(Item.m_shared.m_ammoType, (string)null); } return ammoItem; } private ItemData? GetCurrentBait() { if (Item == null || Utility.IsNullOrWhiteSpace(Item.m_shared.m_ammoType) || !IsBaitAmmo() || IsAmmo()) { return null; } ItemData ammoItem = ((Humanoid)Player.m_localPlayer).GetAmmoItem(); if (ammoItem == null || ammoItem.m_shared.m_ammoType != Item.m_shared.m_ammoType || !((Humanoid)Player.m_localPlayer).GetInventory().ContainsItem(ammoItem)) { ammoItem = ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(Item.m_shared.m_ammoType, (string)null); } return ammoItem; } private bool IsAmmo() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 ItemType? val = Item?.m_shared.m_itemType; if (val.HasValue) { ItemType valueOrDefault = val.GetValueOrDefault(); if ((int)valueOrDefault == 2 || (int)valueOrDefault == 9 || (int)valueOrDefault == 23) { return true; } } return false; } private bool IsBaitAmmo() { return Item?.m_shared.m_ammoType == "$item_fishingbait"; } } private static readonly Vector2 AmmoCountPosition = new Vector2(0f, 86f); private const int AmmoCountFontSize = 14; private const HorizontalAlignmentOptions AmmoCountAlignment = 2; private static readonly Vector2 AmmoIconPosition = new Vector2(0f, 40f); private static readonly Vector2 AmmoIconSize = new Vector2(-10f, -10f); private const string ObjectAmmoName = "ZenUI_AmmoAmount"; private const string ObjectIconName = "ZenUI_AmmoIcon"; private const string ObjectBaitName = "ZenUI_AmmoBait"; private static readonly Dictionary<HotkeyBar, bool> IsDirty = new Dictionary<HotkeyBar, bool>(); private static readonly Dictionary<HotkeyBar, Dictionary<ElementData, ElementExtraData>> ElementExtraDatas = new Dictionary<HotkeyBar, Dictionary<ElementData, ElementExtraData>>(); private static void UpdateVisibility(GameObject ammoCount, GameObject ammoIcon, GameObject ammoBait) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) ((RectTransform)ammoCount.transform).anchoredPosition = AmmoCountPosition; TMP_Text component = ammoCount.GetComponent<TMP_Text>(); component.fontSize = 14f; component.horizontalAlignment = (HorizontalAlignmentOptions)2; RectTransform val = (RectTransform)ammoIcon.transform; val.anchoredPosition = AmmoIconPosition; val.sizeDelta = AmmoIconSize; RectTransform val2 = (RectTransform)ammoBait.transform; val2.anchorMin = new Vector2(0.5f, 0f); val2.anchorMax = new Vector2(1f, 0.5f); foreach (HotkeyBar key in IsDirty.Keys) { IsDirty[key] = true; } } private static void AddCustomElementsToHotkeyPrefab(HotkeyBar bar) { if (Configs.EnableAmmoCount.Value) { Log.Info((object)"Adding Custom Elements", (ushort)0); GameObject elementPrefab = bar.m_elementPrefab; if (!Object.op_Implicit((Object)(object)elementPrefab)) { throw new NullReferenceException("HotkeyBar.m_elementPrefab is null, this should never happen"); } int num = elementPrefab.transform.Find("icon").GetSiblingIndex() + 1; Transform obj = elementPrefab.transform.Find("ZenUI_AmmoAmount"); GameObject val = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val == (Object)null) { GameObject gameObject = ((Component)elementPrefab.transform.Find("amount")).gameObject; val = Object.Instantiate<GameObject>(gameObject); ((Object)val).name = "ZenUI_AmmoAmount"; val.transform.SetSiblingIndex(num); val.SetActive(false); val.transform.SetParent(elementPrefab.transform); num++; FillFields(gameObject.transform, val.transform); } Transform obj2 = elementPrefab.transform.Find("ZenUI_AmmoIcon"); GameObject val2 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val2 == (Object)null) { GameObject gameObject2 = ((Component)elementPrefab.transform.Find("icon")).gameObject; val2 = Object.Instantiate<GameObject>(gameObject2); ((Object)val2).name = "ZenUI_AmmoIcon"; val2.transform.SetSiblingIndex(num); val2.SetActive(false); val2.transform.SetParent(elementPrefab.transform); num++; FillFields(gameObject2.transform, val2.transform); } Transform obj3 = elementPrefab.transform.Find("ZenUI_AmmoBait"); GameObject val3 = ((obj3 != null) ? ((Component)obj3).gameObject : null); if ((Object)(object)val3 == (Object)null) { GameObject gameObject3 = ((Component)elementPrefab.transform.Find("icon")).gameObject; val3 = Object.Instantiate<GameObject>(gameObject3); ((Object)val3).name = "ZenUI_AmmoBait"; val3.transform.SetSiblingIndex(num); val3.SetActive(false); val3.transform.SetParent(elementPrefab.transform); FillFields(gameObject3.transform, val3.transform); } UpdateVisibility(val, val2, val3); Log.Info((object)"Added custom elements to hotkey bar", (ushort)0); } } private static void FillFields(Transform source, Transform dest) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0011: Expected O, but got Unknown FillFields((RectTransform)source, (RectTransform)dest); } private static void FillFields(RectTransform rtSource, RectTransform rtDestination) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) rtDestination.anchoredPosition = rtSource.anchoredPosition; rtDestination.sizeDelta = rtSource.sizeDelta; } private static void UpdateDirtyState(HotkeyBar hotkeyBar) { if (GeneralExtensions.GetValueSafe<HotkeyBar, bool>(IsDirty, hotkeyBar)) { Log.Info((object)"HotkeyBar is dirty", (ushort)0); IsDirty[hotkeyBar] = false; if (hotkeyBar.m_elements.Count > 0) { hotkeyBar.UpdateIcons((Player)null); } } } private static void UpdateAmmoAndIcon(HotkeyBar hotkeyBar, Player player) { if (!ElementExtraDatas.ContainsKey(hotkeyBar)) { ElementExtraDatas.Add(hotkeyBar, new Dictionary<ElementData, ElementExtraData>()); } Dictionary<ElementData, ElementExtraData> dictionary = ElementExtraDatas[hotkeyBar]; if (!Object.op_Implicit((Object)(object)player) || ((Character)player).IsDead()) { dictionary.Clear(); return; } if (dictionary.Count != hotkeyBar.m_elements.Count) { dictionary.Clear(); } if (dictionary.Count > 0 && hotkeyBar.m_elements.Count > 0 && !dictionary.ContainsKey(hotkeyBar.m_elements[0])) { dictionary.Clear(); } if (dictionary.Count == 0) { foreach (ElementData element in hotkeyBar.m_elements) { Log.Info((object)"Get element data from Hotbar objects", (ushort)0); ElementExtraData value = new ElementExtraData(((Component)element.m_go.transform.Find("ZenUI_AmmoAmount")).GetComponent<TMP_Text>(), ((Component)element.m_go.transform.Find("ZenUI_AmmoIcon")).GetComponent<Image>(), ((Component)element.m_go.transform.Find("ZenUI_AmmoBait")).GetComponent<Image>()); dictionary.Add(element, value); } } int num = 0; foreach (ElementData element2 in hotkeyBar.m_elements) { ElementExtraData elementExtraData = dictionary[element2]; if (elementExtraData == null) { continue; } if (!element2.m_used || num > hotkeyBar.m_items.Count) { elementExtraData.Item = null; } else { elementExtraData.Item = hotkeyBar.m_items[num]; if ((Object)(object)elementExtraData.Item.GetIcon() != (Object)(object)element2.m_icon.sprite) { elementExtraData.Item = null; } num++; } elementExtraData.UpdateState(element2); } } [HarmonyPostfix] [HarmonyPatch(typeof(HotkeyBar), "OnEnable")] private static void HotkeyBar_OnEnable(HotkeyBar __instance) { if (Configs.EnableAmmoCount.Value) { AddCustomElementsToHotkeyPrefab(__instance); } } [HarmonyPriority(0)] [HarmonyBefore(new string[] { "Azumatt.AzuExtendedPlayerInventory" })] [HarmonyPrefix] [HarmonyPatch(typeof(HotkeyBar), "Update")] private static void HotkeyBar_Update(HotkeyBar __instance) { if (Configs.EnableAmmoCount.Value) { UpdateDirtyState(__instance); } } [HarmonyPriority(0)] [HarmonyAfter(new string[] { "Azumatt.AzuExtendedPlayerInventory" })] [HarmonyPostfix] [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] private static void HotkeyBar_UpdateIcons(HotkeyBar __instance, Player player) { if (Configs.EnableAmmoCount.Value) { UpdateAmmoAndIcon(__instance, player); } } } [HarmonyPatch] internal static class BiomeNotice { private const float BiomeMessageDelay = 3.5f; private const float BiomeMessageCooldown = 0f; private static float _lastBiomeMessageTime; private static void ShowBiomeMessage(Biome prevBiome = 0) { //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) if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } Timing.Delay((MonoBehaviour)(object)Player.m_localPlayer, 3.5f, (Action)delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Biome biome = EnvMan.instance.GetBiome(); if (biome == prevBiome) { Log.Info((object)$"Biome unchanged, skipping {biome}", (ushort)0); } else if (MessageHud.instance.m_biomeFoundQueue.Count > 0) { Log.Info((object)$"Biome message already queued, skipping {biome}", (ushort)0); } else if (Time.time < _lastBiomeMessageTime + 0f) { Log.Info((object)$"Biome message recently displayed, cooldown: {0f} skipping {biome}", (ushort)0); } else { Log.Info((object)$"Show biome messsage: {biome}", (ushort)0); MessageHud.instance.ShowBiomeFoundMsg("$biome_" + ((object)(Biome)(ref biome)).ToString().ToLower(), true); } }); } [HarmonyPostfix] [HarmonyPatch(typeof(Game), "SpawnPlayer")] private static void Game_SpawnPlayer(Game __instance, bool spawnValkyrie) { if (!spawnValkyrie && Configs.ShowBiomeNotice.Value.HasFlag(Configs.BiomeNoticeType.PlayerSpawn)) { ShowBiomeMessage((Biome)0); } } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "TeleportTo")] private static void Player_TeleportTo(Player __instance, bool distantTeleport, bool __result) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Player __instance2 = __instance; if (Configs.ShowBiomeNotice.Value.HasFlag(Configs.BiomeNoticeType.Teleport) && distantTeleport && __result) { Biome prevBiome = EnvMan.instance.GetBiome(); Timing.When((MonoBehaviour)(object)__instance2, (Func<bool>)(() => !((Character)__instance2).IsTeleporting()), (Action)delegate { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ShowBiomeMessage(prevBiome); }); } } [HarmonyPrefix] [HarmonyPatch(typeof(MessageHud), "ShowBiomeFoundMsg")] private static void MessageHud_ShowBiomeFoundMsg(ref bool __runOriginal) { if (Configs.ShowBiomeNotice.Value.HasFlag(Configs.BiomeNoticeType.Teleport)) { _lastBiomeMessageTime = Time.time; if (Player.m_localPlayer.ShowTeleportAnimation()) { __runOriginal = false; } } } } internal static class Configs { [Flags] public enum BiomeNoticeType { PlayerSpawn = 1, Teleport = 2 } public static readonly ConfigEntry<bool> EnableAmmoCount; public static readonly ConfigEntry<bool> RemoveLensDirt; public static readonly ConfigEntry<bool> AutoOpenSkillsPanel; public static readonly ConfigEntry<bool> EnableSlideAnimation; public static readonly ConfigEntry<bool> ColoredFoodBars; public static readonly ConfigEntry<bool> HideModdedText; public static readonly ConfigEntry<StringList> RemoveRichText; public static readonly ConfigEntry<BiomeNoticeType> ShowBiomeNotice; public static readonly ConfigEntry<bool> UseCraftingUI; public static readonly ConfigEntry<bool> UseCraftingUISearch; public static readonly ConfigEntry<bool> UseCraftingSearchResources; static Configs() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0133: Expected O, but got Unknown UseCraftingUI = Config.Define<bool>(false, "Crafting Panel", "Enable Panel", true, "Replace the vanilla crafting panel with a visual icon style with sorting and grouping. (vanilla: false)\r\n[logout required for changes to take effect]"); UseCraftingUISearch = Config.Define<bool>(false, "Crafting Panel", "Enable Search", true, "Enable the crafting panel search box, does not function without panel enabled."); UseCraftingSearchResources = Config.Define<bool>(false, "Crafting Panel", "Search Resource Requirements", true, "When searching the crafting panel, also search the recipe's resource requirements for matching items."); ShowBiomeNotice = Config.Define<BiomeNoticeType>(false, "General", "Show Biome Notification", BiomeNoticeType.PlayerSpawn | BiomeNoticeType.Teleport, "Show the biome notification on key events. (Vanilla: 0)\r\nPlayer login, ressurecetion, after teleport, first discovery, etc.\r\nTurning this off will not disable first discovery notifications.\r\nNOTE: Using this with BiomeObserver mod is probably overkill."); HideModdedText = Config.Define<bool>(false, "General", "Hide Modded Text On Title Screen", false, "Hide the modded text on the title screen.\r\n[restart required]"); EnableAmmoCount = Config.Define<bool>(true, "General", "Enable Ammo Count", true, "When true an icon and count appears on the hotbar with ammo type and count.\r\n[logout required]"); RemoveLensDirt = Config.Define<bool>(true, "General", "Remove Lens Dirt", true, "Remove the lens dirt from the camera.\r\n[logout required]"); AutoOpenSkillsPanel = Config.Define<bool>(false, "General", "Auto Open Skills Panel", false, "Automatically open the skills panel when the inventory is opened. (vanilla: false)\r\n[logout required]"); EnableSlideAnimation = Config.Define<bool>(false, "General", "Enable Slide Animation", true, "Enable the panel slide animation (vanilla: true)"); ColoredFoodBars = Config.Define<bool>(false, "General", "Colored Food Bars", true, "Colored food bars. (vanilla: false)\r\nTint the background of the food you ate based on the main property of the food: Health = red, stamina = yellow, blue = eitr"); StringList val = new StringList(); ((List<string>)val).Add("_RtD$"); RemoveRichText = Config.Define<StringList>(true, "General", "Remove Rich Text From Translations", val, "Comma separated list of regex patterns. Match against the translation keys. \r\nMatched keys have their translations stripped of rich text.\r\nSome mods add rich text tags like <color> to their translations.\r\nIn order to provide a consistant UI theme you can remove those tags from the translations of matched keys.\r\nIf you don't want to remove any tags then leave the list empty. (Default is to remove the rich text on RtD mods)\r\nIf you need help with regex patterns then check out https://regex101.com/ or ask an AI."); CraftingPanel.InitExplicitGroupConfigs(); } } [HarmonyPatch] internal static class CraftingPanel { internal enum CraftGroup { Everything, Weapons, Magic, Ammo, Armor, Shields, Tools, Equipment, Resources, Food, Trophy, Misc } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")] private static class InventoryGuiUpdateRecipeList { [UsedImplicitly] [HarmonyPriority(600)] private static void Prefix(InventoryGui __instance) { if (Configs.UseCraftingUI.Value && _isLeftPanelDirty) { ClearLeftPanel(); } } [UsedImplicitly] private static void Postfix(InventoryGui __instance) { if (Configs.UseCraftingUI.Value && __instance.InCraftTab()) { UpdateRecipeList(); } } } private const int GridWidth = 5; private const int GridHeightMin = 7; private static InventoryGrid _craftingGrid = null; private static RectTransform _leftPanel = null; private static RectTransform _rightPanel = null; private static ScrollRect _scrollRect = null; private static ScrollRectEnsureVisible _scrollRectEnsureVisible = null; private static CraftingStation? _currentStation; private static CraftGroup? _currentGroup; private static bool _isGroupChanged; private static bool _isLeftPanelDirty; private static List<RecipeDataPair> _sortedRecipes = new List<RecipeDataPair>(); private static readonly SortedDictionary<CraftGroup, List<RecipeDataPair>> GroupToRecipes = new SortedDictionary<CraftGroup, List<RecipeDataPair>>(); private static readonly Dictionary<Recipe, SortedSet<CraftGroup>> RecipeToGroups = new Dictionary<Recipe, SortedSet<CraftGroup>>(); private static readonly Dictionary<ItemData, RecipeDataPair> ItemRecipeData = new Dictionary<ItemData, RecipeDataPair>(); private static readonly Dictionary<CraftGroup, float> ScrollPositions = new Dictionary<CraftGroup, float>(); private static readonly SortedDictionary<CraftGroup, (string IconPrefabName, HashSet<ItemType> Types)> CraftGroups = new SortedDictionary<CraftGroup, (string, HashSet<ItemType>)> { { CraftGroup.Everything, ("Wisp", Enum.GetValues(typeof(ItemType)).Cast<ItemType>().ToHashSet()) }, { CraftGroup.Weapons, ("Battleaxe", new HashSet<ItemType> { (ItemType)3, (ItemType)14, (ItemType)4, (ItemType)22, (ItemType)20 }) }, { CraftGroup.Magic, ("StaffFireball", new HashSet<ItemType>()) }, { CraftGroup.Ammo, ("ArrowIron", new HashSet<ItemType> { (ItemType)9, (ItemType)23 }) }, { CraftGroup.Armor, ("HelmetCarapace", new HashSet<ItemType> { (ItemType)6, (ItemType)7, (ItemType)11, (ItemType)17 }) }, { CraftGroup.Shields, ("ShieldIronBuckler", new HashSet<ItemType> { (ItemType)5 }) }, { CraftGroup.Tools, ("PickaxeIron", new HashSet<ItemType> { (ItemType)19, (ItemType)15, (ItemType)18, (ItemType)16 }) }, { CraftGroup.Equipment, ("chest_hildir1", new HashSet<ItemType> { (ItemType)10 }) }, { CraftGroup.Resources, ("piece_chest_barrel", new HashSet<ItemType> { (ItemType)1 }) }, { CraftGroup.Food, ("CookedMeat", new HashSet<ItemType> { (ItemType)2, (ItemType)21 }) }, { CraftGroup.Trophy, ("TrophyDeer", new HashSet<ItemType> { (ItemType)13 }) }, { CraftGroup.Misc, ("BoneFragments", new HashSet<ItemType> { (ItemType)0 }) } }; private static readonly Dictionary<CraftGroup, HashSet<string>> ExplicitGroupAssignment = new Dictionary<CraftGroup, HashSet<string>> { { CraftGroup.Ammo, new HashSet<string> { "Catapult_ammo", "BombSiege" } }, { CraftGroup.Tools, new HashSet<string> { "Pickaxe*", "Scythe", "FishingRod", "Tankard*" } }, { CraftGroup.Resources, new HashSet<string> { "FishingBait*" } }, { CraftGroup.Magic, new HashSet<string> { "Staff*" } }, { CraftGroup.Food, new HashSet<string> { "Feast*" } } }; private static readonly HashSet<string> AllExplicitAssignmentPatterns = new HashSet<string>(); private static readonly HashSet<ItemType> AllKnownTypes = CraftGroups.Where<KeyValuePair<CraftGroup, (string, HashSet<ItemType>)>>((KeyValuePair<CraftGroup, (string IconPrefabName, HashSet<ItemType> Types)> kvp) => kvp.Key != CraftGroup.Everything).SelectMany<KeyValuePair<CraftGroup, (string, HashSet<ItemType>)>, ItemType>((KeyValuePair<CraftGroup, (string IconPrefabName, HashSet<ItemType> Types)> kvp) => kvp.Value.Types).ToHashSet(); private static CraftGroup FirstGroup(this SortedDictionary<CraftGroup, List<RecipeDataPair>> groupToRecipes) { return groupToRecipes.Groups().First(); } private static IEnumerable<CraftGroup> Groups(this SortedDictionary<CraftGroup, List<RecipeDataPair>> groupToRecipes) { if (groupToRecipes.Count != 2) { return groupToRecipes.Keys; } return groupToRecipes.Keys.Skip(1); } internal static void InitExplicitGroupConfigs() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown foreach (CraftGroup group2 in Enum.GetValues(typeof(CraftGroup))) { if (group2 != 0) { if (!ExplicitGroupAssignment.TryGetValue(group2, out HashSet<string> value)) { value = new HashSet<string>(); ExplicitGroupAssignment.Add(group2, value); } ConfigEntry<StringList> config = Config.Define<StringList>(true, "Crafting Group Assignment", group2.ToString(), new StringList((IEnumerable<string>)value), "Comma separated list of item prefab names explicitly assigned to this group.\r\nUse this to override the default groupings which are based on item type.\r\nThe prefix and suffix wildcard * is supported."); ExplicitGroupAssignment[group2] = ((IEnumerable<string>)config.Value).ToHashSet(); config.SettingChanged += delegate { UpdatePatterns(group2, ((IEnumerable<string>)config.Value).ToHashSet()); }; } } UpdateExplicitAssignmentPatterns(); static void UpdatePatterns(CraftGroup group, HashSet<string> patterns) { ExplicitGroupAssignment[group] = patterns; UpdateExplicitAssignmentPatterns(); } } private static void UpdateExplicitAssignmentPatterns() { AllExplicitAssignmentPatterns.Clear(); AllExplicitAssignmentPatterns.UnionWith(ExplicitGroupAssignment.Values.SelectMany((HashSet<string> set) => set)); } private static void Init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05a9: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; Reset(); _rightPanel = (RectTransform)((Transform)instance.m_crafting).Find("Decription"); _leftPanel = (RectTransform)((Transform)instance.m_crafting).Find("RecipeList"); Log.Info((object)"Resize the panels", (ushort)0); Log.Info((object)"Resize the crafting window", (ushort)0); RectTransform val = (RectTransform)((Component)instance.m_crafting).transform; Vector2 sizeDelta = val.sizeDelta; sizeDelta.y = 685f; val.sizeDelta = sizeDelta; Log.Info((object)"Resize the right panel", (ushort)0); RectTransform rightPanel = _rightPanel; sizeDelta = _rightPanel.sizeDelta; sizeDelta.y = 490f; rightPanel.sizeDelta = sizeDelta; Log.Info((object)"Resize the left panel", (ushort)0); RectTransform leftPanel = _leftPanel; sizeDelta = _leftPanel.sizeDelta; sizeDelta.y = 490f; leftPanel.sizeDelta = sizeDelta; Rect rect = instance.m_recipeListRoot.rect; instance.m_recipeListBaseSize = ((Rect)(ref rect)).height; GameObject obj = Object.Instantiate<GameObject>(((Component)instance.ContainerGrid).gameObject, (Transform)(object)_rightPanel); ((Object)obj).name = "ZenUI_CraftingGrid"; _craftingGrid = obj.GetComponent<InventoryGrid>(); Log.Info((object)"Setup the position defaults", (ushort)0); RectTransform val2 = (RectTransform)((Component)_craftingGrid).transform; val2.anchoredPosition = Vector2.zero; val2.anchorMax = Vector2.one; val2.anchorMin = Vector2.zero; val2.offsetMax = new Vector2(0f, -5f); val2.offsetMin = new Vector2(0f, -5f); val2.sizeDelta = Vector2.zero; val2.pivot = Vector2.one * 0.5f; Log.Info((object)"Setup the tooltip anchor", (ushort)0); RectTransform obj2 = Object.Instantiate<RectTransform>(instance.m_playerGrid.m_tooltipAnchor, (Transform)(object)instance.m_crafting, false); RectTransform val3 = (RectTransform)((Component)obj2).transform; ((Object)obj2).name = "TooltipAnchor"; val3.anchoredPosition = new Vector2(-1000f, 0f); _craftingGrid.m_tooltipAnchor = val3; Log.Info((object)"Setup the UIGroupHandler", (ushort)0); _craftingGrid.m_uiGroup = ((Component)instance.m_crafting).GetComponent<UIGroupHandler>(); Log.Info((object)"Setup the inventory for the grid", (ushort)0); _craftingGrid.m_inventory = new Inventory("$hud_crafting", (Sprite)null, 5, 7); Log.Info((object)"Setup event handlers", (ushort)0); InventoryGrid craftingGrid = _craftingGrid; craftingGrid.m_onSelected = (Action<InventoryGrid, ItemData, Vector2i, Modifier>)Delegate.Combine(craftingGrid.m_onSelected, new Action<InventoryGrid, ItemData, Vector2i, Modifier>(OnSelectedItem)); Log.Info((object)"Remove any original container grid elements from the new crafting grid that may have been there at the time of the clone.", (ushort)0); _craftingGrid.m_elements.Clear(); foreach (Transform item in (Transform)_craftingGrid.m_gridRoot) { Object.Destroy((Object)(object)((Component)item).gameObject); } Log.Info((object)"Clone the scrollbar", (ushort)0); GameObject val4 = Object.Instantiate<GameObject>(((Component)instance.ContainerGrid.m_scrollbar).gameObject, ((Component)_craftingGrid).transform, false); ((Object)val4).name = "ScrollBar"; RectTransform val5 = (RectTransform)val4.transform; val5.anchoredPosition = new Vector2(0f, 0f); val5.anchorMax = new Vector2(1f, 1f); val5.anchorMin = new Vector2(1f, 0f); val5.offsetMax = new Vector2(4f, 0f); val5.offsetMin = new Vector2(-4f, 0f); Log.Info((object)"Fixup the scrollbar", (ushort)0); _craftingGrid.m_scrollbar = val4.GetComponent<Scrollbar>(); _craftingGrid.m_scrollbar.handleRect = (RectTransform)val4.transform.Find("Sliding Area/Handle"); ((UnityEvent<float>)(object)_craftingGrid.m_scrollbar.onValueChanged).AddListener((UnityAction<float>)OnScrollChanged); Log.Info((object)"Reassign the ScrollRect area to point to this crafting grid", (ushort)0); _scrollRect = ((Component)_craftingGrid).GetComponent<ScrollRect>(); _scrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)1; _scrollRect.content = _craftingGrid.m_gridRoot; _scrollRect.verticalScrollbar = _craftingGrid.m_scrollbar; _scrollRect.scrollSensitivity = 10f; _scrollRectEnsureVisible = ((Component)_scrollRect).gameObject.AddComponent<ScrollRectEnsureVisible>(); Log.Info((object)"Move the crafting button down and to the left", (ushort)0); RectTransform val6 = (RectTransform)((Component)instance.m_craftButton).transform.parent; val6.anchoredPosition = new Vector2(-280f, -50f); val6.sizeDelta = new Vector2(-160f, 70f); Log.Info((object)"Resize the progress bar to fit the new button shape", (ushort)0); RectTransform val7 = (RectTransform)instance.m_craftProgressPanel; val7.anchoredPosition = Vector2.zero; sizeDelta = val7.offsetMax; sizeDelta.x = 0f; val7.offsetMax = sizeDelta; sizeDelta = val7.offsetMin; sizeDelta.x = 0f; val7.offsetMin = sizeDelta; sizeDelta = val7.sizeDelta; sizeDelta.x = 180f; val7.sizeDelta = sizeDelta; instance.m_craftProgressBar.SetWidth(180f); Log.Info((object)"Move the requirements panel down and align the right margin", (ushort)0); RectTransform val8 = (RectTransform)((Transform)instance.m_crafting).Find("Decription/requirements"); ((HorizontalOrVerticalLayoutGroup)ExposedGameObjectExtension.GetOrAddComponent<HorizontalLayoutGroup>(((Component)val8).gameObject)).spacing = 0f; val8.anchoredPosition = new Vector2(0f, -48f); val8.anchorMax = new Vector2(1f, 0f); val8.anchorMin = new Vector2(0f, 0f); sizeDelta = val8.sizeDelta; sizeDelta.x = 0f; val8.sizeDelta = sizeDelta; foreach (Transform item2 in (Transform)val8) { ((Behaviour)((Component)item2).GetComponent<Image>()).enabled = true; } Log.Info((object)"Move the repair button up to compensate for the resized crafting panel", (ushort)0); RectTransform val9 = (RectTransform)((Component)instance.m_repairButton).transform; sizeDelta = val9.anchoredPosition; sizeDelta.y = 185.5f; val9.anchoredPosition = sizeDelta; Log.Info((object)"Move the upgrade notice down to the bottom of the right panel", (ushort)0); RectTransform val10 = (RectTransform)instance.m_itemCraftType.transform; sizeDelta = val10.anchoredPosition; sizeDelta.y = 20f; val10.anchoredPosition = sizeDelta; } private static bool TryCurrentGroup(out CraftGroup group) { group = _currentGroup.GetValueOrDefault((CraftGroup)(-1)); return _currentGroup.HasValue; } private static void OnScrollChanged(float value) { if (TryCurrentGroup(out var group)) { ScrollPositions[group] = value; } } private static void ResetScrollPositions() { bool flag = ScrollPositions.Count == 0; foreach (CraftGroup value in Enum.GetValues(typeof(CraftGroup))) { if (flag) { ScrollPositions.Add(value, 1f); } else { ScrollPositions[value] = 1f; } } } private static void Reset() { _currentStation = null; _currentGroup = null; SelectItem(null); ResetScrollPositions(); } private static void ForceRefresh() { Reset(); InventoryGui.instance.UpdateCraftingPanel(false); } private static void UpdateCraftGroupRecipes() { //IL_004a: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) IEnumerable<RecipeDataPair> enumerable = InventoryGui.instance.m_availableRecipes.Where(CraftingPanelSearch.ApplySearchFilter); GroupToRecipes.Clear(); RecipeToGroups.Clear(); foreach (RecipeDataPair item in enumerable) { RecipeDataPair current = item; ItemData itemData = ((RecipeDataPair)(ref current)).Recipe.m_item.m_itemData; ItemType itemType = ItemDataExt.GetItemType(itemData); if (!AllKnownTypes.Contains(itemType)) { Log.Info((object)$"No known type: {itemType} for {ItemDataExt.GetPrefabName(itemData)}", (ushort)0); } AddRecipeToGroup(current, CraftGroup.Everything); bool flag = false; foreach (CraftGroup item2 in CraftGroups.Keys.Where((CraftGroup g) => g != CraftGroup.Everything)) { if (IsWildcardFound(ItemDataExt.GetPrefabName(itemData), AllExplicitAssignmentPatterns)) { if (IsAssignedExplicitly(item2, itemData)) { AddRecipeToGroup(current, item2); flag = true; } } else if (CraftGroups[item2].Types.Contains(itemType)) { AddRecipeToGroup(current, item2); flag = true; } } if (!flag) { AddRecipeToGroup(current, CraftGroup.Misc); } } static void AddRecipeToGroup(RecipeDataPair recipe, CraftGroup group) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) Log.Info((object)$"Add recipe: {ItemDataExt.GetPrefabName(((RecipeDataPair)(ref recipe)).Recipe.m_item)} to group: {group}", (ushort)0); if (!GroupToRecipes.ContainsKey(group)) { GroupToRecipes.Add(group, new List<RecipeDataPair>()); } GroupToRecipes[group].Add(recipe); if (!RecipeToGroups.ContainsKey(((RecipeDataPair)(ref recipe)).Recipe)) { RecipeToGroups.Add(((RecipeDataPair)(ref recipe)).Recipe, new SortedSet<CraftGroup>()); } RecipeToGroups[((RecipeDataPair)(ref recipe)).Recipe].Add(group); } static bool EndsWith(string pattern, string prefabName) { if (pattern.EndsWith("*")) { return prefabName.StartsWith(pattern.Substring(0, pattern.Length - 1)); } return false; } static bool IsAssignedExplicitly(CraftGroup group, ItemData item) { int num; if (ExplicitGroupAssignment.TryGetValue(group, out HashSet<string> value)) { num = (IsWildcardFound(ItemDataExt.GetPrefabName(item), value) ? 1 : 0); if (num != 0) { Log.Info((object)("Explicit item: " + ItemDataExt.GetPrefabName(item) + " in group " + group), (ushort)0); } } else { num = 0; } return (byte)num != 0; } static bool IsWildcardFound(string prefabName, HashSet<string> list) { string prefabName2 = prefabName; if (!list.Contains(prefabName2)) { return list.Any((string pattern) => StartsWith(pattern, prefabName2) || EndsWith(pattern, prefabName2)); } return true; } static bool StartsWith(string pattern, string prefabName) { if (pattern.StartsWith("*")) { return prefabName.EndsWith(pattern.Substring(1)); } return false; } } private static void UpdateGamepad() { //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (ZInput.IsGamepadActive() && InventoryGui.instance.InCraftTab() && GroupToRecipes.Count != 0 && _craftingGrid.m_uiGroup.IsActive) { if (ZInput.GetButtonDown("JoyLStickLeft")) { _craftingGrid.m_selected.x--; } if (ZInput.GetButtonDown("JoyLStickRight")) { _craftingGrid.m_selected.x++; } if (ZInput.GetButtonDown("JoyLStickUp")) { _craftingGrid.m_selected.y--; } if (ZInput.GetButtonDown("JoyLStickDown")) { _craftingGrid.m_selected.y++; } _craftingGrid.m_selected.x = Mathf.Clamp(_craftingGrid.m_selected.x, 0, _craftingGrid.m_width - 1); _craftingGrid.m_selected.y = Mathf.Clamp(_craftingGrid.m_selected.y, 0, _craftingGrid.m_height - 1); _craftingGrid.m_onSelected(_craftingGrid, _craftingGrid.GetGamepadSelectedItem(), _craftingGrid.m_selected, (Modifier)0); _scrollRectEnsureVisible.CenterOnItem(_craftingGrid.GetGamepadSelectedElement()); CraftGroup craftGroup = _currentGroup ?? GroupToRecipes.FirstGroup(); CraftGroup[] array = GroupToRecipes.Groups().ToArray(); Array.Sort(array); int num = Mathf.Max(0, Array.IndexOf(array, craftGroup)); if (ZInput.GetButtonDown("JoyDPadUp")) { craftGroup = array[Mathf.Max(num - 1, 0)]; } if (ZInput.GetButtonDown("JoyDPadDown")) { craftGroup = array[Mathf.Min(num + 1, array.Length - 1)]; } if (craftGroup != _currentGroup) { SelectGroup(craftGroup); } } } private static void UpdateGridUI() { _craftingGrid.UpdateGui((Player)null, (ItemData)null); int maxItems = _craftingGrid.GetInventory().NrOfItems(); foreach (var item4 in IEnumerableExt.WithIndex<Element>((IEnumerable<Element>)_craftingGrid.m_elements).Where<(Element, int)>(((Element Item, int Index) _, int i) => i < maxItems)) { Element item = item4.Item1; int item2 = item4.Item2; ItemData item3 = _craftingGrid.GetInventory().GetItem(item2); UpdateGridElement(item, item3); } } private static void UpdateGridElement(Element element, ItemData item) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_007b: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b6: 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_00d0: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) bool flag = ZoneSystem.instance.GetGlobalKey((GlobalKeys)19) || Player.m_localPlayer.NoCostCheat(); RecipeDataPair val = ItemRecipeData[item]; bool num = ((RecipeDataPair)(ref val)).CanCraft || flag; Color white = Color.white; Color val3; if (!num) { Color val2 = white * 0.4f; val2.a = 1f; val3 = val2; } else { val3 = white; } Color color = val3; Color val4; if (!num) { Color val2 = white * 0.7f; val2.a = 1f; val4 = val2; } else { val4 = white; } Color val5 = val4; Color val6; if (!num) { Color val2 = white * 0.6f; val2.a = 1f; val6 = val2; } else { val6 = white; } Color color2 = val6; ((Behaviour)element.m_equiped).enabled = IsSelectedItem(item); ((Graphic)element.m_icon).color = color; ((Graphic)element.m_amount).color = color2; Image food = element.m_food; ((Graphic)food).color = ((Graphic)food).color * val5; ((Behaviour)element.m_noteleport).enabled = false; if (!num) { ((Behaviour)element.m_quality).enabled = true; element.m_quality.rectTransform.pivot = new Vector2(0.5f, 0.5f); element.m_quality.rectTransform.anchorMin = new Vector2(0f, 0f); element.m_quality.rectTransform.anchorMax = new Vector2(0f, 1f); element.m_quality.rectTransform.offsetMin = new Vector2(15f, 0f); element.m_quality.rectTransform.offsetMax = new Vector2(0f, -3f); element.m_quality.text = "<color=#bb0000aa>X</color>"; } if (item.m_shared.m_maxStackSize > 1) { element.m_amount.text = $"x{item.m_stack}"; } } private static void UpdateGridData(CraftGroup? group) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) Log.Info((object)"Update grid data", (ushort)0); Inventory inventory = _craftingGrid.GetInventory(); inventory.m_inventory.Clear(); ItemRecipeData.Clear(); IEnumerable<RecipeDataPair> enumerable; if (!group.HasValue) { IEnumerable<RecipeDataPair> sortedRecipes = _sortedRecipes; enumerable = sortedRecipes; } else { enumerable = _sortedRecipes.Where((RecipeDataPair pair) => RecipeToGroups[((RecipeDataPair)(ref pair)).Recipe].Contains(group.Value)); } int num = 0; foreach (RecipeDataPair item in enumerable) { RecipeDataPair current = item; Recipe recipe = ((RecipeDataPair)(ref current)).Recipe; for (int i = 0; i < recipe.m_item.m_itemData.m_shared.m_icons.Length; i++) { ItemData val = recipe.m_item.m_itemData.Clone(); val.m_gridPos = new Vector2i(num % 5, num / 5); val.m_stack = recipe.m_amount; val.m_durability = val.GetMaxDurability(); val.m_variant = i; inventory.m_inventory.Add(val); ItemRecipeData.Add(val, current); Log.Debug((object)$"Item: {ItemDataExt.GetPrefabName(val)} Index: {num} Variant: {i} GridPos: {val.m_gridPos} Icons: {val.m_shared.m_icons.Length}", (ushort)0); num++; } } inventory.Changed(); inventory.m_height = Mathf.Max(7, Mathf.CeilToInt((float)inventory.NrOfItems() / 5f)); Log.Info((object)$"Inventory width: {inventory.m_width} height: {inventory.m_height}", (ushort)0); } private static void RestoreScrollPosition() { if (TryCurrentGroup(out var group)) { _scrollRect.verticalNormalizedPosition = ScrollPositions[group]; } } public static void Shutdown() { if (Object.op_Implicit((Object)(object)_craftingGrid)) { ActivateOnCopy.Shutdown(); CraftingPanelSearch.Shutdown(); Object.Destroy((Object)(object)((Component)_craftingGrid.m_scrollbar).gameObject); Object.Destroy((Object)(object)((Component)_craftingGrid.m_tooltipAnchor).gameObject); Object.Destroy((Object)(object)((Component)_craftingGrid).gameObject); } } private static bool ShowCraftingGrid(bool show) { Log.Debug((object)$"Show the crafting grid: {show}", (ushort)0); ((Component)_craftingGrid).gameObject.SetActive(show); Player localPlayer = Player.m_localPlayer; _currentStation = ((localPlayer != null) ? localPlayer.GetCurrentCraftingStation() : null); CraftingPanelSearch.Show(show); ShowVanillaUI(!show); return show; } private static void ShowVanillaUI(bool show) { Log.Debug((object)$"Show vanilla UI elements: {show}", (ushort)0); InventoryGui instance = InventoryGui.instance; ((Behaviour)((Component)instance.m_recipeDecription.transform.parent).GetComponent<Image>()).enabled = show; ((Component)instance.m_recipeDecription).gameObject.SetActive(show); ((Component)instance.m_recipeIcon).gameObject.SetActive(show); ((Component)instance.m_recipeName).gameObject.SetActive(show); ((Behaviour)instance.m_itemCraftType).enabled = show; } private static void ClearLeftPanel() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) Log.Info((object)"Clear left panel", (ushort)0); foreach (Transform item in (Transform)InventoryGui.instance.m_recipeListRoot) { Object.Destroy((Object)(object)((Component)item).gameObject); } _isLeftPanelDirty = false; } private static void UpdateCraftingGroupsUI() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown InventoryGui instance = InventoryGui.instance; _isLeftPanelDirty = true; UpdateGroupListSizeRect(GroupToRecipes.Count); ItemDrop val2 = default(ItemDrop); Piece val3 = default(Piece); foreach (var item2 in IEnumerableExt.WithIndex<CraftGroup>(GroupToRecipes.Groups())) { CraftGroup group = item2.Item1; int item = item2.Item2; GameObject val = Object.Instantiate<GameObject>(instance.m_recipeElementPrefab, (Transform)(object)instance.m_recipeListRoot); val.SetActive(true); ((Object)val).name = group.ToString(); ((RectTransform)val.transform).anchoredPosition = new Vector2(0f, (float)item * (0f - instance.m_recipeListSpace)); ((Component)val.transform.Find("name")).GetComponent<TMP_Text>().text = StringExt.Localize($"$CraftGroup_{group}"); Image component = ((Component)val.transform.Find("icon")).GetComponent<Image>(); GameObject prefab = ZNetScene.instance.GetPrefab(CraftGroups[group].IconPrefabName); if (prefab.TryGetComponent<ItemDrop>(ref val2)) { component.sprite = ItemDataExt.GetIcon(val2); } else if (prefab.TryGetComponent<Piece>(ref val3)) { component.sprite = val3.m_icon; } ((Component)val.transform.Find("Durability")).gameObject.SetActive(false); Transform obj = val.transform.Find("QualityLevel"); ((Component)obj).GetComponent<TMP_Text>().text = GroupToRecipes[group].Count.ToString(); ((Component)obj).gameObject.SetActive(false); ((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { SelectGroup(group); }); ((Component)val.transform.Find("selected")).gameObject.SetActive(((Object)val).name == _currentGroup.ToString()); } } private static void UpdateGroupListSizeRect(int count) { InventoryGui instance = InventoryGui.instance; instance.m_recipeListRoot.SetSizeWithCurrentAnchors((Axis)1, Mathf.Max(instance.m_recipeListBaseSize, (float)count * instance.m_recipeListSpace)); } private static void SortCraftingGroupRecipes() { if (GroupToRecipes.Count == 0) { _sortedRecipes = new List<RecipeDataPair>(); return; } Log.Info((object)"Sort crafting group recipes", (ushort)0); _sortedRecipes = GroupToRecipes[CraftGroup.Everything].OrderBy(CraftGroupOrder).ThenBy(SkillTypeOrder).ThenBy(ItemTypeOrder) .ThenBy(AnimationOrder) .ThenBy(ItemTypeDamageOrder) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.GetBaseBlockPower()) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_deflectionForce) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.GetArmor()) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.GetFoodType()) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_food + ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_foodStamina + ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_foodEitr) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_consumeStatusEffect?.m_category) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_attackStatusEffect?.m_category) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_equipStatusEffect?.m_category) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_item.m_itemData.m_shared.m_teleportable) .ThenBy(delegate(RecipeDataPair data) { CraftingStation craftingStation = ((RecipeDataPair)(ref data)).Recipe.m_craftingStation; return ((craftingStation != null) ? craftingStation.GetHoverName() : null) ?? string.Empty; }) .ThenBy((RecipeDataPair data) => StringExt.Localize(ItemDataExt.GetName(((RecipeDataPair)(ref data)).Recipe.m_item))) .ThenBy((RecipeDataPair data) => ((RecipeDataPair)(ref data)).Recipe.m_amount) .ToList(); static string AnimationOrder(RecipeDataPair recipeData) { return ((RecipeDataPair)(ref recipeData)).Recipe.m_item.m_itemData.m_shared.m_attack.m_attackAnimation; } static CraftGroup CraftGroupOrder(RecipeDataPair recipeData) { return RecipeToGroups[((RecipeDataPair)(ref recipeData)).Recipe].First((CraftGroup g) => g != CraftGroup.Everything); } static string ItemTypeDamageOrder(RecipeDataPair recipeData) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) float num = default(float); DamageType majorityDamageType = ((DamageTypes)(ref ((RecipeDataPair)(ref recipeData)).Recipe.m_item.m_itemData.m_shared.m_damages)).GetMajorityDamageType(ref num); return $"{majorityDamageType}_{num:00000}"; } static ItemType ItemTypeOrder(RecipeDataPair recipeData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return ItemDataExt.GetItemType(((RecipeDataPair)(ref recipeData)).Recipe.m_item.m_itemData); } static float SkillTypeOrder(RecipeDataPair recipeData) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) SkillType skillType = ((RecipeDataPair)(ref recipeData)).Recipe.m_item.m_itemData.m_shared.m_skillType; if ((int)skillType == 11) { return 0.5f; } if ((int)skillType == 14) { return 8.5f; } return (float)skillType; } } private static void SelectGroup(CraftGroup? group) { Log.Info((object)$"Selected group: {group}", (ushort)0); if (_currentGroup != group || !group.HasValue) { SelectItem(null); } _isGroupChanged = true; _currentGroup = group; UpdateGridData(group); RectTransform recipeListRoot = InventoryGui.instance.m_recipeListRoot; for (int i = 0; i < ((Transform)recipeListRoot).childCount; i++) { Transform child = ((Transform)recipeListRoot).GetChild(i); ((Component)child.Find("selected")).gameObject.SetActive(((Object)child).name == group.ToString()); } } private static bool IsSelectedItem(ItemData item) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; if (!Object.op_Implicit((Object)(object)((RecipeDataPair)(ref instance.m_selectedRecipe)).Recipe)) { return false; } Recipe recipe = ((RecipeDataPair)(ref instance.m_selectedRecipe)).Recipe; RecipeDataPair val = ItemRecipeData[item]; if ((Object)(object)recipe == (Object)(object)((RecipeDataPair)(ref val)).Recipe) { return instance.m_selectedVariant == item.m_variant; } return false; } private static void OnSelectedItem(InventoryGrid grid, ItemData? item, Vector2i pos, Modifier modifier) { SelectItem(item); } internal static void SelectItem(ItemData? item) { //IL_0033: 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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Log.Debug((object)("Selected Item: " + ((item != null) ? ItemDataExt.GetPrefabName(item) : null)), (ushort)0); InventoryGui.instance.m_selectedRecipe = (RecipeDataPair)((item == null) ? default(RecipeDataPair) : ItemRecipeData[item]); InventoryGui.instance.m_selectedVariant = item?.m_variant ?? 0; } [HarmonyPrefix] [HarmonyPatch(typeof(Game), "Start")] internal static void Game_Start() { if (Configs.UseCraftingUI.Value) { Init(); CraftingPanelSearch.Init(); } } [HarmonyPostfix] [HarmonyPatch(typeof(InventoryGui), "OnDestroy")] private static void InventoryGui_OnDestroy(InventoryGui __instance) { if (Configs.UseCraftingUI.Value) { Shutdown(); } } internal static void UpdateRecipeList() { Log.Info((object)"Update Recipe List", (ushort)0); ClearLeftPanel(); UpdateCraftGroupRecipes(); SortCraftingGroupRecipes(); SelectDefaultGroup(); UpdateCraftingGroupsUI(); } private static void SelectDefaultGroup() { bool flag = (Object)(object)_currentStation != (Object)(object)Player.m_localPlayer.GetCurrentCraftingStation(); if (GroupToRecipes.Count == 0) { ResetScrollPositions(); SelectGroup(null); } else if (flag || (!_currentGroup.HasValue && GroupToRecipes.Count > 0)) { ResetScrollPositions(); SelectGroup(GroupToRecipes.FirstGroup()); SelectItem(null); } else { SelectGroup(_currentGroup); } } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "Update")] private static void InventoryGui_Update(InventoryGui __instance) { if (Configs.UseCraftingUI.Value && InventoryGui.IsVisible() && Object.op_Implicit((Object)(object)_craftingGrid) && ShowCraftingGrid(InventoryGui.instance.InCraftTab())) { UpdateGamepad(); UpdateGridUI(); if (_isGroupChanged) { RestoreScrollPosition(); } _isGroupChanged = false; } } [HarmonyPostfix] [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] private static void InventoryGui_UpdateRecipe_Postfix(InventoryGui __instance) { if (Configs.UseCraftingUI.Value) { ((Component)__instance.m_variantButton).gameObject.SetActive(false); } } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "SetRecipe")] private static void InventoryGui_SetRecipe(InventoryGui __instance, ref bool __runOriginal) { if (Configs.UseCraftingUI.Value) { __runOriginal = !__instance.InCraftTab(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "ToggleNoPlacementCost")] private static void Player_ToggleNoPlacementCost(Player __instance) { if (Configs.UseCraftingUI.Value) { ForceRefresh(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "ResetCharacterKnownItems")] private static void Player_ResetCharacterKnownItems(Player __instance) { if (Configs.UseCraftingUI.Value) { ForceRefresh(); } } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "Awake")] [HarmonyPriority(800)] private static void InventoryGui_Awake(InventoryGui __instance) { if (Configs.UseCraftingUI.Value) { ActivateOnCopy.Add((MonoBehaviour)(object)__instance.m_recipeDecription); ActivateOnCopy.Add((MonoBehaviour)(object)__instance.m_recipeIcon); ActivateOnCopy.Add((MonoBehaviour)(object)__instance.m_recipeName); ActivateOnCopy.IsSetupComplete = true; } } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGrid), "CreateItemTooltip")] private static void InventoryGrid_CreateItemTooltip(InventoryGrid __instance, ItemData item, UITooltip tooltip, ref bool __runOriginal) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (Configs.UseCraftingUI.Value && !((Object)(object)__instance != (Object)(object)_craftingGrid)) { RecipeDataPair val = ItemRecipeData[item]; if (((RecipeDataPair)(ref val)).Recipe.m_requireOnlyOneIngredient) { __runOriginal = false; string tooltip2 = item.GetTooltip(-1); tooltip2 += StringExt.Localize("\n\n<color=orange>$inventory_onlyoneingredient</color>"); tooltip.Set(item.m_shared.m_name, tooltip2, __instance.m_tooltipAnchor, default(Vector2)); } } } } [HarmonyPatch] internal static class CraftingPanelSearch { private const float FieldWidth = 150f; private const float FieldHeight = 28f; private static GuiInputField _search = null; private static string[] _searchFilters = Array.Empty<string>(); private static bool IsConfigValid { get { if (Configs.UseCraftingUI.Value) { return Configs.UseCraftingUISearch.Value; } return false; } } internal static void Init() { //IL_0088: 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_00b2: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) RectTransform crafting = InventoryGui.instance.m_crafting; GameObject obj = Object.Instantiate<GameObject>(((Component)TextInput.instance.m_inputField).gameObject, (Transform)(object)crafting); ((Object)obj).name = "ZenUI_Search"; _search = obj.GetComponent<GuiInputField>(); _search.VirtualKeyboardTitle = "$menu_filter"; ((Component)((Component)_search).transform.Find("Text Area/Placeholder")).GetComponent<TMP_Text>().SetText(StringExt.Localize("$menu_filter")); ((TMP_InputField)_search).restoreOriginalTextOnEscape = false; RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(150f, 28f); component.anchoredPosition = new Vector2(200f, -82f); component.pivot = Vector2.one * 0.5f; ((UnityEvent<string>)(object)((TMP_InputField)_search).onValueChanged).AddListener((UnityAction<string>)delegate { ApplySoundFx(); UpdateSearchFilter(); UpdateCraftingPanel(); }); ResetSearchFilter(); } internal static void Shutdown() { Object.Destroy((Object)(object)((Component)_search).gameObject); } internal static void Show(bool show) { ((Component)_search).gameObject.SetActive(show && IsConfigValid && !ZInput.IsGamepadActive()); } private static void UpdateSearchFilter() { Log.Info((object)("Update search filter: '" + ((TMP_InputField)_search).text + "'"), (ushort)0); _searchFilters = ((TMP_InputField)_search).text.ToLower().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } private static void ResetSearchFilter() { Log.Info((object)"Resetting search filter", (ushort)0); ((TMP_InputField)_search).text = string.Empty; UpdateSearchFilter(); } internal static bool ApplySearchFilter(RecipeDataPair recipeDataPair) { if (_searchFilters.Length == 0) { return true; } Recipe recipe = ((RecipeDataPair)(ref recipeDataPair)).Recipe; bool value = Configs.UseCraftingSearchResources.Value; if (!IsItemFiltered(recipe.m_item)) { if (value) { return recipe.m_resources.Any((Requirement req) => req.m_amount > 0 && IsItemFiltered(req.m_resItem)); } return false; } return true; static bool IsItemFiltered(ItemDrop item) { return StringExt.Localize(ItemDataExt.GetName(item.m_itemData)).ToLower().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries) .Any((string word) => _searchFilters.Any(word.StartsWith)); } } private static void ApplySoundFx() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) InventoryGui.instance.m_moveItemEffects.Create(((Component)Player.m_localPlayer).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } private static void UpdateCraftingPanel() { CraftingPanel.UpdateRecipeList(); CraftingPanel.SelectItem(null); } [HarmonyPostfix] [HarmonyPatch(typeof(InventoryGui), "Show")] private static void InventoryGui_Show() { if (IsConfigValid) { ResetSearchFilter(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Chat), "HasFocus")] private static void Chat_HasFocus(ref bool __result) { if (IsConfigValid && Object.op_Implicit((Object)(object)_search) && ((TMP_InputField)_search).isFocused) { __result = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] private static void InventoryGui_UpdateRecipe() { if (!IsConfigValid) { return; } if (((TMP_InputField)_search).isFocused) { if (ZInput.GetButtonDown("Chat") || ZInput.GetButtonDown("Block") || ZInput.GetButtonDown("Console") || ZInput.GetButtonDown("Escape") || ZInput.GetButtonDown("Inventory")) { ((TMP_InputField)_search).DeactivateInputField(false); } } else if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible() && ZInput.GetButtonDown("Chat")) { _search.ActivateInputField(); } } } [HarmonyPatch] internal static class FoodPanel { internal enum FoodType { Default, Health, Stamina, Eitr } private static readonly List<(Image Background, Image? Border)> FoodPanelUIs = new List<(Image, Image)>(); private static readonly Color DefaultColor; private static readonly Color DefaultColorAuga; private static readonly Color HealthColor; private static readonly Color HealthColorAuga; private static readonly Color StaminaColor; private static readonly Color StaminaColorAuga; private static readonly Color EitrColor; private static readonly Color EitrColorAuga; private static bool _isAugaLite; internal static FoodType GetFoodType(this ItemData foodItem) { SharedData shared = foodItem.m_shared; float food = shared.m_food; float foodStamina = shared.m_foodStamina; float foodEitr = shared.m_foodEitr; if (food < foodEitr / 2f && foodStamina < foodEitr / 2f) { return FoodType.Eitr; } if (foodStamina < food / 2f) { return FoodType.Health; } if (food < foodStamina / 2f) { return FoodType.Stamina; } return FoodType.Default; } private static void SetFoodPanelColor(List<Food> foods, int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) (Image, Image) ui = FoodPanelUIs[index]; if (!Configs.ColoredFoodBars.Value || index > foods.Count - 1) { ApplyColor(ui, DefaultColor, DefaultColorAuga); return; } switch (foods[index].m_item.GetFoodType()) { case FoodType.Default: ApplyColor(ui, DefaultColor, DefaultColorAuga); break; case FoodType.Health: ApplyColor(ui, HealthColor, HealthColorAuga); break; case FoodType.Stamina: ApplyColor(ui, StaminaColor, StaminaColorAuga); break; case FoodType.Eitr: ApplyColor(ui, EitrColor, EitrColorAuga); break; default: throw new ArgumentOutOfRangeException(); } } private static void ApplyColor((Image Background, Image? Border) ui, Color background, Color border) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) ((Graphic)ui.Background).color = background; if (_isAugaLite) { ((Graphic)ui.Border).color = border; } } [HarmonyPostfix] [HarmonyPatch(typeof(Game), "Start")] internal static void Game_Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown _isAugaLite = Chainloader.PluginInfos.ContainsKey("ZenDragon.AugaLite"); if (_isAugaLite) { Log.Info((object)"AugaLite detected", (ushort)0); { foreach (Transform item in Hud.instance.m_rootObject.transform) { Transform val = item; if (((Object)val).name.StartsWith("FoodPanel")) { Log.Info((object)("Get reference to " + ((Object)val).name + " background and border images"), (ushort)0); Image component = ((Component)val.Find("IconBG")).GetComponent<Image>(); Image component2 = ((Component)val.Find("IconBG/Countdown")).GetComponent<Image>(); FoodPanelUIs.Add((component, component2)); } } return; } } Image[] foodIcons = Hud.instance.m_foodIcons; foreach (Image val2 in foodIcons) { Log.Info((object)("Get reference to " + ((Object)val2).name + " parent image (background)"), (ushort)0); Image component3 = ((Component)((Component)val2).transform.parent).GetComponent<Image>(); FoodPanelUIs.Add((component3, null)); } } [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "UpdateFood")] private static void Hud_UpdateFood(Hud __instance, Player player) { if (FoodPanelUIs.Count != 0) { List<Food> foods = player.GetFoods(); for (int i = 0; i < FoodPanelUIs.Count; i++) { SetFoodPanelColor(foods, i); } } } [HarmonyPostfix] [HarmonyPatch(typeof(Game), "OnDestroy")] private static void Game_OnDestroy() { Log.Info((object)"FoodPanel: OnDestroy called, clearing references to UI elements", (ushort)0); FoodPanelUIs.Clear(); } static FoodPanel() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) Color black = Color.black; black.a = 0.5f; DefaultColor = black; DefaultColorAuga = new Color(0.44f, 0.4f, 0.34f, 1f); HealthColor = new Color(1f, 0.5f, 0.5f, 0.4f); HealthColorAuga = new Color(0.6784f, 0.0863f, 0.0863f, 0.5f); StaminaColor = new Color(1f, 1f, 0.5f, 0.2f); StaminaColorAuga = new Color(0.9176f, 0.6588f, 0f, 0.5f); EitrColor = new Color(0.6f, 0.6f, 1f, 0.5f); EitrColorAuga = new Color(0.6118f, 0.3529f, 0.8118f, 0.5f); } } internal static class ItemIcon { private static class Configs { private static readonly Color SelectGridActivatedColorBlue; private static readonly Color SelectMenuActivatedColorOrange; public static readonly ConfigEntry<Color> ItemActivatedColor; public static readonly ConfigEntry<Color> ItemActivatedHotbarColor; public static readonly ConfigEntry<Color> DurabilityGood; public static readonly ConfigEntry<Color> DurabilityWorn; public static readonly ConfigEntry<Color> DurabilityAtRisk; public static readonly ConfigEntry<Color> DurabilityBroken; public static readonly ConfigEntry<bool> ShowQualityAsSymbols; public static readonly ConfigEntry<bool> Rotate90Degrees; public static readonly ConfigEntry<Color> ItemQualitySymbolColor; public static readonly ConfigEntry<string> ExtraQualityLevelSym; static Configs() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01be: Unknown result type (might be due to invalid IL or missing references) SelectGridActivatedColorBlue = new Color(0.376f, 0.66f, 0.897f, 0.761f); SelectMenuActivatedColorOrange = new Color(0.7574f, 0.5042f, 0.1838f, 1f); ItemActivatedColor = Config.Define<Color>(true, "Active Item", "Activated Color", SelectMenuActivatedColorOrange, $"Background color when the item is activated (equipped / selected)\r\nVanilla blue color: {SelectGridActivatedColorBlue}\r\nMenu orange color: {SelectMenuActivatedColorOrange}"); ItemActivatedHotbarColor = Config.Define<Color>(true, "Active Item", "Activated Color - Hotbar", new Color(0.35f, 0.35f, 0.35f, 0.55f), $"Background color when the item is activated on the hotbar.\r\nVanilla blue color: {SelectGridActivatedColorBlue}\r\nMenu orange color: {SelectMenuActivatedColorOrange}"); Color green = Color.green; green.a = 0.2f; DurabilityGood = Config.Define<Color>(true, "Item Durability Bars", "Durability Good", green, "Durability bar color when durability is good"); green = Color.yellow; green.a = 0.5f; DurabilityWorn = Config.Define<Color>(true, "Item Durability Bars", "Durability Worn", green, "Durability bar color when durability is worn"); green = Color.red; green.a = 0.7f; DurabilityAtRisk = Config.Define<Color>(true, "Item Durability Bars", "Durability At Risk", green, "Durability bar color when durability is at risk of breaking"); DurabilityBroken = Config.Define<Color>(true, "Item Durability Bars", "Durability Broken", Color.gray, "Durability bar color when item is broken"); ShowQualityAsSymbols = Config.Define<bool>(true, "Item Quality Symbols", "Show Quality As Symbols", true, "Item quality is shown as symbols instead of numbers on the inventory grid."); Rotate90Degrees = Config.Define<bool>(true, "Item Quality Symbols", "Rotate Symbols 90 Degrees", false, "The quality symbols are rotated 90 degrees to display them vertically instead of horizontally. This is only used if Show Quality As Symbols is enabled."); green = UIColor.LightYellow.Color; green.a = 0.6f; ItemQualitySymbolColor = Config.Define<Color>(true, "Item Quality Symbols", "Symbol Color", green, "Color of the item quality symbols"); ExtraQualityLevelSym = Config.Define<string>(true, "Item Quality Symbols", "Extra Level Symbols", "★", "The sequence of symbols used to display the quality level. The first symbol is always the dots and can not be changed.\r\nEach symbol adds 4 levels. Preconfigured with 1 symobl so 8 levels supported: Vanilla 4 + 1 symbol x 4 more levels.\r\nSo if you wanted to add 8 more levels for a total of 12 levels (4 + 8), you would add 2 more symbols to the end of the sequence.\r\nHere are some extra symbols you can try. Not all unicode works, These are known to work: ★✽◈⚡▲\r\nExample: ★▲ would be 4 vanilla levels + 4 more levels for ★ + 4 more levels for ▲\r\nNOTE: If your item level exceeds this value it will be displayed as a number instead of a symbol."); } } [HarmonyPatch(typeof(InventoryGrid), "UpdateGui")] private class InventoryGrid_UpdateGui_DurabilityAndScale { private static bool HideEquipmentSlotsQuality(InventoryGrid grid, ItemData item) { if (!(((Object)grid).name == "EquipmentSlotGrid")) { return item.m_quality < 2; } return true; } [UsedImplicitly] private static void Postfix(InventoryGrid __instance, Inventory ___m_inventory, List<Element> ___m_elements) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) int width = ___m_inventory.GetWidth(); foreach (ItemData allItem in ___m_inventory.GetAllItems()) { int num = allItem.m_gridPos.y * width + allItem.m_gridPos.x; if (0 <= num && num < ___m_elements.Count) { Element val = ___m_elements[num]; UpdateItemIcon(val.m_durability, val.m_icon, val.m_equiped, Configs.ItemActivatedColor.Value); if (HideEquipmentSlotsQuality(__instance, allItem)) { val.m_quality.SetText(""); } else { UpdateItemQuality(val.m_quality, allItem.m_quality); } } } } } [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] private class HotkeyBar_UpdateIcons_DurabilityAndScale { [HarmonyPriority(0)] private static void Postfix(HotkeyBar __instance, Player player) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)player) || ((Character)player).IsDead()) { return; } foreach (ElementData element in __instance.m_elements) { Image component = element.m_equiped.GetComponent<Image>(); UpdateItemIcon(element.m_durability, element.m_icon, component, Configs.ItemActivatedHotbarColor.Value); } } } private const float ItemQualitySymbolSizeDots = 14f; private const float ItemQualitySymbolSizeEtc = 12f; private const float ItemQualityLineSpacing = -35f; private const float ItemQualityCharacterSpacing = 8f; private static Color _itemEquippedColorOriginal; private const int MaxDots = 4; private const char Dot = '*'; private static char _maxQualitySymbol; private static string[] _itemQualitySymbols; static ItemIcon() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) _itemEquippedColorOriginal = Color.clear; _itemQualitySymbols = CreateQualityStars(out _maxQualitySymbol); Configs.ExtraQualityLevelSym.SettingChanged += OnQualitySymLevelChanged; } private static void OnQualitySymLevelChanged(object? sender, EventArgs e) { Log.Message((object)"Refreshing the item quality symbols", (ushort)0); _itemQualitySymbols = CreateQualityStars(out _maxQualitySymbol); } private static string[] CreateQualityStars(out char maxQualitySym) { string text = "*" + Configs.ExtraQualityLevelSym.Value; maxQualitySym = text[text.Length - 1]; List<string> list = new List<string> { string.Empty }; string text2 = text; for (int i = 0; i < text2.Length; i++) { char c = text2[i]; for (int j = 0; j < 4; j++) { list.Add(c + new string('*', j)); } } foreach (var item in IEnumerableExt.WithIndex<string>((IEnumerable<string>)list)) { Log.Info((object)$"{item.Item2:D2}: {item.Item1}", (ushort)0); } Log.Message((object)$"Max item quality level: {list.Count - 1} (overflow is allowed)", (ushort)0); return list.ToArray(); } private static void UpdateItemIcon(GuiBar durability, Image icon, Image equipped, Color equipColor) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_001a: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) //IL_00a1: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)equipped)) { if (_itemEquippedColorOriginal == Color.clear) { _itemEquippedColorOriginal = ((Graphic)equipped).color; } if (equipColor != Color.clear) { ((Graphic)equipped).color = equipColor; } else if (_itemEquippedColorOriginal != Color.clear) { ((Graphic)equipped).color = _itemEquippedColorOriginal; } } if (!Object.op_Implicit((Object)(object)durability)) { return; } if (!Object.op_Implicit((Object)(object)durability.m_barImage) && Object.op_Implicit((Object)(object)durability.m_bar)) { durability.m_barImage = ((Component)durability.m_bar).GetComponent<Image>(); } float smoothValue = durability.GetSmoothValue(); if (smoothValue >= 1f) { if (durability.GetColor() == Color.red) { durability.SetColor(Configs.DurabilityBroken.Value); } else if (durability.GetColor() != Color.clear) { ((Component)durability).gameObject.SetActive(false); } } else if (smoothValue >= 0.75f) { durability.SetColor(Configs.DurabilityGood.Value); } else if (smoothValue >= 0.5f) { durability.SetColor(Configs.DurabilityWorn.Value); } else if (smoothValue > 0f) { durability.SetColor(Configs.DurabilityAtRisk.Value); } else { durability.SetColor(Configs.DurabilityBroken.Value); } } private static void UpdateItemQuality(TMP_Text uiElement, int quality) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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) if (!((Behaviour)uiElement).enabled) { return; } if (quality < 0) { uiElement.text = string.Empty; return; } string text = $"{quality}{_maxQualitySymbol}"; string text2 = ((quality < _itemQualitySymbols.Length && Configs.ShowQualityAsSymbols.Value) ? _itemQualitySymbols[quality] : text); if (!(uiElement.text == text2)) { uiElement.text = text2; uiElement.textWrappingMode = (TextWrappingModes)3; ((Graphic)uiElement).color = Configs.ItemQualitySymbolColor.Value; uiElement.lineSpacing = -35f; uiElement.characterSpacing = 8f; uiElement.rectTransform.pivot = new Vector2(1f, 1f); uiElement.rectTransform.anchorMin = new Vector2(1f, 1f); uiElement.rectTransform.anchorMax = new Vector2(1f, 1f); if (!Configs.Rotate90Degrees.Value || !Configs.ShowQualityAsSymbols.Value || quality >= _itemQualitySymbols.Length) { uiElement.fontSize = 14f; uiElement.isRightToLeftText = quality < _itemQualitySymbols.Length; ((Transform)uiElement.rectTransform).localRotation = Quaternion.Euler(0f, 0f, 0f); uiElement.rectTransform.anchoredPosition = new Vector2(-4f, 2f); } else { uiElement.isRightToLeftText = false; uiElement.fontSize = ((quality <= 4) ? 14f : 12f); ((Transform)uiElement.rectTransform).localRotation = Quaternion.Euler(0f, 0f, -90f); uiElement.rectTransform.anchoredPosition = new Vector2(1f, 0f - uiElement.preferredWidth - 4f); } } } } public static class LensDirt { public static void RemoveDirt() { GameCamera instance = GameCamera.instance; if (Object.op_Implicit((Object)(object)instance)) { PostProcessingBehaviour component = ((Component)instance).gameObject.GetComponent<PostProcessingBehaviour>(); if (Object.op_Implicit((Object)(object)component)) { component.profile.bloom.m_Settings.lensDirt.intensity = 0f; } } } } [HarmonyPatch] public static class PanelSlide { [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "Show")] private static void InventoryGui_Show(InventoryGui __instance, Container container) { __instance.ToggleVisibleNoSlide(isVisible: true, container); } [HarmonyPrefix] [HarmonyPatch(typeof(InventoryGui), "Hide")] private static void InventoryGui_Hide(InventoryGui __instance) { __instance.ToggleVisibleNoSlide(isVisible: false, null); } private static void ToggleVisibleNoSlide(this InventoryGui gui, bool isVisible, Container? container) { if (Configs.EnableSlideAnimation.Value) { return; } if (isVisible) { if (!Object.op_Implicit((Object)(object)container)) { ((Component)gui.m_container).gameObject.SetActive(false); } } else if (Object.op_Implicit((Object)(object)gui.m_currentContainer)) { ((Component)gui.m_container).gameObject.SetActive(true); } string text = (isVisible ? "inventory_show" : "inventory_hide"); gui.m_animator.Play(text, 0, 1f); gui.m_animator.Update(0f); } } [HarmonyPatch] public static class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(FejdStartup), "Start")] private static void FejdStartup_Start(FejdStartup __instance) { __instance.m_moddedText.SetActive(!Configs.HideModdedText.Value); } } [BepInPlugin("ZenDragon.ZenUI", "ZenUI", "0.5.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class Plugin : ZenMod<Plugin> { public const string PluginName = "ZenUI"; public const string PluginVersion = "0.5.5"; public const string PluginGUID = "ZenDragon.ZenUI"; protected override void Setup() { ((ZenMod)this).LanguageChanged += OnLanguageChanged; } protected override void TitleScene(bool isFirstBoot) { } protected override void WorldStart() { if (Configs.RemoveLensDirt.Value) { LensDirt.RemoveDirt(); } } protected override void HotRestore() { CraftingPanel.Game_Start(); FoodPanel.Game_Start(); } protected override void Shutdown() { CraftingPanel.Shutdown(); } private static void OnLanguageChanged(string language) { RemoveRichTextTags(); } private static void RemoveRichTextTags() { if (((List<string>)(object)Configs.RemoveRichText.Value).Count == 0) { return; } Log.Info((object)"Applying configs to remove rich text tags from translations", (ushort)0); List<string> list = new List<string>(); Dictionary<string, string> translations = Loca