Decompiled source of MyLittleUI v1.0.6
MyLittleUI.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MyLittleUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MyLittleUI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("345181bf-e9ed-4c88-a4f4-38450f53cc41")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace MyLittleUI; internal static class InventoryCharacterStats { [HarmonyPatch(typeof(InventoryGui), "UpdateCharacterStats")] private class InventoryGui_UpdateCharacterStats_CharacterStats { private static void Postfix(InventoryGui __instance, Player player, TextsDialog ___m_textsDialog) { if (!MyLittleUI.modEnabled.Value || (!MyLittleUI.statsCharacterArmor.Value && !MyLittleUI.statsCharacterEffects.Value)) { return; } if ((MyLittleUI.statsCharacterArmor.Value && (Object)(object)characterStatsTooltip == (Object)null) || (MyLittleUI.statsCharacterEffects.Value && (Object)(object)characterEffectsTooltip == (Object)null)) { InitCharacterTooltips(__instance, player); } if (ZNet.instance.GetTimeSeconds() - totalSecondTooltipWasUpdated > 5.0) { totalSecondTooltipWasUpdated = ZNet.instance.GetTimeSeconds(); if (MyLittleUI.statsCharacterArmor.Value) { characterStatsTooltip.m_text = TooltipStats(player); } if (MyLittleUI.statsCharacterEffects.Value) { characterEffectsTooltip.m_text = TooltipEffects(player, ___m_textsDialog); } } } } [HarmonyPatch] public static class Humanoid_TooltipUpdate { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(Humanoid), "EquipItem", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(Humanoid), "UnequipItem", (Type[])null, (Type[])null); } private static void Postfix(Humanoid __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { totalSecondTooltipWasUpdated = 0.0; } } } [HarmonyPatch(typeof(SEMan), "RemoveAllStatusEffects")] private class SEMan_RemoveAllStatusEffects_TooltipUpdate { private static void Postfix(SEMan __instance) { if (MyLittleUI.modEnabled.Value && (MyLittleUI.statsCharacterArmor.Value || MyLittleUI.statsCharacterEffects.Value)) { Player localPlayer = Player.m_localPlayer; if (__instance == ((localPlayer != null) ? ((Character)localPlayer).GetSEMan() : null)) { totalSecondTooltipWasUpdated = 0.0; } } } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(StatusEffect), typeof(bool), typeof(int), typeof(float) })] private class SEMan_AddStatusEffect_TooltipUpdate { private static void Postfix(SEMan __instance, StatusEffect __result) { if (MyLittleUI.modEnabled.Value && (MyLittleUI.statsCharacterArmor.Value || MyLittleUI.statsCharacterEffects.Value) && (Object)(object)__result != (Object)null) { Player localPlayer = Player.m_localPlayer; if (__instance == ((localPlayer != null) ? ((Character)localPlayer).GetSEMan() : null)) { totalSecondTooltipWasUpdated = 0.0; } } } } [HarmonyPatch(typeof(SEMan), "RemoveStatusEffect", new Type[] { typeof(int), typeof(bool) })] private class SEMan_RemoveStatusEffect_TooltipUpdate { private static void Postfix(SEMan __instance, bool __result) { if (MyLittleUI.modEnabled.Value && (MyLittleUI.statsCharacterArmor.Value || MyLittleUI.statsCharacterEffects.Value) && __result) { Player localPlayer = Player.m_localPlayer; if (__instance == ((localPlayer != null) ? ((Character)localPlayer).GetSEMan() : null)) { totalSecondTooltipWasUpdated = 0.0; } } } } private static UITooltip characterStatsTooltip; private static UITooltip characterEffectsTooltip; private static double totalSecondTooltipWasUpdated = 0.0; private static readonly StringBuilder sb = new StringBuilder(); private static readonly Dictionary<SkillType, float> skills = new Dictionary<SkillType, float>(); private static readonly Dictionary<DamageType, DamageModifier> mods = new Dictionary<DamageType, DamageModifier>(); public static void UpdateTooltipState() { if ((Object)(object)characterStatsTooltip != (Object)null) { ((Behaviour)characterStatsTooltip).enabled = MyLittleUI.statsCharacterArmor.Value; } if ((Object)(object)characterEffectsTooltip != (Object)null) { ((Behaviour)characterEffectsTooltip).enabled = MyLittleUI.statsCharacterEffects.Value; } } private static void InitCharacterTooltips(InventoryGui __instance, Player player) { UITooltip component = __instance.m_containerGrid.m_elementPrefab.GetComponent<UITooltip>(); if ((Object)(object)characterStatsTooltip == (Object)null) { characterStatsTooltip = InitTooltip(component, __instance.m_armor, player.GetPlayerName()); } if ((Object)(object)characterEffectsTooltip == (Object)null) { characterEffectsTooltip = InitTooltip(component, __instance.m_weight, "$inventory_activeeffects"); } MyLittleUI.LogInfo("Character inventory stats patched"); } private static UITooltip InitTooltip(UITooltip prefabTooltip, TMP_Text text, string topic) { FieldInfo[] fields = ((object)prefabTooltip).GetType().GetFields(); UITooltip val = ((Component)text.transform.parent).gameObject.AddComponent<UITooltip>(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(prefabTooltip)); } val.m_topic = topic; return val; } private static void AddRegenStat(ref float stat, float multiplier) { if (multiplier > 1f) { stat += multiplier - 1f; } else { stat *= multiplier; } } private static bool ShouldOverride(DamageModifier a, DamageModifier b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 if ((int)a == 4) { return false; } if ((int)b == 3) { return true; } if ((int)a == 5 && (int)b == 1) { return false; } if ((int)a == 6 && (int)b == 2) { return false; } if (((int)a == 1 || (int)a == 5 || (int)a == 3) && ((int)b == 2 || (int)b == 6)) { return false; } return true; } private static string TooltipEffects(Player player, TextsDialog textsDialog) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: 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_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Expected O, but got Unknown //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Expected O, but got Unknown sb.Clear(); if (((Character)player).GetEquipmentMovementModifier() != 0f) { string arg = ((((Character)player).GetEquipmentMovementModifier() >= 0f) ? "#00FF00" : "#FF0000"); sb.AppendFormat("$item_movement_modifier: <color={0}>{1:P0}</color>\n", arg, ((Character)player).GetEquipmentMovementModifier()); } if (((Character)player).GetEquipmentBaseItemModifier() != 0f) { string arg2 = ((((Character)player).GetEquipmentBaseItemModifier() >= 0f) ? "#00FF00" : "#FF0000"); sb.AppendFormat("$base_item_modifier: <color={0}>{1:P0}</color>\n", arg2, ((Character)player).GetEquipmentBaseItemModifier()); } skills.Clear(); mods.Clear(); SE_Stats val = (SE_Stats)ScriptableObject.CreateInstance("SE_Stats"); SkillType key; foreach (StatusEffect item in ((Character)player).GetSEMan().GetStatusEffects().ToList()) { if (item is SE_Stats) { SE_Stats val2 = (SE_Stats)(object)((item is SE_Stats) ? item : null); val.m_jumpStaminaUseModifier *= val2.m_jumpStaminaUseModifier; val.m_runStaminaDrainModifier *= val2.m_runStaminaDrainModifier; val.m_healthOverTime += val2.m_healthOverTime; val.m_staminaOverTime += val2.m_staminaOverTime; val.m_eitrOverTime += val2.m_eitrOverTime; AddRegenStat(ref val.m_healthRegenMultiplier, val2.m_healthRegenMultiplier); AddRegenStat(ref val.m_staminaRegenMultiplier, val2.m_staminaRegenMultiplier); if (((Character)player).GetMaxEitr() > 0f) { AddRegenStat(ref val.m_eitrRegenMultiplier, val2.m_eitrRegenMultiplier); } val.m_addMaxCarryWeight += val2.m_addMaxCarryWeight; val.m_noiseModifier *= val2.m_noiseModifier; val.m_stealthModifier *= val2.m_stealthModifier; val.m_speedModifier *= val2.m_speedModifier; val.m_maxMaxFallSpeed += val2.m_maxMaxFallSpeed; val.m_fallDamageModifier += val2.m_fallDamageModifier; if (skills.ContainsKey(val2.m_skillLevel)) { Dictionary<SkillType, float> dictionary = skills; key = val2.m_skillLevel; dictionary[key] += val2.m_skillLevelModifier; } else { skills.Add(val2.m_skillLevel, val2.m_skillLevelModifier); } if (skills.ContainsKey(val2.m_skillLevel2)) { Dictionary<SkillType, float> dictionary = skills; key = val2.m_skillLevel2; dictionary[key] += val2.m_skillLevelModifier2; } else { skills.Add(val2.m_skillLevel2, val2.m_skillLevelModifier2); } foreach (DamageModPair mod in val2.m_mods) { if (mods.ContainsKey(mod.m_type)) { if (ShouldOverride(mods[mod.m_type], mod.m_modifier)) { mods[mod.m_type] = mod.m_modifier; } } else { mods[mod.m_type] = mod.m_modifier; } } } else { string text = item.GetTooltipString().Replace(item.m_tooltip, ""); if (!Utility.IsNullOrWhiteSpace(text)) { sb.Append("\n"); sb.Append("<color=orange>" + item.m_name + "</color>"); sb.Append(text); } } } List<ItemData> list = new List<ItemData> { ((Humanoid)player).m_chestItem, ((Humanoid)player).m_legItem, ((Humanoid)player).m_helmetItem, ((Humanoid)player).m_shoulderItem, ((Humanoid)player).m_leftItem, ((Humanoid)player).m_rightItem, ((Humanoid)player).m_utilityItem }; foreach (ItemData item2 in list) { if (item2 == null || item2.m_shared.m_damageModifiers.Count == 0) { continue; } foreach (DamageModPair damageModifier in item2.m_shared.m_damageModifiers) { if (mods.ContainsKey(damageModifier.m_type)) { if (ShouldOverride(mods[damageModifier.m_type], damageModifier.m_modifier)) { mods[damageModifier.m_type] = damageModifier.m_modifier; } } else { mods[damageModifier.m_type] = damageModifier.m_modifier; } } } foreach (KeyValuePair<DamageType, DamageModifier> mod2 in mods) { val.m_mods.Add(new DamageModPair { m_modifier = mod2.Value, m_type = mod2.Key }); } if (((Character)player).GetMaxEitr() > 0f) { val.m_eitrRegenMultiplier += player.GetEquipmentEitrRegenModifier(); } string tooltipString = ((StatusEffect)val).GetTooltipString(); if (!Utility.IsNullOrWhiteSpace(tooltipString)) { sb.Append("\n"); sb.Append(tooltipString); } foreach (KeyValuePair<SkillType, float> skill in skills) { if (skill.Value != 0f) { StringBuilder stringBuilder = sb; key = skill.Key; stringBuilder.AppendFormat("\n{0} <color=orange>{1}</color>", "$skill_" + ((object)(SkillType)(ref key)).ToString().ToLower(), skill.Value.ToString("+0;-0")); } } if ((Object)(object)MyLittleUI.epicLootPlugin != (Object)null && MyLittleUI.statsCharacterEffectsMagic.Value) { Type type = AccessTools.TypeByName("EpicLoot.TextsDialog_UpdateTextsList_Patch"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "AddMagicEffectsPage", (Type[])null, (Type[])null); if (methodInfo != null) { textsDialog.m_texts.Clear(); textsDialog.m_texts.Add(new TextInfo("", "")); textsDialog.m_texts.Add(new TextInfo("", "")); methodInfo.Invoke(methodInfo, new object[2] { textsDialog, player }); TextInfo val3 = textsDialog.m_texts[2]; sb.Append("\n"); sb.Append(val3.m_topic); sb.Append("\n"); sb.Append(string.Join("\n", from line in val3.m_text.Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries) where LineIsValid(line) select line).Replace("<size=20>", "").Replace("</size>", "")); } } } return Localization.instance.Localize(sb.ToString()); static bool LineIsValid(string line) { return line != "" && !line.StartsWith(" <") && !line.StartsWith("\n") && !Utility.IsNullOrWhiteSpace(line); } } private static string TooltipStats(Player player) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_00ac: 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) sb.Clear(); sb.AppendFormat("$item_armor: <color=orange>{0}</color>", ((Character)player).GetBodyArmor()); ItemData currentWeapon = ((Humanoid)player).GetCurrentWeapon(); if (currentWeapon != null) { DamageTypes damage = currentWeapon.GetDamage(currentWeapon.m_quality, (float)Game.m_worldLevel); if ((int)currentWeapon.m_shared.m_skillType == 8 && ((Humanoid)player).GetAmmoItem() != null) { ((DamageTypes)(ref damage)).Add(((Humanoid)player).GetAmmoItem().GetDamage(), 1); } sb.Append("\n"); ItemData.AddHandedTip(currentWeapon, sb); sb.Append(((DamageTypes)(ref damage)).GetTooltipString(currentWeapon.m_shared.m_skillType) ?? ""); sb.Append($"\n$item_knockback: <color=orange>{currentWeapon.m_shared.m_attackForce}</color>"); sb.Append($"\n$item_backstab: <color=orange>{currentWeapon.m_shared.m_backstabBonus}x</color>"); } ItemData currentBlocker = ((Humanoid)player).GetCurrentBlocker(); if (currentBlocker != null) { int quality = currentBlocker.m_quality; sb.Append("\n"); sb.Append($"\n$item_blockpower: <color=orange>{currentBlocker.GetBlockPowerTooltip(quality):0}</color>"); if (currentBlocker.m_shared.m_timedBlockBonus > 1f) { sb.Append($"\n$item_blockforce: <color=orange>{currentBlocker.GetDeflectionForce(quality)}</color>"); sb.Append($"\n$item_parrybonus: <color=orange>{currentBlocker.m_shared.m_timedBlockBonus}x</color>"); } string damageModifiersTooltipString = SE_Stats.GetDamageModifiersTooltipString(currentBlocker.m_shared.m_damageModifiers); if (damageModifiersTooltipString.Length > 0) { sb.Append(damageModifiersTooltipString); } } return Localization.instance.Localize(sb.ToString()); } } internal class ItemIcon { private static class DefaultQualityStyle { public static bool initialized; public static TextWrappingModes textWrappingMode; public static float fontSize; public static Color color; public static bool isRightToLeftText; public static float lineSpacing; public static float characterSpacing; public static void Save(TMP_Text quality) { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) initialized = true; textWrappingMode = quality.textWrappingMode; fontSize = quality.fontSize; color = ((Graphic)quality).color; isRightToLeftText = quality.isRightToLeftText; lineSpacing = quality.lineSpacing; characterSpacing = quality.characterSpacing; } public static void Load(TMP_Text quality) { //IL_0002: 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) quality.textWrappingMode = textWrappingMode; quality.fontSize = fontSize; ((Graphic)quality).color = color; quality.isRightToLeftText = isRightToLeftText; quality.lineSpacing = lineSpacing; quality.characterSpacing = characterSpacing; } public static bool IsTextWasChanged(TMP_Text quality) { //IL_0002: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return quality.textWrappingMode != textWrappingMode || quality.fontSize != fontSize || ((Graphic)quality).color != color || quality.isRightToLeftText != isRightToLeftText || quality.lineSpacing != lineSpacing || quality.lineSpacing != characterSpacing; } } [HarmonyPatch(typeof(InventoryGrid), "UpdateGui")] private class InventoryGrid_UpdateGui_DurabilityAndScale { private static void Postfix(Inventory ___m_inventory, List<Element> ___m_elements) { if (!MyLittleUI.modEnabled.Value) { return; } 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, allItem); UpdateItemQuality(val.m_quality, allItem.m_quality); } } } } [HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")] private class HotkeyBar_UpdateIcons_DurabilityAndScale { private static void Postfix(Player player, List<ItemData> ___m_items, List<ElementData> ___m_elements) { if (!MyLittleUI.modEnabled.Value || !Object.op_Implicit((Object)(object)player) || ((Character)player).IsDead()) { return; } for (int i = 0; i < ___m_items.Count; i++) { ItemData val = ___m_items[i]; if (val != null && 0 <= val.m_gridPos.x && val.m_gridPos.x < ___m_elements.Count) { ElementData val2 = ___m_elements[val.m_gridPos.x]; UpdateItemIcon(val2.m_durability, val2.m_icon, val); } } } } private static Vector3 itemIconScaleOriginal = Vector3.zero; private static readonly Dictionary<int, string> qualityCache = new Dictionary<int, string>(); private static void UpdateItemIcon(GuiBar durability, Image icon, ItemData item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00f6: 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_0156: 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) //IL_017b: Unknown result type (might be due to invalid IL or missing references) if (itemIconScaleOriginal == Vector3.zero) { itemIconScaleOriginal = ((Component)icon).transform.localScale; } if (MyLittleUI.itemIconScale.Value != 1f) { ((Component)icon).transform.localScale = itemIconScaleOriginal * Mathf.Clamp(MyLittleUI.itemIconScale.Value, 0.2f, 2f); } if (!MyLittleUI.durabilityEnabled.Value || !item.m_shared.m_useDurability || !(item.m_durability < item.GetMaxDurability())) { return; } if (item.m_durability <= 0f) { durability.SetValue(1f); durability.SetColor((Color)((Mathf.Sin(Time.time * 10f) > 0f) ? MyLittleUI.durabilityBroken.Value : new Color(0f, 0f, 0f, 0f))); return; } float durabilityPercentage = item.GetDurabilityPercentage(); durability.SetValue(durabilityPercentage); if (durabilityPercentage >= 0.75f) { durability.SetColor(MyLittleUI.durabilityFine.Value); } else if (durabilityPercentage >= 0.5f) { durability.SetColor(MyLittleUI.durabilityWorn.Value); } else if (durabilityPercentage >= 0.25f) { durability.SetColor(MyLittleUI.durabilityAtRisk.Value); } else { durability.SetColor(MyLittleUI.durabilityBroken.Value); } } private static char GetQualitySymbol() { return Utility.IsNullOrWhiteSpace(MyLittleUI.itemQualitySymbol.Value) ? '★' : MyLittleUI.itemQualitySymbol.Value[0]; } public static void FillItemQualityCache() { StringBuilder stringBuilder = new StringBuilder(); qualityCache.Clear(); int num = Math.Min(MyLittleUI.itemQualityMax.Value, MyLittleUI.itemQualityColumns.Value * MyLittleUI.itemQualityRows.Value); for (int i = 1; i <= num; i++) { stringBuilder.Append(GetQualitySymbol()); qualityCache.Add(i, stringBuilder.ToString()); if (i % MyLittleUI.itemQualityColumns.Value == 0) { stringBuilder.Append("\n"); } } } private static void UpdateItemQuality(TMP_Text quality, int m_quality) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!MyLittleUI.itemQuality.Value || !((Behaviour)quality).enabled) { return; } if (!DefaultQualityStyle.initialized) { DefaultQualityStyle.Save(quality); } if (!qualityCache.ContainsKey(m_quality)) { if (DefaultQualityStyle.IsTextWasChanged(quality)) { DefaultQualityStyle.Load(quality); } return; } quality.text = qualityCache[m_quality]; quality.textWrappingMode = (TextWrappingModes)3; quality.fontSize = MyLittleUI.itemQualitySymbolSize.Value; ((Graphic)quality).color = MyLittleUI.itemQualitySymbolColor.Value; quality.isRightToLeftText = true; quality.lineSpacing = MyLittleUI.itemQualityLineSpacing.Value; quality.characterSpacing = MyLittleUI.itemQualityCharacterSpacing.Value; } } public static class ItemTooltip { [HarmonyPatch(typeof(InventoryGui), "Awake")] private class InventoryGui_Awake_ItemTooltipCraftingFontSize { private static void Postfix(InventoryGui __instance) { TMP_Text recipeDecription = __instance.m_recipeDecription; TextMeshProUGUI val = ((recipeDecription != null) ? ((Component)recipeDecription).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)val != (Object)null) { ((TMP_Text)val).fontSizeMin = 12f; } } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float) })] private class ItemDropItemData_GetTooltip_ItemTooltip { [HarmonyPriority(800)] private static void Postfix(ItemData item, int qualityLevel, bool crafting, float worldLevel, ref string __result) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (!MyLittleUI.modEnabled.Value || !MyLittleUI.itemTooltip.Value || UnityInput.Current.GetKey((KeyCode)308) || UnityInput.Current.GetKey((KeyCode)307)) { return; } if (tooltipCache.Count > 200) { tooltipCache.Clear(); } int stableHashCode = StringExtensionMethods.GetStableHashCode(__result); if (tooltipCache.ContainsKey(stableHashCode)) { __result = tooltipCache[stableHashCode]; } else { if (item == null) { return; } int num = __result.IndexOf("\n\n", StringComparison.InvariantCulture); if (num == -1) { return; } sb.Clear(); string text = __result.Substring(0, num + 2); __result = __result.Substring(text.Length); sb.Append(text); int num2 = -1; string statusEffectTooltip = item.GetStatusEffectTooltip(qualityLevel, ((Character)Player.m_localPlayer).GetSkillLevel(item.m_shared.m_skillType)); if (!string.IsNullOrEmpty(statusEffectTooltip)) { tails.Insert(0, "\n\n" + statusEffectTooltip.Substring(0, statusEffectTooltip.IndexOf("</color>\n", StringComparison.OrdinalIgnoreCase))); } foreach (string tail in tails) { num2 = __result.IndexOf(tail, StringComparison.InvariantCulture); if (num2 != -1) { break; } } if (!string.IsNullOrEmpty(statusEffectTooltip)) { tails.RemoveAt(0); } string value = ""; if (num2 != -1) { value = __result.Substring(num2); __result = __result.Substring(0, num2); } tokenPositions.Clear(); arrResult.Clear(); arrResult.AddRange(__result.Split(new char[1] { '\n' }, StringSplitOptions.None)); int i; for (i = 0; i < arrResult.Count; i++) { if (arrResult[i] == "\n") { continue; } List<KeyValuePair<string, string>> list = localizedTooltipTokens.Where((KeyValuePair<string, string> kvp) => arrResult[i].IndexOf(kvp.Key) > -1).ToList(); if (list.Count() > 0) { if (tokenPositions.ContainsKey(list[0].Value)) { tokenPositions[list[0].Value].Add(i); continue; } tokenPositions.Add(list[0].Value, new List<int> { i }); } else if (tokenPositions.Count > 0) { tokenPositions.Last().Value.Add(i); } else { sb.Append(arrResult[i]); sb.Append("\n"); arrResult.RemoveAt(i); i--; } } ReorderTooltip(item, qualityLevel, worldLevel, crafting && 1 < qualityLevel && qualityLevel <= item.m_shared.m_maxQuality); if (num2 != -1) { sb.Append(value); } __result = sb.ToString(); __result = __result.Replace("<color=orange>", MyLittleUI.itemTooltipColored.Value ? "<color=#ffa500ff>" : "<color=#add8e6ff>").Replace("<color=yellow>", MyLittleUI.itemTooltipColored.Value ? "<color=#ffff00ff>" : "<color=#c0c0c0ff>").Replace("<color=silver>", "<color=#c0c0c0ff>") .Replace("<color=lightblue>", "<color=#add8e6ff>") .Replace("\n\n\n", "\n\n"); tooltipCache.Add(stableHashCode, __result); } } } private const string projectileTooltipGroup = "projectile"; private static readonly Dictionary<string, string> localizedTooltipTokens = new Dictionary<string, string>(); private static readonly List<string> tails = new List<string>(); private static readonly List<string> tokens = new List<string>(); private static readonly HashSet<string> craftingTokens = new HashSet<string>(); private static readonly StringBuilder sb = new StringBuilder(); private static readonly Dictionary<string, List<int>> tokenPositions = new Dictionary<string, List<int>>(); private static readonly List<string> arrResult = new List<string>(); private static readonly Dictionary<int, string> tooltipCache = new Dictionary<int, string>(); private const int tooltipCachedEntriesMax = 200; public static void Initialize() { FillTooltipTails(); InitTooltipTokens(); InitializeTokenGroups(); } private static void FillTooltipTails() { tails.Clear(); if ((Object)(object)MyLittleUI.epicLootPlugin != (Object)null) { MethodInfo methodInfo = AccessTools.Method(((object)MyLittleUI.epicLootPlugin).GetType(), "GetRarityColor", (Type[])null, (Type[])null); Type type = AccessTools.TypeByName("EpicLoot.ItemRarity"); if (methodInfo != null && type != null) { foreach (object enumValue in type.GetEnumValues()) { tails.Add($"<color={methodInfo.Invoke(methodInfo, new object[1] { enumValue })}>\n"); tails.Add($"\n<color={methodInfo.Invoke(methodInfo, new object[1] { enumValue })}>"); } } } tails.Add("\n\n$item_seteffect"); } private static void InitTooltipTokens() { string[] array = new string[44] { "$item_dlc", "$item_onehanded", "$item_twohanded", "$item_crafter", "$item_noteleport", "$item_value", "$item_weight", "$item_quality", "$item_durability", "$item_repairlevel", "$item_food_health", "$item_food_stamina", "$item_food_eitr", "$item_food_duration", "$item_food_regen", "$item_staminause", "$item_eitruse", "$item_healthuse", "$item_staminahold", "$item_knockback", "$item_backstab", "$item_blockpower", "$item_blockarmor", "$item_blockforce", "$item_deflection", "$item_parrybonus", "$item_armor", "$item_movement_modifier", "$item_eitrregen_modifier", "$base_item_modifier", "$item_seteffect", "$inventory_dmgmod", "$inventory_damage", "$inventory_blunt", "$inventory_slash", "$inventory_pierce", "$inventory_fire", "$inventory_frost", "$inventory_lightning", "$inventory_poison", "$inventory_spirit", "$se_staminaregen", "$item_newgameplusitem", "$item_tamedonly" }; string[] array2 = array; foreach (string text in array2) { localizedTooltipTokens[text] = text; } craftingTokens.Clear(); craftingTokens.Add("$item_weight"); craftingTokens.Add("$item_quality"); craftingTokens.Add("$item_durability"); craftingTokens.Add("$item_repairlevel"); craftingTokens.Add("$item_blockpower"); craftingTokens.Add("$item_blockarmor"); craftingTokens.Add("$item_blockforce"); craftingTokens.Add("$inventory_damage"); craftingTokens.Add("$inventory_blunt"); craftingTokens.Add("$inventory_slash"); craftingTokens.Add("$inventory_pierce"); craftingTokens.Add("$inventory_fire"); craftingTokens.Add("$inventory_frost"); craftingTokens.Add("$inventory_lightning"); craftingTokens.Add("$inventory_poison"); craftingTokens.Add("$inventory_spirit"); } private static void InitializeTokenGroups() { tokens.Clear(); tokens.Add("$item_dlc"); tokens.Add("$item_newgameplusitem"); tokens.Add("$item_onehanded"); tokens.Add("$item_twohanded"); tokens.Add("$item_noteleport"); tokens.Add("$item_value"); tokens.Add("$item_tamedonly"); tokens.Add(""); tokens.Add("$item_food_health"); tokens.Add("$item_food_stamina"); tokens.Add("$item_food_eitr"); tokens.Add("$item_food_duration"); tokens.Add("$item_food_regen"); tokens.Add("$se_staminaregen"); tokens.Add(""); tokens.Add("$inventory_damage"); tokens.Add("$inventory_blunt"); tokens.Add("$inventory_slash"); tokens.Add("$inventory_pierce"); tokens.Add("$inventory_fire"); tokens.Add("$inventory_frost"); tokens.Add("$inventory_lightning"); tokens.Add("$inventory_poison"); tokens.Add("$inventory_spirit"); tokens.Add("$item_knockback"); tokens.Add("$item_backstab"); tokens.Add("$item_staminause"); tokens.Add("$item_eitruse"); tokens.Add("$item_healthuse"); tokens.Add("$item_staminahold"); tokens.Add(""); tokens.Add("$item_blockpower"); tokens.Add("$item_blockarmor"); tokens.Add("$item_blockforce"); tokens.Add("$item_deflection"); tokens.Add("$item_parrybonus"); tokens.Add("projectile"); tokens.Add("$item_armor"); tokens.Add("$inventory_dmgmod"); tokens.Add(""); tokens.Add("$item_durability"); tokens.Add("$item_repairlevel"); tokens.Add(""); tokens.Add("$item_movement_modifier"); tokens.Add("$item_eitrregen_modifier"); tokens.Add("$base_item_modifier"); tokens.Add(""); tokens.Add("$item_weight"); tokens.Add("$item_crafter"); tokens.Add("$item_quality"); } private static void ReorderTooltip(ItemData item, int m_quality, float m_worldLevel, bool upgradingTooltip) { bool flag = false; foreach (string token in tokens) { if (token == "") { if (flag) { sb.Append('\n'); } flag = false; } else if (token == "projectile") { string projectileTooltip = item.GetProjectileTooltip(m_quality); if (projectileTooltip.Length > 0) { flag = true; sb.Append("\n\n"); sb.Append(projectileTooltip); } if (flag) { sb.Append('\n'); } flag = false; } else { flag = AppendToken(token, item, m_quality, m_worldLevel, upgradingTooltip) || flag; } } } private static bool AppendToken(string token, ItemData item, int m_quality, float m_worldLevel, bool upgrading) { if (!tokenPositions.ContainsKey(token)) { return false; } List<int> list = tokenPositions[token]; for (int i = 0; i < list.Count; i++) { sb.AppendFormat("\n{0}", GetTokenString(list, i, token, item, m_quality, m_worldLevel, upgrading)); } return true; } private static string GetTokenString(List<int> tokPos, int i, string token, ItemData item, int m_quality, float m_worldLevel, bool upgrading) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!upgrading || i > 0 || !craftingTokens.Contains(token)) { return arrResult[tokPos[i]]; } string text = arrResult[tokPos[i]]; int num = text.IndexOf(": "); if (num == -1) { return text; } num += 2; if (token.StartsWith("$inventory_")) { DamageTypes damage = item.GetDamage(m_quality, m_worldLevel); DamageTypes damage2 = item.GetDamage(m_quality - 1, m_worldLevel); float num2 = default(float); float num3 = default(float); ((Character)Player.m_localPlayer).GetSkills().GetRandomSkillRange(ref num2, ref num3, item.m_shared.m_skillType); float damageByToken = GetDamageByToken(token, damage2); if (damageByToken != -1f && damageByToken != GetDamageByToken(token, damage)) { return text.Insert(num, GetStringUpgradeFrom(((DamageTypes)(ref damage2)).DamageRange(damageByToken, num2, num3))); } } else { switch (token) { case "$item_weight": if (item.m_shared.m_scaleWeightByQuality != 0f) { int quality = item.m_quality; item.m_quality = m_quality - 1; string value2 = item.GetWeight().ToString("0.0"); item.m_quality = quality; return text.Insert(num, GetStringUpgradeFrom(value2)); } break; case "$item_quality": return text.Insert(num, GetStringUpgradeFrom($"<color=orange>{m_quality - 1}</color>")); case "$item_durability": if (item.GetMaxDurability(m_quality) != item.GetMaxDurability(m_quality - 1)) { return text.Insert(num, GetStringUpgradeFrom($"<color=orange>{item.GetMaxDurability(m_quality - 1)}</color>")); } goto default; default: if (token == "$item_blockarmor" && item.GetBaseBlockPower(m_quality) != item.GetBaseBlockPower(m_quality - 1)) { return text.Insert(num, GetStringUpgradeFrom(string.Format("<color=orange>{0}</color> <color=yellow>({1})</color>", item.GetBaseBlockPower(m_quality - 1), item.GetBlockPowerTooltip(m_quality - 1).ToString("0")))); } if (token == "$item_blockforce" && item.GetDeflectionForce(m_quality) != item.GetDeflectionForce(m_quality - 1)) { return text.Insert(num, GetStringUpgradeFrom($"<color=orange>{item.GetDeflectionForce(m_quality - 1)}</color>")); } break; } } return text; static string GetStringUpgradeFrom(string value) { return value.Replace("<color=yellow>", "<color=silver>").Replace("<color=orange>", "<color=lightblue>") + " → "; } } private static float GetDamageByToken(string token, DamageTypes damages) { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_016d: 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_015b: 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_0149: 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) if (1 == 0) { } float result = token switch { "$inventory_damage" => damages.m_damage, "$inventory_blunt" => damages.m_blunt, "$inventory_slash" => damages.m_slash, "$inventory_pierce" => damages.m_pierce, "$inventory_fire" => damages.m_fire, "$inventory_frost" => damages.m_frost, "$inventory_lightning" => damages.m_lightning, "$inventory_poison" => damages.m_poison, "$inventory_spirit" => damages.m_spirit, _ => -1f, }; if (1 == 0) { } return result; } } internal static class CustomStatusEffectsList { [HarmonyPatch(typeof(Hud), "Awake")] public static class Hud_Awake_CustomTemplate { public static void Postfix() { InitializeStatusEffectTemplate(); ChangeSailingIndicator(); } } [HarmonyPatch(typeof(Hud), "OnDestroy")] public static class Hud_OnDestroy_CustomTemplate { public static void Prefix() { m_statusEffectTemplate = null; m_statusEffectTemplateOriginal = null; } } [HarmonyPatch(typeof(Hud), "UpdateStatusEffects")] public static class Hud_UpdateStatusEffects_Patch { public static void Postfix(List<RectTransform> ___m_statusEffects) { //IL_0035: 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) if (!MyLittleUI.modEnabled.Value || !GetStatusEffectsPositionEnabled()) { return; } for (int i = 0; i < ___m_statusEffects.Count; i++) { ___m_statusEffects[i].anchoredPosition = Vector2.op_Implicit(GetStatusEffectPosition(i)); if (GetStatusEffectsElementEnabled()) { bool flag = !((Component)((Transform)___m_statusEffects[i]).Find("TimeText")).gameObject.activeSelf; ((Component)((Transform)___m_statusEffects[i]).Find("Name")).GetComponent<TMP_Text>().verticalAlignment = (VerticalAlignmentOptions)(flag ? 512 : 256); } } } } private const string templateName = "SE_Template_MLU"; private static RectTransform m_statusEffectTemplateOriginal; private static Vector2 m_statusEffectListRootPositionOriginal = Vector2.op_Implicit(Vector3.zero); private static RectTransform m_statusEffectTemplate; private static Vector2 m_shipWindIndicatorRootPositionOriginal = Vector2.op_Implicit(Vector3.zero); private static Vector2 m_shipWindIconRootPositionOriginal = Vector2.op_Implicit(Vector3.zero); private static Vector3 GetStatusEffectPosition(int i) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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) float num = i * (Game.m_noMap ? (MyLittleUI.statusEffectsPositionSpacingNomap.Value + MyLittleUI.statusEffectsElementSizeNomap.Value) : (MyLittleUI.statusEffectsPositionSpacing.Value + MyLittleUI.statusEffectsElementSize.Value)); MyLittleUI.StatusEffectDirection statusEffectDirection = (Game.m_noMap ? MyLittleUI.statusEffectsFillingDirectionNomap.Value : MyLittleUI.statusEffectsFillingDirection.Value); if (1 == 0) { } Vector3 result = (Vector3)(statusEffectDirection switch { MyLittleUI.StatusEffectDirection.LeftToRight => new Vector3(num, 0f, 0f), MyLittleUI.StatusEffectDirection.RightToLeft => new Vector3(0f - num, 0f, 0f), MyLittleUI.StatusEffectDirection.TopToBottom => new Vector3(0f, 0f - num, 0f), MyLittleUI.StatusEffectDirection.BottomToTop => new Vector3(0f, num, 0f), _ => new Vector3(0f - num, 0f, 0f), }); if (1 == 0) { } return result; } public static void InitializeStatusEffectTemplate() { //IL_0042: 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_00e8: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Hud.instance == (Object)null)) { if ((Object)(object)m_statusEffectTemplateOriginal == (Object)null) { m_statusEffectTemplateOriginal = Hud.instance.m_statusEffectTemplate; m_statusEffectListRootPositionOriginal = Hud.instance.m_statusEffectListRoot.anchoredPosition; } if ((Object)(object)m_statusEffectTemplate == (Object)null) { m_statusEffectTemplate = Object.Instantiate<RectTransform>(m_statusEffectTemplateOriginal, (Transform)(object)Hud.instance.m_statusEffectListRoot); } ((Component)m_statusEffectTemplate).gameObject.SetActive(false); ((Object)m_statusEffectTemplate).name = "SE_Template_MLU"; int num = (Game.m_noMap ? MyLittleUI.statusEffectsElementSizeNomap.Value : MyLittleUI.statusEffectsElementSize.Value); RectTransform component = ((Component)((Transform)m_statusEffectTemplate).Find("Icon")).GetComponent<RectTransform>(); component.SetSizeWithCurrentAnchors((Axis)1, (float)num); component.SetSizeWithCurrentAnchors((Axis)0, (float)num); component.anchoredPosition = new Vector2((float)(-num), 0f); RectTransform component2 = ((Component)((Transform)m_statusEffectTemplate).Find("Cooldown")).GetComponent<RectTransform>(); component2.sizeDelta = component.sizeDelta; component2.anchoredPosition = component.anchoredPosition; RectTransform component3 = ((Component)((Transform)m_statusEffectTemplate).Find("Name")).GetComponent<RectTransform>(); component3.SetSizeWithCurrentAnchors((Axis)1, (float)(num + 4)); component3.SetSizeWithCurrentAnchors((Axis)0, 200f); component3.anchorMin = Vector2.one; component3.anchorMax = Vector2.one; ((Transform)component3).localPosition = Vector2.op_Implicit(new Vector2(64f, ((Transform)component).localPosition.y)); TextMeshProUGUI component4 = ((Component)component3).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component4).alignment = (TextAlignmentOptions)257; ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component4).fontSizeMax = num / 2; ((TMP_Text)component4).fontSizeMin = num / 2; RectTransform component5 = ((Component)((Transform)m_statusEffectTemplate).Find("TimeText")).GetComponent<RectTransform>(); component5.sizeDelta = component3.sizeDelta; component5.anchorMin = component3.anchorMin; component5.anchorMax = component3.anchorMax; ((Transform)component5).localPosition = ((Transform)component3).localPosition; TextMeshProUGUI component6 = ((Component)component5).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component6).alignment = (TextAlignmentOptions)1025; ((TMP_Text)component6).textWrappingMode = ((TMP_Text)component4).textWrappingMode; ((TMP_Text)component6).fontSizeMax = ((TMP_Text)component4).fontSizeMax; ((TMP_Text)component6).fontSizeMin = ((TMP_Text)component4).fontSizeMin; if (Hud.instance.m_statusEffects.Count > 0) { Object.Destroy((Object)(object)((Component)Hud.instance.m_statusEffects.Last()).gameObject); Hud.instance.m_statusEffects.RemoveAt(Hud.instance.m_statusEffects.Count - 1); } Hud.instance.m_statusEffectListRoot.anchoredPosition = ((MyLittleUI.modEnabled.Value && GetStatusEffectsPositionEnabled()) ? GetStatusEffectsPositionAnchor() : m_statusEffectListRootPositionOriginal); Hud.instance.m_statusEffectTemplate = ((MyLittleUI.modEnabled.Value && GetStatusEffectsElementEnabled()) ? m_statusEffectTemplate : m_statusEffectTemplateOriginal); } } public static void ChangeSailingIndicator() { //IL_0015: 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_0033: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Hud.instance == (Object)null)) { if (m_shipWindIndicatorRootPositionOriginal == Vector2.zero) { m_shipWindIndicatorRootPositionOriginal = Hud.instance.m_shipWindIndicatorRoot.anchoredPosition; m_shipWindIconRootPositionOriginal = ((Component)Hud.instance.m_shipHudRoot.transform.Find("PowerIcon")).GetComponent<RectTransform>().anchoredPosition; } Hud.instance.m_shipWindIndicatorRoot.anchoredPosition = ((MyLittleUI.modEnabled.Value && GetSailingIndicatorEnabled()) ? GetSailingIndicatorWindIndicatorPosition() : m_shipWindIndicatorRootPositionOriginal); ((Transform)Hud.instance.m_shipWindIndicatorRoot).localScale = Vector3.one * ((MyLittleUI.modEnabled.Value && GetSailingIndicatorEnabled()) ? GetSailingIndicatorWindIndicatorScale() : 1f); ((Component)Hud.instance.m_shipHudRoot.transform.Find("PowerIcon")).GetComponent<RectTransform>().anchoredPosition = ((MyLittleUI.modEnabled.Value && GetSailingIndicatorEnabled()) ? GetSailingIndicatorPowerIconPosition() : m_shipWindIconRootPositionOriginal); ((Transform)((Component)Hud.instance.m_shipHudRoot.transform.Find("PowerIcon")).GetComponent<RectTransform>()).localScale = Vector3.one * ((MyLittleUI.modEnabled.Value && GetSailingIndicatorEnabled()) ? GetSailingIndicatorPowerIconScale() : 1f); } } private static Vector2 GetStatusEffectsPositionAnchor() { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return Game.m_noMap ? MyLittleUI.statusEffectsPositionAnchorNomap.Value : MyLittleUI.statusEffectsPositionAnchor.Value; } private static bool GetSailingIndicatorEnabled() { return Game.m_noMap ? MyLittleUI.sailingIndicatorEnabledNomap.Value : MyLittleUI.sailingIndicatorEnabled.Value; } private static Vector2 GetSailingIndicatorWindIndicatorPosition() { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return Game.m_noMap ? MyLittleUI.sailingIndicatorWindIndicatorPositionNomap.Value : MyLittleUI.sailingIndicatorWindIndicatorPosition.Value; } private static float GetSailingIndicatorWindIndicatorScale() { return Game.m_noMap ? MyLittleUI.sailingIndicatorWindIndicatorScaleNomap.Value : MyLittleUI.sailingIndicatorWindIndicatorScale.Value; } private static Vector2 GetSailingIndicatorPowerIconPosition() { //IL_0019: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return Game.m_noMap ? MyLittleUI.sailingIndicatorPowerIconPositionNomap.Value : MyLittleUI.sailingIndicatorPowerIconPosition.Value; } private static float GetSailingIndicatorPowerIconScale() { return Game.m_noMap ? MyLittleUI.sailingIndicatorPowerIconScaleNomap.Value : MyLittleUI.sailingIndicatorPowerIconScale.Value; } private static bool GetStatusEffectsPositionEnabled() { return Game.m_noMap ? MyLittleUI.statusEffectsPositionEnabledNomap.Value : MyLittleUI.statusEffectsPositionEnabled.Value; } private static bool GetStatusEffectsElementEnabled() { return Game.m_noMap ? MyLittleUI.statusEffectsElementEnabledNomap.Value : MyLittleUI.statusEffectsElementEnabled.Value; } } [BepInPlugin("shudnal.MyLittleUI", "My Little UI", "1.0.6")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("randyknapp.mods.auga")] public class MyLittleUI : BaseUnityPlugin { public enum StationHover { Vanilla, Percentage, MinutesSeconds } public enum ChestItemsHover { Vanilla, Percentage, ItemsMaxRoom, FreeSlots } public enum ChestNameHover { Vanilla, CustomName, TypeThenCustomName, CustomNameThenType } public enum StatusEffectDirection { RightToLeft, LeftToRight, TopToBottom, BottomToTop } [HarmonyPatch(typeof(Container), "GetHoverText")] private class Container_GetHoverText_Duration { private static readonly StringBuilder result = new StringBuilder(); private static void Postfix(Container __instance, ref string __result, bool ___m_checkGuardStone, string ___m_name, Inventory ___m_inventory) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!modEnabled.Value || (chestHoverName.Value == ChestNameHover.Vanilla && chestHoverItems.Value == ChestItemsHover.Vanilla) || (___m_checkGuardStone && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false))) { return; } result.Clear(); string @string = __instance.m_nview.GetZDO().GetString(ZDOVars.s_text, ""); if (chestHoverName.Value == ChestNameHover.Vanilla || !chestCustomName.Value || Utility.IsNullOrWhiteSpace(@string)) { result.Append(___m_name); } else if (chestHoverName.Value == ChestNameHover.CustomName) { result.Append(@string); } else if (chestHoverName.Value == ChestNameHover.TypeThenCustomName) { result.Append(___m_name); result.Append(" ("); result.Append(@string); result.Append(")"); } else if (chestHoverName.Value == ChestNameHover.CustomNameThenType) { result.Append(@string); result.Append(" ("); result.Append(___m_name); result.Append(")"); } result.Append(" "); if (chestHoverItems.Value == ChestItemsHover.Percentage) { result.Append($"{___m_inventory.SlotsUsedPercentage():F0}%"); } else if (chestHoverItems.Value == ChestItemsHover.FreeSlots) { result.Append($"{___m_inventory.GetEmptySlots()}"); } else if (chestHoverItems.Value == ChestItemsHover.ItemsMaxRoom) { result.Append($"{___m_inventory.NrOfItems()}/{___m_inventory.GetWidth() * ___m_inventory.GetHeight()}"); } else if (___m_inventory.NrOfItems() == 0) { result.Append("( $piece_container_empty )"); } result.Append("\n[<color=yellow><b>$KEY_Use</b></color>] $piece_container_open"); if (chestShowHoldToStack.Value) { result.Append(" $msg_stackall_hover"); } long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); if (__instance.CheckAccess(playerID) && chestShowRename.Value) { if (!ZInput.IsNonClassicFunctionality() || !ZInput.IsGamepadActive()) { result.Append("\n[<color=yellow><b>$KEY_AltPlace + $KEY_Use</b></color>] $hud_rename"); } else { result.Append("\n[<color=yellow><b>$KEY_JoyAltKeys + $KEY_Use</b></color>] $hud_rename"); } } __result = Localization.instance.Localize(result.ToString()); } } [HarmonyPatch(typeof(Container), "Interact")] private class Container_Interact_ChestRename { private static bool Prefix(Container __instance, Humanoid character, bool hold, bool alt, bool ___m_checkGuardStone) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!modEnabled.Value) { return true; } if (!chestCustomName.Value) { return true; } if (!alt) { return true; } if (hold) { return true; } if (___m_checkGuardStone && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, true, false)) { ((Character)character).Message((MessageType)2, "$piece_noaccess", 0, (Sprite)null); return true; } long playerID = Game.instance.GetPlayerProfile().GetPlayerID(); if (!__instance.CheckAccess(playerID)) { ((Character)character).Message((MessageType)2, "$piece_noaccess", 0, (Sprite)null); return true; } textInputForContainer = __instance; TextInput.instance.Show("$hud_rename " + __instance.m_name, __instance.m_nview.GetZDO().GetString(ZDOVars.s_text, ""), 32); return false; } } [HarmonyPatch(typeof(TextInput), "setText")] private class TextInput_setText_ChestRename { private static void Postfix(string text) { if (modEnabled.Value && !((Object)(object)textInputForContainer == (Object)null)) { textInputForContainer.m_nview.GetZDO().Set(ZDOVars.s_text, text); textInputForContainer.OnContainerChanged(); textInputForContainer = null; } } } [HarmonyPatch(typeof(TextInput), "Hide")] private class TextInput_Hide_ChestRename { private static void Postfix() { if (modEnabled.Value && !((Object)(object)textInputForContainer == (Object)null)) { textInputForContainer = null; } } } [HarmonyPatch(typeof(Fermenter), "GetHoverText")] private class Fermenter_GetHoverText_Duration { private static void Postfix(Fermenter __instance, ref string __result, bool ___m_exposed) { //IL_004f: 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_00cd: Invalid comparison between Unknown and I4 if (!modEnabled.Value || hoverFermenter.Value == StationHover.Vanilla || Utility.IsNullOrWhiteSpace(__result) || ___m_exposed || !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)) { return; } string text = Localization.instance.Localize(__instance.GetContentName()); if (!string.IsNullOrEmpty(text) && __result.Contains(text + ", ")) { __result = __result.Replace(text + ", ", "") + "\n" + text; } if ((int)__instance.GetStatus() == 1) { if (hoverFermenter.Value == StationHover.Percentage) { __result += $"\n{__instance.GetFermentationTime() / (double)__instance.m_fermentationDuration:P0}"; } else if (hoverFermenter.Value == StationHover.MinutesSeconds) { __result = __result + "\n" + FromSeconds((double)__instance.m_fermentationDuration - __instance.GetFermentationTime()); } } } } [HarmonyPatch(typeof(Plant), "GetHoverText")] private class Plant_GetHoverText_Duration { private static void Postfix(Plant __instance, ref string __result) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if (modEnabled.Value && hoverPlant.Value != 0 && !Utility.IsNullOrWhiteSpace(__result) && (int)__instance.GetStatus() <= 0) { if (hoverPlant.Value == StationHover.Percentage) { __result += $"\n{__instance.TimeSincePlanted() / (double)__instance.GetGrowTime():P0}"; } else if (hoverPlant.Value == StationHover.MinutesSeconds) { __result = __result + "\n" + FromSeconds((double)__instance.GetGrowTime() - __instance.TimeSincePlanted()); } } } } [HarmonyPatch(typeof(Beehive), "GetHoverText")] private class Beehive_GetHoverText_Duration { private static void Postfix(Beehive __instance, ref string __result) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!modEnabled.Value || hoverBeeHive.Value == StationHover.Vanilla || Utility.IsNullOrWhiteSpace(__result)) { return; } int honeyLevel = __instance.GetHoneyLevel(); if (!PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false) || honeyLevel == __instance.m_maxHoney) { return; } float @float = __instance.m_nview.GetZDO().GetFloat("product", 0f); if (hoverBeeHive.Value == StationHover.Percentage) { __result += $"\n{@float / __instance.m_secPerUnit:P0}"; } else if (hoverBeeHive.Value == StationHover.MinutesSeconds) { __result = __result + "\n" + FromSeconds(__instance.m_secPerUnit - @float); } if (hoverBeeHiveTotal.Value && honeyLevel < 3) { if (hoverBeeHive.Value == StationHover.Percentage) { __result += $"\n{(@float + __instance.m_secPerUnit * (float)honeyLevel) / (__instance.m_secPerUnit * (float)__instance.m_maxHoney):P0}"; } else if (hoverBeeHive.Value == StationHover.MinutesSeconds) { __result = __result + "\n" + FromSeconds(__instance.m_secPerUnit * (float)__instance.m_maxHoney - (@float + __instance.m_secPerUnit * (float)honeyLevel)); } } } } [HarmonyPatch(typeof(CookingStation), "UpdateCooking")] private class CookingStation_UpdateCooking_Duration { private static readonly StringBuilder sb = new StringBuilder(); private static string GetItemName(CookingStation __instance, string currentItem, out bool itemReady, out ItemConversion conversion) { string text = currentItem; conversion = __instance.GetItemConversion(currentItem); if (conversion != null) { itemReady = ((Object)((Component)conversion.m_to).gameObject).name == text; text = (itemReady ? conversion.m_to.GetHoverName() : conversion.m_from.GetHoverName()); } else { itemReady = false; List<ItemDrop> allItems = ObjectDB.instance.GetAllItems((ItemType)1, currentItem); if (allItems.Count > 0) { text = allItems[0].GetHoverName(); } } return text; } private static string HoverText(CookingStation __instance, string ___m_name, string ___m_addItemTooltip, ZNetView ___m_nview) { sb.Clear(); if (___m_nview.IsOwner()) { string text = default(string); float num = default(float); Status val = default(Status); for (int i = 0; i < __instance.m_slots.Length; i++) { __instance.GetSlot(i, ref text, ref num, ref val); if (text == "") { continue; } sb.Append("\n"); bool itemReady; ItemConversion conversion; string itemName = GetItemName(__instance, text, out itemReady, out conversion); if (conversion == null || text == ((Object)__instance.m_overCookedItem).name) { sb.Append(itemName); continue; } sb.Append(itemName); sb.Append(" "); bool flag = itemReady && Mathf.Sin(Time.time * 10f) > 0f; if (flag) { sb.Append("<color=red>"); } if (hoverCooking.Value == StationHover.Percentage) { sb.Append($"{(num - (itemReady ? conversion.m_cookTime : 0f)) / conversion.m_cookTime:P0}"); } else if (hoverCooking.Value == StationHover.MinutesSeconds) { sb.Append(FromSeconds(conversion.m_cookTime - (num - (itemReady ? conversion.m_cookTime : 0f)))); } if (flag) { sb.Append("</color>"); } } } return ___m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] " + ___m_addItemTooltip + (ZInput.GamepadActive ? "" : ("\n[<color=yellow><b>1-8</b></color>] " + ___m_addItemTooltip)) + Localization.instance.Localize(sb.ToString()); } private static void Postfix(CookingStation __instance, Switch ___m_addFoodSwitch, string ___m_addItemTooltip, string ___m_name, ZNetView ___m_nview) { if (modEnabled.Value && hoverCooking.Value != 0 && Object.op_Implicit((Object)(object)___m_addFoodSwitch)) { ___m_addFoodSwitch.m_hoverText = HoverText(__instance, ___m_name, ___m_addItemTooltip, ___m_nview); } } } [HarmonyPatch(typeof(CookingStation), "HoverText")] private class CookingStation_HoverText_Duration { private static readonly StringBuilder sb = new StringBuilder(); private static string GetItemName(CookingStation __instance, string currentItem, out bool itemReady, out ItemConversion conversion) { string text = currentItem; conversion = __instance.GetItemConversion(currentItem); if (conversion != null) { itemReady = ((Object)((Component)conversion.m_to).gameObject).name == text; text = (itemReady ? conversion.m_to.GetHoverName() : conversion.m_from.GetHoverName()); } else { itemReady = false; List<ItemDrop> allItems = ObjectDB.instance.GetAllItems((ItemType)1, currentItem); if (allItems.Count > 0) { text = allItems[0].GetHoverName(); } } return text; } private static void Postfix(CookingStation __instance, ref string __result, ZNetView ___m_nview) { if (!modEnabled.Value || hoverCooking.Value == StationHover.Vanilla || Utility.IsNullOrWhiteSpace(__result) || !___m_nview.IsOwner()) { return; } sb.Clear(); string text = default(string); float num = default(float); Status val = default(Status); for (int i = 0; i < __instance.m_slots.Length; i++) { __instance.GetSlot(i, ref text, ref num, ref val); if (text == "") { continue; } sb.Append("\n"); bool itemReady; ItemConversion conversion; string itemName = GetItemName(__instance, text, out itemReady, out conversion); if (conversion == null || text == ((Object)__instance.m_overCookedItem).name) { sb.Append(itemName); continue; } sb.Append(itemName); sb.Append(" "); if (itemReady && Mathf.Sin(Time.time * 10f) > 0f) { sb.Append("<color=red>"); } if (hoverCooking.Value == StationHover.Percentage) { sb.Append($"{(num - (itemReady ? conversion.m_cookTime : 0f)) / conversion.m_cookTime:P0}"); } else if (hoverCooking.Value == StationHover.MinutesSeconds) { sb.Append(FromSeconds(conversion.m_cookTime - (num - (itemReady ? conversion.m_cookTime : 0f)))); } if (itemReady && Mathf.Sin(Time.time * 10f) > 0f) { sb.Append("</color>"); } } __result += Localization.instance.Localize(sb.ToString()); } } [HarmonyPatch(typeof(Smelter), "OnHoverAddFuel")] private class Smelter_OnHoverAddFuel_SmelterHover { private static readonly StringBuilder sb = new StringBuilder(); private static void Postfix(Smelter __instance, ref string __result, string ___m_name, ItemDrop ___m_fuelItem, int ___m_maxFuel, int ___m_maxOre, int ___m_fuelPerProduct, float ___m_secPerProduct, Windmill ___m_windmill) { if (modEnabled.Value && (hoverSmelterShowFuelAndItem.Value || hoverSmelterEstimatedTime.Value)) { float fuel = __instance.GetFuel(); int queueSize = __instance.GetQueueSize(); sb.Clear(); sb.Append(___m_name); if (hoverSmelterShowFuelAndItem.Value && ___m_maxOre > 0) { sb.Append($" ({queueSize}/{___m_maxOre})"); } sb.Append(" ("); sb.Append(___m_fuelItem.m_itemData.m_shared.m_name); sb.Append($" {Mathf.CeilToInt(fuel)}/{___m_maxFuel})"); sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] $piece_smelter_add "); sb.Append(___m_fuelItem.m_itemData.m_shared.m_name); if (hoverSmelterEstimatedTime.Value && __instance.IsActive() && ___m_maxOre > 0) { sb.Append("\n"); float num = Mathf.Max(((Object)(object)___m_windmill != (Object)null) ? ___m_windmill.GetPowerOutput() : 1f, 0.0001f); float num2 = (float)((___m_fuelPerProduct != 0) ? Math.Min(Mathf.FloorToInt(fuel / (float)___m_fuelPerProduct), queueSize) : queueSize) * ___m_secPerProduct; sb.Append(FromSeconds((___m_fuelPerProduct == 0 || fuel / (float)___m_fuelPerProduct >= (float)queueSize) ? ((num2 - __instance.GetBakeTimer()) / num) : (___m_secPerProduct * fuel / (float)___m_fuelPerProduct))); } __result = Localization.instance.Localize(sb.ToString()); } } } [HarmonyPatch(typeof(Smelter), "OnHoverAddOre")] private class Smelter_OnHoverAddOre_SmelterHover { private static readonly StringBuilder sb = new StringBuilder(); private static string GetItemName(Smelter __instance, string currentItem, ref bool nonconversionItem) { string result = currentItem; ItemConversion itemConversion = __instance.GetItemConversion(currentItem); if (itemConversion != null) { result = itemConversion.m_from.m_itemData.m_shared.m_name; } else { nonconversionItem = true; List<ItemDrop> allItems = ObjectDB.instance.GetAllItems((ItemType)1, currentItem); if (allItems.Count > 0) { result = allItems[0].m_itemData.m_shared.m_name; } } return result; } private static void Postfix(Smelter __instance, ref string __result, string ___m_name, ItemDrop ___m_fuelItem, int ___m_maxFuel, int ___m_maxOre, int ___m_fuelPerProduct, float ___m_secPerProduct, bool ___m_requiresRoof, bool ___m_haveRoof, string ___m_addOreTooltip, ZNetView ___m_nview, List<ItemConversion> ___m_conversion, Windmill ___m_windmill) { if (!modEnabled.Value || (!hoverSmelterShowFuelAndItem.Value && !hoverSmelterEstimatedTime.Value && !hoverSmelterShowQueuedItems.Value)) { return; } float fuel = __instance.GetFuel(); int queueSize = __instance.GetQueueSize(); sb.Clear(); sb.Append(___m_name); sb.Append($" ({queueSize}/{___m_maxOre})"); if (hoverSmelterShowFuelAndItem.Value && (Object)(object)___m_fuelItem != (Object)null && ___m_maxFuel > 0) { sb.Append(" ("); sb.Append(___m_fuelItem.m_itemData.m_shared.m_name); sb.Append($" {Mathf.CeilToInt(fuel)}/{___m_maxFuel})"); } if (___m_requiresRoof && !___m_haveRoof && Mathf.Sin(Time.time * 10f) > 0f) { sb.Append(" <color=yellow>$piece_smelter_reqroof</color>"); } sb.Append("\n[<color=yellow><b>$KEY_Use</b></color>] " + ___m_addOreTooltip); if (hoverSmelterEstimatedTime.Value && __instance.IsActive() && ___m_maxOre > 0) { sb.Append("\n"); float num = Mathf.Max(((Object)(object)___m_windmill != (Object)null) ? ___m_windmill.GetPowerOutput() : 1f, 0.0001f); float num2 = (float)((___m_fuelPerProduct != 0) ? Math.Min(Mathf.FloorToInt(fuel / (float)___m_fuelPerProduct), queueSize) : queueSize) * ___m_secPerProduct; sb.Append(FromSeconds((___m_fuelPerProduct == 0 || fuel / (float)___m_fuelPerProduct >= (float)queueSize) ? ((num2 - __instance.GetBakeTimer()) / num) : (___m_secPerProduct * fuel / (float)___m_fuelPerProduct))); } if (hoverSmelterShowQueuedItems.Value && __instance.GetQueuedOre() != "") { List<string> list = new List<string>(); int num3 = 0; string text = ""; bool nonconversionItem = false; for (int i = 0; i < queueSize; i++) { string @string = ___m_nview.GetZDO().GetString($"item{i}", ""); if (@string == "") { break; } if (text == "") { num3++; text = @string; } else if (@string == text) { num3++; } else { list.Add($"{GetItemName(__instance, text, ref nonconversionItem)} x{num3}"); num3 = 1; text = @string; } } if (text != "" && num3 > 0) { list.Add($"{GetItemName(__instance, text, ref nonconversionItem)} x{num3}"); } if (___m_conversion.Count > 1 || list.Count > 1 || nonconversionItem) { sb.Append("\n"); sb.Append("\n"); sb.Append(string.Join("\n", list)); } } __result = Localization.instance.Localize(sb.ToString()); } } [HarmonyPatch(typeof(FejdStartup), "UpdateCharacterList")] private class FejdStartup_UpdateCharacterList_MainMenuStats { private static readonly StringBuilder sb = new StringBuilder(); private static PlayerProfile playerProfile; private static int statCount = 0; private static string GetStatName(PlayerStatType stat) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) string name = Enum.GetName(typeof(PlayerStatType), stat); StringBuilder stringBuilder = new StringBuilder(); string text = name; foreach (char c in text) { if (char.IsUpper(c) && stringBuilder.Length > 0) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString(); } private static void AddStat(PlayerStatType stat, string statName = "", bool showIfZero = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (playerProfile.m_playerStats.m_stats.ContainsKey(stat)) { float num = playerProfile.m_playerStats.m_stats[stat]; if (num != 0f || showIfZero) { sb.Append("\n"); sb.Append(string.Format("{0}: {1}", (statName != "") ? statName : GetStatName(stat), num)); statCount++; } } } private static void AddLine() { if (statCount > 0) { sb.Append("\n"); } statCount = 0; } private static void Postfix(TMP_Text ___m_csSourceInfo, List<PlayerProfile> ___m_profiles, int ___m_profileIndex, GameObject ___m_playerInstance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_00ae: 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_00da: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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) if (!modEnabled.Value || !statsMainMenu.Value || !Object.op_Implicit((Object)(object)___m_playerInstance)) { return; } playerProfile = ___m_profiles[___m_profileIndex]; sb.Append(Localization.instance.Localize((((int)playerProfile.m_fileSource == 3) ? "$menu_legacynotice \n\n" : "") + ((!FileHelpers.m_cloudEnabled) ? "$menu_cloudsavesdisabled" : ""))); if (statsMainMenuAll.Value) { ((Component)___m_csSourceInfo.transform).GetComponent<RectTransform>().anchorMax = Vector2.one; ___m_csSourceInfo.transform.localPosition = new Vector3(___m_csSourceInfo.transform.localPosition.x, 0f, ___m_csSourceInfo.transform.localPosition.z); foreach (PlayerStatType value in Enum.GetValues(typeof(PlayerStatType))) { AddStat(value); } } else { AddStat((PlayerStatType)6, "Kills", showIfZero: true); AddStat((PlayerStatType)0, "", showIfZero: true); AddStat((PlayerStatType)1, "Crafts", showIfZero: true); AddStat((PlayerStatType)2, "", showIfZero: true); if (statsMainMenuAdvanced.Value) { AddLine(); AddStat((PlayerStatType)8); AddStat((PlayerStatType)9); AddStat((PlayerStatType)85); AddStat((PlayerStatType)96); AddLine(); AddStat((PlayerStatType)3); AddStat((PlayerStatType)4); AddStat((PlayerStatType)23); AddStat((PlayerStatType)49); AddLine(); AddStat((PlayerStatType)28); AddStat((PlayerStatType)36); AddStat((PlayerStatType)38); AddStat((PlayerStatType)76); AddStat((PlayerStatType)77); AddStat((PlayerStatType)48); AddLine(); AddStat((PlayerStatType)50); AddStat((PlayerStatType)15); AddStat((PlayerStatType)51); AddStat((PlayerStatType)52); AddStat((PlayerStatType)53); } } ___m_csSourceInfo.text = sb.ToString(); sb.Clear(); } } [HarmonyPatch(typeof(Tameable), "GetHoverText")] private class Tameable_GetHoverText_Tameable { private static void Postfix(Tameable __instance, ZNetView ___m_nview, ref string __result) { if (!modEnabled.Value || hoverTame.Value == StationHover.Vanilla || !___m_nview.IsValid()) { return; } if (!__instance.m_character.IsTamed()) { if (__instance.m_tamingTime == 0f && hoverTameTimeToTame.Value) { return; } float remainingTime = __instance.GetRemainingTime(); if (remainingTime != __instance.m_tamingTime) { if (hoverTame.Value == StationHover.Percentage) { __result += Localization.instance.Localize($"\n$hud_tame: {(__instance.m_tamingTime - remainingTime) / __instance.m_tamingTime:P0}"); } else if (hoverTame.Value == StationHover.MinutesSeconds) { __result += Localization.instance.Localize("\n$hud_tame: " + FromSeconds(remainingTime)); } } } else { if (!hoverTameTimeToFed.Value) { return; } DateTime dateTime = new DateTime(___m_nview.GetZDO().GetLong(ZDOVars.s_tameLastFeeding, 0L)); double totalSeconds = (ZNet.instance.GetTime() - dateTime).TotalSeconds; if (!(totalSeconds >= (double)__instance.m_fedDuration)) { double num = (double)__instance.m_fedDuration - totalSeconds; if (hoverTame.Value == StationHover.Percentage) { __result += Localization.instance.Localize($"\n$hud_tamehappy: {num / (double)__instance.m_fedDuration:P0}"); } else if (hoverTame.Value == StationHover.MinutesSeconds) { __result += Localization.instance.Localize("\n$hud_tamehappy: " + FromSeconds(num)); } } } } } [HarmonyPatch(typeof(Character), "GetHoverText")] private class Character_GetHoverText_GrowUpDevelopment { private static void Postfix(Character __instance, ZNetView ___m_nview, ref string __result) { if (!modEnabled.Value || !___m_nview.IsValid() || hoverCharacter.Value == StationHover.Vanilla) { return; } Growup val = default(Growup); if (hoverCharacterGrowth.Value && ((Component)__instance).TryGetComponent<Growup>(ref val) && val.m_growTime != 0f) { double totalSeconds = val.m_baseAI.GetTimeSinceSpawned().TotalSeconds; if (!(totalSeconds > (double)val.m_growTime)) { string name = ((Object)val.GetPrefab()).name; if (!characterNames.ContainsKey(name)) { characterNames.Add(name, val.GetPrefab().GetComponent<Character>()?.m_name); } switch (hoverCharacter.Value) { case StationHover.Percentage: __result += $"\n{Localization.instance.Localize(characterNames[name])}: {totalSeconds / (double)val.m_growTime:P0}"; break; case StationHover.MinutesSeconds: __result = __result + "\n" + Localization.instance.Localize(characterNames[name]) + ": " + FromSeconds((double)val.m_growTime - totalSeconds); break; } } } else { Procreation val2 = default(Procreation); if (!hoverCharacterProcreation.Value || !((Component)__instance).TryGetComponent<Procreation>(ref val2) || !val2.IsPregnant()) { return; } long @long = ___m_nview.GetZDO().GetLong(ZDOVars.s_pregnant, 0L); double totalSeconds2 = (ZNet.instance.GetTime() - new DateTime(@long)).TotalSeconds; if (!(totalSeconds2 > (double)val2.m_pregnancyDuration)) { string name2 = ((Object)val2.m_offspring).name; if (!characterNames.ContainsKey(name2)) { characterNames.Add(name2, val2.m_offspring.GetComponent<Character>()?.m_name); } switch (hoverCharacter.Value) { case StationHover.Percentage: __result += $"\n{Localization.instance.Localize(characterNames[name2])}: {totalSeconds2 / (double)val2.m_pregnancyDuration:P0}"; break; case StationHover.MinutesSeconds: __result = __result + "\n" + Localization.instance.Localize(characterNames[name2]) + ": " + FromSeconds((double)val2.m_pregnancyDuration - totalSeconds2); break; } } } } } [HarmonyPatch(typeof(EggGrow), "GetHoverText")] private class EggGrow_GetHoverText_EggGrow { private static void Postfix(EggGrow __instance, ItemDrop ___m_item, ZNetView ___m_nview, ref string __result) { if (!modEnabled.Value || hoverCharacter.Value == StationHover.Vanilla || !Object.op_Implicit((Object)(object)___m_item) || !Object.op_Implicit((Object)(object)___m_nview) || !___m_nview.IsValid()) { return; } float @float = ___m_nview.GetZDO().GetFloat(ZDOVars.s_growStart, 0f); bool flag = @float > 0f; if (!(hoverCharacterEggGrow.Value && flag)) { return; } double num = ZNet.instance.GetTimeSeconds() - (double)@float; if (!(num > (double)__instance.m_growTime)) { GameObject grownPrefab = __instance.m_grownPrefab; string name = ((Object)grownPrefab).name; if (!characterNames.ContainsKey(name)) { characterNames.Add(name, grownPrefab.GetComponent<Character>()?.m_name); } switch (hoverCharacter.Value) { case StationHover.Percentage: __result += $"\n{Localization.instance.Localize(characterNames[name])}: {num / (double)__instance.m_growTime:P0}"; break; case StationHover.MinutesSeconds: __result = __result + "\n" + Localization.instance.Localize(characterNames[name]) + ": " + FromSeconds((double)__instance.m_growTime - num); break; } } } } [HarmonyPatch(typeof(InventoryGui), "SetupRequirement")] public static class InventoryGui_SetupRequirement_AddAvailableAmount { public static void Postfix(Transform elementRoot, Requirement req, Player player, bool __result) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (modEnabled.Value && showAvailableItemsAmount.Value && __result && !UnityInput.Current.GetKey((KeyCode)308) && !UnityInput.Current.GetKey((KeyCode)307)) { TMP_Text component = ((Component)((Component)elementRoot).transform.Find("res_amount")).GetComponent<TMP_Text>(); if (!((Object)(object)component == (Object)null)) { component.SetText(component.text + $" <color=#{ColorUtility.ToHtmlStringRGBA(availableItemsAmountColor.Value)}>({((Humanoid)player).GetInventory().CountItems(req.m_resItem.m_itemData.m_shared.m_name, -1, true)})</color>"); } } } } [HarmonyPatch(typeof(InventoryGui), "Awake")] public static class InventoryGui_Awake_AddAvailableAmount { public static void Postfix(InventoryGui __instance) { if (modEnabled.Value && inventoryOpenCloseAnimationSpeed.Value != 1f) { SetInventoryAnimationSpeed(); } } } private const string pluginID = "shudnal.MyLittleUI"; private const string pluginName = "My Little UI"; private const string pluginVersion = "1.0.6"; private Harmony _harmony; public static ConfigEntry<bool> modEnabled; private static ConfigEntry<bool> loggingEnabled; private static ConfigEntry<bool> showAvailableItemsAmount; private static ConfigEntry<Color> availableItemsAmountColor; public static ConfigEntry<bool> durabilityEnabled; public static ConfigEntry<Color> durabilityFine; public static ConfigEntry<Color> durabilityWorn; public static ConfigEntry<Color> durabilityAtRisk; public static ConfigEntry<Color> durabilityBroken; public static ConfigEntry<float> itemIconScale; public static ConfigEntry<bool> itemTooltip; public static ConfigEntry<bool> itemTooltipColored; public static ConfigEntry<bool> itemQuality; public static ConfigEntry<string> itemQualitySymbol; public static ConfigEntry<Color> itemQualitySymbolColor; public static ConfigEntry<float> itemQualitySymbolSize; public static ConfigEntry<int> itemQualityMax; public static ConfigEntry<int> itemQualityRows; public static ConfigEntry<int> itemQualityColumns; public static ConfigEntry<float> itemQualityLineSpacing; public static ConfigEntry<float> itemQualityCharacterSpacing; private static ConfigEntry<float> inventoryOpenCloseAnimationSpeed; private static ConfigEntry<bool> statsMainMenu; private static ConfigEntry<bool> statsMainMenuAdvanced; private static ConfigEntry<bool> statsMainMenuAll; public static ConfigEntry<bool> statsCharacterArmor; public static ConfigEntry<bool> statsCharacterEffects; public static ConfigEntry<bool> statsCharacterEffectsMagic; private static ConfigEntry<StationHover> hoverFermenter; private static ConfigEntry<StationHover> hoverPlant; private static ConfigEntry<StationHover> hoverCooking; private static ConfigEntry<StationHover> hoverBeeHive; private static ConfigEntry<bool> hoverBeeHiveTotal; public static ConfigEntry<StationHover> hoverCharacter; public static ConfigEntry<bool> hoverCharacterGrowth; public static ConfigEntry<bool> hoverCharacterProcreation; public static ConfigEntry<bool> hoverCharacterEggGrow; private static ConfigEntry<StationHover> hoverTame; private static ConfigEntry<bool> hoverTameTimeToTame; private static ConfigEntry<bool> hoverTameTimeToFed; private static ConfigEntry<bool> hoverSmelterEstimatedTime; private static ConfigEntry<bool> hoverSmelterShowFuelAndItem; private static ConfigEntry<bool> hoverSmelterShowQueuedItems; private static ConfigEntry<ChestItemsHover> chestHoverItems; private static ConfigEntry<ChestNameHover> chestHoverName; private static ConfigEntry<bool> chestCustomName; private static ConfigEntry<bool> chestShowHoldToStack; private static ConfigEntry<bool> chestShowRename; public static ConfigEntry<bool> statusEffectsPositionEnabled; public static ConfigEntry<Vector2> statusEffectsPositionAnchor; public static ConfigEntry<StatusEffectDirection> statusEffectsFillingDirection; public static ConfigEntry<int> statusEffectsPositionSpacing; public static ConfigEntry<bool> statusEffectsElementEnabled; public static ConfigEntry<int> statusEffectsElementSize; public static ConfigEntry<bool> statusEffectsPositionEnabledNomap; public static ConfigEntry<Vector2> statusEffectsPositionAnchorNomap; public static ConfigEntry<StatusEffectDirection> statusEffectsFillingDirectionNomap; public static ConfigEntry<int> statusEffectsPositionSpacingNomap; public static ConfigEntry<bool> statusEffectsElementEnabledNomap; public static ConfigEntry<int> statusEffectsElementSizeNomap; public static ConfigEntry<bool> sailingIndicatorEnabled; public static ConfigEntry<Vector2> sailingIndicatorPowerIconPosition; public static ConfigEntry<float> sailingIndicatorPowerIconScale; public static ConfigEntry<Vector2> sailingIndicatorWindIndicatorPosition; public static ConfigEntry<float> sailingIndicatorWindIndicatorScale; public static ConfigEntry<bool> sailingIndicatorEnabledNomap; public static ConfigEntry<Vector2> sailingIndicatorPowerIconPositionNomap; public static ConfigEntry<float> sailingIndicatorPowerIconScaleNomap; public static ConfigEntry<Vector2> sailingIndicatorWindIndicatorPositionNomap; public static ConfigEntry<float> sailingIndicatorWindIndicatorScaleNomap; private static Container textInputForContainer; private static readonly Dictionary<string, string> characterNames = new Dictionary<string, string>(); private static MyLittleUI instance; public static Component epicLootPlugin; private void Awake() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Dedicated server. Loading skipped."); return; } _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "shudnal.MyLittleUI"); instance = this; ConfigInit(); epicLootPlugin = ((Component)this).GetComponent("EpicLoot"); ItemTooltip.Initialize(); Game.isModded = true; } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } public static void LogInfo(object data) { if (loggingEnabled.Value) { ((BaseUnityPlugin)instance).Logger.LogInfo(data); } } private void ConfigInit() { //IL_00a0: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d7f: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 2562, "Nexus mod ID for updates"); modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the mod."); loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Logging enabled", false, "Enable logging."); showAvailableItemsAmount = ((BaseUnityPlugin)this).Config.Bind<bool>("Item - Available resources amount", "Enabled", true, "Show amount of available resources for crafting in requirements list"); availableItemsAmountColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Available resources amount", "Color", new Color(0.68f, 0.85f, 0.9f), "Color of amount of available resources."); durabilityEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Item - Durability", "0 - Enabled", true, "Enable color of durability."); durabilityFine = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Durability", "1 - Fine", new Color(0.11765f, 0.72941f, 0.03529f, 1f), "Color of durability > 75%."); durabilityWorn = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Durability", "2 - Worn", new Color(0.72941f, 0.72941f, 0.03529f, 1f), "Color of durability > 50%."); durabilityAtRisk = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Durability", "3 - At risk", new Color(0.72941f, 0.34902f, 0.03529f, 1f), "Color of durability > 25%."); durabilityBroken = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Durability", "4 - Broken", new Color(0.72941f, 0.03529f, 0.03529f, 1f), "Color of durability >= 0%."); itemIconScale = ((BaseUnityPlugin)this).Config.Bind<float>("Item - Icon", "Icon scale", 1f, "Relative scale size of item icons."); itemTooltip = ((BaseUnityPlugin)this).Config.Bind<bool>("Item - Tooltip", "Enabled", true, "Updated item tooltip. Hold Alt to see original tooltip"); itemTooltipColored = ((BaseUnityPlugin)this).Config.Bind<bool>("Item - Tooltip", "Colored numbers", true, "Orange and yellow value numbers in tooltip, light blue if disabled"); itemQuality = ((BaseUnityPlugin)this).Config.Bind<bool>("Item - Quality", "Enabled", false, "Show item quality as symbol"); itemQualitySymbol = ((BaseUnityPlugin)this).Config.Bind<string>("Item - Quality", "Symbol", "★", "Symbol to show."); itemQualitySymbolColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Item - Quality", "Symbol Color", new Color(1f, 0.65f, 0f, 1f), "Symbol color"); itemQualitySymbolSize = ((BaseUnityPlugin)this).Config.Bind<float>("Item - Quality", "Symbol Size", 10f, "Symbol size"); itemQualityMax = ((BaseUnityPlugin)this).Config.Bind<int>("Item - Quality", "Maximum symbols", 8, "Maximum amount of symbols to show."); itemQualityRows = ((BaseUnityPlugin)this).Config.Bind<int>("Item - Quality", "Maximum rows", 2, "Maximum amount of rows to show."); itemQualityColumns = ((BaseUnityPlugin)this).Config.Bind<int>("Item - Quality", "Maximum columns", 4, "Maximum amount of columns to show."); itemQualityLineSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("Item - Quality", "Space between lines", -35f, "Line spacing."); itemQualityCharacterSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("Item - Quality", "Space between characters", 8f, "Character spacing."); itemQualitySymbol.SettingChanged += delegate { itemQualitySymbol.Value = itemQualitySymbol.Value[0].ToString(); }; itemQualitySymbol.SettingChanged += delegate { ItemIcon.FillItemQualityCache(); }; itemQualityMax.SettingChanged += delegate { ItemIcon.FillItemQualityCache(); }; itemQualityRows.SettingChanged += delegate { ItemIcon.FillItemQualityCache(); }; itemQualityColumns.SettingChanged += delegate { ItemIcon.FillItemQualityCache(); }; ItemIcon.FillItemQualityCache(); inventoryOpenCloseAnimationSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Inventory", "Animation speed", 1f, "Inventory show/close animation speed"); inventoryOpenCloseAnimationSpeed.SettingChanged += delegate { SetInventoryAnimationSpeed(); }; statsMainMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Main menu", "Show stats in main menu", true, "Show character statistics in main menu"); statsMainMenuAdvanced = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Main menu", "Show advanced stats in main menu", true, "Show advanced character statistics in main menu"); statsMainMenuAll = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Main menu", "Show all stats in main menu", false, "Show all character statistics in main menu"); statsCharacterArmor = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Character", "Show character stats on armor hover", true, "Show character stats in armor tooltip"); statsCharacterEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Character", "Show character active effects on weight hover", true, "Show character active effects in weight tooltip"); statsCharacterEffectsMagic = ((BaseUnityPlugin)this).Config.Bind<bool>("Stats - Character", "Show character active magic effects (EpicLoot) on weight hover", true, "Show character active magic effects in weight tooltip"); statsCharacterArmor.SettingChanged += delegate { InventoryCharacterStats.UpdateTooltipState(); }; statsCharacterEffects.SettingChanged += delegate { InventoryCharacterStats.UpdateTooltipState(); }; hoverCharacter = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Character", "Character Hover", StationHover.Vanilla, "Format of baby development's total needed time/percent."); hoverCharacterGrowth = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Character", "Show baby growth", true, "Show total growth percentage/remaining for babies."); hoverCharacterProcreation = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Character", "Show offspring", true, "Show percentage/remaining for new offspring."); hoverCharacterEggGrow = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Character", "Show egg hatching", true, "Show percentage/remaining for egg hatching."); hoverFermenter = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Stations", "Fermenter Hover", StationHover.Vanilla, "Hover text for fermenter."); hoverPlant = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Stations", "Plants Hover", StationHover.Vanilla, "Hover text for plants."); hoverCooking = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Stations", "Cooking stations Hover", StationHover.Vanilla, "Hover text for cooking stations."); hoverBeeHive = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Stations", "Bee Hive Hover", StationHover.Vanilla, "Hover text for bee hive."); hoverBeeHiveTotal = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Stations", "Bee Hive Show total", true, "Show total needed time/percent for bee hive."); hoverTame = ((BaseUnityPlugin)this).Config.Bind<StationHover>("Hover - Tameable", "Tameable Hover", StationHover.Vanilla, "Format of total needed time/percent to tame or to stay fed."); hoverTameTimeToTame = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Tameable", "Show time to tame", true, "Show total needed time/percent to tame."); hoverTameTimeToFed = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Tameable", "Show time to stay fed", true, "Show total needed time/percent to stay fed."); hoverSmelterEstimatedTime = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Smelters", "Show estimated time", true, "Show estimated end time for a smelter station (charcoal kiln, forge, etc. including non vanilla)."); hoverSmelterShowFuelAndItem = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Smelters", "Always show fuel and item", true, "Show current smelting item and fuel loaded on both fuel and ore switches."); hoverSmelterShowQueuedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Smelters", "Show queued items", true, "Show queued items currently being smelted. Doesn't show the list if there is only one item to smelt."); chestCustomName = ((BaseUnityPlugin)this).Config.Bind<bool>("Hover - Chests", "Enable custom names", true, "Enable custom names for chests."); chestHoverItems = ((BaseUnityPlugin)this).Config.Bind<ChestItemsHover>("Hover - Chests"