Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of BetterScoreboard v1.1.3
BetterScoreboard.dll
Decompiled 2 months agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterScoreboard.Patches; using BetterScoreboard.Properties; using HarmonyLib; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; 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("BetterScoreboard")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterScoreboard")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9dbaf54f-c6d4-4960-912e-20c5f0a0fc4c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterScoreboard { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bulletbot.betterscoreboard", "BetterScoreboard", "1.1.3")] public class Plugin : BaseUnityPlugin { public static class RiskOfOptions { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__2_0; public static Func<ItemTierConfig, object> <>9__3_0; internal void <OnAwake>b__2_0() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) foreach (ItemTierConfig itemTierConfig in instance.itemTierConfigs) { itemTierConfig.enabled.Value = (bool)((ConfigEntryBase)itemTierConfig.enabled).DefaultValue; itemTierConfig.order.Value = (int)((ConfigEntryBase)itemTierConfig.order).DefaultValue; itemTierConfig.color.Value = (Color)((ConfigEntryBase)itemTierConfig.color).DefaultValue; itemTierConfig.includedTiers.Value = (string)((ConfigEntryBase)itemTierConfig.includedTiers).DefaultValue; } } internal object <OnItemCatalogInit>b__3_0(ItemTierConfig x) { return ((ConfigEntryBase)x.order).DefaultValue; } } public const string modGUID = "com.rune580.riskofoptions"; public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } public static void OnAwake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown Bitmap icon = Resources.icon; using (MemoryStream memoryStream = new MemoryStream()) { ((Image)icon).Save((Stream)memoryStream, ImageFormat.Png); Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).filterMode = (FilterMode)0; ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.hideBelowZeroCounters)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(instance.textSizeIncrease, new IntSliderConfig { min = 0, max = 120 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.swapPositionTexts)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.defaultCurrency)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.currencyHover)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(instance.hoveredCurrency)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.useWholeNumbers)); object obj = <>c.<>9__2_0; if (obj == null) { UnityAction val2 = delegate { //IL_0066: Unknown result type (might be due to invalid IL or missing references) foreach (ItemTierConfig itemTierConfig in instance.itemTierConfigs) { itemTierConfig.enabled.Value = (bool)((ConfigEntryBase)itemTierConfig.enabled).DefaultValue; itemTierConfig.order.Value = (int)((ConfigEntryBase)itemTierConfig.order).DefaultValue; itemTierConfig.color.Value = (Color)((ConfigEntryBase)itemTierConfig.color).DefaultValue; itemTierConfig.includedTiers.Value = (string)((ConfigEntryBase)itemTierConfig.includedTiers).DefaultValue; } }; <>c.<>9__2_0 = val2; obj = (object)val2; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Revert Item Tier Settings", "General", "Reverts all settings for the item tiers.", "Confirm", (UnityAction)obj)); } public static void OnItemCatalogInit() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown foreach (ItemTierConfig item in instance.itemTierConfigs.OrderBy((ItemTierConfig x) => ((ConfigEntryBase)x.order).DefaultValue)) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(item.enabled)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(item.order, new IntSliderConfig { min = 1, max = instance.itemTierConfigs.Count })); ModSettingsManager.AddOption((BaseOption)new ColorOption(item.color)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(item.includedTiers)); } } } public class ItemTierConfig { public ItemTierDef tierDef; public string name; public ConfigEntry<bool> enabled; public ConfigEntry<int> order; public ConfigEntry<Color> color; public ConfigEntry<string> includedTiers; public ItemTierConfig(ItemTierDef tierDef = null) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_0093: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected I4, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b1: Invalid comparison between Unknown and I4 this.tierDef = tierDef; name = "Unknown"; bool flag = true; int num = 1; Color val = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)10)); string text = ""; if ((Object)(object)tierDef != (Object)null) { name = ((Object)tierDef).name; flag = (int)tierDef.tier != 6 && (int)tierDef.tier != 7 && (int)tierDef.tier != 8; num += tierDef.tier - ((int)tierDef.tier >= 6) - ((int)tierDef.tier > 10) + 1; val = Color32.op_Implicit(ColorCatalog.GetColor(tierDef.colorIndex)); text = (((int)tierDef.tier == 9) ? "VoidTier1Def,VoidTier2Def,VoidTier3Def" : ""); } enabled = ((BaseUnityPlugin)instance).Config.Bind<bool>(name, "Enabled", flag, "Determines whether to count this tier."); enabled.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateCounter = true; }; order = ((BaseUnityPlugin)instance).Config.Bind<int>(name, "Order", num, "Determines the priority of this tier."); order.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateCounter = true; }; color = ((BaseUnityPlugin)instance).Config.Bind<Color>(name, "Color", val, "Determines the color of this tier. Leave blank for default color."); color.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateCounter = true; }; includedTiers = ((BaseUnityPlugin)instance).Config.Bind<string>(name, "Included Tiers", text, "Determines the count of the listed tiers included in this tier, separated by commas."); includedTiers.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateCounter = true; }; } } public class HoverHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public bool isHovered; private void Awake() { if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<GraphicRaycaster>())) { ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); } } private void OnDisable() { isHovered = false; } public void OnPointerEnter(PointerEventData eventData) { isHovered = true; } public void OnPointerExit(PointerEventData eventData) { isHovered = false; } } public enum CurrencyType { Money, Lunar, Void } private const string modGUID = "bulletbot.betterscoreboard"; private const string modName = "BetterScoreboard"; private const string modVer = "1.1.3"; public static Plugin instance; public ManualLogSource logger; private readonly Harmony harmony = new Harmony("bulletbot.betterscoreboard"); public const string category = "General"; public ConfigEntry<bool> hideBelowZeroCounters; private ConfigEntry<int> textSizeIncrease; private ConfigEntry<bool> swapPositionTexts; public ConfigEntry<bool> currencyHover; public ConfigEntry<string> defaultCurrency; public ConfigEntry<string> hoveredCurrency; private ConfigEntry<bool> useWholeNumbers; public List<ItemTierConfig> itemTierConfigs; private UIElementAllocator<ScoreboardStrip> stripAllocator = null; private bool shouldApplyChanges = false; private float initialPosition = -1f; private float initialSize = -1f; private float initialMoneyPosition = -1f; private float initialItemCountPosition = -1f; private void Awake() { //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown instance = this; logger = Logger.CreateLogSource("BetterScoreboard"); hideBelowZeroCounters = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Hide Item Tier Counters Below Zero", true, "Determines whether the item tier counters below zero should be hidden."); hideBelowZeroCounters.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateCounter = true; }; textSizeIncrease = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Item Tier Counter Size Increase", 30, "Determines how much the text size increases on the X axis, moving to the left."); textSizeIncrease.SettingChanged += delegate { shouldApplyChanges = true; }; swapPositionTexts = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Swap Positions Between Texts", false, "Determines whether the money text and item counter text should swap positions."); swapPositionTexts.SettingChanged += delegate { shouldApplyChanges = true; }; string[] array = (from CurrencyType x in Enum.GetValues(typeof(CurrencyType)) select x.ToString()).ToArray(); string text = "\n\nOptions:\n" + string.Join("\n", array); defaultCurrency = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Default Currency", array[0], "Determines the default currency type to display when not hovering over the money text." + text); defaultCurrency.SettingChanged += delegate { ScoreboardStripPatch.shouldUpdateMoney = true; }; currencyHover = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Currency Hover", true, "Determines if the value is displayed when hovering over the money text, based on the 'Hovered Currency' setting."); hoveredCurrency = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Hovered Currency", array[1], "Determines the currency type to display when hovering over the money text." + text); useWholeNumbers = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use Whole Numbers", true, "Determines whether the numbers should display as whole numbers."); itemTierConfigs = new List<ItemTierConfig> { new ItemTierConfig() }; if (RiskOfOptions.IsLoaded()) { RiskOfOptions.OnAwake(); } Stage.onStageStartGlobal += delegate { stripAllocator = null; shouldApplyChanges = true; initialPosition = -1f; initialSize = -1f; initialMoneyPosition = -1f; initialItemCountPosition = -1f; }; HUD.shouldHudDisplay += (ShouldHudDisplayDelegate)delegate(HUD hud, ref bool _) { //IL_010a: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) if (shouldApplyChanges) { if (stripAllocator == null) { stripAllocator = (UIElementAllocator<ScoreboardStrip>)typeof(ScoreboardController).GetField("stripAllocator", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(hud.scoreboardPanel.GetComponent<ScoreboardController>()); } else { List<PlayerCharacterMasterController> list = PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController x) => ((Component)x).gameObject.activeInHierarchy && (Object)(object)x.master.GetBody() != (Object)null && Util.GetBestMasterName(x.master) != null).ToList(); for (int i = 0; i < list.Count; i++) { TextMeshProUGUI moneyText = stripAllocator.elements[i].moneyText; GameObject gameObject = ((Component)moneyText).gameObject; if ((Object)(object)gameObject.GetComponent<HoverHandler>() == (Object)null) { gameObject.AddComponent<HoverHandler>(); } RectTransform component = ((Component)moneyText).GetComponent<RectTransform>(); TextMeshProUGUI itemCountText = stripAllocator.elements[i].itemCountText; RectTransform component2 = ((Component)itemCountText).GetComponent<RectTransform>(); if (initialPosition == -1f) { initialPosition = ((Transform)component2).localPosition.x; } if (initialSize == -1f) { initialSize = component2.sizeDelta.x; } if (initialMoneyPosition == -1f) { initialMoneyPosition = ((Transform)component).localPosition.y; } if (initialItemCountPosition == -1f) { initialItemCountPosition = ((Transform)component2).localPosition.y; } ((Transform)component).localPosition = new Vector3(((Transform)component).localPosition.x, swapPositionTexts.Value ? initialItemCountPosition : initialMoneyPosition, ((Transform)component).localPosition.z); int value = textSizeIncrease.Value; ((Transform)component2).localPosition = new Vector3(initialPosition - (float)(value / 2), swapPositionTexts.Value ? initialMoneyPosition : initialItemCountPosition, ((Transform)component2).localPosition.z); component2.sizeDelta = new Vector2(initialSize + (float)value, component2.sizeDelta.y); ((TMP_Text)itemCountText).horizontalAlignment = (HorizontalAlignmentOptions)4; ((TMP_Text)itemCountText).enableAutoSizing = true; } shouldApplyChanges = false; } } }; harmony.PatchAll(); } public CurrencyType GetCurrencyTypeByName(string name) { string[] array = (from CurrencyType x in Enum.GetValues(typeof(CurrencyType)) select x.ToString()).ToArray(); string[] array2 = array; foreach (string text in array2) { if (text == name) { return (CurrencyType)Enum.Parse(typeof(CurrencyType), name); } } return (CurrencyType)Enum.Parse(typeof(CurrencyType), array.First()); } public (uint, string) GetDataByCurrencyType(CharacterMaster master, CurrencyType currencyType) { uint item = 0u; string item2 = null; switch (currencyType) { case CurrencyType.Money: item = master.money; item2 = "$" + item.ToString(useWholeNumbers.Value ? "" : "N0"); break; case CurrencyType.Lunar: item = master.playerCharacterMasterController.networkUser.lunarCoins; item2 = string.Format("<color=#{0}><sprite name=\"LunarCoin\" tint=1>{1}</color>", ColorCatalog.GetColorHexString((ColorIndex)12), item.ToString(useWholeNumbers.Value ? "" : "N0")); break; case CurrencyType.Void: item = master.voidCoins; item2 = string.Format("<color=#{0}><sprite name=\"VoidCoin\" tint=1>{1}</color>", ColorCatalog.GetColorHexString((ColorIndex)27), item.ToString(useWholeNumbers.Value ? "" : "N0")); break; } return (item, item2); } } } namespace BetterScoreboard.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("BetterScoreboard.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static Bitmap icon { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown object @object = ResourceManager.GetObject("icon", resourceCulture); return (Bitmap)@object; } } internal Resources() { } } } namespace BetterScoreboard.Patches { [HarmonyPatch(typeof(ItemCatalog))] internal class ItemCatalogPatch { [HarmonyPatch("Init")] [HarmonyPostfix] private static void Init() { ItemTierDef[] itemTierDefs = ContentManager.itemTierDefs; foreach (ItemTierDef tierDef in itemTierDefs) { Plugin.instance.itemTierConfigs.Add(new Plugin.ItemTierConfig(tierDef)); } if (Plugin.RiskOfOptions.IsLoaded()) { Plugin.RiskOfOptions.OnItemCatalogInit(); } } } [HarmonyPatch(typeof(ScoreboardStrip))] internal class ScoreboardStripPatch { public static bool shouldUpdateCounter; public static bool shouldUpdateMoney; private static GameObject hoveredMoneyText; [HarmonyPatch("UpdateItemCountText")] [HarmonyPrefix] private static bool UpdateItemCountText(ScoreboardStrip __instance, CharacterMaster ___master, ref int ___previousItemCount) { //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Invalid comparison between Unknown and I4 //IL_00d9: 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_0242: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Expected O, but got I4 //IL_027f->IL027f: Incompatible stack types: O vs I4 //IL_0278->IL027f: Incompatible stack types: I4 vs O //IL_0278->IL027f: Incompatible stack types: O vs I4 ItemInventoryDisplay itemInventoryDisplay = __instance.itemInventoryDisplay; int totalVisibleItemCount = itemInventoryDisplay.GetTotalVisibleItemCount(); if (Object.op_Implicit((Object)(object)___master) && Object.op_Implicit((Object)(object)itemInventoryDisplay) && (totalVisibleItemCount != ___previousItemCount || shouldUpdateCounter)) { ___previousItemCount = totalVisibleItemCount; Inventory inventory = ___master.inventory; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(___previousItemCount); List<string> list = new List<string>(); Color val2 = default(Color); foreach (Plugin.ItemTierConfig item in Plugin.instance.itemTierConfigs.OrderBy((Plugin.ItemTierConfig x) => x.order.Value)) { if (!item.enabled.Value) { continue; } ItemTierDef tierDef = item.tierDef; int num = 0; if ((Object)(object)tierDef == (Object)null) { for (ItemIndex val = (ItemIndex)0; (int)val < ItemCatalog.itemCount; val = (ItemIndex)(val + 1)) { ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)ItemTierCatalog.GetItemTierDef(itemDef.tier) == (Object)null && !itemDef.hidden) { num += inventory.GetItemCount(val); } } } else { num = inventory.GetTotalItemCountOfTier(tierDef.tier); } if (!string.IsNullOrEmpty(item.includedTiers.Value)) { foreach (string includedTier in from x in item.includedTiers.Value.Split(new char[1] { ',' }) select x.Trim()) { Plugin.ItemTierConfig itemTierConfig = Plugin.instance.itemTierConfigs.FirstOrDefault((Plugin.ItemTierConfig x) => x.name == includedTier); if (itemTierConfig != null) { num += inventory.GetTotalItemCountOfTier(itemTierConfig.tierDef.tier); } } } if (Plugin.instance.hideBelowZeroCounters.Value && num <= 0) { continue; } string text = "#" + ColorUtility.ToHtmlStringRGB(item.color.Value); if (!ColorUtility.TryParseHtmlString(text, ref val2)) { object obj = "#"; int num2; if ((Object)(object)tierDef != (Object)null) { obj = tierDef.colorIndex; num2 = (int)obj; } else { num2 = 10; obj = num2; num2 = (int)obj; } text = (string?)num2 + ColorCatalog.GetColorHexString((ColorIndex)obj); } list.Add($"<color={text}>{num}</color>"); } if (list.Count > 0) { stringBuilder.Append(" (" + string.Join(" ", list) + ")"); } ((TMP_Text)__instance.itemCountText).text = stringBuilder.ToString(); if (shouldUpdateCounter) { shouldUpdateCounter = false; } } return false; } [HarmonyPatch("UpdateMoneyText")] [HarmonyPrefix] private static bool UpdateMoneyText(ScoreboardStrip __instance, CharacterMaster ___master, ref uint ___previousMoney) { if (Object.op_Implicit((Object)(object)___master)) { GameObject gameObject = ((Component)__instance.moneyText).gameObject; Plugin.HoverHandler component = gameObject.GetComponent<Plugin.HoverHandler>(); var (num, text) = Plugin.instance.GetDataByCurrencyType(___master, Plugin.instance.GetCurrencyTypeByName(Plugin.instance.defaultCurrency.Value)); if (Plugin.instance.currencyHover.Value && (Object)(object)component != (Object)null && component.isHovered && !shouldUpdateMoney) { string item = Plugin.instance.GetDataByCurrencyType(___master, Plugin.instance.GetCurrencyTypeByName(Plugin.instance.hoveredCurrency.Value)).Item2; ((TMP_Text)__instance.moneyText).text = item; if ((Object)(object)hoveredMoneyText != (Object)(object)((Component)component).gameObject) { hoveredMoneyText = ((Component)component).gameObject; } } else if (shouldUpdateMoney || num != ___previousMoney || (Object)(object)gameObject == (Object)(object)hoveredMoneyText) { ___previousMoney = num; ((TMP_Text)__instance.moneyText).text = text; if ((Object)(object)gameObject == (Object)(object)hoveredMoneyText) { hoveredMoneyText = null; } } if (shouldUpdateMoney) { shouldUpdateMoney = false; } } return false; } [HarmonyPatch("OnDisable")] [HarmonyPostfix] private static void OnDisable(EquipmentIcon ___equipmentIcon) { EventSystem current = EventSystem.current; TooltipController.RemoveTooltip((MPEventSystem)(object)((current is MPEventSystem) ? current : null), ___equipmentIcon.tooltipProvider); } } }