Decompiled source of LootIntel v1.1.0

plugins/LootIntel.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace KanOrn.LootIntel
{
	[BepInPlugin("kan_orn.repo.lootintel", "Loot Intel", "1.1.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Id = "kan_orn.repo.lootintel";

		private Harmony harmony;

		private GameObject overlay;

		private void Awake()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			ConfigEntry<bool> boxes = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "CosmeticBoxes", true, "Show cosmetic boxes by rarity.");
			ConfigEntry<bool> collection = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "Collection", false, "Show unlocked cosmetics and collection size.");
			ConfigEntry<bool> loot = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "LootValue", false, "Show the remaining loot value on the map.");
			overlay = new GameObject("Loot Intel");
			Object.DontDestroyOnLoad((Object)(object)overlay);
			overlay.AddComponent<Overlay>().Configure(boxes, collection, loot);
			harmony = new Harmony("kan_orn.repo.lootintel");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loot Intel loaded.");
		}

		private void OnDestroy()
		{
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			if (Object.op_Implicit((Object)(object)overlay))
			{
				Object.Destroy((Object)(object)overlay);
			}
		}
	}
	public sealed class Overlay : MonoBehaviour
	{
		private struct OwnedCosmetic
		{
			internal string Name;

			internal CosmeticType Type;

			internal Rarity Rarity;
		}

		private sealed class LootRow
		{
			internal string Name;

			internal int Count;

			internal double Value;
		}

		private static readonly FieldRef<MenuManager, MenuPage> Page = AccessTools.FieldRefAccess<MenuManager, MenuPage>("currentMenuPage");

		private static readonly FieldRef<MetaManager, bool> SaveReady = AccessTools.FieldRefAccess<MetaManager, bool>("saveReady");

		private static readonly FieldRef<MetaManager, List<int>> Unlocks = AccessTools.FieldRefAccess<MetaManager, List<int>>("cosmeticUnlocks");

		private static readonly FieldRef<CosmeticWorldObject, bool> Exploding = AccessTools.FieldRefAccess<CosmeticWorldObject, bool>("exploding");

		private static readonly FieldRef<CosmeticWorldObject, PhysGrabObject> BoxGrab = AccessTools.FieldRefAccess<CosmeticWorldObject, PhysGrabObject>("physGrabObject");

		private static readonly FieldRef<ValuableObject, PhysGrabObject> LootGrab = AccessTools.FieldRefAccess<ValuableObject, PhysGrabObject>("physGrabObject");

		private static readonly FieldRef<ValuableObject, float> Value = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent");

		private static readonly FieldRef<ValuableObject, bool> ValueSet = AccessTools.FieldRefAccess<ValuableObject, bool>("dollarValueSet");

		private static readonly FieldRef<ValuableObject, bool> Committed = AccessTools.FieldRefAccess<ValuableObject, bool>("committedToExtraction");

		private static readonly Color Gold = new Color(1f, 0.75f, 0.28f);

		private static readonly Color Ink = new Color(0.068f, 0.076f, 0.078f, 0.56f);

		private static readonly Color Paper = new Color(0.93f, 0.94f, 0.88f);

		private static readonly Color Muted = new Color(0.68f, 0.73f, 0.69f);

		private static readonly Color Tile = new Color(0.13f, 0.16f, 0.16f, 0.38f);

		private static readonly Color[] RarityColors = (Color[])(object)new Color[4]
		{
			new Color(0.52f, 0.87f, 0.58f),
			new Color(0.35f, 0.82f, 1f),
			new Color(0.89f, 0.55f, 1f),
			new Color(1f, 0.81f, 0.33f)
		};

		private static readonly string[] RarityNames = new string[4] { "Common", "Uncommon", "Rare", "Ultra Rare" };

		private readonly int[] boxCounts = new int[4];

		private readonly HashSet<int> unlockedIds = new HashSet<int>();

		private readonly Dictionary<(string Name, float UnitValue), LootRow> groups = new Dictionary<(string, float), LootRow>();

		private readonly List<LootRow> sortedLoot = new List<LootRow>();

		private ConfigEntry<bool> showBoxes;

		private ConfigEntry<bool> showCollection;

		private ConfigEntry<bool> showLoot;

		private bool mapReady;

		private bool collectionReady;

		private int owned;

		private int catalogSize;

		private int itemCount;

		private double totalValue;

		private float nextRefresh;

		private Vector2 scroll;

		private bool collectionTab;

		private int collectionSignature;

		private List<string> cosmeticRows = new List<string>();

		private GUIStyle text;

		private GUIStyle small;

		private GUIStyle amount;

		private GUIStyle rowName;

		internal static Overlay Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		internal void Configure(ConfigEntry<bool> boxes, ConfigEntry<bool> collection, ConfigEntry<bool> loot)
		{
			showBoxes = boxes;
			showCollection = collection;
			showLoot = loot;
		}

		private static bool OnMap()
		{
			if (Object.op_Implicit((Object)(object)RunManager.instance))
			{
				return SemiFunc.RunIsLevel();
			}
			return false;
		}

		private static MenuPage CurrentPage()
		{
			if (!Object.op_Implicit((Object)(object)MenuManager.instance))
			{
				return null;
			}
			return Page.Invoke(MenuManager.instance);
		}

		private static bool IsEscape(MenuPage page)
		{
			if (Object.op_Implicit((Object)(object)page) && Object.op_Implicit((Object)(object)MenuPageEsc.instance))
			{
				return (Object)(object)((Component)MenuPageEsc.instance).gameObject == (Object)(object)((Component)page).gameObject;
			}
			return false;
		}

		private void Update()
		{
			Tick();
		}

		internal void Tick()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected I4, but got Unknown
			if (Time.unscaledTime < nextRefresh)
			{
				return;
			}
			nextRefresh = Time.unscaledTime + 0.75f;
			mapReady = OnMap() && Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated;
			Array.Clear(boxCounts, 0, boxCounts.Length);
			groups.Clear();
			sortedLoot.Clear();
			itemCount = 0;
			totalValue = 0.0;
			RefreshCollection();
			if (!mapReady)
			{
				return;
			}
			CosmeticWorldObject[] array = Object.FindObjectsByType<CosmeticWorldObject>((FindObjectsSortMode)0);
			foreach (CosmeticWorldObject val in array)
			{
				PhysGrabObject val2 = BoxGrab.Invoke(val);
				int num = (int)val.rarity;
				if (num >= 0 && num < boxCounts.Length && !Exploding.Invoke(val) && (!Object.op_Implicit((Object)(object)val2) || !val2.dead))
				{
					boxCounts[num]++;
				}
			}
			if (!showLoot.Value && !IsEscape(CurrentPage()))
			{
				return;
			}
			ValuableObject[] array2 = Object.FindObjectsByType<ValuableObject>((FindObjectsSortMode)0);
			foreach (ValuableObject val3 in array2)
			{
				PhysGrabObject val4 = LootGrab.Invoke(val3);
				float num2 = Value.Invoke(val3);
				if (ValueSet.Invoke(val3) && !Committed.Invoke(val3) && (!Object.op_Implicit((Object)(object)val4) || !val4.dead) && !(num2 <= 0f) && !float.IsNaN(num2) && !float.IsInfinity(num2))
				{
					itemCount++;
					totalValue += num2;
					string text = ((Object)((Component)val3).gameObject).name.Replace("(Clone)", "").Trim();
					if (!groups.TryGetValue((text, num2), out var value))
					{
						value = new LootRow
						{
							Name = text
						};
						groups.Add((text, num2), value);
					}
					value.Count++;
					value.Value += num2;
				}
			}
			sortedLoot.AddRange(groups.Values.OrderByDescending((LootRow row) => row.Value).ThenBy<LootRow, string>((LootRow row) => row.Name, StringComparer.OrdinalIgnoreCase));
		}

		private void RefreshCollection()
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: 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)
			MetaManager instance = MetaManager.instance;
			collectionReady = Object.op_Implicit((Object)(object)instance) && SaveReady.Invoke(instance) && instance.cosmeticAssets != null && Unlocks.Invoke(instance) != null;
			owned = 0;
			catalogSize = 0;
			if (!collectionReady)
			{
				cosmeticRows.Clear();
				collectionSignature = 0;
				return;
			}
			List<OwnedCosmetic> list = new List<OwnedCosmetic>();
			int num = 17;
			unlockedIds.Clear();
			unlockedIds.UnionWith(Unlocks.Invoke(instance));
			for (int i = 0; i < instance.cosmeticAssets.Count; i++)
			{
				CosmeticAsset val = instance.cosmeticAssets[i];
				if (Object.op_Implicit((Object)(object)val) && val.prefab != null && ((PrefabRef<GameObject>)(object)val.prefab).IsValid())
				{
					catalogSize++;
					if (unlockedIds.Contains(i))
					{
						owned++;
						string name = (string.IsNullOrWhiteSpace(val.assetName) ? ((Object)val).name : val.assetName);
						list.Add(new OwnedCosmetic
						{
							Name = name,
							Type = val.type,
							Rarity = val.rarity
						});
						num = num * 31 + ((Object)val).GetInstanceID();
					}
				}
			}
			if (num == collectionSignature)
			{
				return;
			}
			collectionSignature = num;
			cosmeticRows.Clear();
			foreach (IGrouping<CosmeticType, OwnedCosmetic> item in from asset in list
				group asset by asset.Type into @group
				orderby ((object)@group.Key/*cast due to .constrained prefix*/).ToString()
				select @group)
			{
				cosmeticRows.Add(TypeLabel((Enum)(object)item.Key) + " (" + item.Count() + ")");
				foreach (OwnedCosmetic item2 in item.OrderBy<OwnedCosmetic, string>((OwnedCosmetic asset) => asset.Name, StringComparer.OrdinalIgnoreCase))
				{
					cosmeticRows.Add("    " + item2.Name + "  ·  " + TypeLabel((Enum)(object)item2.Rarity));
				}
			}
		}

		private static string TypeLabel(Enum type)
		{
			return Regex.Replace(type.ToString(), "(?<=[a-z])(?=[A-Z])", " ");
		}

		private void OnGUI()
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (showBoxes == null || !OnMap())
			{
				return;
			}
			MenuPage val = CurrentPage();
			bool flag = IsEscape(val);
			if (!flag && (Object.op_Implicit((Object)(object)val) || !mapReady || (!showBoxes.Value && !showCollection.Value && !showLoot.Value)))
			{
				return;
			}
			InitStyles();
			float num = Mathf.Min(Mathf.Clamp((float)Screen.height / 900f, 0.65f, 1.5f), (float)Screen.width / 440f);
			float width = (float)Screen.width / num;
			float height = (float)Screen.height / num;
			Matrix4x4 matrix = GUI.matrix;
			Color color = GUI.color;
			int depth = GUI.depth;
			try
			{
				GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
				GUI.depth = -120;
				GUI.color = Color.white;
				if (flag)
				{
					DrawEscape(width, height);
				}
				else
				{
					DrawHud(width, height);
				}
			}
			finally
			{
				GUI.matrix = matrix;
				GUI.color = color;
				GUI.depth = depth;
			}
		}

		private void DrawEscape(float width, float height)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: 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_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(width - 412f, 54f, 392f, Mathf.Min(600f, height - 78f));
			Frame(rect);
			float num = ((Rect)(ref rect)).x + 16f;
			float num2 = ((Rect)(ref rect)).y + 12f;
			DrawToggle(num, num2, "Cosmetic boxes on HUD", showBoxes);
			DrawToggle(num, num2 + 33f, "Collection progress on HUD", showCollection);
			DrawToggle(num, num2 + 66f, "Loot value on HUD", showLoot);
			num2 += 110f;
			LabelPair(num, num2, 360f, "COSMETIC BOXES", mapReady ? boxCounts.Sum().ToString() : "Loading");
			num2 += 27f;
			DrawRarities(num, num2, 360f);
			num2 += 50f;
			LabelPair(num, num2, 360f, "COSMETICS UNLOCKED", CollectionText());
			num2 += 30f;
			LabelPair(num, num2, 360f, "REMAINING LOOT", mapReady ? Money(totalValue) : "Loading");
			num2 += 28f;
			if (DrawTab(new Rect(num, num2, 177f, 26f), "Map loot", !collectionTab))
			{
				collectionTab = false;
				scroll = Vector2.zero;
			}
			if (DrawTab(new Rect(num + 183f, num2, 177f, 26f), "Owned cosmetics", collectionTab))
			{
				collectionTab = true;
				scroll = Vector2.zero;
			}
			num2 += 32f;
			int num3 = (collectionTab ? cosmeticRows.Count : sortedLoot.Count);
			if (num3 == 0)
			{
				string text = ((!collectionTab) ? (mapReady ? "No remaining valuables" : "Loading map") : (collectionReady ? "No cosmetics unlocked" : "Loading collection"));
				GUI.Label(new Rect(num, num2, 360f, 25f), text, rowName);
				return;
			}
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num, num2, 360f, Mathf.Max(32f, ((Rect)(ref rect)).yMax - num2 - 14f));
			scroll = GUI.BeginScrollView(val, scroll, new Rect(0f, 0f, 342f, (float)(num3 * 25)));
			try
			{
				int num4 = Mathf.Max(0, (int)scroll.y / 25);
				int num5 = Mathf.Min(num3, num4 + Mathf.CeilToInt(((Rect)(ref val)).height / 25f) + 2);
				for (int i = num4; i < num5; i++)
				{
					float num6 = i * 25;
					if (collectionTab)
					{
						string text2 = cosmeticRows[i];
						GUI.Label(new Rect(3f, num6, 334f, 25f), text2, text2.StartsWith("    ") ? rowName : this.text);
					}
					else
					{
						LootRow lootRow = sortedLoot[i];
						GUI.Label(new Rect(3f, num6, 235f, 25f), lootRow.Count + "× " + lootRow.Name, rowName);
						GUI.Label(new Rect(238f, num6, 99f, 25f), Money(lootRow.Value / (double)lootRow.Count), amount);
					}
				}
			}
			finally
			{
				GUI.EndScrollView();
			}
		}

		private void DrawHud(float width, float height)
		{
			//IL_00b1: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			float num = 9 + (showBoxes.Value ? 45 : 0) + (showCollection.Value ? 25 : 0) + (showLoot.Value ? 25 : 0);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(width - 333f, height - num - 19f, 313f, num);
			float num2 = ((Rect)(ref val)).x + 13f;
			float num3 = ((Rect)(ref val)).y + 4f;
			if (showBoxes.Value)
			{
				DrawRarities(num2, num3, 287f);
				num3 += 45f;
			}
			if (showCollection.Value)
			{
				Fill(new Rect(num2, num3, 287f, 23f), Tile);
				LabelPair(num2 + 4f, num3, 279f, "Cosmetics", CollectionText());
				num3 += 25f;
			}
			if (showLoot.Value)
			{
				Fill(new Rect(num2, num3, 287f, 23f), Tile);
				LabelPair(num2 + 4f, num3, 279f, "Loot (" + itemCount + ")", Money(totalValue));
			}
		}

		private bool DrawTab(Rect rect, string label, bool selected)
		{
			//IL_0000: 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_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Fill(rect, (Color)(selected ? new Color(0.35f, 0.25f, 0.1f, 0.68f) : Tile));
			GUI.Label(new Rect(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 16f, ((Rect)(ref rect)).height), label, text);
			return GUI.Button(rect, GUIContent.none, GUIStyle.none);
		}

		private void DrawToggle(float x, float y, string label, ConfigEntry<bool> option)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_00a6: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(x, y, 360f, 29f);
			Fill(val, (Color)(((Rect)(ref val)).Contains(Event.current.mousePosition) ? new Color(0.2f, 0.23f, 0.21f) : Tile));
			GUI.Label(new Rect(x + 9f, y, 269f, 29f), label, text);
			Fill(new Rect(x + 304f, y + 5f, 47f, 19f), (Color)(option.Value ? new Color(0.35f, 0.25f, 0.1f) : Ink));
			GUI.Label(new Rect(x + 290f, y, 52f, 29f), option.Value ? "ON" : "OFF", amount);
			if (GUI.Button(val, GUIContent.none, GUIStyle.none))
			{
				option.Value = !option.Value;
				nextRefresh = 0f;
			}
		}

		private void DrawRarities(float x, float y, float width)
		{
			//IL_0029: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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)
			float num = (width - 12f) / 4f;
			for (int i = 0; i < boxCounts.Length; i++)
			{
				float num2 = x + (float)i * (num + 4f);
				Fill(new Rect(num2, y, num, 38f), Tile);
				Fill(new Rect(num2, y, num, 2f), RarityColors[i]);
				GUI.Label(new Rect(num2 + 3f, y + 2f, num - 6f, 16f), RarityNames[i], small);
				GUI.Label(new Rect(num2 + 3f, y + 17f, num - 8f, 20f), mapReady ? boxCounts[i].ToString() : "—", amount);
			}
		}

		private void LabelPair(float x, float y, float width, string label, string value)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(x, y, width * 0.72f, 25f), label, text);
			GUI.Label(new Rect(x + width * 0.6f, y, width * 0.4f, 25f), value, amount);
		}

		private string CollectionText()
		{
			if (!collectionReady)
			{
				return "Loading";
			}
			return owned + " / " + catalogSize;
		}

		private static string Money(double value)
		{
			return "$" + value.ToString("N0", CultureInfo.InvariantCulture);
		}

		private static void Frame(Rect rect)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Fill(new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), new Color(0f, 0f, 0f, 0.46f));
			Fill(rect, Ink);
			Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 2f), Gold);
			Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 3f, ((Rect)(ref rect)).height), Gold);
		}

		private static void Fill(Rect rect, Color color)
		{
			//IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = Color.white;
		}

		private void InitStyles()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (text == null)
			{
				text = Style(14, Paper, (TextAnchor)3, (FontStyle)1);
				small = Style(11, Muted, (TextAnchor)3, (FontStyle)0);
				amount = Style(14, Gold, (TextAnchor)5, (FontStyle)1);
				rowName = Style(12, Paper, (TextAnchor)3, (FontStyle)0);
			}
		}

		private static GUIStyle Style(int size, Color color, TextAnchor anchor, FontStyle weight)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontSize = size,
				alignment = anchor,
				fontStyle = weight,
				clipping = (TextClipping)1,
				padding = new RectOffset()
			};
			val.normal.textColor = color;
			return val;
		}
	}
	[HarmonyPatch(typeof(GameDirector), "Update")]
	internal static class GameLoop
	{
		private static void Postfix()
		{
			Overlay.Instance?.Tick();
		}
	}
}