Decompiled source of MetaBonk v1.0.0

MetaBonk.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MbMetaMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MbMetaMod")]
[assembly: AssemblyTitle("MbMetaMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Megabonk.Meta;

[BepInPlugin("mb.meta.menu.silver", "Meta Progression (Menu Silver)", "3.0.1")]
public sealed class MetaProgressionPlugin : BasePlugin
{
	private enum Upgrade
	{
		Speed,
		Luck,
		Xp,
		Magnet
	}

	private static class Loc
	{
		private static readonly Dictionary<string, Dictionary<string, string>> Translations = new Dictionary<string, Dictionary<string, string>>
		{
			["en"] = new Dictionary<string, string>
			{
				["title"] = "Meta Progression (F8 - toggle)",
				["silver"] = "Silver",
				["speed"] = "Speed",
				["luck"] = "Luck",
				["xp"] = "Experience",
				["magnet"] = "Pickup Range",
				["level"] = "lvl",
				["buy"] = "Buy",
				["per_level"] = "per level to total",
				["absolute"] = "range per level",
				["reset_refund"] = "Reset all and refund silver",
				["close"] = "Close",
				["language"] = "Language"
			},
			["ru"] = new Dictionary<string, string>
			{
				["title"] = "Мета-прокачка (F8 — открыть/закрыть)",
				["silver"] = "Серебро",
				["speed"] = "Скорость",
				["luck"] = "Удача",
				["xp"] = "Опыт",
				["magnet"] = "Подбор",
				["level"] = "ур",
				["buy"] = "Купить",
				["per_level"] = "к итогу/ур",
				["absolute"] = "радиуса/ур",
				["reset_refund"] = "Сбросить всё и вернуть серебро",
				["close"] = "Закрыть",
				["language"] = "Язык"
			}
		};

		public static string Get(string key)
		{
			string key2 = Language?.Value ?? "en";
			if (!Translations.ContainsKey(key2))
			{
				key2 = "en";
			}
			if (!Translations[key2].ContainsKey(key))
			{
				return key;
			}
			return Translations[key2][key];
		}
	}

	public sealed class MetaUi : MonoBehaviour
	{
		private Rect _area = new Rect(40f, 80f, 520f, 360f);

		private bool _drag;

		private Vector2 _dragDelta;

		private static MetaUi _instance;

		private const float PAD = 10f;

		private const float LINE = 22f;

		private const float BTN_H = 26f;

		private const float COL_L_LABEL = 330f;

		private const float COL_R_BTN = 160f;

		private void Awake()
		{
			_instance = this;
		}

		public static void ScheduleStatsUpdate(float delay)
		{
			if ((Object)(object)_instance != (Object)null)
			{
				((MonoBehaviour)_instance).StartCoroutine(DelayedStatsUpdate(delay));
			}
		}

		private static IEnumerator DelayedStatsUpdate(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			ForceUpdateAllStats();
		}

		public void Update()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown((KeyCode)289))
			{
				UiVisible = !UiVisible;
				if (UiVisible)
				{
					ManualLogSource log = Log;
					bool flag = default(bool);
					BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(25, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] UI opened, silver=");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(GetSilver());
					}
					log.LogMessage(val);
				}
			}
			if (UiVisible)
			{
				bool mouseButtonDown = Input.GetMouseButtonDown(0);
				bool mouseButton = Input.GetMouseButton(0);
				bool mouseButtonUp = Input.GetMouseButtonUp(0);
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(((Rect)(ref _area)).x, ((Rect)(ref _area)).y, ((Rect)(ref _area)).width, 24f);
				if (mouseButtonDown && ((Rect)(ref val3)).Contains(val2))
				{
					_drag = true;
					_dragDelta = val2 - ((Rect)(ref _area)).position;
				}
				if (mouseButton && _drag)
				{
					((Rect)(ref _area)).position = val2 - _dragDelta;
				}
				if (mouseButtonUp)
				{
					_drag = false;
				}
			}
		}

		public void OnGUI()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			if (UiVisible)
			{
				GUI.Box(_area, "");
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref _area)).x, ((Rect)(ref _area)).y, ((Rect)(ref _area)).width, 24f);
				GUI.Box(val, Loc.Get("title"));
				float num = ((Rect)(ref _area)).x + 10f;
				float num2 = ((Rect)(ref _area)).y + 24f + 10f;
				float num3 = ((Rect)(ref _area)).width - 20f;
				int silver = GetSilver();
				GUI.Label(new Rect(num, num2, num3, 22f), $"{Loc.Get("silver")}: {silver}");
				num2 += 28f;
				Row(ref num2, Loc.Get("speed"), Upgrade.Speed, LvlSpeed.Value, $"+{SpeedPct.Value * 100.0:0.#}% {Loc.Get("per_level")}");
				Row(ref num2, Loc.Get("luck"), Upgrade.Luck, LvlLuck.Value, $"+{LuckPct.Value * 100.0:0.#}% {Loc.Get("per_level")}");
				Row(ref num2, Loc.Get("xp"), Upgrade.Xp, LvlXp.Value, $"+{XpPct.Value * 100.0:0.#}% {Loc.Get("per_level")}");
				Row(ref num2, Loc.Get("magnet"), Upgrade.Magnet, LvlMagnet.Value, $"+{MagnetAbs.Value:0.##} {Loc.Get("absolute")}");
				num2 += 10f;
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(num, num2, num3, 26f);
				if (GUI.Button(val2, Loc.Get("reset_refund")))
				{
					FullReset();
				}
				num2 += 32f;
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(num, num2, num3, 26f);
				string text = ((Language.Value == "ru") ? "RU" : "EN");
				if (GUI.Button(val3, Loc.Get("language") + ": " + text))
				{
					Language.Value = ((Language.Value == "en") ? "ru" : "en");
					((BasePlugin)Instance).Config.Save();
				}
				num2 += 32f;
				Rect val4 = default(Rect);
				((Rect)(ref val4))..ctor(num, num2, num3, 26f);
				if (GUI.Button(val4, Loc.Get("close")))
				{
					UiVisible = false;
				}
			}
		}

		private void Row(ref float y, string title, Upgrade k, int level, string note)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref _area)).x + 10f;
			float num2 = ((Rect)(ref _area)).width - 20f;
			GUI.Label(new Rect(num, y, 330f, 22f), $"{title}: {Loc.Get("level")} {level} ({note})");
			int num3 = PriceNext(k);
			int silver = GetSilver();
			bool enabled = silver >= num3;
			bool enabled2 = GUI.enabled;
			GUI.enabled = enabled;
			if (GUI.Button(new Rect(num + num2 - 160f, y - 2f, 160f, 26f), $"{Loc.Get("buy")} — {num3}"))
			{
				Buy(k);
			}
			GUI.enabled = enabled2;
			y += 26f;
		}
	}

	internal static ManualLogSource Log;

	internal Harmony _h;

	private static ConfigEntry<int> LvlSpeed;

	private static ConfigEntry<int> LvlLuck;

	private static ConfigEntry<int> LvlXp;

	private static ConfigEntry<int> LvlMagnet;

	private static ConfigEntry<int> P0_Speed;

	private static ConfigEntry<int> P0_Luck;

	private static ConfigEntry<int> P0_Xp;

	private static ConfigEntry<int> P0_Magnet;

	private static ConfigEntry<double> PriceK;

	private static ConfigEntry<double> SpeedPct;

	private static ConfigEntry<double> LuckPct;

	private static ConfigEntry<double> XpPct;

	private static ConfigEntry<double> MagnetAbs;

	private static ConfigEntry<string> Language;

	internal static bool UiVisible;

	private static object CachedProgressionSaveFile;

	private static PropertyInfo PI_ProgFile_Silver;

	private static Assembly GameAsm;

	private const string NS_DataManager = "Assets.Scripts.Managers.DataManager";

	private const string NS_SaveManager = "Assets.Scripts.Saves___Serialization.Progression.SaveManager";

	private const string NS_MyPlayer = "Assets.Scripts.Actors.Player.MyPlayer";

	private const string NS_EStat = "Assets.Scripts.Menu.Shop.EStat";

	private const string NS_ProgSaveFile = "Assets.Scripts.Saves___Serialization.SaveFiles.ProgressionSaveFile";

	private const string NS_PlayerStatsNew = "Assets.Scripts.Inventory__Items__Pickups.Stats.PlayerStatsNew";

	private static Type T_DataManager;

	private static Type T_SaveManager;

	private static Type T_MyPlayer;

	private static Type T_EStat;

	private static Type T_ProgSaveFile;

	private static Type T_PlayerStatsNew;

	private static MethodInfo MI_SaveManager_Save;

	private static MethodInfo MI_PlayerStatsNew_UpdateStat;

	private static PropertyInfo PI_SaveManager_Instance;

	private static PropertyInfo PI_SaveManager_ProgFile;

	private static PropertyInfo PI_PlayerStatsNew_Stats;

	private static object CachedPlayerStatsNew;

	private static object E_Speed;

	private static object E_Luck;

	private static object E_XpMul;

	private static object E_Magnet;

	private const string STAT_Speed = "MoveSpeedMultiplier";

	private const string STAT_Luck = "Luck";

	private const string STAT_XpMul = "XpIncreaseMultiplier";

	private const string STAT_Magnet = "PickupRange";

	private const BindingFlags BF_ALL = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

	internal static MetaProgressionPlugin Instance => (MetaProgressionPlugin)((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins["mb.meta.menu.silver"].Instance;

	public override void Load()
	{
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Expected O, but got Unknown
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Expected O, but got Unknown
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0397: Expected O, but got Unknown
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_0437: Expected O, but got Unknown
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Expected O, but got Unknown
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029b: Expected O, but got Unknown
		//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0403: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		LvlSpeed = ((BasePlugin)this).Config.Bind<int>("State", "SpeedLevel", 0, (ConfigDescription)null);
		LvlLuck = ((BasePlugin)this).Config.Bind<int>("State", "LuckLevel", 0, (ConfigDescription)null);
		LvlXp = ((BasePlugin)this).Config.Bind<int>("State", "XpLevel", 0, (ConfigDescription)null);
		LvlMagnet = ((BasePlugin)this).Config.Bind<int>("State", "MagnetLevel", 0, (ConfigDescription)null);
		P0_Speed = ((BasePlugin)this).Config.Bind<int>("Prices", "P0_Speed", 10, (ConfigDescription)null);
		P0_Luck = ((BasePlugin)this).Config.Bind<int>("Prices", "P0_Luck", 10, (ConfigDescription)null);
		P0_Xp = ((BasePlugin)this).Config.Bind<int>("Prices", "P0_Xp", 10, (ConfigDescription)null);
		P0_Magnet = ((BasePlugin)this).Config.Bind<int>("Prices", "P0_Magnet", 10, (ConfigDescription)null);
		PriceK = ((BasePlugin)this).Config.Bind<double>("Prices", "Growth", 1.35, (ConfigDescription)null);
		SpeedPct = ((BasePlugin)this).Config.Bind<double>("Gains", "SpeedPctPerLvl", 0.03, (ConfigDescription)null);
		LuckPct = ((BasePlugin)this).Config.Bind<double>("Gains", "LuckPctPerLvl", 0.02, (ConfigDescription)null);
		XpPct = ((BasePlugin)this).Config.Bind<double>("Gains", "XpPctPerLvl", 0.05, (ConfigDescription)null);
		MagnetAbs = ((BasePlugin)this).Config.Bind<double>("Gains", "MagnetAbsPerLvl", 0.5, (ConfigDescription)null);
		Language = ((BasePlugin)this).Config.Bind<string>("UI", "Language", "en", "Language (en/ru)");
		_h = new Harmony("mb.meta.menu.silver.runtime");
		TryResolveGameAssembly();
		TryPatch("Assets.Scripts.Saves___Serialization.SaveFiles.ProgressionSaveFile", "Init", null, new Action<object>(ProgressionSaveFile_Init_Postfix));
		TryPatch("Assets.Scripts.Saves___Serialization.Progression.SaveManager", "Load", null, new Action<object, bool>(SaveManager_Load_Postfix), new Type[1] { typeof(bool) });
		bool flag = default(bool);
		if (T_PlayerStatsNew != null)
		{
			try
			{
				ConstructorInfo constructorInfo = T_PlayerStatsNew.GetConstructors(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((ConstructorInfo c) => c.GetParameters().Length >= 1);
				if (constructorInfo != null)
				{
					HarmonyMethod val = new HarmonyMethod(typeof(MetaProgressionPlugin).GetMethod("PlayerStatsNew_Ctor_Postfix", BindingFlags.Static | BindingFlags.NonPublic));
					_h.Patch((MethodBase)constructorInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Log.LogMessage((object)"[Meta] Patched PlayerStatsNew constructor");
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(44, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Meta] Failed to patch PlayerStatsNew ctor: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val2);
			}
		}
		TryPatch("Assets.Scripts.Actors.Player.MyPlayer", "Start", null, new Action<object>(MyPlayer_Start_Postfix));
		if (MI_PlayerStatsNew_UpdateStat != null)
		{
			try
			{
				HarmonyMethod val3 = new HarmonyMethod(typeof(MetaProgressionPlugin).GetMethod("PlayerStatsNew_UpdateStat_Postfix", BindingFlags.Static | BindingFlags.NonPublic));
				_h.Patch((MethodBase)MI_PlayerStatsNew_UpdateStat, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Log.LogMessage((object)"[Meta] Successfully patched PlayerStatsNew.UpdateStat");
			}
			catch (Exception ex2)
			{
				ManualLogSource log2 = Log;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(50, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Meta] Failed to patch PlayerStatsNew.UpdateStat: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex2.Message);
				}
				log2.LogError(val4);
			}
		}
		else
		{
			Log.LogWarning((object)"[Meta] Could not find PlayerStatsNew.UpdateStat method!");
		}
		try
		{
			if (!ClassInjector.IsTypeRegisteredInIl2Cpp(typeof(MetaUi)))
			{
				ClassInjector.RegisterTypeInIl2Cpp<MetaUi>();
			}
			GameObject val5 = new GameObject("MB_Meta_UI")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)(object)val5);
			val5.AddComponent<MetaUi>();
		}
		catch (Exception ex3)
		{
			ManualLogSource log3 = Log;
			BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Meta] UI init failed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex3.Message);
			}
			log3.LogWarning(val2);
		}
		Log.LogMessage((object)"Meta Progression v3.0.1 loaded. F8: open menu.");
	}

	private static void TryResolveGameAssembly()
	{
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Expected O, but got Unknown
		if (GameAsm == null)
		{
			GameAsm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "Assembly-CSharp");
		}
		if (GameAsm == null)
		{
			return;
		}
		if ((object)T_DataManager == null)
		{
			T_DataManager = GameAsm.GetType("Assets.Scripts.Managers.DataManager");
		}
		if ((object)T_SaveManager == null)
		{
			T_SaveManager = GameAsm.GetType("Assets.Scripts.Saves___Serialization.Progression.SaveManager");
		}
		if ((object)T_MyPlayer == null)
		{
			T_MyPlayer = GameAsm.GetType("Assets.Scripts.Actors.Player.MyPlayer");
		}
		if ((object)T_EStat == null)
		{
			T_EStat = GameAsm.GetType("Assets.Scripts.Menu.Shop.EStat");
		}
		if ((object)T_ProgSaveFile == null)
		{
			T_ProgSaveFile = GameAsm.GetType("Assets.Scripts.Saves___Serialization.SaveFiles.ProgressionSaveFile");
		}
		if ((object)T_PlayerStatsNew == null)
		{
			T_PlayerStatsNew = GameAsm.GetType("Assets.Scripts.Inventory__Items__Pickups.Stats.PlayerStatsNew");
		}
		if (PI_SaveManager_Instance == null && T_SaveManager != null)
		{
			PI_SaveManager_Instance = T_SaveManager.GetProperty("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		}
		if (PI_SaveManager_ProgFile == null && T_SaveManager != null)
		{
			PI_SaveManager_ProgFile = T_SaveManager.GetProperty("progression", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? T_SaveManager.GetProperty("progressionSaveFile", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? T_SaveManager.GetProperty("save", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		}
		if (MI_SaveManager_Save == null && T_SaveManager != null)
		{
			MI_SaveManager_Save = T_SaveManager.GetMethod("Save", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
		}
		if (PI_ProgFile_Silver == null && T_ProgSaveFile != null)
		{
			PI_ProgFile_Silver = T_ProgSaveFile.GetProperty("silver", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		}
		if (PI_PlayerStatsNew_Stats == null && T_PlayerStatsNew != null)
		{
			PI_PlayerStatsNew_Stats = T_PlayerStatsNew.GetProperty("stats", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		}
		if (MI_PlayerStatsNew_UpdateStat == null && T_PlayerStatsNew != null && T_EStat != null)
		{
			MI_PlayerStatsNew_UpdateStat = T_PlayerStatsNew.GetMethod("UpdateStat", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { T_EStat }, null);
		}
		if (T_EStat != null && (E_Speed == null || E_Luck == null || E_XpMul == null || E_Magnet == null))
		{
			E_Speed = EnumValue(T_EStat, "MoveSpeedMultiplier");
			E_Luck = EnumValue(T_EStat, "Luck");
			E_XpMul = EnumValue(T_EStat, "XpIncreaseMultiplier");
			E_Magnet = EnumValue(T_EStat, "PickupRange");
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(50, 4, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] EStat resolved: Speed=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(E_Speed);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Luck=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(E_Luck);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", XP=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(E_XpMul);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Magnet=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<object>(E_Magnet);
			}
			log.LogMessage(val);
		}
	}

	private static object EnumValue(Type enumType, string name)
	{
		try
		{
			return Enum.Parse(enumType, name, ignoreCase: true);
		}
		catch
		{
			return null;
		}
	}

	private void TryPatch(string typeName, string methodName, Delegate prefix = null, Delegate postfix = null, Type[] argTypes = null)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Expected O, but got Unknown
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Expected O, but got Unknown
		TryResolveGameAssembly();
		Type type = GameAsm?.GetType(typeName);
		bool flag = default(bool);
		if (type == null)
		{
			ManualLogSource log = Log;
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Type not found: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
			}
			log.LogWarning(val);
			return;
		}
		MethodInfo methodInfo = ((argTypes == null) ? AccessTools.Method(type, methodName, (Type[])null, (Type[])null) : AccessTools.Method(type, methodName, argTypes, (Type[])null));
		if (methodInfo == null)
		{
			ManualLogSource log2 = Log;
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Method not found: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(typeName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(methodName);
			}
			log2.LogWarning(val);
			return;
		}
		HarmonyMethod val2 = (((object)prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(prefix.Method));
		HarmonyMethod val3 = (((object)postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(postfix.Method));
		_h.Patch((MethodBase)methodInfo, val2, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		ManualLogSource log3 = Log;
		BepInExMessageLogInterpolatedStringHandler val4 = new BepInExMessageLogInterpolatedStringHandler(17, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[Meta] Patched: ");
			((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(typeName);
			((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(".");
			((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(methodName);
		}
		log3.LogMessage(val4);
	}

	private static object GetProgressionSaveFile()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Expected O, but got Unknown
		if (CachedProgressionSaveFile != null)
		{
			return CachedProgressionSaveFile;
		}
		TryResolveGameAssembly();
		try
		{
			object obj = PI_SaveManager_Instance?.GetValue(null);
			if (obj != null && PI_SaveManager_ProgFile != null)
			{
				object value = PI_SaveManager_ProgFile.GetValue(obj);
				if (value != null)
				{
					CachedProgressionSaveFile = value;
					Log.LogMessage((object)"[Meta] ProgressionSaveFile via SaveManager.Instance");
					return value;
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(54, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] GetProgressionSaveFile via SaveManager failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
		}
		return null;
	}

	private static int GetSilver()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		try
		{
			object progressionSaveFile = GetProgressionSaveFile();
			if (progressionSaveFile == null || PI_ProgFile_Silver == null)
			{
				return 0;
			}
			object value = PI_ProgFile_Silver.GetValue(progressionSaveFile);
			return (value != null) ? ((int)value) : 0;
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] GetSilver failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
			return 0;
		}
	}

	private static void SetSilver(int value)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		try
		{
			object progressionSaveFile = GetProgressionSaveFile();
			if (progressionSaveFile != null && !(PI_ProgFile_Silver == null))
			{
				PI_ProgFile_Silver.SetValue(progressionSaveFile, value);
				SaveGame();
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] SetSilver failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
		}
	}

	private static bool TrySpendSilver(int amount)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		if (amount <= 0)
		{
			return true;
		}
		int silver = GetSilver();
		bool flag = default(bool);
		BepInExMessageLogInterpolatedStringHandler val;
		if (silver < amount)
		{
			ManualLogSource log = Log;
			val = new BepInExMessageLogInterpolatedStringHandler(40, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Insufficient silver: have ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(silver);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", need ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
			}
			log.LogMessage(val);
			return false;
		}
		SetSilver(silver - amount);
		ManualLogSource log2 = Log;
		val = new BepInExMessageLogInterpolatedStringHandler(33, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Spent ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" silver, remaining: ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(silver - amount);
		}
		log2.LogMessage(val);
		return true;
	}

	private static void RefundSilver(int amount)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		if (amount > 0)
		{
			int silver = GetSilver();
			SetSilver(silver + amount);
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(36, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Refunded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(amount);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" silver, new total: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(silver + amount);
			}
			log.LogMessage(val);
		}
	}

	private static void SaveGame()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Expected O, but got Unknown
		try
		{
			object obj = PI_SaveManager_Instance?.GetValue(null);
			MI_SaveManager_Save?.Invoke(obj, null);
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] SaveGame failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
		}
	}

	private static int PriceNext(Upgrade k)
	{
		if (1 == 0)
		{
		}
		int num = k switch
		{
			Upgrade.Speed => LvlSpeed.Value, 
			Upgrade.Luck => LvlLuck.Value, 
			Upgrade.Xp => LvlXp.Value, 
			Upgrade.Magnet => LvlMagnet.Value, 
			_ => 0, 
		};
		if (1 == 0)
		{
		}
		int num2 = num;
		if (1 == 0)
		{
		}
		num = k switch
		{
			Upgrade.Speed => P0_Speed.Value, 
			Upgrade.Luck => P0_Luck.Value, 
			Upgrade.Xp => P0_Xp.Value, 
			Upgrade.Magnet => P0_Magnet.Value, 
			_ => 0, 
		};
		if (1 == 0)
		{
		}
		int num3 = num;
		double a = (double)num3 * Math.Pow(PriceK.Value, num2);
		return Math.Max(1, (int)Math.Ceiling(a));
	}

	private static bool Buy(Upgrade k)
	{
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		int amount = PriceNext(k);
		if (!TrySpendSilver(amount))
		{
			return false;
		}
		switch (k)
		{
		case Upgrade.Speed:
		{
			ConfigEntry<int> lvlSpeed = LvlSpeed;
			int value = lvlSpeed.Value;
			lvlSpeed.Value = value + 1;
			break;
		}
		case Upgrade.Luck:
		{
			ConfigEntry<int> lvlLuck = LvlLuck;
			int value = lvlLuck.Value;
			lvlLuck.Value = value + 1;
			break;
		}
		case Upgrade.Xp:
		{
			ConfigEntry<int> lvlXp = LvlXp;
			int value = lvlXp.Value;
			lvlXp.Value = value + 1;
			break;
		}
		case Upgrade.Magnet:
		{
			ConfigEntry<int> lvlMagnet = LvlMagnet;
			int value = lvlMagnet.Value;
			lvlMagnet.Value = value + 1;
			break;
		}
		}
		((BasePlugin)Instance).Config.Save();
		ManualLogSource log = Log;
		bool flag = default(bool);
		BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(52, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Bought ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Upgrade>(k);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", new level: ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(GetLevel(k));
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (will apply on next run)");
		}
		log.LogMessage(val);
		return true;
	}

	private static int GetLevel(Upgrade k)
	{
		if (1 == 0)
		{
		}
		int result = k switch
		{
			Upgrade.Speed => LvlSpeed.Value, 
			Upgrade.Luck => LvlLuck.Value, 
			Upgrade.Xp => LvlXp.Value, 
			Upgrade.Magnet => LvlMagnet.Value, 
			_ => 0, 
		};
		if (1 == 0)
		{
		}
		return result;
	}

	private static long SumSpent(int p0, double k, int L)
	{
		if (L <= 0)
		{
			return 0L;
		}
		double a = (double)p0 * (Math.Pow(k, L) - 1.0) / (k - 1.0);
		return (long)Math.Ceiling(a);
	}

	private static void FullReset()
	{
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Expected O, but got Unknown
		int num = (int)SumSpent(P0_Speed.Value, PriceK.Value, LvlSpeed.Value) + (int)SumSpent(P0_Luck.Value, PriceK.Value, LvlLuck.Value) + (int)SumSpent(P0_Xp.Value, PriceK.Value, LvlXp.Value) + (int)SumSpent(P0_Magnet.Value, PriceK.Value, LvlMagnet.Value);
		RefundSilver(num);
		ConfigEntry<int> lvlSpeed = LvlSpeed;
		ConfigEntry<int> lvlLuck = LvlLuck;
		ConfigEntry<int> lvlXp = LvlXp;
		int num3 = (LvlMagnet.Value = 0);
		int num5 = (lvlXp.Value = num3);
		int value = (lvlLuck.Value = num5);
		lvlSpeed.Value = value;
		((BasePlugin)Instance).Config.Save();
		ManualLogSource log = Log;
		bool flag = default(bool);
		BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(70, 1, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Full reset completed, refunded ");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" silver (will apply on next run)");
		}
		log.LogMessage(val);
	}

	private static void PlayerStatsNew_Ctor_Postfix(object __instance)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		try
		{
			CachedPlayerStatsNew = __instance;
			Log.LogMessage((object)"[Meta] PlayerStatsNew instance cached");
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] PlayerStatsNew_Ctor_Postfix failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
		}
	}

	private static void PlayerStatsNew_UpdateStat_Postfix(object __instance, object stat)
	{
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Expected O, but got Unknown
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Expected O, but got Unknown
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0352: Expected O, but got Unknown
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Expected O, but got Unknown
		bool flag = default(bool);
		try
		{
			if (__instance == null || stat == null || PI_PlayerStatsNew_Stats == null)
			{
				return;
			}
			object value = PI_PlayerStatsNew_Stats.GetValue(__instance);
			if (value == null)
			{
				return;
			}
			Type type = value.GetType();
			MethodInfo method = type.GetMethod("ContainsKey");
			PropertyInfo property = type.GetProperty("Item");
			if (E_Speed != null && stat.Equals(E_Speed))
			{
				if ((bool)method.Invoke(value, new object[1] { stat }))
				{
					float num = (float)property.GetValue(value, new object[1] { stat });
					float num2 = 1f + (float)((double)LvlSpeed.Value * SpeedPct.Value);
					float num3 = num * num2;
					property.SetValue(value, num3, new object[1] { stat });
					ManualLogSource log = Log;
					BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(22, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Speed: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num3, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (x");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num2, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					log.LogMessage(val);
				}
			}
			else if (E_Luck != null && stat.Equals(E_Luck))
			{
				if ((bool)method.Invoke(value, new object[1] { stat }))
				{
					float num4 = (float)property.GetValue(value, new object[1] { stat });
					float num5 = (float)((double)LvlLuck.Value * LuckPct.Value);
					float num6 = num4 + num5;
					property.SetValue(value, num6, new object[1] { stat });
					ManualLogSource log2 = Log;
					BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(21, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Luck: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num4, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num6, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (+");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num5, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					log2.LogMessage(val);
				}
			}
			else if (E_XpMul != null && stat.Equals(E_XpMul))
			{
				if ((bool)method.Invoke(value, new object[1] { stat }))
				{
					float num7 = (float)property.GetValue(value, new object[1] { stat });
					float num8 = 1f + (float)((double)LvlXp.Value * XpPct.Value);
					float num9 = num7 * num8;
					property.SetValue(value, num9, new object[1] { stat });
					ManualLogSource log3 = Log;
					BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(19, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] XP: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num7, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num9, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (x");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num8, "F2");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					log3.LogMessage(val);
				}
			}
			else if (E_Magnet != null && stat.Equals(E_Magnet) && (bool)method.Invoke(value, new object[1] { stat }))
			{
				float num10 = (float)property.GetValue(value, new object[1] { stat });
				float num11 = (float)((double)LvlMagnet.Value * MagnetAbs.Value);
				float num12 = num10 + num11;
				property.SetValue(value, num12, new object[1] { stat });
				ManualLogSource log4 = Log;
				BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(23, 3, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] Magnet: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num10, "F2");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num12, "F2");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (+");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num11, "F2");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
				}
				log4.LogMessage(val);
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log5 = Log;
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Meta] PlayerStatsNew_UpdateStat_Postfix failed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
			}
			log5.LogError(val2);
		}
	}

	private static void ForceUpdateAllStats()
	{
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		try
		{
			if (CachedPlayerStatsNew != null && !(MI_PlayerStatsNew_UpdateStat == null))
			{
				if (LvlSpeed.Value > 0 && E_Speed != null)
				{
					MI_PlayerStatsNew_UpdateStat.Invoke(CachedPlayerStatsNew, new object[1] { E_Speed });
				}
				if (LvlLuck.Value > 0 && E_Luck != null)
				{
					MI_PlayerStatsNew_UpdateStat.Invoke(CachedPlayerStatsNew, new object[1] { E_Luck });
				}
				if (LvlXp.Value > 0 && E_XpMul != null)
				{
					MI_PlayerStatsNew_UpdateStat.Invoke(CachedPlayerStatsNew, new object[1] { E_XpMul });
				}
				if (LvlMagnet.Value > 0 && E_Magnet != null)
				{
					MI_PlayerStatsNew_UpdateStat.Invoke(CachedPlayerStatsNew, new object[1] { E_Magnet });
				}
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] ForceUpdateAllStats failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogError(val);
		}
	}

	private static void ProgressionSaveFile_Init_Postfix(object __instance)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		bool flag = default(bool);
		try
		{
			CachedProgressionSaveFile = __instance;
			int silver = GetSilver();
			ManualLogSource log = Log;
			BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] ProgressionSaveFile.Init captured, silver=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(silver);
			}
			log.LogMessage(val);
		}
		catch (Exception ex)
		{
			ManualLogSource log2 = Log;
			BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Meta] ProgressionSaveFile_Init_Postfix failed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
			}
			log2.LogWarning(val2);
		}
	}

	private static void SaveManager_Load_Postfix(object __instance, bool loadBackup)
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		bool flag = default(bool);
		try
		{
			TryResolveGameAssembly();
			CachedProgressionSaveFile = null;
			GetProgressionSaveFile();
			int silver = GetSilver();
			ManualLogSource log = Log;
			BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(42, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] SaveManager.Load completed, silver=");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(silver);
			}
			log.LogMessage(val);
		}
		catch (Exception ex)
		{
			ManualLogSource log2 = Log;
			BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Meta] SaveManager_Load_Postfix failed: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
			}
			log2.LogWarning(val2);
		}
	}

	private static void MyPlayer_Start_Postfix(object __instance)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		try
		{
			Log.LogMessage((object)"[Meta] MyPlayer.Start called - applying stats.");
			ForceUpdateAllStats();
			if (CachedPlayerStatsNew == null)
			{
				Log.LogMessage((object)"[Meta] PlayerStatsNew not ready yet, will retry in 1 second...");
				MetaUi.ScheduleStatsUpdate(1f);
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Meta] MyPlayer_Start_Postfix failed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val);
		}
	}
}