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 ConfigEntry<bool> EnableDebugLogging { 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.)");
EnableDebugLogging = config.Bind<bool>("Debug", "Enable Debug Logging", false, "Enable verbose debug logging to console (for troubleshooting)");
}
}
[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 static void LogDebug(string message)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
ConfigEntry<bool> enableDebugLogging = ModConfig.EnableDebugLogging;
if (enableDebugLogging != null && enableDebugLogging.Value)
{
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(8, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[DEBUG] ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message);
}
log.LogInfo(val);
}
}
public override void Load()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Expected O, but got Unknown
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
Instance = this;
Log = ((BasePlugin)this).Log;
ModConfig.Initialize(((BasePlugin)this).Config);
bool flag = default(bool);
try
{
ClassInjector.RegisterTypeInIl2Cpp<StatsPanel>();
ClassInjector.RegisterTypeInIl2Cpp<PluginUpdateBehaviour>();
}
catch (Exception ex)
{
ManualLogSource log = Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to register IL2CPP types: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
try
{
GameObject val2 = new GameObject("DetailedRunStats_Updater");
Object.DontDestroyOnLoad((Object)val2);
val2.AddComponent<PluginUpdateBehaviour>();
}
catch (Exception ex2)
{
ManualLogSource log2 = Log;
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to create update handler: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex2.Message);
}
log2.LogWarning(val3);
}
SceneChangeHandler.Initialize();
RunStatsTracker.Initialize();
_harmony = new Harmony("com.megabonk.detailedrunstats");
try
{
_harmony.PatchAll();
}
catch (Exception ex3)
{
ManualLogSource log3 = Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to apply Harmony patches: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex3);
}
log3.LogError(val);
}
try
{
ManualPatches.ApplyManualPatches(_harmony);
}
catch (Exception ex4)
{
ManualLogSource log4 = Log;
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to apply manual patches: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex4.Message);
}
log4.LogWarning(val3);
}
ManualLogSource log5 = Log;
BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(30, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("com.megabonk.detailedrunstats");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" loaded successfully!");
}
log5.LogInfo(val4);
}
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 TextMeshProUGUI _statsTextRight;
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()
{
if ((Object)(object)_cachedFont != (Object)null)
{
return;
}
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;
Plugin.LogDebug("Found game font: " + ((Object)_cachedFont).name);
return;
}
}
Plugin.Log.LogWarning((object)"Could not find any TextMeshPro font in scene!");
}
[HideFromIl2Cpp]
public void Initialize()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
try
{
CacheGameFont();
CreateBackground();
CreateHeader();
CreateStatsText();
Plugin.LogDebug("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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
try
{
CacheGameFont();
CreateStatsTextOnly();
Plugin.LogDebug("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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("StatsTextLeft");
val.transform.SetParent(((Component)this).transform, false);
RectTransform obj = val.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0f, 0f);
obj.anchorMax = new Vector2(0.5f, 1f);
obj.pivot = new Vector2(0f, 1f);
obj.offsetMin = new Vector2(10f, 10f);
obj.offsetMax = new Vector2(-5f, -5f);
_statsText = val.AddComponent<TextMeshProUGUI>();
SetupStatsText(_statsText);
((TMP_Text)_statsText).text = "Loading...";
val.SetActive(true);
GameObject val2 = new GameObject("StatsTextRight");
val2.transform.SetParent(((Component)this).transform, false);
RectTransform obj2 = val2.AddComponent<RectTransform>();
obj2.anchorMin = new Vector2(0.5f, 0f);
obj2.anchorMax = new Vector2(1f, 1f);
obj2.pivot = new Vector2(0f, 1f);
obj2.offsetMin = new Vector2(5f, 10f);
obj2.offsetMax = new Vector2(-10f, -5f);
_statsTextRight = val2.AddComponent<TextMeshProUGUI>();
SetupStatsText(_statsTextRight);
((TMP_Text)_statsTextRight).text = "";
val2.SetActive(true);
Plugin.LogDebug("Created two-column stats layout, parent: " + ((Object)((Component)this).transform).name);
}
[HideFromIl2Cpp]
private void SetupStatsText(TextMeshProUGUI text)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_cachedFont != (Object)null)
{
((TMP_Text)text).font = _cachedFont;
if ((Object)(object)_cachedFontMaterial != (Object)null)
{
((TMP_Text)text).fontSharedMaterial = _cachedFontMaterial;
}
}
((TMP_Text)text).fontSize = 12f;
((Graphic)text).color = new Color(0.85f, 0.92f, 0.85f, 1f);
((TMP_Text)text).alignment = (TextAlignmentOptions)257;
((TMP_Text)text).enableWordWrapping = true;
((TMP_Text)text).overflowMode = (TextOverflowModes)0;
((TMP_Text)text).lineSpacing = 2f;
((TMP_Text)text).margin = new Vector4(5f, 5f, 5f, 5f);
((Behaviour)text).enabled = true;
}
[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)
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);
TMP_FontAsset font = ((TMP_Text)_statsText).font;
Plugin.LogDebug("Created stats text with font: " + (((font != null) ? ((Object)font).name : null) ?? "NULL"));
}
[HideFromIl2Cpp]
public void RefreshStats()
{
//IL_1399: Unknown result type (might be due to invalid IL or missing references)
//IL_13a0: Expected O, but got Unknown
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);
}
}
SplitContentToColumns(stringBuilder.ToString());
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error refreshing stats: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
if ((Object)(object)_statsText != (Object)null)
{
((TMP_Text)_statsText).text = "Error loading stats";
}
if ((Object)(object)_statsTextRight != (Object)null)
{
((TMP_Text)_statsTextRight).text = "";
}
}
}
[HideFromIl2Cpp]
private void SplitContentToColumns(string fullContent)
{
if ((Object)(object)_statsText == (Object)null)
{
return;
}
if ((Object)(object)_statsTextRight == (Object)null)
{
((TMP_Text)_statsText).text = fullContent;
return;
}
string[] array = fullContent.Split(new char[1] { '\n' }, StringSplitOptions.None);
StringBuilder stringBuilder = new StringBuilder();
StringBuilder stringBuilder2 = new StringBuilder();
new HashSet<string> { "Defensive", "Offensive", "Modifiers", "Utility", "Economy" };
HashSet<string> hashSet = new HashSet<string> { "Combat", "Exploration", "Run Summary" };
StringBuilder stringBuilder3 = stringBuilder;
bool flag = false;
string[] array2 = array;
foreach (string text in array2)
{
if (text.Contains("<b>") && text.Contains("</b>"))
{
flag = false;
foreach (string item in hashSet)
{
if (text.Contains(item))
{
flag = true;
break;
}
}
stringBuilder3 = (flag ? stringBuilder2 : stringBuilder);
}
stringBuilder3.AppendLine(text);
}
((TMP_Text)_statsText).text = stringBuilder.ToString().TrimEnd();
((TMP_Text)_statsTextRight).text = stringBuilder2.ToString().TrimEnd();
Plugin.LogDebug($"Stats split - Left: {((TMP_Text)_statsText).text.Length} chars, Right: {((TMP_Text)_statsTextRight).text.Length} chars");
}
[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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
try
{
float stat2 = stats.GetStat(stat);
float num = stat2 + 1f;
float num2 = fallbackDefault + 1f;
Plugin.LogDebug($"Stat '{name}' ({stat}): stored={stat2}, display={num}, baseDisplay={num2}");
float num3 = 0.001f;
if (Math.Abs(stat2 - fallbackDefault) < num3)
{
Plugin.LogDebug(" -> Skipping (no change)");
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);
Plugin.LogDebug(" -> Added: " + text2 + " → " + text);
}
catch (Exception ex)
{
Plugin.LogDebug($"Stat '{name}' ({stat}): Error - {ex.Message}");
}
}
[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_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
try
{
float stat2 = stats.GetStat(stat);
float num;
if (TryGetCharacterBaseStat(stat, out var baseValue))
{
num = baseValue;
Plugin.LogDebug($"Stat '{name}' ({stat}): current={stat2}, characterBase={num}, format={format}");
}
else
{
num = fallbackDefault;
Plugin.LogDebug($"Stat '{name}' ({stat}): current={stat2}, fallbackBase={num}, format={format}");
}
float num2 = 0.001f;
if (Math.Abs(stat2 - num) < num2)
{
Plugin.LogDebug(" -> Skipping (no change)");
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);
Plugin.LogDebug(" -> Added: " + text2 + " → " + text);
}
catch (Exception ex)
{
Plugin.LogDebug($"Stat '{name}' ({stat}): Error - {ex.Message}");
}
}
[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.LogDebug("Raw stats cache reset for new run.");
}
[HideFromIl2Cpp]
public static void CacheRawStats()
{
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
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;
Plugin.LogDebug($"Cached {_cachedRawStats.Count} raw stats from BonkersAPI");
if (_cachedRawStats.TryGetValue((EStat)2, out var value))
{
Plugin.LogDebug($" Raw Shield: {value}");
}
if (_cachedRawStats.TryGetValue((EStat)0, out var value2))
{
Plugin.LogDebug($" Raw MaxHealth: {value2}");
}
}
else
{
Plugin.Log.LogWarning((object)"BonkersAPI.Player.RawStatsDict returned null");
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to cache raw stats: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val2);
}
}
[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_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
if (_runStatsDiscovered)
{
return;
}
_runStatsDiscovered = true;
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 || !ModConfig.EnableDebugLogging.Value)
{
return;
}
Plugin.LogDebug("=== ALL EMyStat enum names ===");
string[] names = Enum.GetNames(type);
Plugin.LogDebug($"Total stats available: {names.Length}");
string[] array = names;
foreach (string text in array)
{
Plugin.LogDebug(" " + text);
}
Plugin.LogDebug("=== End ALL EMyStat ===");
Plugin.LogDebug("=== EMyStat with values > 0 ===");
array = names;
foreach (string text2 in array)
{
int nativeRunStat = GetNativeRunStat(text2);
if (nativeRunStat > 0)
{
Plugin.LogDebug($" {text2} = {nativeRunStat}");
}
}
Plugin.LogDebug("=== End EMyStat values ===");
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to discover RunStats: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
[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.LogDebug("RunStatsTracker initialized.");
}
}
public static void CacheEquipmentCounts()
{
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Expected O, but got Unknown
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);
}
}
Plugin.LogDebug($"Cached equipment: {WeaponCount} weapons, {TomeCount} tomes");
break;
}
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error caching equipment counts: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
public static void OnGreedShrineActivated()
{
GreedShrinesActivated++;
Plugin.LogDebug($"Greed Shrine activated! Total: {GreedShrinesActivated}");
}
public static void OnMoaiShrineActivated()
{
MoaiShrinesActivated++;
Plugin.LogDebug($"Moai Shrine activated! Total: {MoaiShrinesActivated}");
}
public static void OnMicrowaveUsed()
{
MicrowavesUsed++;
Plugin.LogDebug($"Microwave used! Total: {MicrowavesUsed}");
}
public static void OnShadyGuyInteraction()
{
ShadyGuyInteractions++;
Plugin.LogDebug($"Shady Guy interaction! Total: {ShadyGuyInteractions}");
}
public static void ResetForNewRun()
{
GreedShrinesActivated = 0;
MoaiShrinesActivated = 0;
MicrowavesUsed = 0;
ShadyGuyInteractions = 0;
WeaponCount = 0;
TomeCount = 0;
Plugin.LogDebug("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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: 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_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);
Plugin.LogDebug($"Patched {typeName}.{methodInfo.Name} for tracking");
}
catch (Exception ex)
{
ManualLogSource log3 = 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);
}
log3.LogWarning(val);
}
}
private static Type FindType(string typeName)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
try
{
Type type = assembly.GetType(typeName);
if (type != null)
{
Plugin.LogDebug("Found " + typeName + " in " + assembly.GetName().Name);
return type;
}
Type[] types = assembly.GetTypes();
foreach (Type type2 in types)
{
if (type2.Name == typeName)
{
Plugin.LogDebug("Found " + typeName + ": " + type2.FullName);
return type2;
}
}
}
catch
{
}
}
return null;
}
private static MethodInfo FindInteractMethod(Type type)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
string[] interactionMethodNames = InteractionMethodNames;
foreach (string text in interactionMethodNames)
{
MethodInfo method = type.GetMethod(text, bindingAttr);
if (method != null)
{
Plugin.LogDebug(" Found method: " + text);
return method;
}
}
return null;
}
private static void LogAvailableMethods(Type type, string typeName)
{
BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
Plugin.LogDebug("=== " + typeName + " Methods ===");
MethodInfo[] methods = type.GetMethods(bindingAttr);
foreach (MethodInfo methodInfo in methods)
{
Plugin.LogDebug($" {methodInfo.Name}({string.Join(", ", Array.ConvertAll(methodInfo.GetParameters(), (ParameterInfo p) => p.ParameterType.Name))})");
}
Plugin.LogDebug("=== End Methods ===");
}
}
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;
private static GameObject _questsPanel;
private static GameObject _questsContent;
private static bool _showingStats = true;
private static TextMeshProUGUI _headerText;
private static Button _toggleButton;
[HarmonyPostfix]
[HarmonyPatch("StartDeathScreen")]
private static void StartDeathScreen_Postfix(DeathScreen __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
try
{
Plugin.LogDebug("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 ShowStats_Postfix(DeathScreen __instance)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
try
{
Plugin.LogDebug("DeathScreen ShowStats - creating stats panel.");
CreateStatsPanel(((Component)__instance).transform);
}
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 create stats panel on ShowStats: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
[HarmonyPostfix]
[HarmonyPatch("GoToMenu")]
private static void GoToMenu_Postfix()
{
CleanupPanel("GoToMenu");
}
[HarmonyPostfix]
[HarmonyPatch("Restart")]
private static void Restart_Postfix()
{
CleanupPanel("Restart");
}
private static void CleanupPanel(string reason)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
try
{
if ((Object)(object)_statsPanelObject != (Object)null)
{
Object.Destroy((Object)(object)_statsPanelObject);
_statsPanelObject = null;
_statsPanel = null;
Plugin.LogDebug("Stats panel destroyed on " + reason + ".");
}
PlayerStatsCache.Clear();
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error cleaning up stats panel: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
log.LogError(val);
}
}
private static void CreateStatsPanel(Transform parent)
{
if ((Object)(object)_statsPanelObject != (Object)null)
{
Plugin.LogDebug("Stats panel already exists, refreshing.");
_statsPanel?.RefreshStats();
return;
}
DeathScreen component = ((Component)parent).GetComponent<DeathScreen>();
if ((Object)(object)component != (Object)null && (Object)(object)component.statsWindow != (Object)null)
{
for (int i = 0; i < component.statsWindow.transform.childCount; i++)
{
Transform child = component.statsWindow.transform.GetChild(i);
Plugin.LogDebug($" Child {i}: {((Object)child).name}");
if (((Object)child).name == "W_Quests")
{
_questsPanel = ((Component)child).gameObject;
Plugin.LogDebug("Found W_Quests panel");
break;
}
}
if ((Object)(object)_questsPanel != (Object)null)
{
SetupTogglePanel(_questsPanel);
Plugin.LogDebug("Stats panel setup with toggle successfully.");
return;
}
}
Plugin.Log.LogWarning((object)"Could not find W_Quests panel, creating from scratch");
object obj;
if (component == null)
{
obj = null;
}
else
{
GameObject statsWindow = component.statsWindow;
obj = ((statsWindow != null) ? statsWindow.transform : null);
}
if (obj == null)
{
obj = parent;
}
CreateStatsPanelFromScratch((Transform)obj);
}
private static void SetupTogglePanel(GameObject questsPanel)
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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)
foreach (TextMeshProUGUI componentsInChild in questsPanel.GetComponentsInChildren<TextMeshProUGUI>(true))
{
if (((Object)((Component)componentsInChild).gameObject).name.ToLower().Contains("header") || ((TMP_Text)componentsInChild).text.ToUpper() == "QUESTS")
{
_headerText = componentsInChild;
Plugin.LogDebug("Found header text: '" + ((TMP_Text)componentsInChild).text + "'");
break;
}
}
ScrollRect componentInChildren = questsPanel.GetComponentInChildren<ScrollRect>(true);
Transform val = null;
if ((Object)(object)componentInChildren != (Object)null)
{
val = (Transform)(object)componentInChildren.content;
}
if ((Object)(object)val == (Object)null)
{
val = questsPanel.transform.Find("Content");
}
if ((Object)(object)val != (Object)null)
{
_questsContent = new GameObject("QuestsContentBackup");
_questsContent.transform.SetParent(val, false);
_questsContent.SetActive(false);
List<Transform> list = new List<Transform>();
for (int i = 0; i < val.childCount; i++)
{
Transform child = val.GetChild(i);
if ((Object)(object)((Component)child).gameObject != (Object)(object)_questsContent)
{
list.Add(child);
}
}
foreach (Transform item in list)
{
item.SetParent(_questsContent.transform, false);
}
_statsPanelObject = new GameObject("StatsContent");
_statsPanelObject.transform.SetParent(val, false);
RectTransform obj = _statsPanelObject.AddComponent<RectTransform>();
obj.anchorMin = Vector2.zero;
obj.anchorMax = Vector2.one;
obj.offsetMin = Vector2.zero;
obj.offsetMax = Vector2.zero;
_statsPanel = _statsPanelObject.AddComponent<StatsPanel>();
_statsPanel.InitializeForClonedPanel();
_statsPanel.RefreshStats();
Plugin.LogDebug("Created stats content in " + ((Object)val).name);
}
if ((Object)(object)_headerText != (Object)null)
{
Transform parent = ((TMP_Text)_headerText).transform.parent;
GameObject val2 = ((parent != null) ? ((Component)parent).gameObject : null) ?? ((Component)_headerText).gameObject;
_toggleButton = val2.GetComponent<Button>();
if ((Object)(object)_toggleButton == (Object)null)
{
_toggleButton = val2.AddComponent<Button>();
}
((UnityEvent)_toggleButton.onClick).AddListener(UnityAction.op_Implicit((Action)ToggleView));
((TMP_Text)_headerText).text = "STATS";
_showingStats = true;
Plugin.LogDebug("Toggle button setup on header");
}
}
private static void ToggleView()
{
_showingStats = !_showingStats;
if (_showingStats)
{
if ((Object)(object)_statsPanelObject != (Object)null)
{
_statsPanelObject.SetActive(true);
}
if ((Object)(object)_questsContent != (Object)null)
{
_questsContent.SetActive(false);
}
if ((Object)(object)_headerText != (Object)null)
{
((TMP_Text)_headerText).text = "STATS";
}
_statsPanel?.RefreshStats();
Plugin.LogDebug("Switched to STATS view");
}
else
{
if ((Object)(object)_statsPanelObject != (Object)null)
{
_statsPanelObject.SetActive(false);
}
if ((Object)(object)_questsContent != (Object)null)
{
_questsContent.SetActive(true);
}
if ((Object)(object)_headerText != (Object)null)
{
((TMP_Text)_headerText).text = "QUESTS";
}
Plugin.LogDebug("Switched to QUESTS view");
}
}
private static void LogHierarchy(Transform t, string indent)
{
Plugin.LogDebug($"{indent}{((Object)t).name} (active: {((Component)t).gameObject.activeSelf})");
for (int i = 0; i < t.childCount; i++)
{
LogHierarchy(t.GetChild(i), indent + " ");
}
}
private static void CreateStatsPanelFromScratch(Transform targetParent)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
_statsPanelObject = new GameObject("DetailedRunStatsPanel");
_statsPanelObject.transform.SetParent(targetParent, false);
RectTransform obj = _statsPanelObject.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.76f, 0.05f);
obj.anchorMax = new Vector2(0.99f, 0.95f);
obj.pivot = new Vector2(0.5f, 0.5f);
obj.offsetMin = Vector2.zero;
obj.offsetMax = Vector2.zero;
_statsPanelObject.SetActive(true);
_statsPanel = _statsPanelObject.AddComponent<StatsPanel>();
_statsPanel.Initialize();
_statsPanel.RefreshStats();
Plugin.LogDebug("Stats panel created from scratch.");
}
public static void Cleanup()
{
if ((Object)(object)_questsContent != (Object)null && (Object)(object)_headerText != (Object)null)
{
_questsContent.SetActive(true);
((TMP_Text)_headerText).text = "QUESTS";
}
if ((Object)(object)_statsPanelObject != (Object)null)
{
Object.Destroy((Object)(object)_statsPanelObject);
_statsPanelObject = null;
}
if ((Object)(object)_questsContent != (Object)null)
{
Transform parent = _questsContent.transform.parent;
if ((Object)(object)parent != (Object)null)
{
List<Transform> list = new List<Transform>();
for (int i = 0; i < _questsContent.transform.childCount; i++)
{
list.Add(_questsContent.transform.GetChild(i));
}
foreach (Transform item in list)
{
item.SetParent(parent, false);
}
}
Object.Destroy((Object)(object)_questsContent);
_questsContent = null;
}
_statsPanel = null;
_questsPanel = null;
_headerText = null;
_toggleButton = null;
_showingStats = true;
}
}
internal static class PlayerStatsCache
{
public static PlayerStatsNew CachedPlayerStats { get; private set; }
public static MyPlayer CachedMyPlayer { get; private set; }
public static void CachePlayerStats()
{
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
try
{
Plugin.LogDebug("Caching player stats...");
foreach (GameObject item in Object.FindObjectsOfType<GameObject>())
{
try
{
MyPlayer component = item.GetComponent<MyPlayer>();
if ((Object)(object)component != (Object)null)
{
CachedMyPlayer = component;
Plugin.LogDebug("Found MyPlayer on: " + ((Object)item).name);
PlayerInventory inventory = component.inventory;
if (inventory != null)
{
PropertyInfo property = ((object)inventory).GetType().GetProperty("playerStats");
if (!(property != null))
{
break;
}
object? value = property.GetValue(inventory);
CachedPlayerStats = (PlayerStatsNew)((value is PlayerStatsNew) ? value : null);
if (CachedPlayerStats != null)
{
Plugin.LogDebug("Player stats cached successfully.");
return;
}
break;
}
break;
}
}
catch
{
}
}
Plugin.Log.LogWarning((object)"Could not cache player stats.");
}
catch (Exception ex)
{
ManualLogSource log = Plugin.Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error caching player stats: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogError(val);
}
}
public static void Clear()
{
CachedPlayerStats = null;
CachedMyPlayer = null;
}
}
internal static class SceneChangeHandler
{
private static bool _initialized;
private static bool _pendingRawStatsCache;
private static float _rawStatsCacheTimer;
public static void Initialize()
{
if (!_initialized)
{
SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
_initialized = true;
Plugin.LogDebug("Scene change handler initialized.");
}
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
Plugin.LogDebug("Scene loaded: " + ((Scene)(ref scene)).name);
if (((Scene)(ref scene)).name == "GeneratedMap")
{
StatsPanel.ResetRawStatsCache();
RunStatsTracker.ResetForNewRun();
_pendingRawStatsCache = true;
_rawStatsCacheTimer = 0f;
Plugin.LogDebug("Scheduled raw stats caching for new run.");
}
}
public static void Update()
{
if (_pendingRawStatsCache)
{
_rawStatsCacheTimer += Time.deltaTime;
if (_rawStatsCacheTimer >= 2f)
{
_pendingRawStatsCache = false;
StatsPanel.CacheRawStats();
}
}
}
public static void Cleanup()
{
DeathScreenPatch.Cleanup();
}
}
}