Decompiled source of BetterScoreboard v1.1.1

BetterScoreboard.dll

Decompiled 2 weeks ago
using 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.1")]
	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__1_0;

				internal void <OnAwake>b__1_0()
				{
					//IL_0066: Unknown result type (might be due to invalid IL or missing references)
					foreach (ItemTierConfig itemTierConfig in instance.itemTierConfigs)
					{
						itemTierConfig.active.Value = (bool)((ConfigEntryBase)itemTierConfig.active).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;
					}
				}
			}

			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_00b4: Expected O, but got Unknown
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: 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 CheckBoxOption(instance.includeUntieredCount));
				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));
				object obj = <>c.<>9__1_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.active.Value = (bool)((ConfigEntryBase)itemTierConfig.active).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__1_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_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Expected O, but got Unknown
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Expected O, but got Unknown
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Expected O, but got Unknown
				foreach (ItemTierConfig itemTierConfig in instance.itemTierConfigs)
				{
					ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(itemTierConfig.active));
					ModSettingsManager.AddOption((BaseOption)new IntSliderOption(itemTierConfig.order, new IntSliderConfig
					{
						min = 1,
						max = instance.itemTierConfigs.Count + 1
					}));
					ModSettingsManager.AddOption((BaseOption)new ColorOption(itemTierConfig.color));
					ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(itemTierConfig.includedTiers));
				}
			}
		}

		public class ItemTierConfig
		{
			public ItemTierDef tierDef;

			public ConfigEntry<bool> active;

			public ConfigEntry<int> order;

			public ConfigEntry<Color> color;

			public ConfigEntry<string> includedTiers;

			public ItemTierConfig(ItemTierDef tierDef)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Invalid comparison between Unknown and I4
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Invalid comparison between Unknown and I4
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Invalid comparison between Unknown and I4
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Invalid comparison between Unknown and I4
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected I4, but got Unknown
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Invalid comparison between Unknown and I4
				this.tierDef = tierDef;
				string category = GetCategory();
				active = ((BaseUnityPlugin)instance).Config.Bind<bool>(category, "Enabled", (int)tierDef.tier != 6 && (int)tierDef.tier != 7 && (int)tierDef.tier != 8, "Determines whether to count this tier.");
				active.SettingChanged += delegate
				{
					ScoreboardStripPatch.shouldUpdateCounter = true;
				};
				order = ((BaseUnityPlugin)instance).Config.Bind<int>(category, "Order", tierDef.tier - ((int)tierDef.tier > 10) + 1, "Determines the priority of this tier.");
				order.SettingChanged += delegate
				{
					ScoreboardStripPatch.shouldUpdateCounter = true;
				};
				color = ((BaseUnityPlugin)instance).Config.Bind<Color>(category, "Color", Color32.op_Implicit(ColorCatalog.GetColor(tierDef.colorIndex)), "Determines the color of this tier. Leave blank for default color.");
				color.SettingChanged += delegate
				{
					ScoreboardStripPatch.shouldUpdateCounter = true;
				};
				includedTiers = ((BaseUnityPlugin)instance).Config.Bind<string>(category, "Included Tiers", ((int)tierDef.tier == 9) ? "VoidTier1Def,VoidTier2Def,VoidTier3Def" : "", "Determines the count of the listed tiers included in this tier, separated by commas.");
				includedTiers.SettingChanged += delegate
				{
					ScoreboardStripPatch.shouldUpdateCounter = true;
				};
			}

			public string GetCategory()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected I4, but got Unknown
				string text = "Item Tier: " + ((Object)tierDef).name;
				ItemTier tier = tierDef.tier;
				ItemTier val = tier;
				switch ((int)val)
				{
				case 0:
					text += " (White/Common)";
					break;
				case 1:
					text += " (Green/Uncommon)";
					break;
				case 2:
					text += " (Red/Legendary)";
					break;
				case 3:
					text += " (Blue/Lunar)";
					break;
				case 4:
					text += " (Yellow/Boss)";
					break;
				case 6:
				case 7:
				case 8:
				case 9:
					text += " (Purple/Void)";
					break;
				}
				return text;
			}
		}

		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.1";

		private const string riskOfOptionsModGUID = "com.rune580.riskofoptions";

		public static Plugin instance;

		public ManualLogSource logger;

		private readonly Harmony harmony = new Harmony("bulletbot.betterscoreboard");

		public ConfigEntry<bool> hideBelowZeroCounters;

		public ConfigEntry<bool> includeUntieredCount;

		private ConfigEntry<int> textSizeIncrease;

		private ConfigEntry<bool> swapPositionTexts;

		public ConfigEntry<bool> currencyHover;

		public ConfigEntry<string> defaultCurrency;

		public ConfigEntry<string> hoveredCurrency;

		public List<ItemTierConfig> itemTierConfigs = new List<ItemTierConfig>();

		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_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			instance = this;
			logger = Logger.CreateLogSource("BetterScoreboard");
			string text = "General";
			hideBelowZeroCounters = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Hide Item Tier Counters Below Zero", true, "Determines whether the item tier counters below zero should be hidden.");
			hideBelowZeroCounters.SettingChanged += delegate
			{
				ScoreboardStripPatch.shouldUpdateCounter = true;
			};
			includeUntieredCount = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Include Untiered Count", true, "Determines whether to include untiered item count to the item tier counters.");
			includeUntieredCount.SettingChanged += delegate
			{
				ScoreboardStripPatch.shouldUpdateCounter = true;
			};
			textSizeIncrease = ((BaseUnityPlugin)this).Config.Bind<int>(text, "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>(text, "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 text2 = "\n\nOptions:\n" + string.Join("\n", array);
			defaultCurrency = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Default Currency", array[0], "Determines the default currency type to display when not hovering over the money text." + text2);
			defaultCurrency.SettingChanged += delegate
			{
				ScoreboardStripPatch.shouldUpdateMoney = true;
			};
			currencyHover = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "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>(text, "Hovered Currency", array[1], "Determines the currency type to display when hovering over the money text." + text2);
			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_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_020f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_0232: Unknown result type (might be due to invalid IL or missing references)
				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();
						int num = 0;
						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;
							num++;
						}
						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;
			switch (currencyType)
			{
			case CurrencyType.Money:
				item = master.money;
				return (item, "$" + item);
			case CurrencyType.Lunar:
				item = master.playerCharacterMasterController.networkUser.lunarCoins;
				return (item, $"<color=#{ColorCatalog.GetColorHexString((ColorIndex)12)}><sprite name=\"LunarCoin\" tint=1>{item}</color>");
			case CurrencyType.Void:
				item = master.voidCoins;
				return (item, $"<color=#{ColorCatalog.GetColorHexString((ColorIndex)27)}><sprite name=\"VoidCoin\" tint=1>{item}</color>");
			default:
				return (item, null);
			}
		}
	}
}
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_00c0: 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_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Invalid comparison between Unknown and I4
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			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 val = default(Color);
				foreach (Plugin.ItemTierConfig item in Plugin.instance.itemTierConfigs.OrderBy((Plugin.ItemTierConfig x) => x.order.Value))
				{
					if (!item.active.Value)
					{
						continue;
					}
					int num = inventory.GetTotalItemCountOfTier(item.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) => ((Object)x.tierDef).name == includedTier);
							if (itemTierConfig != null)
							{
								num += inventory.GetTotalItemCountOfTier(itemTierConfig.tierDef.tier);
							}
						}
					}
					if (!Plugin.instance.hideBelowZeroCounters.Value || num > 0)
					{
						string text = "#" + ColorUtility.ToHtmlStringRGB(item.color.Value);
						if (!ColorUtility.TryParseHtmlString(text, ref val))
						{
							text = "#" + ColorCatalog.GetColorHexString(item.tierDef.colorIndex);
						}
						list.Add($"<color={text}>{num}</color>");
					}
				}
				if (Plugin.instance.includeUntieredCount.Value)
				{
					int num2 = 0;
					for (ItemIndex val2 = (ItemIndex)0; (int)val2 < ItemCatalog.itemCount; val2 = (ItemIndex)(val2 + 1))
					{
						ItemDef itemDef = ItemCatalog.GetItemDef(val2);
						if ((Object)(object)ItemTierCatalog.GetItemTierDef(itemDef.tier) == (Object)null && !itemDef.hidden)
						{
							num2 += inventory.GetItemCount(val2);
						}
					}
					if (!Plugin.instance.hideBelowZeroCounters.Value || num2 > 0)
					{
						list.Add($"<color=#{ColorCatalog.GetColorHexString((ColorIndex)10)}>{num2}</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);
		}
	}
}