Decompiled source of DetailedRunStats v1.0.0

DetailedRunStats.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Assets.Scripts.Actors.Player;
using Assets.Scripts.Inventory__Items__Pickups.Stats;
using Assets.Scripts.Menu.Shop;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BonkersLib.Core;
using BonkersLib.Services;
using DetailedRunStats.Patches;
using DetailedRunStats.Tracking;
using DetailedRunStats.UI;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DetailedRunStats")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Displays detailed player stats on the death/end-of-run screen in Megabonk")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+064a9c20dc01c5645b10e25aa8c236de14b97d0c")]
[assembly: AssemblyProduct("Detailed Run Stats")]
[assembly: AssemblyTitle("DetailedRunStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DetailedRunStats
{
	public static class ModConfig
	{
		public static ConfigEntry<bool> ShowDefensiveStats { get; private set; }

		public static ConfigEntry<bool> ShowOffensiveStats { get; private set; }

		public static ConfigEntry<bool> ShowModifierStats { get; private set; }

		public static ConfigEntry<bool> ShowUtilityStats { get; private set; }

		public static ConfigEntry<bool> ShowEconomyStats { get; private set; }

		public static ConfigEntry<bool> ShowCombatStats { get; private set; }

		public static ConfigEntry<bool> ShowExplorationStats { get; private set; }

		public static ConfigEntry<bool> ShowRunSummary { get; private set; }

		public static ConfigEntry<bool> OnlyShowChangedStats { get; private set; }

		public static ConfigEntry<bool> ShowEnemyTypeKills { get; private set; }

		public static ConfigEntry<bool> ShowItemProcs { get; private set; }

		public static void Initialize(ConfigFile config)
		{
			ShowDefensiveStats = config.Bind<bool>("Stat Categories", "Show Defensive Stats", true, "Show defensive stats (Max HP, Regen, Armor, Evasion, etc.)");
			ShowOffensiveStats = config.Bind<bool>("Stat Categories", "Show Offensive Stats", true, "Show offensive stats (Damage, Crit Chance, Attack Speed, etc.)");
			ShowModifierStats = config.Bind<bool>("Stat Categories", "Show Modifier Stats", true, "Show modifier stats (Size, Projectile Speed, Duration, etc.)");
			ShowUtilityStats = config.Bind<bool>("Stat Categories", "Show Utility Stats", true, "Show utility stats (Extra Jumps, Luck, Difficulty, etc.)");
			ShowEconomyStats = config.Bind<bool>("Stat Categories", "Show Economy Stats", true, "Show economy stats (XP Gain, Gold Gain, Silver Gain, etc.)");
			ShowCombatStats = config.Bind<bool>("Stat Categories", "Show Combat Stats", true, "Show combat stats (Kills, Crits, Evades, etc.)");
			ShowExplorationStats = config.Bind<bool>("Stat Categories", "Show Exploration Stats", true, "Show exploration stats (Chests, Shrines, Microwaves, etc.)");
			ShowRunSummary = config.Bind<bool>("Stat Categories", "Show Run Summary", true, "Show run summary (Stage, Gold, XP, Weapons, etc.)");
			OnlyShowChangedStats = config.Bind<bool>("Display Options", "Only Show Changed Stats", true, "Only show player stats that changed during the run (base -> current format)");
			ShowEnemyTypeKills = config.Bind<bool>("Display Options", "Show Enemy Type Kills", true, "Show kills broken down by enemy type (Goblins, Skeletons, etc.)");
			ShowItemProcs = config.Bind<bool>("Display Options", "Show Item Procs", true, "Show item proc counts (Blood Magic, Ice Cube, Moldy Cheese, etc.)");
			Plugin.Log.LogInfo((object)"Config initialized.");
		}
	}
	[BepInPlugin("com.megabonk.detailedrunstats", "DetailedRunStats", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		private Harmony _harmony;

		public static Plugin Instance { get; private set; }

		public static ManualLogSource Log { get; private set; }

		public override void Load()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//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_00b0: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			Instance = this;
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("com.megabonk.detailedrunstats");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loading!");
			}
			log.LogInfo(val);
			ModConfig.Initialize(((BasePlugin)this).Config);
			try
			{
				ClassInjector.RegisterTypeInIl2Cpp<StatsPanel>();
				ClassInjector.RegisterTypeInIl2Cpp<PluginUpdateBehaviour>();
				Log.LogInfo((object)"Registered IL2CPP types.");
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to register IL2CPP types: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log2.LogError(val2);
			}
			try
			{
				GameObject val3 = new GameObject("DetailedRunStats_Updater");
				Object.DontDestroyOnLoad((Object)val3);
				val3.AddComponent<PluginUpdateBehaviour>();
				Log.LogInfo((object)"Created update handler.");
			}
			catch (Exception ex2)
			{
				ManualLogSource log3 = Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to create update handler: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex2.Message);
				}
				log3.LogWarning(val4);
			}
			SceneChangeHandler.Initialize();
			RunStatsTracker.Initialize();
			try
			{
				Type typeFromHandle = typeof(DeathScreen);
				ManualLogSource log4 = Log;
				val = new BepInExInfoLogInterpolatedStringHandler(27, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== DeathScreen Methods ===");
				}
				log4.LogInfo(val);
				MethodInfo[] methods = typeFromHandle.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					ManualLogSource log5 = Log;
					val = new BepInExInfoLogInterpolatedStringHandler(12, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Method: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(methodInfo.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("(");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", Array.ConvertAll(methodInfo.GetParameters(), (ParameterInfo p) => p.ParameterType.Name)));
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					log5.LogInfo(val);
				}
				ManualLogSource log6 = Log;
				val = new BepInExInfoLogInterpolatedStringHandler(31, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== End DeathScreen Methods ===");
				}
				log6.LogInfo(val);
			}
			catch (Exception ex3)
			{
				ManualLogSource log7 = Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to discover DeathScreen methods: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex3.Message);
				}
				log7.LogWarning(val4);
			}
			_harmony = new Harmony("com.megabonk.detailedrunstats");
			try
			{
				_harmony.PatchAll();
				Log.LogInfo((object)"Harmony patches applied successfully.");
			}
			catch (Exception ex4)
			{
				ManualLogSource log8 = Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to apply Harmony patches: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex4);
				}
				log8.LogError(val2);
			}
			try
			{
				ManualPatches.ApplyManualPatches(_harmony);
				Log.LogInfo((object)"Manual patches applied successfully.");
			}
			catch (Exception ex5)
			{
				ManualLogSource log9 = Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to apply manual patches: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex5.Message);
				}
				log9.LogWarning(val4);
			}
			ManualLogSource log10 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("com.megabonk.detailedrunstats");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded successfully!");
			}
			log10.LogInfo(val);
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			SceneChangeHandler.Cleanup();
			return ((BasePlugin)this).Unload();
		}
	}
	public class PluginUpdateBehaviour : MonoBehaviour
	{
		public PluginUpdateBehaviour(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Update()
		{
			SceneChangeHandler.Update();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.megabonk.detailedrunstats";

		public const string PLUGIN_NAME = "DetailedRunStats";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace DetailedRunStats.UI
{
	public class StatsPanel : MonoBehaviour
	{
		private TextMeshProUGUI _statsText;

		private static TMP_FontAsset _cachedFont;

		private static Material _cachedFontMaterial;

		private static Dictionary<EStat, float> _cachedRawStats;

		private static bool _rawStatsCached;

		private static bool _runStatsDiscovered;

		public StatsPanel(IntPtr ptr)
			: base(ptr)
		{
		}

		[HideFromIl2Cpp]
		private static void CacheGameFont()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			if ((Object)(object)_cachedFont != (Object)null)
			{
				return;
			}
			bool flag = default(bool);
			foreach (TextMeshProUGUI item in Object.FindObjectsOfType<TextMeshProUGUI>())
			{
				if ((Object)(object)((TMP_Text)item).font != (Object)null)
				{
					_cachedFont = ((TMP_Text)item).font;
					_cachedFontMaterial = ((TMP_Text)item).fontSharedMaterial;
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found game font: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)_cachedFont).name);
					}
					log.LogInfo(val);
					return;
				}
			}
			Plugin.Log.LogWarning((object)"Could not find any TextMeshPro font in scene!");
		}

		[HideFromIl2Cpp]
		public void Initialize()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			try
			{
				CacheGameFont();
				CreateBackground();
				CreateHeader();
				CreateStatsText();
				Plugin.Log.LogInfo((object)"StatsPanel initialized successfully.");
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to initialize StatsPanel: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		[HideFromIl2Cpp]
		public void InitializeForClonedPanel()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			try
			{
				CacheGameFont();
				CreateStatsTextOnly();
				Plugin.Log.LogInfo((object)"StatsPanel initialized for cloned panel.");
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(40, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to initialize cloned StatsPanel: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		[HideFromIl2Cpp]
		private void CreateStatsTextOnly()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			GameObject val = new GameObject("StatsText");
			val.transform.SetParent(((Component)this).transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = new Vector2(0f, 0f);
			obj.sizeDelta = new Vector2(0f, 800f);
			_statsText = val.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)_cachedFont != (Object)null)
			{
				((TMP_Text)_statsText).font = _cachedFont;
				if ((Object)(object)_cachedFontMaterial != (Object)null)
				{
					((TMP_Text)_statsText).fontSharedMaterial = _cachedFontMaterial;
				}
			}
			((TMP_Text)_statsText).fontSize = 14f;
			((Graphic)_statsText).color = new Color(0.85f, 0.92f, 0.85f, 1f);
			((TMP_Text)_statsText).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_statsText).enableWordWrapping = true;
			((TMP_Text)_statsText).overflowMode = (TextOverflowModes)0;
			((TMP_Text)_statsText).lineSpacing = 4f;
			((TMP_Text)_statsText).margin = new Vector4(15f, 10f, 15f, 10f);
			((TMP_Text)_statsText).text = "Loading stats...";
			((Behaviour)_statsText).enabled = true;
			val.SetActive(true);
			LayoutRebuilder.ForceRebuildLayoutImmediate(obj);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(57, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Created stats text for cloned panel with font: ");
				TMP_FontAsset font = ((TMP_Text)_statsText).font;
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((font != null) ? ((Object)font).name : null) ?? "NULL");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", parent: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)this).transform).name);
			}
			log.LogInfo(val2);
		}

		[HideFromIl2Cpp]
		private void CreateBackground()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)((Component)this).gameObject.AddComponent<Image>()).color = new Color(0.08f, 0.14f, 0.12f, 0.98f);
			CreateBorder();
		}

		[HideFromIl2Cpp]
		private void CreateBorder()
		{
			//IL_0031: 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_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			((Color)(ref color))..ctor(0.25f, 0.45f, 0.35f, 1f);
			float num = 2f;
			CreateBorderEdge("TopBorder", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f - num), Vector2.zero, color);
			CreateBorderEdge("BottomBorder", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), Vector2.zero, new Vector2(0f, num), color);
			CreateBorderEdge("LeftBorder", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), Vector2.zero, new Vector2(num, 0f), color);
			CreateBorderEdge("RightBorder", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(0f - num, 0f), Vector2.zero, color);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(0.4f, 0.65f, 0.5f, 1f);
			float size = 8f;
			CreateCorner("TopLeftCorner", new Vector2(0f, 1f), new Vector2(-1f, 1f), size, color2);
			CreateCorner("TopRightCorner", new Vector2(1f, 1f), new Vector2(1f, 1f), size, color2);
			CreateCorner("BottomLeftCorner", new Vector2(0f, 0f), new Vector2(-1f, -1f), size, color2);
			CreateCorner("BottomRightCorner", new Vector2(1f, 0f), new Vector2(1f, -1f), size, color2);
		}

		[HideFromIl2Cpp]
		private void CreateBorderEdge(string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 offsetMin, Vector2 offsetMax, Color color)
		{
			//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_0018: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(((Component)this).transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			obj.pivot = pivot;
			obj.offsetMin = offsetMin;
			obj.offsetMax = offsetMax;
			((Graphic)val.AddComponent<Image>()).color = color;
		}

		[HideFromIl2Cpp]
		private void CreateCorner(string name, Vector2 anchor, Vector2 direction, float size, Color color)
		{
			//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_0018: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent(((Component)this).transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = anchor;
			obj.anchorMax = anchor;
			obj.pivot = new Vector2((float)((direction.x > 0f) ? 1 : 0), (float)((direction.y > 0f) ? 1 : 0));
			obj.sizeDelta = new Vector2(size, size);
			obj.anchoredPosition = Vector2.zero;
			((Graphic)val.AddComponent<Image>()).color = color;
		}

		[HideFromIl2Cpp]
		private void CreateHeader()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Header");
			val.transform.SetParent(((Component)this).transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.sizeDelta = new Vector2(0f, 32f);
			obj.anchoredPosition = new Vector2(0f, -2f);
			((Graphic)val.AddComponent<Image>()).color = new Color(0.06f, 0.1f, 0.09f, 1f);
			GameObject val2 = new GameObject("Separator");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = new Vector2(0f, 0f);
			obj2.anchorMax = new Vector2(1f, 0f);
			obj2.pivot = new Vector2(0.5f, 0f);
			obj2.sizeDelta = new Vector2(0f, 1f);
			obj2.anchoredPosition = Vector2.zero;
			((Graphic)val2.AddComponent<Image>()).color = new Color(0.25f, 0.45f, 0.35f, 1f);
			GameObject val3 = new GameObject("HeaderText");
			val3.transform.SetParent(val.transform, false);
			RectTransform obj3 = val3.AddComponent<RectTransform>();
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			obj3.offsetMin = Vector2.zero;
			obj3.offsetMax = Vector2.zero;
			TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)_cachedFont != (Object)null)
			{
				((TMP_Text)val4).font = _cachedFont;
				if ((Object)(object)_cachedFontMaterial != (Object)null)
				{
					((TMP_Text)val4).fontSharedMaterial = _cachedFontMaterial;
				}
			}
			((TMP_Text)val4).text = "STATS";
			((TMP_Text)val4).fontSize = 16f;
			((TMP_Text)val4).fontStyle = (FontStyles)1;
			((Graphic)val4).color = new Color(0.75f, 0.85f, 0.75f, 1f);
			((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
		}

		[HideFromIl2Cpp]
		private void CreateStatsText()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_0147: Expected O, but got Unknown
			GameObject val = new GameObject("StatsText");
			val.transform.SetParent(((Component)this).transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			obj.offsetMin = new Vector2(10f, 10f);
			obj.offsetMax = new Vector2(-10f, -38f);
			_statsText = val.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)_cachedFont != (Object)null)
			{
				((TMP_Text)_statsText).font = _cachedFont;
				if ((Object)(object)_cachedFontMaterial != (Object)null)
				{
					((TMP_Text)_statsText).fontSharedMaterial = _cachedFontMaterial;
				}
			}
			((TMP_Text)_statsText).fontSize = 11f;
			((Graphic)_statsText).color = new Color(0.85f, 0.92f, 0.85f, 1f);
			((TMP_Text)_statsText).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_statsText).enableWordWrapping = true;
			((TMP_Text)_statsText).overflowMode = (TextOverflowModes)3;
			((TMP_Text)_statsText).lineSpacing = 0f;
			((TMP_Text)_statsText).text = "Loading stats...";
			((Behaviour)_statsText).enabled = true;
			val.SetActive(true);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Created stats text with font: ");
				TMP_FontAsset font = ((TMP_Text)_statsText).font;
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((font != null) ? ((Object)font).name : null) ?? "NULL");
			}
			log.LogInfo(val2);
		}

		[HideFromIl2Cpp]
		public void RefreshStats()
		{
			//IL_13eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_13f2: Expected O, but got Unknown
			//IL_13a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_13af: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				PlayerStatsNew cachedPlayerStats = PlayerStatsCache.CachedPlayerStats;
				if (cachedPlayerStats == null)
				{
					Plugin.Log.LogWarning((object)"No cached player stats available for refresh.");
					if ((Object)(object)_statsText != (Object)null)
					{
						((TMP_Text)_statsText).text = "Stats unavailable";
					}
					return;
				}
				StringBuilder stringBuilder = new StringBuilder();
				StringBuilder stringBuilder2 = new StringBuilder();
				if (ModConfig.ShowDefensiveStats.Value)
				{
					stringBuilder2.Clear();
					TryAppendChangedStat(stringBuilder2, "Max HP", cachedPlayerStats, (EStat)0, "0", 40f);
					TryAppendChangedStat(stringBuilder2, "HP Regen", cachedPlayerStats, (EStat)1, "0.0", 10f);
					TryAppendChangedStat(stringBuilder2, "Overheal", cachedPlayerStats, (EStat)47, "0", 0f);
					TryAppendChangedStat(stringBuilder2, "Shield", cachedPlayerStats, (EStat)2, "0", 0f);
					TryAppendChangedStat(stringBuilder2, "Armor", cachedPlayerStats, (EStat)4, "%", 0f);
					TryAppendChangedStat(stringBuilder2, "Evasion", cachedPlayerStats, (EStat)5, "%", 0.01f);
					TryAppendChangedStat(stringBuilder2, "Lifesteal", cachedPlayerStats, (EStat)17, "%", 0f);
					TryAppendChangedStat(stringBuilder2, "Thorns", cachedPlayerStats, (EStat)3, "0", 0f);
					if (stringBuilder2.Length > 0)
					{
						stringBuilder.AppendLine("<color=#88DDAA><b>Defensive</b></color>");
						stringBuilder.Append(stringBuilder2);
						stringBuilder.AppendLine();
					}
				}
				if (ModConfig.ShowOffensiveStats.Value)
				{
					stringBuilder2.Clear();
					TryAppendChangedStat(stringBuilder2, "Damage", cachedPlayerStats, (EStat)12, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Crit Chance", cachedPlayerStats, (EStat)18, "%", 0.01f);
					TryAppendChangedStatCritDamage(stringBuilder2, "Crit Damage", cachedPlayerStats, (EStat)19, 1f);
					TryAppendChangedStat(stringBuilder2, "Attack Speed", cachedPlayerStats, (EStat)15, "%", 1f);
					TryAppendChangedStat(stringBuilder2, "Projectile Count", cachedPlayerStats, (EStat)16, "0", 0f);
					TryAppendChangedStat(stringBuilder2, "Projectile Bounces", cachedPlayerStats, (EStat)45, "0", 0f);
					if (stringBuilder2.Length > 0)
					{
						stringBuilder.AppendLine("<color=#FF9966><b>Offensive</b></color>");
						stringBuilder.Append(stringBuilder2);
						stringBuilder.AppendLine();
					}
				}
				if (ModConfig.ShowModifierStats.Value)
				{
					stringBuilder2.Clear();
					TryAppendChangedStat(stringBuilder2, "Size", cachedPlayerStats, (EStat)9, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Projectile Speed", cachedPlayerStats, (EStat)11, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Duration", cachedPlayerStats, (EStat)10, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Knockback", cachedPlayerStats, (EStat)24, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Movement Speed", cachedPlayerStats, (EStat)25, "x", 1f);
					if (stringBuilder2.Length > 0)
					{
						stringBuilder.AppendLine("<color=#AADDFF><b>Modifiers</b></color>");
						stringBuilder.Append(stringBuilder2);
						stringBuilder.AppendLine();
					}
				}
				if (ModConfig.ShowUtilityStats.Value)
				{
					stringBuilder2.Clear();
					TryAppendChangedStat(stringBuilder2, "Extra Jumps", cachedPlayerStats, (EStat)46, "0", 0f);
					TryAppendChangedStat(stringBuilder2, "Jump Height", cachedPlayerStats, (EStat)26, "0", 9f);
					TryAppendChangedStat(stringBuilder2, "Luck", cachedPlayerStats, (EStat)30, "%", 0f);
					TryAppendChangedStat(stringBuilder2, "Difficulty", cachedPlayerStats, (EStat)38, "%", 0f);
					if (stringBuilder2.Length > 0)
					{
						stringBuilder.AppendLine("<color=#66CCFF><b>Utility</b></color>");
						stringBuilder.Append(stringBuilder2);
						stringBuilder.AppendLine();
					}
				}
				if (ModConfig.ShowEconomyStats.Value)
				{
					stringBuilder2.Clear();
					TryAppendChangedStat(stringBuilder2, "Pickup Range", cachedPlayerStats, (EStat)29, "0", 8f);
					TryAppendChangedStat(stringBuilder2, "XP Gain", cachedPlayerStats, (EStat)32, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Gold Gain", cachedPlayerStats, (EStat)31, "x", 1f);
					TryAppendChangedStat(stringBuilder2, "Silver Gain", cachedPlayerStats, (EStat)49, "x", 1f);
					if (stringBuilder2.Length > 0)
					{
						stringBuilder.AppendLine("<color=#FFDD66><b>Economy</b></color>");
						stringBuilder.Append(stringBuilder2);
						stringBuilder.AppendLine();
					}
				}
				if (stringBuilder.Length == 0 && ModConfig.OnlyShowChangedStats.Value)
				{
					stringBuilder.AppendLine("<color=#AAAAAA>No stats were upgraded during this run.</color>");
				}
				if (ModConfig.ShowCombatStats.Value)
				{
					int nativeRunStat = GetNativeRunStat("eliteKills");
					int nativeRunStat2 = GetNativeRunStat("bossKills");
					int nativeRunStat3 = GetNativeRunStat("minibossKills");
					int nativeRunStat4 = GetNativeRunStat("finalBossKills");
					int nativeRunStat5 = GetNativeRunStat("minibossKillsCalcium");
					int nativeRunStat6 = GetNativeRunStat("crits");
					int nativeRunStat7 = GetNativeRunStat("evades");
					int nativeRunStat8 = GetNativeRunStat("lifestealHealing");
					int nativeRunStat9 = GetNativeRunStat("damageReductionArmor");
					int nativeRunStat10 = GetNativeRunStat("damageReductionArmorAsKnight");
					int num = (ModConfig.ShowEnemyTypeKills.Value ? GetNativeRunStat("skeletonKills") : 0);
					int num2 = (ModConfig.ShowEnemyTypeKills.Value ? GetNativeRunStat("goblinKills") : 0);
					int nativeRunStat11 = GetNativeRunStat("fireKills");
					int nativeRunStat12 = GetNativeRunStat("lightningKills");
					int nativeRunStat13 = GetNativeRunStat("standingStillKills");
					int nativeRunStat14 = GetNativeRunStat("cactusKillsWithThorns");
					int nativeRunStat15 = GetNativeRunStat("foxWispsKills");
					int nativeRunStat16 = GetNativeRunStat("killsInTornadoWithTornado");
					int num3 = (ModConfig.ShowItemProcs.Value ? GetNativeRunStat("bloodMagicProcs") : 0);
					int num4 = (ModConfig.ShowItemProcs.Value ? GetNativeRunStat("icecubeFreezes") : 0);
					int num5 = (ModConfig.ShowItemProcs.Value ? GetNativeRunStat("moldyCheeseProcs") : 0);
					int num6 = (ModConfig.ShowItemProcs.Value ? GetNativeRunStat("aegisBlocks") : 0);
					int nativeRunStat17 = GetNativeRunStat("wallhugs");
					if (nativeRunStat > 0 || nativeRunStat3 > 0 || nativeRunStat2 > 0 || nativeRunStat4 > 0 || nativeRunStat6 > 0 || nativeRunStat7 > 0 || nativeRunStat8 > 0 || nativeRunStat11 > 0 || nativeRunStat12 > 0 || nativeRunStat9 > 0 || num > 0 || num2 > 0 || nativeRunStat13 > 0 || nativeRunStat14 > 0 || nativeRunStat15 > 0 || nativeRunStat16 > 0 || num3 > 0 || num4 > 0 || num5 > 0 || num6 > 0 || nativeRunStat17 > 0 || nativeRunStat5 > 0 || nativeRunStat10 > 0)
					{
						stringBuilder.AppendLine("<color=#FF8866><b>Combat</b></color>");
						if (nativeRunStat4 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder4 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(43, 1, stringBuilder3);
							handler.AppendLiteral("  Final Boss Kills: <color=#FF4444>");
							handler.AppendFormatted(nativeRunStat4);
							handler.AppendLiteral("</color>");
							stringBuilder4.AppendLine(ref handler);
						}
						if (nativeRunStat2 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder5 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(37, 1, stringBuilder3);
							handler.AppendLiteral("  Boss Kills: <color=#FF6666>");
							handler.AppendFormatted(nativeRunStat2);
							handler.AppendLiteral("</color>");
							stringBuilder5.AppendLine(ref handler);
						}
						if (nativeRunStat3 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder6 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Miniboss Kills: <color=#FF8888>");
							handler.AppendFormatted(nativeRunStat3);
							handler.AppendLiteral("</color>");
							stringBuilder6.AppendLine(ref handler);
						}
						if (nativeRunStat5 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder7 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(43, 1, stringBuilder3);
							handler.AppendLiteral("  Calcium Miniboss: <color=#FFFFFF>");
							handler.AppendFormatted(nativeRunStat5);
							handler.AppendLiteral("</color>");
							stringBuilder7.AppendLine(ref handler);
						}
						if (nativeRunStat > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder8 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(38, 1, stringBuilder3);
							handler.AppendLiteral("  Elite Kills: <color=#FFAA66>");
							handler.AppendFormatted(nativeRunStat);
							handler.AppendLiteral("</color>");
							stringBuilder8.AppendLine(ref handler);
						}
						if (num2 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder9 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(39, 1, stringBuilder3);
							handler.AppendLiteral("  Goblin Kills: <color=#66DD66>");
							handler.AppendFormatted(num2);
							handler.AppendLiteral("</color>");
							stringBuilder9.AppendLine(ref handler);
						}
						if (num > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder10 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Skeleton Kills: <color=#DDDDAA>");
							handler.AppendFormatted(num);
							handler.AppendLiteral("</color>");
							stringBuilder10.AppendLine(ref handler);
						}
						if (nativeRunStat11 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder11 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(37, 1, stringBuilder3);
							handler.AppendLiteral("  Fire Kills: <color=#FF6644>");
							handler.AppendFormatted(nativeRunStat11);
							handler.AppendLiteral("</color>");
							stringBuilder11.AppendLine(ref handler);
						}
						if (nativeRunStat12 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder12 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(42, 1, stringBuilder3);
							handler.AppendLiteral("  Lightning Kills: <color=#FFFF66>");
							handler.AppendFormatted(nativeRunStat12);
							handler.AppendLiteral("</color>");
							stringBuilder12.AppendLine(ref handler);
						}
						if (nativeRunStat14 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder13 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(39, 1, stringBuilder3);
							handler.AppendLiteral("  Thorns Kills: <color=#66AA66>");
							handler.AppendFormatted(nativeRunStat14);
							handler.AppendLiteral("</color>");
							stringBuilder13.AppendLine(ref handler);
						}
						if (nativeRunStat15 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder14 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Fox Wisp Kills: <color=#FF8844>");
							handler.AppendFormatted(nativeRunStat15);
							handler.AppendLiteral("</color>");
							stringBuilder14.AppendLine(ref handler);
						}
						if (nativeRunStat16 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder15 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
							handler.AppendLiteral("  Tornado Kills: <color=#88DDDD>");
							handler.AppendFormatted(nativeRunStat16);
							handler.AppendLiteral("</color>");
							stringBuilder15.AppendLine(ref handler);
						}
						if (nativeRunStat13 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder16 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(47, 1, stringBuilder3);
							handler.AppendLiteral("  Standing Still Kills: <color=#AABBFF>");
							handler.AppendFormatted(nativeRunStat13);
							handler.AppendLiteral("</color>");
							stringBuilder16.AppendLine(ref handler);
						}
						if (nativeRunStat6 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder17 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
							handler.AppendLiteral("  Critical Hits: <color=#FFDD44>");
							handler.AppendFormatted(nativeRunStat6);
							handler.AppendLiteral("</color>");
							stringBuilder17.AppendLine(ref handler);
						}
						if (nativeRunStat7 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder18 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(33, 1, stringBuilder3);
							handler.AppendLiteral("  Evades: <color=#88DDFF>");
							handler.AppendFormatted(nativeRunStat7);
							handler.AppendLiteral("</color>");
							stringBuilder18.AppendLine(ref handler);
						}
						if (nativeRunStat8 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder19 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(44, 1, stringBuilder3);
							handler.AppendLiteral("  Lifesteal Healing: <color=#88FF88>");
							handler.AppendFormatted(nativeRunStat8);
							handler.AppendLiteral("</color>");
							stringBuilder19.AppendLine(ref handler);
						}
						if (nativeRunStat9 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder20 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Damage Blocked: <color=#8888FF>");
							handler.AppendFormatted(nativeRunStat9);
							handler.AppendLiteral("</color>");
							stringBuilder20.AppendLine(ref handler);
						}
						if (nativeRunStat10 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder21 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(47, 1, stringBuilder3);
							handler.AppendLiteral("  Knight Armor Blocked: <color=#8888FF>");
							handler.AppendFormatted(nativeRunStat10);
							handler.AppendLiteral("</color>");
							stringBuilder21.AppendLine(ref handler);
						}
						if (num6 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder22 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(39, 1, stringBuilder3);
							handler.AppendLiteral("  Aegis Blocks: <color=#AAAAFF>");
							handler.AppendFormatted(num6);
							handler.AppendLiteral("</color>");
							stringBuilder22.AppendLine(ref handler);
						}
						if (num3 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder23 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(44, 1, stringBuilder3);
							handler.AppendLiteral("  Blood Magic Procs: <color=#CC4444>");
							handler.AppendFormatted(num3);
							handler.AppendLiteral("</color>");
							stringBuilder23.AppendLine(ref handler);
						}
						if (num4 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder24 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(43, 1, stringBuilder3);
							handler.AppendLiteral("  Ice Cube Freezes: <color=#88DDFF>");
							handler.AppendFormatted(num4);
							handler.AppendLiteral("</color>");
							stringBuilder24.AppendLine(ref handler);
						}
						if (num5 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder25 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(45, 1, stringBuilder3);
							handler.AppendLiteral("  Moldy Cheese Procs: <color=#AADD66>");
							handler.AppendFormatted(num5);
							handler.AppendLiteral("</color>");
							stringBuilder25.AppendLine(ref handler);
						}
						if (nativeRunStat17 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder26 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(36, 1, stringBuilder3);
							handler.AppendLiteral("  Wall Hugs: <color=#DDAAFF>");
							handler.AppendFormatted(nativeRunStat17);
							handler.AppendLiteral("</color>");
							stringBuilder26.AppendLine(ref handler);
						}
						stringBuilder.AppendLine();
					}
				}
				DiscoverRunStatNames();
				if (ModConfig.ShowExplorationStats.Value)
				{
					int nativeRunStat18 = GetNativeRunStat("chestsOpened");
					int nativeRunStat19 = GetNativeRunStat("chestsBought");
					int nativeRunStat20 = GetNativeRunStat("potsBroken");
					int nativeRunStat21 = GetNativeRunStat("shrineCharge");
					int nativeRunStat22 = GetNativeRunStat("shrineChargeSandstorm");
					int nativeRunStat23 = GetNativeRunStat("shrineChallenge");
					int nativeRunStat24 = GetNativeRunStat("shrineSucc");
					int nativeRunStat25 = GetNativeRunStat("questsCompleted");
					int nativeRunStat26 = GetNativeRunStat("challengesCompleted");
					int greedShrinesActivated = RunStatsTracker.GreedShrinesActivated;
					int moaiShrinesActivated = RunStatsTracker.MoaiShrinesActivated;
					int microwavesUsed = RunStatsTracker.MicrowavesUsed;
					int shadyGuyInteractions = RunStatsTracker.ShadyGuyInteractions;
					if (nativeRunStat18 > 0 || nativeRunStat19 > 0 || nativeRunStat20 > 0 || nativeRunStat21 > 0 || nativeRunStat22 > 0 || nativeRunStat23 > 0 || nativeRunStat24 > 0 || greedShrinesActivated > 0 || moaiShrinesActivated > 0 || microwavesUsed > 0 || shadyGuyInteractions > 0 || nativeRunStat25 > 0 || nativeRunStat26 > 0)
					{
						stringBuilder.AppendLine("<color=#88CCFF><b>Exploration</b></color>");
						if (nativeRunStat18 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder27 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
							handler.AppendLiteral("  Chests Opened: <color=#88FF88>");
							handler.AppendFormatted(nativeRunStat18);
							handler.AppendLiteral("</color>");
							stringBuilder27.AppendLine(ref handler);
						}
						if (nativeRunStat19 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder28 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
							handler.AppendLiteral("  Chests Bought: <color=#FFDD66>");
							handler.AppendFormatted(nativeRunStat19);
							handler.AppendLiteral("</color>");
							stringBuilder28.AppendLine(ref handler);
						}
						if (nativeRunStat20 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder29 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(38, 1, stringBuilder3);
							handler.AppendLiteral("  Pots Broken: <color=#AAAAAA>");
							handler.AppendFormatted(nativeRunStat20);
							handler.AppendLiteral("</color>");
							stringBuilder29.AppendLine(ref handler);
						}
						if (nativeRunStat21 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder30 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Charge Shrines: <color=#88DDFF>");
							handler.AppendFormatted(nativeRunStat21);
							handler.AppendLiteral("</color>");
							stringBuilder30.AppendLine(ref handler);
						}
						if (nativeRunStat22 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder31 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(44, 1, stringBuilder3);
							handler.AppendLiteral("  Sandstorm Shrines: <color=#DDAA66>");
							handler.AppendFormatted(nativeRunStat22);
							handler.AppendLiteral("</color>");
							stringBuilder31.AppendLine(ref handler);
						}
						if (nativeRunStat23 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder32 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(44, 1, stringBuilder3);
							handler.AppendLiteral("  Challenge Shrines: <color=#FF88AA>");
							handler.AppendFormatted(nativeRunStat23);
							handler.AppendLiteral("</color>");
							stringBuilder32.AppendLine(ref handler);
						}
						if (greedShrinesActivated > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder33 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
							handler.AppendLiteral("  Greed Shrines: <color=#FFDD66>");
							handler.AppendFormatted(greedShrinesActivated);
							handler.AppendLiteral("</color>");
							stringBuilder33.AppendLine(ref handler);
						}
						if (nativeRunStat24 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder34 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(41, 1, stringBuilder3);
							handler.AppendLiteral("  Magnet Shrines: <color=#FF88FF>");
							handler.AppendFormatted(nativeRunStat24);
							handler.AppendLiteral("</color>");
							stringBuilder34.AppendLine(ref handler);
						}
						if (moaiShrinesActivated > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder35 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(39, 1, stringBuilder3);
							handler.AppendLiteral("  Moai Shrines: <color=#88AAFF>");
							handler.AppendFormatted(moaiShrinesActivated);
							handler.AppendLiteral("</color>");
							stringBuilder35.AppendLine(ref handler);
						}
						if (microwavesUsed > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder36 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(37, 1, stringBuilder3);
							handler.AppendLiteral("  Microwaves: <color=#FFAA88>");
							handler.AppendFormatted(microwavesUsed);
							handler.AppendLiteral("</color>");
							stringBuilder36.AppendLine(ref handler);
						}
						if (shadyGuyInteractions > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder37 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(36, 1, stringBuilder3);
							handler.AppendLiteral("  Shady Guy: <color=#AA88FF>");
							handler.AppendFormatted(shadyGuyInteractions);
							handler.AppendLiteral("</color>");
							stringBuilder37.AppendLine(ref handler);
						}
						if (nativeRunStat25 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder38 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(43, 1, stringBuilder3);
							handler.AppendLiteral("  Quests Completed: <color=#FFDD88>");
							handler.AppendFormatted(nativeRunStat25);
							handler.AppendLiteral("</color>");
							stringBuilder38.AppendLine(ref handler);
						}
						if (nativeRunStat26 > 0)
						{
							StringBuilder stringBuilder3 = stringBuilder;
							StringBuilder stringBuilder39 = stringBuilder3;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(47, 1, stringBuilder3);
							handler.AppendLiteral("  Challenges Completed: <color=#FF88DD>");
							handler.AppendFormatted(nativeRunStat26);
							handler.AppendLiteral("</color>");
							stringBuilder39.AppendLine(ref handler);
						}
						stringBuilder.AppendLine();
					}
				}
				if (ModConfig.ShowRunSummary.Value)
				{
					stringBuilder.AppendLine("<color=#DDBBFF><b>Run Summary</b></color>");
					GameStateService game = BonkersAPI.Game;
					string value = ((game != null) ? game.StageName : null) ?? "Unknown";
					GameStateService game2 = BonkersAPI.Game;
					int value2 = ((game2 != null) ? game2.StageTier : 0);
					StringBuilder stringBuilder3 = stringBuilder;
					StringBuilder stringBuilder40 = stringBuilder3;
					StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(40, 2, stringBuilder3);
					handler.AppendLiteral("  Stage: <color=#88FF88>");
					handler.AppendFormatted(value);
					handler.AppendLiteral("</color> (Tier ");
					handler.AppendFormatted(value2);
					handler.AppendLiteral(")");
					stringBuilder40.AppendLine(ref handler);
					int nativeRunStat27 = GetNativeRunStat("goldEarned");
					int nativeRunStat28 = GetNativeRunStat("goldSpent");
					int nativeRunStat29 = GetNativeRunStat("xpGained");
					stringBuilder3 = stringBuilder;
					StringBuilder stringBuilder41 = stringBuilder3;
					handler = new StringBuilder.AppendInterpolatedStringHandler(38, 1, stringBuilder3);
					handler.AppendLiteral("  Gold Earned: <color=#FFDD66>");
					handler.AppendFormatted(nativeRunStat27);
					handler.AppendLiteral("</color>");
					stringBuilder41.AppendLine(ref handler);
					if (nativeRunStat28 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder42 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(37, 1, stringBuilder3);
						handler.AppendLiteral("  Gold Spent: <color=#FFAA66>");
						handler.AppendFormatted(nativeRunStat28);
						handler.AppendLiteral("</color>");
						stringBuilder42.AppendLine(ref handler);
					}
					if (nativeRunStat29 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder43 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(36, 1, stringBuilder3);
						handler.AppendLiteral("  XP Gained: <color=#88DDFF>");
						handler.AppendFormatted(nativeRunStat29);
						handler.AppendLiteral("</color>");
						stringBuilder43.AppendLine(ref handler);
					}
					GameStateService game3 = BonkersAPI.Game;
					int num7 = ((game3 != null) ? game3.BossCurses : 0);
					if (num7 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder44 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(38, 1, stringBuilder3);
						handler.AppendLiteral("  Boss Curses: <color=#FF88AA>");
						handler.AppendFormatted(num7);
						handler.AppendLiteral("</color>");
						stringBuilder44.AppendLine(ref handler);
					}
					if (RunStatsTracker.WeaponCount > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder45 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(34, 1, stringBuilder3);
						handler.AppendLiteral("  Weapons: <color=#88FF88>");
						handler.AppendFormatted(RunStatsTracker.WeaponCount);
						handler.AppendLiteral("</color>");
						stringBuilder45.AppendLine(ref handler);
					}
					if (RunStatsTracker.TomeCount > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder46 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(32, 1, stringBuilder3);
						handler.AppendLiteral("  Tomes: <color=#88DDFF>");
						handler.AppendFormatted(RunStatsTracker.TomeCount);
						handler.AppendLiteral("</color>");
						stringBuilder46.AppendLine(ref handler);
					}
					int nativeRunStat30 = GetNativeRunStat("projectilesFired");
					int nativeRunStat31 = GetNativeRunStat("powerupsUsed");
					int nativeRunStat32 = GetNativeRunStat("itemsPickedUp");
					int nativeRunStat33 = GetNativeRunStat("silverEarned");
					if (nativeRunStat30 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder47 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(44, 1, stringBuilder3);
						handler.AppendLiteral("  Projectiles Fired: <color=#AAAAAA>");
						handler.AppendFormatted(FormatLargeNumber(nativeRunStat30));
						handler.AppendLiteral("</color>");
						stringBuilder47.AppendLine(ref handler);
					}
					if (nativeRunStat31 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder48 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
						handler.AppendLiteral("  Powerups Used: <color=#FF88FF>");
						handler.AppendFormatted(nativeRunStat31);
						handler.AppendLiteral("</color>");
						stringBuilder48.AppendLine(ref handler);
					}
					if (nativeRunStat32 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder49 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(42, 1, stringBuilder3);
						handler.AppendLiteral("  Items Picked Up: <color=#88FF88>");
						handler.AppendFormatted(nativeRunStat32);
						handler.AppendLiteral("</color>");
						stringBuilder49.AppendLine(ref handler);
					}
					if (nativeRunStat33 > 0)
					{
						stringBuilder3 = stringBuilder;
						StringBuilder stringBuilder50 = stringBuilder3;
						handler = new StringBuilder.AppendInterpolatedStringHandler(40, 1, stringBuilder3);
						handler.AppendLiteral("  Silver Earned: <color=#CCCCCC>");
						handler.AppendFormatted(nativeRunStat33);
						handler.AppendLiteral("</color>");
						stringBuilder50.AppendLine(ref handler);
					}
				}
				if ((Object)(object)_statsText != (Object)null)
				{
					((TMP_Text)_statsText).text = stringBuilder.ToString();
					ManualLogSource log = Plugin.Log;
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(28, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stats text updated, length: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(((TMP_Text)_statsText).text.Length);
					}
					log.LogDebug(val);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error refreshing stats: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log2.LogError(val2);
				if ((Object)(object)_statsText != (Object)null)
				{
					((TMP_Text)_statsText).text = "Error loading stats";
				}
			}
		}

		[HideFromIl2Cpp]
		private static string FormatLargeNumber(float value)
		{
			if (!(value >= 1000000f))
			{
				if (!(value >= 1000f))
				{
					return $"{value:F0}";
				}
				return $"{value / 1000f:F1}K";
			}
			return $"{value / 1000000f:F1}M";
		}

		[HideFromIl2Cpp]
		private void TryAppendChangedStatCritDamage(StringBuilder sb, string name, PlayerStatsNew stats, EStat stat, float fallbackDefault)
		{
			//IL_0001: 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: Expected O, but got Unknown
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: 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_00be: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				float stat2 = stats.GetStat(stat);
				float num = stat2 + 1f;
				float num2 = fallbackDefault + 1f;
				ManualLogSource log = Plugin.Log;
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(43, 5, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stat '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<EStat>(stat);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): stored=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(stat2);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", display=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", baseDisplay=");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num2);
				}
				log.LogDebug(val);
				float num3 = 0.001f;
				if (Math.Abs(stat2 - fallbackDefault) < num3)
				{
					ManualLogSource log2 = Plugin.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(25, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  -> Skipping (no change)");
					}
					log2.LogDebug(val);
					return;
				}
				string text = $"{num:F1}x";
				string text2 = $"{num2:F1}x";
				string value = ((num > num2) ? "#88FF88" : "#FF8888");
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(46, 4, sb);
				handler.AppendLiteral("  ");
				handler.AppendFormatted(name);
				handler.AppendLiteral(": <color=#AAAAAA>");
				handler.AppendFormatted(text2);
				handler.AppendLiteral("</color> → <color=");
				handler.AppendFormatted(value);
				handler.AppendLiteral(">");
				handler.AppendFormatted(text);
				handler.AppendLiteral("</color>");
				sb.AppendLine(ref handler);
				ManualLogSource log3 = Plugin.Log;
				val = new BepInExDebugLogInterpolatedStringHandler(15, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  -> Added: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" → ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				log3.LogDebug(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Plugin.Log;
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(20, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stat '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<EStat>(stat);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): Error - ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log4.LogDebug(val);
			}
		}

		[HideFromIl2Cpp]
		private void TryAppendChangedStat(StringBuilder sb, string name, PlayerStatsNew stats, EStat stat, string format, float fallbackDefault)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_028c: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				float stat2 = stats.GetStat(stat);
				float num;
				BepInExDebugLogInterpolatedStringHandler val;
				if (TryGetCharacterBaseStat(stat, out var baseValue))
				{
					num = baseValue;
					ManualLogSource log = Plugin.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(45, 5, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stat '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<EStat>(stat);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): current=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(stat2);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", characterBase=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", format=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(format);
					}
					log.LogDebug(val);
				}
				else
				{
					num = fallbackDefault;
					ManualLogSource log2 = Plugin.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(44, 5, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stat '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<EStat>(stat);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): current=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(stat2);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", fallbackBase=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", format=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(format);
					}
					log2.LogDebug(val);
				}
				float num2 = 0.001f;
				if (Math.Abs(stat2 - num) < num2)
				{
					ManualLogSource log3 = Plugin.Log;
					val = new BepInExDebugLogInterpolatedStringHandler(25, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  -> Skipping (no change)");
					}
					log3.LogDebug(val);
					return;
				}
				string text = FormatStatValue(stat2, format);
				string text2 = FormatStatValue(num, format);
				string value = (IsStatImprovement(stat, stat2, num) ? "#88FF88" : "#FF8888");
				StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(46, 4, sb);
				handler.AppendLiteral("  ");
				handler.AppendFormatted(name);
				handler.AppendLiteral(": <color=#AAAAAA>");
				handler.AppendFormatted(text2);
				handler.AppendLiteral("</color> → <color=");
				handler.AppendFormatted(value);
				handler.AppendLiteral(">");
				handler.AppendFormatted(text);
				handler.AppendLiteral("</color>");
				sb.AppendLine(ref handler);
				ManualLogSource log4 = Plugin.Log;
				val = new BepInExDebugLogInterpolatedStringHandler(15, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  -> Added: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" → ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				log4.LogDebug(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log5 = Plugin.Log;
				BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(20, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stat '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<EStat>(stat);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): Error - ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log5.LogDebug(val);
			}
		}

		[HideFromIl2Cpp]
		private string FormatStatValue(float value, string format)
		{
			return format switch
			{
				"%" => $"{value * 100f:F0}%", 
				"x" => $"{value:F1}x", 
				"0.0" => $"{value:F1}", 
				_ => $"{value:F0}", 
			};
		}

		[HideFromIl2Cpp]
		private bool IsStatImprovement(EStat stat, float currentValue, float defaultValue)
		{
			return currentValue > defaultValue;
		}

		[HideFromIl2Cpp]
		public static void ResetRawStatsCache()
		{
			_cachedRawStats = null;
			_rawStatsCached = false;
			_runStatsDiscovered = false;
			Plugin.Log.LogDebug((object)"Raw stats cache reset for new run.");
		}

		[HideFromIl2Cpp]
		public static void CacheRawStats()
		{
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_003a: 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_006a: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				PlayerService player = BonkersAPI.Player;
				Dictionary<EStat, float> val = ((player != null) ? player.RawStatsDict : null);
				if (val != null)
				{
					_cachedRawStats = new Dictionary<EStat, float>();
					Enumerator<EStat, float> enumerator = val.GetEnumerator();
					while (enumerator.MoveNext())
					{
						KeyValuePair<EStat, float> current = enumerator.Current;
						_cachedRawStats[current.Key] = current.Value;
					}
					_rawStatsCached = true;
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Cached ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(_cachedRawStats.Count);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" raw stats from BonkersAPI");
					}
					log.LogInfo(val2);
					if (_cachedRawStats.TryGetValue((EStat)2, out var value))
					{
						ManualLogSource log2 = Plugin.Log;
						BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(14, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("  Raw Shield: ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(value);
						}
						log2.LogDebug(val3);
					}
					if (_cachedRawStats.TryGetValue((EStat)0, out var value2))
					{
						ManualLogSource log3 = Plugin.Log;
						BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(17, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("  Raw MaxHealth: ");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(value2);
						}
						log3.LogDebug(val3);
					}
				}
				else
				{
					Plugin.Log.LogWarning((object)"BonkersAPI.Player.RawStatsDict returned null");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to cache raw stats: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val4);
			}
		}

		[HideFromIl2Cpp]
		private static bool TryGetCharacterBaseStat(EStat stat, out float baseValue)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			baseValue = 0f;
			if (_rawStatsCached && _cachedRawStats != null && _cachedRawStats.TryGetValue(stat, out var value))
			{
				baseValue = value;
				return true;
			}
			return false;
		}

		[HideFromIl2Cpp]
		public static void DiscoverRunStatNames()
		{
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			if (_runStatsDiscovered)
			{
				return;
			}
			_runStatsDiscovered = true;
			bool flag = default(bool);
			try
			{
				Type type = null;
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					try
					{
						type = assembly.GetType("Assets.Scripts.Saves___Serialization.Progression.Stats.EMyStat");
						if (type != null)
						{
							break;
						}
					}
					catch
					{
					}
				}
				if (!(type != null) || !type.IsEnum)
				{
					return;
				}
				Plugin.Log.LogInfo((object)"=== ALL EMyStat enum names ===");
				string[] names = Enum.GetNames(type);
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Total stats available: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(names.Length);
				}
				log.LogInfo(val);
				string[] array = names;
				foreach (string text in array)
				{
					ManualLogSource log2 = Plugin.Log;
					val = new BepInExInfoLogInterpolatedStringHandler(2, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					}
					log2.LogInfo(val);
				}
				Plugin.Log.LogInfo((object)"=== End ALL EMyStat ===");
				Plugin.Log.LogInfo((object)"=== EMyStat with values > 0 ===");
				array = names;
				foreach (string text2 in array)
				{
					int nativeRunStat = GetNativeRunStat(text2);
					if (nativeRunStat > 0)
					{
						ManualLogSource log3 = Plugin.Log;
						val = new BepInExInfoLogInterpolatedStringHandler(5, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(nativeRunStat);
						}
						log3.LogInfo(val);
					}
				}
				Plugin.Log.LogInfo((object)"=== End EMyStat values ===");
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to discover RunStats: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val2);
			}
		}

		[HideFromIl2Cpp]
		private static int GetNativeRunStat(string statName)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			try
			{
				BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
				Type type = null;
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					try
					{
						type = assembly.GetType("Assets.Scripts.Saves___Serialization.Progression.Stats.RunStats");
						if (type != null)
						{
							break;
						}
					}
					catch
					{
					}
				}
				if (type == null)
				{
					return 0;
				}
				MethodInfo method = type.GetMethod("GetStat", bindingAttr, null, new Type[1] { typeof(string) }, null);
				if (method != null)
				{
					object obj2 = method.Invoke(null, new object[1] { statName });
					if (obj2 is int)
					{
						return (int)obj2;
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error getting native run stat '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(statName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
			return 0;
		}
	}
}
namespace DetailedRunStats.Tracking
{
	public static class RunStatsTracker
	{
		private static bool _initialized;

		public static int WeaponCount { get; private set; }

		public static int TomeCount { get; private set; }

		public static int GreedShrinesActivated { get; private set; }

		public static int MoaiShrinesActivated { get; private set; }

		public static int MicrowavesUsed { get; private set; }

		public static int ShadyGuyInteractions { get; private set; }

		public static void Initialize()
		{
			if (!_initialized)
			{
				_initialized = true;
				Plugin.Log.LogDebug((object)"RunStatsTracker initialized.");
			}
		}

		public static void CacheEquipmentCounts()
		{
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				foreach (GameObject item in Object.FindObjectsOfType<GameObject>())
				{
					MyPlayer component = item.GetComponent<MyPlayer>();
					if (!((Object)(object)component != (Object)null) || component.inventory == null)
					{
						continue;
					}
					Type type = ((object)component.inventory).GetType();
					BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
					PropertyInfo? obj = type.GetProperty("weapons", bindingAttr) ?? type.GetProperty("Weapons", bindingAttr);
					FieldInfo fieldInfo = type.GetField("weapons", bindingAttr) ?? type.GetField("Weapons", bindingAttr);
					object obj2 = obj?.GetValue(component.inventory) ?? fieldInfo?.GetValue(component.inventory);
					if (obj2 != null)
					{
						PropertyInfo property = obj2.GetType().GetProperty("Count", bindingAttr);
						if (property != null)
						{
							WeaponCount = (int)property.GetValue(obj2);
						}
					}
					PropertyInfo? obj3 = type.GetProperty("tomes", bindingAttr) ?? type.GetProperty("Tomes", bindingAttr);
					FieldInfo fieldInfo2 = type.GetField("tomes", bindingAttr) ?? type.GetField("Tomes", bindingAttr);
					object obj4 = obj3?.GetValue(component.inventory) ?? fieldInfo2?.GetValue(component.inventory);
					if (obj4 != null)
					{
						PropertyInfo property2 = obj4.GetType().GetProperty("Count", bindingAttr);
						if (property2 != null)
						{
							TomeCount = (int)property2.GetValue(obj4);
						}
					}
					ManualLogSource log = Plugin.Log;
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(34, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cached equipment: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(WeaponCount);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" weapons, ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(TomeCount);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" tomes");
					}
					log.LogDebug(val);
					break;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error caching equipment counts: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogWarning(val2);
			}
		}

		public static void OnGreedShrineActivated()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			GreedShrinesActivated++;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Greed Shrine activated! Total: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(GreedShrinesActivated);
			}
			log.LogInfo(val);
		}

		public static void OnMoaiShrineActivated()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			MoaiShrinesActivated++;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Moai Shrine activated! Total: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(MoaiShrinesActivated);
			}
			log.LogInfo(val);
		}

		public static void OnMicrowaveUsed()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			MicrowavesUsed++;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Microwave used! Total: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(MicrowavesUsed);
			}
			log.LogInfo(val);
		}

		public static void OnShadyGuyInteraction()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			ShadyGuyInteractions++;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Shady Guy interaction! Total: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(ShadyGuyInteractions);
			}
			log.LogInfo(val);
		}

		public static void ResetForNewRun()
		{
			GreedShrinesActivated = 0;
			MoaiShrinesActivated = 0;
			MicrowavesUsed = 0;
			ShadyGuyInteractions = 0;
			WeaponCount = 0;
			TomeCount = 0;
			Plugin.Log.LogDebug((object)"RunStatsTracker reset for new run.");
		}
	}
}
namespace DetailedRunStats.Patches
{
	internal static class ManualPatches
	{
		private static readonly string[] InteractionMethodNames = new string[7] { "Interact", "OnInteract", "DoInteraction", "Activate", "OnActivate", "Use", "OnUse" };

		public static void ApplyManualPatches(Harmony harmony)
		{
			PatchInteractable(harmony, "InteractableShrineGreed", typeof(GreedShrinePatch), "Interact");
			PatchInteractable(harmony, "InteractableShrineMoai", typeof(MoaiShrinePatch), "Interact");
			PatchInteractable(harmony, "InteractableMicrowave", typeof(MicrowavePatch), "UseMicrowave");
			PatchInteractable(harmony, "InteractableShadyGuy", typeof(ShadyGuyPatch), "Disappear");
		}

		private static void PatchInteractable(Harmony harmony, string typeName, Type patchClass, string specificMethodName = null)
		{
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				Type type = FindType(typeName);
				if (type == null)
				{
					ManualLogSource log = Plugin.Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" type");
					}
					log.LogWarning(val);
					return;
				}
				LogAvailableMethods(type, typeName);
				MethodInfo methodInfo;
				if (!string.IsNullOrEmpty(specificMethodName))
				{
					BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
					methodInfo = type.GetMethod(specificMethodName, bindingAttr);
					if (methodInfo == null)
					{
						ManualLogSource log2 = Plugin.Log;
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not find method ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(specificMethodName);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
						}
						log2.LogWarning(val);
						return;
					}
				}
				else
				{
					methodInfo = FindInteractMethod(type);
					if (methodInfo == null)
					{
						return;
					}
				}
				MethodInfo method = patchClass.GetMethod("Postfix", BindingFlags.Static | BindingFlags.Public);
				harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				ManualLogSource log3 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Patched ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(typeName);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(methodInfo.Name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" for tracking");
				}
				log3.LogInfo(val2);
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(18, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to patch ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log4.LogWarning(val);
			}
		}

		private static Type FindType(string typeName)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			bool flag = default(bool);
			foreach (Assembly assembly in assemblies)
			{
				try
				{
					Type type = assembly.GetType(typeName);
					if (type != null)
					{
						ManualLogSource log = Plugin.Log;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" in ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(assembly.GetName().Name);
						}
						log.LogInfo(val);
						return type;
					}
					Type[] types = assembly.GetTypes();
					foreach (Type type2 in types)
					{
						if (type2.Name == typeName)
						{
							ManualLogSource log2 = Plugin.Log;
							BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(8, 2, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
								((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(type2.FullName);
							}
							log2.LogInfo(val);
							return type2;
						}
					}
				}
				catch
				{
				}
			}
			return null;
		}

		private static MethodInfo FindInteractMethod(Type type)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			string[] interactionMethodNames = InteractionMethodNames;
			bool flag = default(bool);
			foreach (string text in interactionMethodNames)
			{
				MethodInfo method = type.GetMethod(text, bindingAttr);
				if (method != null)
				{
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Found method: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
					}
					log.LogInfo(val);
					return method;
				}
			}
			return null;
		}

		private static void LogAvailableMethods(Type type, string typeName)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Methods ===");
			}
			log.LogInfo(val);
			MethodInfo[] methods = type.GetMethods(bindingAttr);
			foreach (MethodInfo methodInfo in methods)
			{
				ManualLogSource log2 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(4, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(methodInfo.Name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("(");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", Array.ConvertAll(methodInfo.GetParameters(), (ParameterInfo p) => p.ParameterType.Name)));
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
				}
				log2.LogInfo(val);
			}
			ManualLogSource log3 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(19, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== End Methods ===");
			}
			log3.LogInfo(val);
		}
	}
	internal static class GreedShrinePatch
	{
		private static float _lastTime;

		public static void Postfix()
		{
			if (Time.time - _lastTime > 0.5f)
			{
				_lastTime = Time.time;
				RunStatsTracker.OnGreedShrineActivated();
			}
		}
	}
	internal static class MoaiShrinePatch
	{
		private static float _lastTime;

		public static void Postfix()
		{
			if (Time.time - _lastTime > 0.5f)
			{
				_lastTime = Time.time;
				RunStatsTracker.OnMoaiShrineActivated();
			}
		}
	}
	internal static class MicrowavePatch
	{
		private static float _lastTime;

		public static void Postfix()
		{
			if (Time.time - _lastTime > 0.5f)
			{
				_lastTime = Time.time;
				RunStatsTracker.OnMicrowaveUsed();
			}
		}
	}
	internal static class ShadyGuyPatch
	{
		private static float _lastTime;

		public static void Postfix()
		{
			if (Time.time - _lastTime > 0.5f)
			{
				_lastTime = Time.time;
				RunStatsTracker.OnShadyGuyInteraction();
			}
		}
	}
	[HarmonyPatch(typeof(DeathScreen))]
	internal static class DeathScreenPatch
	{
		private static StatsPanel _statsPanel;

		private static GameObject _statsPanelObject;

		[HarmonyPostfix]
		[HarmonyPatch("StartDeathScreen")]
		private static void StartDeathScreen_Postfix(DeathScreen __instance)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			try
			{
				Plugin.Log.LogDebug((object)"DeathScreen StartDeathScreen - caching stats.");
				PlayerStatsCache.CachePlayerStats();
				RunStatsTracker.CacheEquipmentCounts();
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to cache stats on StartDeathScreen: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ShowStats")]
		private static void ShowS