Decompiled source of UncappedUpgrades v1.0.1

plugins/UncappedUpgrades.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("UncappedUpgrades")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d9a19312fac65480f30052359db9efcb658d9c88")]
[assembly: AssemblyProduct("UncappedUpgrades")]
[assembly: AssemblyTitle("UncappedUpgrades")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UncappedUpgrades
{
	internal static class HostConfig
	{
		private static ConfigFile cfg;

		private static string messageName;

		private static string[] personal;

		private static Dictionary<string, string> whenHostLacksMod;

		private static Func<bool> active;

		private static HandleNamedMessageDelegate handler;

		private static IntPtr registeredOn;

		private static float nextSend;

		private static float joinedAt;

		private static string lastSent;

		private static string lastApplied;

		private static bool overriding;

		private static bool heardFromHost;

		private static bool warnedMissing;

		private static bool savedFlag;

		private static bool savingPersonal;

		private static readonly Dictionary<ConfigEntryBase, string> originals = new Dictionary<ConfigEntryBase, string>();

		internal static bool FromHost
		{
			get
			{
				if (overriding)
				{
					return heardFromHost;
				}
				return false;
			}
		}

		internal static void Init(BasePlugin plugin, string guid, string[] personalKeys, Dictionary<string, string> offWithoutHost, Func<bool> isActive = null)
		{
			cfg = plugin.Config;
			messageName = guid + ".HostConfig";
			personal = personalKeys ?? Array.Empty<string>();
			whenHostLacksMod = offWithoutHost ?? new Dictionary<string, string>();
			active = isActive;
			cfg.SettingChanged += OnSettingChanged;
			plugin.AddComponent<HostConfigRunner>();
		}

		private static void OnSettingChanged(object sender, SettingChangedEventArgs e)
		{
			try
			{
				if (overriding && !savingPersonal && IsPersonal(e.ChangedSetting.Definition))
				{
					SavePersonal();
				}
			}
			catch
			{
			}
		}

		private static string Id(ConfigDefinition d)
		{
			return d.Section + "." + d.Key;
		}

		private static bool IsPersonal(ConfigDefinition d)
		{
			string[] array = personal;
			foreach (string text in array)
			{
				if (text.EndsWith(".*") ? (d.Section == text.Substring(0, text.Length - 2)) : (Id(d) == text))
				{
					return true;
				}
			}
			return false;
		}

		internal static void Tick()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				bool flag = (Object)(object)singleton != (Object)null && singleton.IsListening;
				if (!flag || singleton.IsServer || (active != null && !active()))
				{
					if (overriding)
					{
						Restore();
					}
					if (flag && singleton.IsServer)
					{
						HostTick(singleton);
					}
					if (!flag)
					{
						registeredOn = IntPtr.Zero;
					}
				}
				else
				{
					ClientTick(singleton);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag2 = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(15, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Host settings: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
			}
		}

		private static void HostTick(NetworkManager nm)
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (Time.unscaledTime < nextSend || nm.CustomMessagingManager == null)
			{
				return;
			}
			nextSend = Time.unscaledTime + 1.5f;
			List<string> list = new List<string>();
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in cfg)
			{
				if (!IsPersonal(item.Key))
				{
					list.Add(item.Key.Section + "\u001f" + item.Key.Key + "\u001f" + item.Value.GetSerializedValue());
				}
			}
			string text = string.Join("\u001e", list);
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(text.Length * 2 + 64, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(text, false);
				nm.CustomMessagingManager.SendNamedMessageToAll(messageName, val, (NetworkDelivery)4);
			}
			finally
			{
				((FastBufferWriter)(ref val)).Dispose();
			}
			if (text != lastSent)
			{
				lastSent = text;
				Plugin.Log.LogInfo((object)"Sending this game's settings to all players.");
			}
		}

		private static void ClientTick(NetworkManager nm)
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			CustomMessagingManager customMessagingManager = nm.CustomMessagingManager;
			if (customMessagingManager != null && registeredOn != ((Il2CppObjectBase)customMessagingManager).Pointer)
			{
				if (handler == null)
				{
					handler = DelegateSupport.ConvertDelegate<HandleNamedMessageDelegate>((Delegate)new Action<ulong, FastBufferReader>(OnReceived));
				}
				customMessagingManager.RegisterNamedMessageHandler(messageName, handler);
				registeredOn = ((Il2CppObjectBase)customMessagingManager).Pointer;
			}
			if (!overriding)
			{
				Begin();
				joinedAt = Time.unscaledTime;
				foreach (KeyValuePair<string, string> item in whenHostLacksMod)
				{
					Set(item.Key, item.Value);
				}
			}
			if (!heardFromHost && !warnedMissing && Time.unscaledTime - joinedAt > 15f)
			{
				warnedMissing = true;
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(88, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("No settings from the host: the host doesn't seem to have ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("UncappedUpgrades");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", so it stays off in this game.");
				}
				log.LogWarning(val);
			}
		}

		private static void OnReceived(ulong sender, FastBufferReader reader)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				string text = default(string);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false);
				if (!overriding)
				{
					Begin();
				}
				heardFromHost = true;
				if (text == lastApplied)
				{
					return;
				}
				lastApplied = text;
				int num = 0;
				string[] array = text.Split('\u001e');
				for (int i = 0; i < array.Length; i++)
				{
					string[] array2 = array[i].Split('\u001f');
					if (array2.Length == 3)
					{
						ConfigDefinition d = new ConfigDefinition(array2[0], array2[1]);
						if (!IsPersonal(d) && Set(Id(d), array2[2]))
						{
							num++;
						}
					}
				}
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Using the host's settings (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" values).");
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Host settings (receive): ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val2);
			}
		}

		private static void Begin()
		{
			overriding = true;
			heardFromHost = false;
			warnedMissing = false;
			lastApplied = null;
			savedFlag = cfg.SaveOnConfigSet;
			cfg.SaveOnConfigSet = false;
		}

		private static bool Set(string id, string value)
		{
			foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in cfg)
			{
				if (!(Id(item.Key) != id))
				{
					ConfigEntryBase value2 = item.Value;
					if (!originals.ContainsKey(value2))
					{
						originals[value2] = value2.GetSerializedValue();
					}
					if (value2.GetSerializedValue() != value)
					{
						value2.SetSerializedValue(value);
					}
					return true;
				}
			}
			return false;
		}

		private static void SavePersonal()
		{
			savingPersonal = true;
			Dictionary<ConfigEntryBase, string> dictionary = new Dictionary<ConfigEntryBase, string>();
			try
			{
				foreach (KeyValuePair<ConfigEntryBase, string> original in originals)
				{
					dictionary[original.Key] = original.Key.GetSerializedValue();
					original.Key.SetSerializedValue(original.Value);
				}
				cfg.Save();
			}
			finally
			{
				foreach (KeyValuePair<ConfigEntryBase, string> item in dictionary)
				{
					try
					{
						item.Key.SetSerializedValue(item.Value);
					}
					catch
					{
					}
				}
				savingPersonal = false;
			}
		}

		private static void Restore()
		{
			foreach (KeyValuePair<ConfigEntryBase, string> original in originals)
			{
				try
				{
					original.Key.SetSerializedValue(original.Value);
				}
				catch
				{
				}
			}
			originals.Clear();
			overriding = false;
			heardFromHost = false;
			lastApplied = null;
			cfg.SaveOnConfigSet = savedFlag;
			try
			{
				cfg.Save();
			}
			catch
			{
			}
			Plugin.Log.LogInfo((object)"Left the game; back to this computer's own settings.");
		}
	}
	public class HostConfigRunner : MonoBehaviour
	{
		public HostConfigRunner(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Update()
		{
			HostConfig.Tick();
		}
	}
	[HarmonyPatch]
	internal static class HostSettings
	{
		private const string MessageName = "girthy_mods.UncappedUpgrades.Settings";

		private static HandleNamedMessageDelegate handler;

		private static Dictionary<string, string> synced;

		internal static bool Enabled
		{
			get
			{
				if (synced == null || !synced.TryGetValue("Enabled", out var value) || !bool.TryParse(value, out var result))
				{
					return Plugin.Enabled.Value;
				}
				return result;
			}
		}

		internal static float LimitMultiplier
		{
			get
			{
				if (synced == null || !synced.TryGetValue("LimitMultiplier", out var value) || !float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					return Plugin.LimitMultiplier.Value;
				}
				return result;
			}
		}

		internal static string KeepLimitsFor
		{
			get
			{
				if (synced == null || !synced.TryGetValue("KeepLimitsFor", out var value))
				{
					return Plugin.KeepLimitsFor.Value;
				}
				return value;
			}
		}

		[HarmonyPatch(typeof(RunManager), "OnNetworkSpawn")]
		[HarmonyPostfix]
		private static void Listen()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				if (!((Object)(object)singleton == (Object)null) && !singleton.IsServer && singleton.CustomMessagingManager != null)
				{
					if (handler == null)
					{
						handler = DelegateSupport.ConvertDelegate<HandleNamedMessageDelegate>((Delegate)new Action<ulong, FastBufferReader>(OnReceived));
					}
					singleton.CustomMessagingManager.RegisterNamedMessageHandler("girthy_mods.UncappedUpgrades.Settings", handler);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Host settings (listen): ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
				}
				log.LogError(val);
			}
		}

		private static void OnReceived(ulong sender, FastBufferReader reader)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				string text = default(string);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false);
				Dictionary<string, string> dictionary = new Dictionary<string, string>();
				string[] array = text.Split(';');
				foreach (string text2 in array)
				{
					int num = text2.IndexOf('=');
					if (num > 0)
					{
						dictionary[text2.Substring(0, num)] = text2.Substring(num + 1);
					}
				}
				synced = dictionary;
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Using the host's upgrade-limit settings: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Host settings (receive): ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log2.LogError(val2);
			}
		}

		[HarmonyPatch(typeof(RunManager), "StartRunOnServerRpc")]
		[HarmonyPrefix]
		private static void StartRun_Prefix(RunManager __instance, out bool __state)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			__state = false;
			try
			{
				__state = (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1;
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(RunManager), "StartRunOnServerRpc")]
		[HarmonyPostfix]
		private static void StartRun_Postfix(bool __state)
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if (!__state)
			{
				return;
			}
			bool value = default(bool);
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				if ((Object)(object)singleton == (Object)null || !singleton.IsServer || singleton.CustomMessagingManager == null)
				{
					return;
				}
				CultureInfo invariantCulture = CultureInfo.InvariantCulture;
				string[] array = new string[3];
				value = Plugin.Enabled.Value;
				array[0] = "Enabled=" + value;
				array[1] = "LimitMultiplier=" + Plugin.LimitMultiplier.Value.ToString(invariantCulture);
				array[2] = "KeepLimitsFor=" + (Plugin.KeepLimitsFor.Value ?? "").Replace(";", ",");
				string text = string.Join(";", array);
				FastBufferWriter val = default(FastBufferWriter);
				((FastBufferWriter)(ref val))..ctor(Encoding.UTF8.GetByteCount(text) * 2 + 64, (Allocator)2, -1);
				try
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(text, false);
					singleton.CustomMessagingManager.SendNamedMessageToAll("girthy_mods.UncappedUpgrades.Settings", val, (NetworkDelivery)4);
				}
				finally
				{
					((FastBufferWriter)(ref val)).Dispose();
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(22, 1, ref value);
				if (value)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Host settings (send): ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				log.LogError(val2);
			}
		}

		[HarmonyPatch(typeof(RunManager), "OnDestroy")]
		[HarmonyPostfix]
		private static void Clear()
		{
			synced = null;
		}
	}
	[HarmonyPatch]
	internal static class LimitPatches
	{
		private static string keepCacheKey;

		private static HashSet<StatType> keep = new HashSet<StatType>();

		private static bool loggedOnce;

		private static bool Kept(StatType stat)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			string text = HostSettings.KeepLimitsFor ?? "";
			if (text != keepCacheKey)
			{
				keepCacheKey = text;
				keep = new HashSet<StatType>();
				string[] array = text.Split(new char[2] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
				bool flag = default(bool);
				foreach (string text2 in array)
				{
					if (Enum.TryParse<StatType>(text2.Trim(), ignoreCase: true, out StatType result))
					{
						keep.Add(result);
						continue;
					}
					ManualLogSource log = Plugin.Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(31, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("KeepLimitsFor: unknown stat \"");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\".");
					}
					log.LogWarning(val);
				}
			}
			return keep.Contains(stat);
		}

		[HarmonyPatch(typeof(ImprovementInventoryGenerator), "_GetAllPossibleCharacterImprovements_b__33_2")]
		[HarmonyPrefix]
		private static bool ShopFilter_Prefix(CharacterImprovementItem improvement, ref bool __result, out float __state)
		{
			return Before(improvement, ref __result, out __state);
		}

		[HarmonyPatch(typeof(ImprovementInventoryGenerator), "_GetAllPossibleCharacterImprovements_b__33_2")]
		[HarmonyPostfix]
		private static void ShopFilter_Postfix(CharacterImprovementItem improvement, float __state)
		{
			After(improvement, __state);
		}

		[HarmonyPatch(typeof(CharacterImprovementItem), "CanStillOffer")]
		[HarmonyPrefix]
		private static bool CanStillOffer_Prefix(CharacterImprovementItem __instance, ref bool __result, out float __state)
		{
			return Before(__instance, ref __result, out __state);
		}

		[HarmonyPatch(typeof(CharacterImprovementItem), "CanStillOffer")]
		[HarmonyPostfix]
		private static void CanStillOffer_Postfix(CharacterImprovementItem __instance, float __state)
		{
			After(__instance, __state);
		}

		private static bool Before(CharacterImprovementItem item, ref bool __result, out float __state)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			__state = float.NaN;
			try
			{
				if (item == null || !HostSettings.Enabled)
				{
					return true;
				}
				float statLimitForOffer = item.statLimitForOffer;
				if (statLimitForOffer == 0f)
				{
					return true;
				}
				if (Kept(((ImprovementItem)item).Stat))
				{
					return true;
				}
				float limitMultiplier = HostSettings.LimitMultiplier;
				if (limitMultiplier <= 0f)
				{
					if (!loggedOnce)
					{
						loggedOnce = true;
						Plugin.Log.LogInfo((object)"Upgrade limits removed: stat upgrades keep being offered.");
					}
					__result = true;
					return false;
				}
				__state = statLimitForOffer;
				item.statLimitForOffer = statLimitForOffer * limitMultiplier;
				return true;
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(15, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Upgrade limit: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
				return true;
			}
		}

		private static void After(CharacterImprovementItem item, float __state)
		{
			if (float.IsNaN(__state) || item == null)
			{
				return;
			}
			try
			{
				item.statLimitForOffer = __state;
			}
			catch
			{
			}
		}
	}
	[BepInPlugin("girthy_mods.UncappedUpgrades", "UncappedUpgrades", "1.0.1")]
	public class Plugin : BasePlugin
	{
		public const string Guid = "girthy_mods.UncappedUpgrades";

		public const string Name = "UncappedUpgrades";

		public const string Version = "1.0.1";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<float> LimitMultiplier;

		internal static ConfigEntry<string> KeepLimitsFor;

		public override void Load()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			HostConfig.Init((BasePlugin)(object)this, "girthy_mods.UncappedUpgrades", Array.Empty<string>(), new Dictionary<string, string> { ["Limits.Enabled"] = "false" });
			Enabled = ((BasePlugin)this).Config.Bind<bool>("Limits", "Enabled", true, "Remove (or raise) the limits on stat upgrades in the level-up shop.");
			LimitMultiplier = ((BasePlugin)this).Config.Bind<float>("Limits", "LimitMultiplier", 0f, new ConfigDescription("0 = no limits at all. Otherwise the game's limits are multiplied by this (2 = twice as high).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			KeepLimitsFor = ((BasePlugin)this).Config.Bind<string>("Limits", "KeepLimitsFor", "", "Stats that keep the game's normal limit, comma-separated (e.g. \"Dodge, Armor\"). Names: Damage, Size, FireRate, MovementSpeed, MaxHealth, HealthRegeneration, Armor, Dodge, CriticalChance, CriticalDamage, Luck, XPGain, PickupRadius, Range, Speed, LifeTime, Projectiles, Rerolls, Revives, ReviveSpeed, GoldGain.");
			Harmony val = new Harmony("girthy_mods.UncappedUpgrades");
			val.PatchAll(typeof(LimitPatches));
			val.PatchAll(typeof(HostSettings));
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(8, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("UncappedUpgrades");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.0.1");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ready.");
			}
			log.LogInfo(val2);
		}
	}
}