Decompiled source of MetaLimits v2.0.2

plugins/MetaLimits.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Alexandria.Misc;
using BepInEx;
using Dungeonator;
using Gunfiguration;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d6d7a494-722e-4763-959b-c2d6b6a42b01")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MetaLimits;

public static class MetaConfig
{
	public static Gunfig _Gunfig = null;

	internal const string PILOTPAST_LABEL = "The Pilot's Affinity";

	private static readonly List<string> PILOTPAST_OPTIONS = new List<string>();

	private static readonly List<string> PILOTPAST_DESCRIPTIONS = new List<string>();

	internal const string MARINEPAST_LABEL = "The Marine's Affinity";

	private static readonly List<string> MARINEPAST_OPTIONS = new List<string>();

	private static readonly List<string> MARINEPAST_DESCRIPTIONS = new List<string>();

	internal const string CONVICTPAST_LABEL = "The Convict's Affinity";

	private static readonly List<string> CONVICTPAST_OPTIONS = new List<string>();

	private static readonly List<string> CONVICTPAST_DESCRIPTIONS = new List<string>();

	internal const string HUNTERPAST_LABEL = "The Hunter's Affinity";

	private static readonly List<string> HUNTERPAST_OPTIONS = new List<string>();

	private static readonly List<string> HUNTERPAST_DESCRIPTIONS = new List<string>();

	internal const string BULLETPAST_LABEL = "The Bullet's Affinity";

	private static readonly List<string> BULLETPAST_OPTIONS = new List<string>();

	private static readonly List<string> BULLETPAST_DESCRIPTIONS = new List<string>();

	internal const string ROBOTPAST_LABEL = "The Robot's Affinity";

	private static readonly List<string> ROBOTPAST_OPTIONS = new List<string>();

	private static readonly List<string> ROBOTPAST_DESCRIPTIONS = new List<string>();

	internal const string PARADOXPAST_LABEL = "The Paradox's Affinity";

	private static readonly List<string> PARADOXPAST_OPTIONS = new List<string>();

	private static readonly List<string> PARADOXPAST_DESCRIPTIONS = new List<string>();

	internal const string SLINGERPAST_LABEL = "The Slinger's Affinity";

	private static readonly List<string> SLINGERPAST_OPTIONS = new List<string>();

	private static readonly List<string> SLINGERPAST_DESCRIPTIONS = new List<string>();

	internal const string COOPCHEST_LABEL = "The Cultist's Affinity";

	private static readonly List<string> COOPCHEST_OPTIONS = new List<string>();

	private static readonly List<string> COOPCHEST_DESCRIPTIONS = new List<string>();

	internal const string STARTCHEST_LABEL = "The Gungeon's Affinity";

	private static readonly List<string> STARTCHEST_OPTIONS = new List<string>();

	private static readonly List<string> STARTCHEST_DESCRIPTIONS = new List<string>();

	internal const string MULTI_LABEL = "Bowler's Affinity";

	private static readonly List<string> MULTI_OPTIONS = new List<string>();

	private static readonly List<string> MULTI_DESCRIPTIONS = new List<string>();

	internal const string MAGNIFICENCE_LABEL = "Frifle and Mauser's Affinity";

	private static readonly List<string> MAGNIFICENCE_OPTIONS = new List<string>();

	private static readonly List<string> MAGNIFICENCE_DESCRIPTIONS = new List<string>();

	internal const string SYNERGYCHEST_LABEL = "Sorceress's Affinity";

	private static readonly List<string> SYNERGYCHEST_OPTIONS = new List<string>();

	private static readonly List<string> SYNERGYCHEST_DESCRIPTIONS = new List<string>();

	internal const string SYNERGYFACTOR_LABEL = "Tinker's Affinity";

	private static readonly List<string> SYNERGYFACTOR_OPTIONS = new List<string>();

	private static readonly List<string> SYNERGYFACTOR_DESCRIPTIONS = new List<string>();

	internal const string SYNERGYFUSE_LABEL = "Tonic's Affinity";

	private static readonly List<string> SYNERGYFUSE_OPTIONS = new List<string>();

	private static readonly List<string> SYNERGYFUSE_DESCRIPTIONS = new List<string>();

	internal const string SEE_LABEL = "Ser Manuel's Affinity";

	private static readonly List<string> SEE_OPTIONS = new List<string>();

	private static readonly List<string> SEE_DESCRIPTIONS = new List<string>();

	internal const string CURSE_LABEL = "Daisuke's Affinity";

	private static readonly List<string> CURSE_OPTIONS = new List<string>();

	private static readonly List<string> CURSE_DESCRIPTIONS = new List<string>();

	internal const string BOSSHIT_LABEL = "Gunsling King's Affinity";

	private static readonly List<string> BOSSHIT_OPTIONS = new List<string>();

	private static readonly List<string> BOSSHIT_DESCRIPTIONS = new List<string>();

	internal const string MAP_LABEL = "The Lost Adventurer's Affinity";

	private static readonly List<string> MAP_OPTIONS = new List<string>();

	private static readonly List<string> MAP_DESCRIPTIONS = new List<string>();

	internal const string MONEY_LABEL = "Winchester's Affinity";

	private static readonly List<string> MONEY_OPTIONS = new List<string>();

	private static readonly List<string> MONEY_DESCRIPTIONS = new List<string>();

	internal const string SECRET_LABEL = "Ledge Goblin's Affinity";

	private static readonly List<string> SECRET_OPTIONS = new List<string>();

	private static readonly List<string> SECRET_DESCRIPTIONS = new List<string>();

	internal const string SYNERGYCHESTSPAWN_LABEL = "Advanced Dragun's Affinity";

	private static readonly List<string> SYNERGYCHESTSPAWN_OPTIONS = new List<string>();

	private static readonly List<string> SYNERGYCHESTSPAWN_DESCRIPTIONS = new List<string>();

	internal const string CAP_LABEL = "The Bosses' Affinity";

	private static readonly List<string> CAP_OPTIONS = new List<string>();

	private static readonly List<string> CAP_DESCRIPTIONS = new List<string>();

	internal const string RAT_LABEL = "Resourceful Rat's Affinity";

	private static readonly List<string> RAT_OPTIONS = new List<string>();

	private static readonly List<string> RAT_DESCRIPTIONS = new List<string>();

	private static void BuildOptions()
	{
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0667: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0707: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_097c: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a05: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a8d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b59: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_11d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cf0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d49: Unknown result type (might be due to invalid IL or missing references)
		//IL_137d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1765: Unknown result type (might be due to invalid IL or missing references)
		//IL_177b: Unknown result type (might be due to invalid IL or missing references)
		Color val = default(Color);
		((Color)(ref val))..ctor(1f, 0.4f, 0f);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(1f, 0.7f, 4f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0f, 0.6f, 0.4f);
		Color val4 = default(Color);
		((Color)(ref val4))..ctor(0.5f, 0.5f, 1f);
		Color val5 = default(Color);
		((Color)(ref val5))..ctor(1f, 0.5f, 0.7f);
		Color val6 = default(Color);
		((Color)(ref val6))..ctor(0f, 1f, 0.8f);
		Color val7 = default(Color);
		((Color)(ref val7))..ctor(0.5f, 0.5f, 0.8f);
		Color val8 = default(Color);
		((Color)(ref val8))..ctor(0.8f, 0.4f, 0f);
		Color val9 = default(Color);
		((Color)(ref val9))..ctor(0.1f, 0.3f, 1f);
		Color val10 = default(Color);
		((Color)(ref val10))..ctor(0.7f, 0.9f, 0.8f);
		Color val11 = default(Color);
		((Color)(ref val11))..ctor(0.1f, 0.7f, 0.8f);
		Color val12 = default(Color);
		((Color)(ref val12))..ctor(0.6f, 0f, 0f);
		Color val13 = default(Color);
		((Color)(ref val13))..ctor(1f, 0f, 0.4f);
		Color val14 = default(Color);
		((Color)(ref val14))..ctor(0.3f, 0.4f, 0.55f);
		Color val15 = default(Color);
		((Color)(ref val15))..ctor(0.3f, 0.5f, 0.15f);
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18001))
		{
			PILOTPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			PILOTPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Mimic chests spawn 2.25% of the time. Increased with curse."));
			PILOTPAST_OPTIONS.Add(GunfigHelpers.WithColor("More Mimics", val5));
			PILOTPAST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Mimic chests spawn an additive 10% of the time.", val5));
		}
		else
		{
			PILOTPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			PILOTPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Pilot's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18003))
		{
			MARINEPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			MARINEPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Normal ammo drop chance."));
			MARINEPAST_OPTIONS.Add(GunfigHelpers.WithColor("Ample Ammo", val3));
			MARINEPAST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Increases ammo drop chance by a multiplicative 125%", val3));
		}
		else
		{
			MARINEPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			MARINEPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Marine's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18002))
		{
			CONVICTPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			CONVICTPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Normal boss Hegemony drops."));
			CONVICTPAST_OPTIONS.Add(GunfigHelpers.Green("Hearty Hegemony"));
			CONVICTPAST_DESCRIPTIONS.Add(GunfigHelpers.Green("Bosses drop 1 additional base Hegemony."));
		}
		else
		{
			CONVICTPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			CONVICTPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Convict's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18004))
		{
			HUNTERPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			HUNTERPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Room rewards are about 9% likely every room clear without getting a reward."));
			HUNTERPAST_OPTIONS.Add(GunfigHelpers.WithColor("Refreshed Rewards", val));
			HUNTERPAST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Incremental room reward chance increased by an additive 2%", val));
		}
		else
		{
			HUNTERPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			HUNTERPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Hunter's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18006))
		{
			BULLETPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			BULLETPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Start with at least 2 blanks per floor."));
			BULLETPAST_OPTIONS.Add(GunfigHelpers.Cyan("Bonus Blank"));
			BULLETPAST_DESCRIPTIONS.Add(GunfigHelpers.Cyan("Start with at least 3 blanks per floor."));
		}
		else
		{
			BULLETPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			BULLETPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Bullet's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)18005))
		{
			ROBOTPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			ROBOTPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Base starting armor."));
			ROBOTPAST_OPTIONS.Add(GunfigHelpers.Blue("Additional Armor"));
			ROBOTPAST_DESCRIPTIONS.Add(GunfigHelpers.Blue("Start with 1 additional point of armor."));
		}
		else
		{
			ROBOTPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			ROBOTPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Robot's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)10504))
		{
			PARADOXPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			PARADOXPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Glitch chest appearance rate of 0.1%"));
			PARADOXPAST_OPTIONS.Add(GunfigHelpers.Magenta("Gather Glitches"));
			PARADOXPAST_DESCRIPTIONS.Add(GunfigHelpers.Magenta("Glitch chest appearance rate increased to 0.6%"));
		}
		else
		{
			PARADOXPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			PARADOXPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Paradox's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)52001))
		{
			SLINGERPAST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SLINGERPAST_DESCRIPTIONS.Add(GunfigHelpers.White("Start with 0 coolness."));
			SLINGERPAST_OPTIONS.Add(GunfigHelpers.WithColor("Create Coolness", val));
			SLINGERPAST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Start with 2 coolness.", val));
		}
		else
		{
			SLINGERPAST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SLINGERPAST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Slinger's Past."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)100000))
		{
			COOPCHEST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			COOPCHEST_DESCRIPTIONS.Add(GunfigHelpers.White("Only spawn one copy of initial chests."));
			COOPCHEST_OPTIONS.Add(GunfigHelpers.WithColor("The Power of Friendship", val13));
			COOPCHEST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Spawn a duplicate chest at the start of Co-op Mode.", val13));
		}
		else
		{
			COOPCHEST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			COOPCHEST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Co-op Run."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)10500))
		{
			STARTCHEST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.White("No starting chest."));
			STARTCHEST_OPTIONS.Add(GunfigHelpers.WithColor("Starter Chest", val));
			STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.White("Start with a D rank chest."));
			if (GameStatsManager.Instance.GetFlag((GungeonFlags)18001) || GameStatsManager.Instance.GetFlag((GungeonFlags)18003) || GameStatsManager.Instance.GetFlag((GungeonFlags)18002) || GameStatsManager.Instance.GetFlag((GungeonFlags)18004) || GameStatsManager.Instance.GetFlag((GungeonFlags)100000) || GameStatsManager.Instance.GetFlag((GungeonFlags)18005))
			{
				STARTCHEST_OPTIONS.Add(GunfigHelpers.WithColor("Evolved Chest", val14));
				STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.White("Start with a C rank chest."));
				if (GameStatsManager.Instance.GetFlag((GungeonFlags)19000))
				{
					STARTCHEST_OPTIONS.Add(GunfigHelpers.WithColor("Final Chest", val15));
					STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Start with a B rank chest.", val15));
				}
				else
				{
					STARTCHEST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
					STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Lich."));
				}
			}
			else
			{
				STARTCHEST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
				STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill any vanilla Past."));
			}
		}
		else
		{
			STARTCHEST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			STARTCHEST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Dragun."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)57503))
		{
			MULTI_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			MULTI_DESCRIPTIONS.Add(GunfigHelpers.White("Your initial chest drops one item."));
			MULTI_OPTIONS.Add(GunfigHelpers.Magenta("Rainbow Blessing"));
			MULTI_DESCRIPTIONS.Add(GunfigHelpers.Magenta("Your initial chest has multiple options."));
		}
		else
		{
			MULTI_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			MULTI_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Rainbow Run."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)35101))
		{
			MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling A/S items after the first are 80%/95%/98.6%/99%"));
			MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence I", val4));
			MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 70%/95%/98.6%/99%"));
			if (GameStatsManager.Instance.GetFlag((GungeonFlags)35102))
			{
				MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence II Dawn of Souls", val5));
				MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 60%/95%/98.6%/99%"));
				if (GameStatsManager.Instance.GetFlag((GungeonFlags)35103))
				{
					MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence III 3D", val6));
					MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 60%/80%/98.6%/99%"));
					if (GameStatsManager.Instance.GetFlag((GungeonFlags)35104))
					{
						MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.Blue("Magnificence IV The After Years"));
						MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 60%/80%/90%/99%"));
						if (GameStatsManager.Instance.GetFlag((GungeonFlags)35105))
						{
							MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence V Advance", val7));
							MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 50%/80%/90%/99%"));
							if (GameStatsManager.Instance.GetFlag((GungeonFlags)35106))
							{
								MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.Red("Magnificence VI Pixel Remaster"));
								MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 50%/70%/90%/99%"));
								if (GameStatsManager.Instance.GetFlag((GungeonFlags)35107))
								{
									MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence VII Remake", val3));
									MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 50%/70%/80%/99%"));
									if (GameStatsManager.Instance.GetFlag((GungeonFlags)35108))
									{
										MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence VIII Remastered", val8));
										MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 50%/70%/80%/90%"));
										if (GameStatsManager.Instance.GetFlag((GungeonFlags)35109))
										{
											MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.Yellow("Magnificence IX Steam Version"));
											MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/70%/80%/90%"));
											if (GameStatsManager.Instance.GetFlag((GungeonFlags)35110))
											{
												MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence X HD", val9));
												MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/60%/80%/90%"));
												if (GameStatsManager.Instance.GetFlag((GungeonFlags)35111))
												{
													MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence XI Online", val4));
													MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/60%/70%/90%"));
													if (GameStatsManager.Instance.GetFlag((GungeonFlags)35112))
													{
														MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence XII The Zodiac Age", val2));
														MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/60%/70%/80%"));
														if (GameStatsManager.Instance.GetFlag((GungeonFlags)35113))
														{
															MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence XIII Lightning Returns", val10));
															MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/50%/70%/80%"));
															if (GameStatsManager.Instance.GetFlag((GungeonFlags)35114))
															{
																MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence XIV A Realm Reborn", val11));
																MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.White("Chances of rerolling after the first are 40%/50%/60%/80%"));
																if (GameStatsManager.Instance.GetFlag((GungeonFlags)35500))
																{
																	MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.WithColor("Magnificence XV Royal Edition", val12));
																	MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Chances of rerolling after the first are 30%/40%/50%/70%", val12));
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			if (!GameStatsManager.Instance.GetFlag((GungeonFlags)35500))
			{
				MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
				if (GameStatsManager.Instance.GetFlag((GungeonFlags)35114))
				{
					MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete the final hunt."));
				}
				else
				{
					MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete the next hunt."));
				}
			}
		}
		else
		{
			MAGNIFICENCE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			MAGNIFICENCE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a hunt."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)59001))
		{
			SEE_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SEE_DESCRIPTIONS.Add(GunfigHelpers.White("Regular enemies have hidden HP."));
			SEE_OPTIONS.Add(GunfigHelpers.Cyan("Stats Studied"));
			SEE_DESCRIPTIONS.Add(GunfigHelpers.Cyan("Regular enemies have visible HP bars."));
		}
		else
		{
			SEE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SEE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Find Ser Manuel in the Gungeon."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)56515))
		{
			CURSE_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			CURSE_DESCRIPTIONS.Add(GunfigHelpers.White("Natural curse accumulation."));
			CURSE_OPTIONS.Add(GunfigHelpers.Green("Curse Cure"));
			CURSE_DESCRIPTIONS.Add(GunfigHelpers.White("Picking up health or armor removes 1 curse point one time per run. (sound plays)"));
			if (GameStatsManager.Instance.GetFlag((GungeonFlags)56525))
			{
				CURSE_OPTIONS.Add(GunfigHelpers.Yellow("Master Misfortune"));
				CURSE_DESCRIPTIONS.Add(GunfigHelpers.Yellow("Picking up health or armor removes 1 curse point two times per run. (sound plays)"));
			}
			else
			{
				CURSE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
				CURSE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Double Challenge Run."));
			}
		}
		else
		{
			CURSE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			CURSE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Challenge Run."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)27518))
		{
			BOSSHIT_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			BOSSHIT_DESCRIPTIONS.Add(GunfigHelpers.White("Lose no-damage rewards during boss fights after taking a hit."));
			BOSSHIT_OPTIONS.Add(GunfigHelpers.Red("Battle Boast"));
			BOSSHIT_DESCRIPTIONS.Add(GunfigHelpers.Red("No-damage boss rewards ignore your first hit. (2 in co-op) \"I meant to do that.\""));
		}
		else
		{
			BOSSHIT_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			BOSSHIT_DESCRIPTIONS.Add(GunfigHelpers.Gray("Receive Gunsling King's reward after completing 10 challenges."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)24540))
		{
			MAP_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			MAP_DESCRIPTIONS.Add(GunfigHelpers.White("Maps have a 0.03% chance to spawn as a room pickup reward."));
			MAP_OPTIONS.Add(GunfigHelpers.Green("Memorized Maps"));
			MAP_DESCRIPTIONS.Add(GunfigHelpers.Green("Maps gain an additional flat 1% chance to spawn per room clear."));
		}
		else
		{
			MAP_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			MAP_DESCRIPTIONS.Add(GunfigHelpers.Gray("Help the Lost Adventurer on all five floors."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)25508))
		{
			MONEY_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			MONEY_DESCRIPTIONS.Add(GunfigHelpers.White("No starting casings."));
			MONEY_OPTIONS.Add(GunfigHelpers.Yellow("Persistent Prizes"));
			MONEY_DESCRIPTIONS.Add(GunfigHelpers.Yellow("Start with 15 casings."));
		}
		else
		{
			MONEY_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			MONEY_DESCRIPTIONS.Add(GunfigHelpers.Gray("Win three of Winchester's games and claim his reward."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)28540))
		{
			SECRET_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SECRET_DESCRIPTIONS.Add(GunfigHelpers.White("Secret Rooms cannot be detected using guns with infinite ammo."));
			SECRET_OPTIONS.Add(GunfigHelpers.WithColor("Frustrated Findings", val3));
			SECRET_DESCRIPTIONS.Add(GunfigHelpers.WithColor("Infinite ammo guns can crack breakable walls.", val3));
		}
		else
		{
			SECRET_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SECRET_DESCRIPTIONS.Add(GunfigHelpers.Gray("Receive the reward for tormenting Ledge Goblin."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)55515))
		{
			SYNERGYCHEST_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SYNERGYCHEST_DESCRIPTIONS.Add(GunfigHelpers.White("Synergy chests have about a 50% chance of success."));
			SYNERGYCHEST_OPTIONS.Add(GunfigHelpers.Red("Blessed Synergy"));
			SYNERGYCHEST_DESCRIPTIONS.Add(GunfigHelpers.Red("Synergy chests have an 80% chance of success."));
		}
		else
		{
			SYNERGYCHEST_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SYNERGYCHEST_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Blessed Run."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)30100))
		{
			SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.White("First and second synergies receive boosted find rates."));
			SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Yellow("AMPLIFIED"));
			SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.White("Second synergy rate is raised further."));
			if (GameStatsManager.Instance.GetFlag((GungeonFlags)30200))
			{
				SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Red("Cadence"));
				SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.White("Synergy Factor is doubled along with previous tiers."));
				if (GameStatsManager.Instance.GetFlag((GungeonFlags)30300))
				{
					SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.WithColor("SYNCHRONY", val6));
					SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.White("Third synergy also receives a boosted rate."));
					if (GameStatsManager.Instance.GetFlag((GungeonFlags)30400))
					{
						SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Cyan("Hatsune Miku"));
						SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.Cyan("Synergy Factor is tripled along with previous tiers."));
					}
					else
					{
						SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
						SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.Gray("Build the last Elevator Shortcut."));
					}
				}
				else
				{
					SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
					SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.Gray("Build the next Elevator Shortcut."));
				}
			}
			else
			{
				SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
				SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.Gray("Build the next Elevator Shortcut."));
			}
		}
		else
		{
			SYNERGYFACTOR_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SYNERGYFACTOR_DESCRIPTIONS.Add(GunfigHelpers.Gray("Build an Elevator Shortcut."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)57003))
		{
			SYNERGYFUSE_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SYNERGYFUSE_DESCRIPTIONS.Add(GunfigHelpers.White("Natural synergy chests always have a fuse."));
			SYNERGYFUSE_OPTIONS.Add(GunfigHelpers.Blue("Faster than Fuses"));
			SYNERGYFUSE_DESCRIPTIONS.Add(GunfigHelpers.Blue("Synergy chests have a regular fuse rate. Carries over to next unlock tier."));
			if (GameStatsManager.Instance.GetPlayerStatValue((TrackedStats)25) >= 500f || GameStatsManager.Instance.GetFlag((GungeonFlags)57010))
			{
				SYNERGYFUSE_OPTIONS.Add(GunfigHelpers.Green("Better than Bonus Stages"));
				SYNERGYFUSE_DESCRIPTIONS.Add(GunfigHelpers.Yellow("Super Tonic is unlocked."));
			}
			else
			{
				SYNERGYFUSE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
				SYNERGYFUSE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Have at least 500 Hegemony and do a double dodge roll (if you feel like it)."));
			}
		}
		else
		{
			SYNERGYFUSE_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SYNERGYFUSE_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Turbo Run."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)19001))
		{
			SYNERGYCHESTSPAWN_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			SYNERGYCHESTSPAWN_DESCRIPTIONS.Add(GunfigHelpers.White("Synergy chests have a 5% chance to spawn."));
			SYNERGYCHESTSPAWN_OPTIONS.Add(GunfigHelpers.Magenta("Synergized Synergy"));
			SYNERGYCHESTSPAWN_DESCRIPTIONS.Add(GunfigHelpers.Magenta("Synergy chests have a 10% chance to spawn."));
		}
		else
		{
			SYNERGYCHESTSPAWN_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			SYNERGYCHESTSPAWN_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Advanced Dragun."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)19700))
		{
			CAP_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			CAP_DESCRIPTIONS.Add(GunfigHelpers.White("Normal Boss DPS Cap."));
			CAP_OPTIONS.Add(GunfigHelpers.Blue("Better Bosses"));
			CAP_DESCRIPTIONS.Add(GunfigHelpers.White("Boss DPS Cap decreased by 25%, taking less damage."));
			CAP_OPTIONS.Add(GunfigHelpers.Red("Bosses Busted"));
			CAP_DESCRIPTIONS.Add(GunfigHelpers.Red("Boss DPS Cap increased by 25%, taking more damage."));
		}
		else
		{
			CAP_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			CAP_DESCRIPTIONS.Add(GunfigHelpers.Gray("Complete a Boss Rush."));
		}
		if (GameStatsManager.Instance.GetFlag((GungeonFlags)20121))
		{
			RAT_OPTIONS.Add(GunfigHelpers.White("Vanilla"));
			RAT_DESCRIPTIONS.Add(GunfigHelpers.White("The Resourceful Rat will steal unattended items."));
			RAT_OPTIONS.Add(GunfigHelpers.WithColor("RATDIE", val3));
			RAT_DESCRIPTIONS.Add(GunfigHelpers.WithColor("The Resourceful Rat will leave your items alone.", val3));
		}
		else
		{
			RAT_OPTIONS.Add(GunfigHelpers.Gray("Locked"));
			RAT_DESCRIPTIONS.Add(GunfigHelpers.Gray("Kill the Resourceful Rat."));
		}
	}

	internal static void Init()
	{
		_Gunfig = Gunfig.Get(GunfigHelpers.Cyan("MetaLimits"));
		BuildOptions();
		_Gunfig.AddScrollBox("The Pilot's Affinity", PILOTPAST_OPTIONS, (string)null, (Action<string, string>)null, PILOTPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Marine's Affinity", MARINEPAST_OPTIONS, (string)null, (Action<string, string>)null, MARINEPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Convict's Affinity", CONVICTPAST_OPTIONS, (string)null, (Action<string, string>)null, CONVICTPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Hunter's Affinity", HUNTERPAST_OPTIONS, (string)null, (Action<string, string>)null, HUNTERPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Bullet's Affinity", BULLETPAST_OPTIONS, (string)null, (Action<string, string>)null, BULLETPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Robot's Affinity", ROBOTPAST_OPTIONS, (string)null, (Action<string, string>)null, ROBOTPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Paradox's Affinity", PARADOXPAST_OPTIONS, (string)null, (Action<string, string>)null, PARADOXPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Slinger's Affinity", SLINGERPAST_OPTIONS, (string)null, (Action<string, string>)null, SLINGERPAST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Cultist's Affinity", COOPCHEST_OPTIONS, (string)null, (Action<string, string>)null, COOPCHEST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Gungeon's Affinity", STARTCHEST_OPTIONS, (string)null, (Action<string, string>)null, STARTCHEST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Bowler's Affinity", MULTI_OPTIONS, (string)null, (Action<string, string>)null, MULTI_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Frifle and Mauser's Affinity", MAGNIFICENCE_OPTIONS, (string)null, (Action<string, string>)null, MAGNIFICENCE_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Ser Manuel's Affinity", SEE_OPTIONS, (string)null, (Action<string, string>)null, SEE_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Daisuke's Affinity", CURSE_OPTIONS, (string)null, (Action<string, string>)null, CURSE_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Gunsling King's Affinity", BOSSHIT_OPTIONS, (string)null, (Action<string, string>)null, BOSSHIT_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Lost Adventurer's Affinity", MAP_OPTIONS, (string)null, (Action<string, string>)null, MAP_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Winchester's Affinity", MONEY_OPTIONS, (string)null, (Action<string, string>)null, MONEY_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Ledge Goblin's Affinity", SECRET_OPTIONS, (string)null, (Action<string, string>)null, SECRET_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Tinker's Affinity", SYNERGYFACTOR_OPTIONS, (string)null, (Action<string, string>)null, SYNERGYFACTOR_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Sorceress's Affinity", SYNERGYCHEST_OPTIONS, (string)null, (Action<string, string>)null, SYNERGYCHEST_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Tonic's Affinity", SYNERGYFUSE_OPTIONS, (string)null, (Action<string, string>)null, SYNERGYFUSE_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Advanced Dragun's Affinity", SYNERGYCHESTSPAWN_OPTIONS, (string)null, (Action<string, string>)null, SYNERGYCHESTSPAWN_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("The Bosses' Affinity", CAP_OPTIONS, (string)null, (Action<string, string>)null, CAP_DESCRIPTIONS, (Update)1);
		_Gunfig.AddScrollBox("Resourceful Rat's Affinity", RAT_OPTIONS, (string)null, (Action<string, string>)null, RAT_DESCRIPTIONS, (Update)1);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("bassforte.etg.metalimits", "MetaLimits", "2.0.2")]
public class MetaLimitsModule : BaseUnityPlugin
{
	[HarmonyPatch(typeof(SharedDungeonSettings), "RandomShouldBecomeMimic")]
	private class SharedDungeonSettingsPatch
	{
		[HarmonyILManipulator]
		private static void RandomShouldBecomeMimicIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchMul(instr),
				(Instruction instr) => ILPatternMatchingExt.MatchAdd(instr)
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("MimicChestRate"));
			}
		}
	}

	[HarmonyPatch(typeof(LootEngine), "DoAmmoClipCheck", new Type[] { typeof(float) })]
	private class DoAmmoClipCheckPatch
	{
		[HarmonyILManipulator]
		private static void GenerateContentsIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0)
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("AmmoMultValue"));
			}
		}
	}

	[HarmonyPatch(typeof(AIActor), "HandleLootPinata")]
	private class HandleLootPinataPatch
	{
		[HarmonyILManipulator]
		private static void LootPinataIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 1)
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("BossHege"));
			}
		}
	}

	[HarmonyPatch(typeof(Dungeon), "InformRoomCleared")]
	private class InformRoomClearedPatch
	{
		private static void Postfix()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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 (MetaConfig._Gunfig.Value("The Hunter's Affinity") == "Refreshed Rewards")
			{
				PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer;
				primaryPlayer.AdditionalChestSpawnChance += 0.02f;
			}
			if (MetaConfig._Gunfig.Value("The Lost Adventurer's Affinity") == "Memorized Maps" && (double)Random.value < 0.01)
			{
				PickupObject byId = PickupObjectDatabase.GetById(137);
				LootEngine.SpawnItem(((Component)byId).gameObject, Vector2.op_Implicit(((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition), Vector2.zero, 0f, true, true, false);
			}
		}
	}

	[HarmonyPatch(typeof(Chest), "Initialize")]
	private class InitializePatch
	{
		[HarmonyILManipulator]
		private static void InitializeIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 0.001f)
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("GlitchChestRate"));
			}
		}
	}

	[HarmonyPatch(typeof(Dungeon), "FloorReached")]
	private class FloorReachedPatch
	{
		private static void Postfix()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Invalid comparison between Unknown and I4
			GameManager instance = GameManager.Instance;
			if ((int)instance.CurrentGameType == 1)
			{
				boastEnabled = 2;
			}
			else
			{
				boastEnabled = 1;
			}
			if ((int)instance.CurrentLevelOverrideState != 5 && (int)instance.CurrentLevelOverrideState != 1 && (int)instance.CurrentLevelOverrideState != 2 && !GameStatsManager.Instance.rainbowRunToggled && startChest)
			{
				if (GameStatsManager.Instance.GetSessionStatValue((TrackedStats)23) < 0.1f)
				{
					SpawnInitialChest();
				}
				if (GameStatsManager.Instance.GetSessionStatValue((TrackedStats)23) < 0.1f && (int)instance.CurrentGameType == 1 && MetaConfig._Gunfig.Value("The Cultist's Affinity") == "The Power of Friendship")
				{
					SpawnInitialChest();
				}
			}
			if (GameStatsManager.Instance.IsRainbowRun && (int)instance.CurrentGameType == 1 && MetaConfig._Gunfig.Value("The Cultist's Affinity") == "The Power of Friendship")
			{
				SpawnCoopRainbow();
			}
		}
	}

	[HarmonyPatch(typeof(MagnificenceConstants), "ModifyQualityByMagnificence")]
	private class MagnificenceConstantsPatch
	{
		[HarmonyILManipulator]
		private static void ModifyQualityByMagnificenceIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(instr, "Clamp01")
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("AssignMagnificenceValue"));
			}
		}
	}

	[HarmonyPatch(typeof(Chest), "SpewContentsOntoGround")]
	public class SpewContentsOntoGroundPatch
	{
		private static bool Prefix(Chest __instance, List<Transform> spawnTransforms)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.IsRainbowChest && (GameStatsManager.Instance.IsRainbowRun || MetaConfig._Gunfig.Value("Bowler's Affinity") == "Rainbow Blessing") && Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)__instance).transform.position) == GameManager.Instance.Dungeon.data.Entrance)
			{
				List<DebrisObject> list = new List<DebrisObject>();
				for (int i = 0; i < __instance.contents.Count; i++)
				{
					List<GameObject> list2 = new List<GameObject>();
					list2.Add(((Component)__instance.contents[i]).gameObject);
					List<DebrisObject> list3 = LootEngine.SpewLoot(list2, spawnTransforms[i].position);
					list.AddRange(list3);
					for (int j = 0; j < list3.Count; j++)
					{
						if (Object.op_Implicit((Object)(object)list3[j]))
						{
							list3[j].PreventFallingInPits = true;
						}
						if (!((Object)(object)((Component)list3[j]).GetComponent<Gun>() != (Object)null) && !((Object)(object)((Component)list3[j]).GetComponent<CurrencyPickup>() != (Object)null) && (Object)(object)((BraveBehaviour)list3[j]).specRigidbody != (Object)null)
						{
							((BraveBehaviour)list3[j]).specRigidbody.CollideWithOthers = false;
							DebrisObject val = list3[j];
							val.OnTouchedGround = (Action<DebrisObject>)Delegate.Combine(val.OnTouchedGround, new Action<DebrisObject>(__instance.BecomeViableItem));
						}
					}
				}
				((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(__instance.HandleRainbowRunLootProcessing(list));
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Chest), "GenerateContents")]
	private class GenerateContentsPatch
	{
		[HarmonyILManipulator]
		private static void GenerateContentsIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(instr, "Clamp")
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("AssignSynergyChestValue"));
			}
		}
	}

	[HarmonyPatch(typeof(SynergyFactorConstants), "GetSynergyFactor")]
	private class SynergyFactorPatch
	{
		[HarmonyILManipulator]
		private static void ModifyGetSynergyFactor(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 3)
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("MultSynergyFactor"));
			}
		}
	}

	[HarmonyPatch(typeof(Chest), "RoomEntered")]
	private class RoomEnteredPatch
	{
		[HarmonyILManipulator]
		private static void GenerateContentsIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 1f)
			}))
			{
				val.Emit(OpCodes.Ldloc_0);
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("SynergyFuseValue"));
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Pop);
			}
		}
	}

	[HarmonyPatch(typeof(FloorRewardData), "GetTargetQualityFromChances")]
	private class GetTargetQualityFromChancesPatch
	{
		private static void Postfix(FloorRewardData __instance)
		{
			if (MetaConfig._Gunfig.Value("Advanced Dragun's Affinity") == "Synergized Synergy")
			{
				GameManager.Instance.RewardManager.GlobalSynerchestChance = 0.1f;
			}
			currMagnificence = __instance.DetermineCurrentMagnificence(false);
		}
	}

	[HarmonyPatch(typeof(HealthHaver), "Start")]
	private class HealthHaverStartPatch
	{
		private static void Postfix(HealthHaver __instance)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			float num = 1f;
			if (MetaConfig._Gunfig.Value("The Bosses' Affinity") == "Better Bosses")
			{
				num = 0.75f;
			}
			if (MetaConfig._Gunfig.Value("The Bosses' Affinity") == "Bosses Busted")
			{
				num = 1.25f;
			}
			GameLevelDefinition lastLoadedLevelDefinition = GameManager.Instance.GetLastLoadedLevelDefinition();
			if (__instance.IsBoss && !__instance.IsSubboss && lastLoadedLevelDefinition.bossDpsCap > 0f)
			{
				float num2 = 1f;
				if ((int)GameManager.Instance.CurrentGameType == 1)
				{
					num2 = (GameManager.Instance.COOP_ENEMY_HEALTH_MULTIPLIER + 2f) / 2f;
				}
				__instance.m_bossDpsCap = lastLoadedLevelDefinition.bossDpsCap * num2 * num;
			}
		}
	}

	[HarmonyPatch(typeof(PlayerController), "Damaged")]
	private class DamagedPlayerPatch
	{
		private static void Postfix(PlayerController __instance)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			RoomHandler currentRoom = __instance.CurrentRoom;
			if (MetaConfig._Gunfig.Value("Gunsling King's Affinity") == "Battle Boast" && boastEnabled > 0 && (int)currentRoom.area.PrototypeRoomCategory == 3 && (int)currentRoom.area.PrototypeRoomBossSubcategory == 0)
			{
				__instance.CurrentRoom.PlayerHasTakenDamageInThisRoom = false;
				boastEnabled--;
				AkSoundEngine.PostEvent("Play_OBJ_power_up_01", ((Component)__instance).gameObject);
			}
		}
	}

	[HarmonyPatch(typeof(Projectile), "OnRigidbodyCollision")]
	private class OnRigidBodyCollisionPatch
	{
		[HarmonyILManipulator]
		private static void GenerateContentsIL(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction instr) => ILPatternMatchingExt.MatchCallvirt<Gun>(instr, "get_InfiniteAmmo")
			}))
			{
				val.Emit(OpCodes.Call, (MethodBase)typeof(MetaLimitsModule).GetMethod("InfiniteAmmoCheck"));
			}
		}
	}

	[HarmonyPatch(typeof(PickupObject), "ShouldBeTakenByRat")]
	private class ShouldBeTakenByRatPatch
	{
		private static bool Prefix(ref bool __result)
		{
			if (MetaConfig._Gunfig.Value("Resourceful Rat's Affinity") == "RATDIE")
			{
				__result = false;
				return false;
			}
			return true;
		}
	}

	public const string GUID = "bassforte.etg.metalimits";

	public const string NAME = "MetaLimits";

	public const string VERSION = "2.0.2";

	public const string TEXT_COLOR = "#00FFFF";

	internal static float currMagnificence = 0f;

	internal static bool configStarted = false;

	internal static int curseCure1 = 0;

	internal static int curseCure2 = 0;

	internal static bool CostsFlag = true;

	public static bool startChest = true;

	internal static int boastEnabled = 1;

	private static GameObject VFXHealthBar = null;

	private static readonly int ScouterId = 821;

	public void Start()
	{
		ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
	}

	public void GMStart(GameManager g)
	{
		Log("MetaLimits v2.0.2 started successfully.");
		MetaConfig.Init();
		InitQoLHooks();
		configStarted = true;
		CustomActions.OnRunStart = (Action<PlayerController, PlayerController, GameMode>)Delegate.Combine(CustomActions.OnRunStart, new Action<PlayerController, PlayerController, GameMode>(initialTonic));
		CustomActions.OnRunStart = (Action<PlayerController, PlayerController, GameMode>)Delegate.Combine(CustomActions.OnRunStart, new Action<PlayerController, PlayerController, GameMode>(initialStats));
		CustomActions.OnAnyPlayerCollectedHealth = (Action<HealthPickup, PlayerController>)Delegate.Combine(CustomActions.OnAnyPlayerCollectedHealth, new Action<HealthPickup, PlayerController>(CureCurse));
	}

	internal void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("bassforte.etg.metalimits");
		val.PatchAll();
	}

	private static void InitQoLHooks()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		new Hook((MethodBase)typeof(PlayerController).GetMethod("Awake", BindingFlags.Instance | BindingFlags.Public), typeof(MetaLimitsModule).GetMethod("OnPlayerAwake", BindingFlags.Static | BindingFlags.NonPublic));
	}

	public static float MimicChestRate(float curr)
	{
		if (MetaConfig._Gunfig.Value("The Pilot's Affinity") == "More Mimics")
		{
			return curr += 0.1f;
		}
		return curr;
	}

	public static float AmmoMultValue(float curr)
	{
		if (MetaConfig._Gunfig.Value("The Marine's Affinity") == "Ample Ammo")
		{
			curr *= 1.25f;
		}
		return curr;
	}

	public static int BossHege(int curr)
	{
		if (MetaConfig._Gunfig.Value("The Convict's Affinity") == "Hearty Hegemony")
		{
			curr++;
		}
		return curr;
	}

	private static void initialStats(PlayerController arg1, PlayerController arg2, GameMode arg3)
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Invalid comparison between Unknown and I4
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Invalid comparison between Unknown and I4
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Expected O, but got Unknown
		//IL_01ff: 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_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Invalid comparison between Unknown and I4
		int num = 0;
		if (MetaConfig._Gunfig.Value("Daisuke's Affinity") == "Curse Cure")
		{
			num = 1;
		}
		if (MetaConfig._Gunfig.Value("Daisuke's Affinity") == "Master Misfortune")
		{
			num = 2;
		}
		curseCure1 = num;
		curseCure2 = num;
		if (MetaConfig._Gunfig.Value("The Slinger's Affinity") == "Create Coolness")
		{
			StatModifier val = new StatModifier();
			val.amount = 2f;
			val.modifyType = (ModifyMethod)0;
			val.statToBoost = (StatType)4;
			GameManager.Instance.PrimaryPlayer.ownerlessStatModifiers.Add(val);
			GameManager.Instance.PrimaryPlayer.stats.RecalculateStats(GameManager.Instance.PrimaryPlayer, false, false);
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				GameManager.Instance.SecondaryPlayer.ownerlessStatModifiers.Add(val);
				GameManager.Instance.SecondaryPlayer.stats.RecalculateStats(GameManager.Instance.SecondaryPlayer, false, false);
			}
		}
		if (MetaConfig._Gunfig.Value("The Robot's Affinity") == "Additional Armor")
		{
			HealthHaver healthHaver = ((BraveBehaviour)GameManager.Instance.PrimaryPlayer).healthHaver;
			healthHaver.Armor += 1f;
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				HealthHaver healthHaver2 = ((BraveBehaviour)GameManager.Instance.SecondaryPlayer).healthHaver;
				healthHaver2.Armor += 1f;
			}
		}
		if (MetaConfig._Gunfig.Value("Winchester's Affinity") == "Persistent Prizes")
		{
			LootEngine.SpawnCurrency(((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition, 15, false);
		}
		if (MetaConfig._Gunfig.Value("The Bullet's Affinity") == "Bonus Blank")
		{
			StatModifier val2 = new StatModifier();
			val2.amount = 1f;
			val2.modifyType = (ModifyMethod)0;
			val2.statToBoost = (StatType)18;
			GameManager.Instance.PrimaryPlayer.ownerlessStatModifiers.Add(val2);
			GameManager.Instance.PrimaryPlayer.stats.RecalculateStats(GameManager.Instance.PrimaryPlayer, false, false);
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				GameManager.Instance.SecondaryPlayer.ownerlessStatModifiers.Add(val2);
				GameManager.Instance.SecondaryPlayer.stats.RecalculateStats(GameManager.Instance.SecondaryPlayer, false, false);
			}
		}
	}

	private static void CureCurse(HealthPickup arg1, PlayerController player)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_00cd: Expected O, but got Unknown
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		if (player.stats.GetStatValue((StatType)14) >= 1f)
		{
			if (curseCure1 > 0 && (Object)(object)player == (Object)(object)GameManager.Instance.PrimaryPlayer)
			{
				curseCure1--;
				StatModifier val = new StatModifier();
				val.amount = -1f;
				val.modifyType = (ModifyMethod)0;
				val.statToBoost = (StatType)14;
				player.ownerlessStatModifiers.Add(val);
				player.stats.RecalculateStats(player, false, false);
				AkSoundEngine.PostEvent("Play_OBJ_power_up_01", ((Component)arg1).gameObject);
			}
			if (curseCure2 > 0 && (Object)(object)player == (Object)(object)GameManager.Instance.SecondaryPlayer)
			{
				curseCure2--;
				StatModifier val2 = new StatModifier();
				val2.amount = -1f;
				val2.modifyType = (ModifyMethod)0;
				val2.statToBoost = (StatType)14;
				player.ownerlessStatModifiers.Add(val2);
				player.stats.RecalculateStats(player, false, false);
				AkSoundEngine.PostEvent("Play_OBJ_power_up_01", ((Component)arg1).gameObject);
			}
		}
	}

	public static float GlitchChestRate(float curr)
	{
		if (MetaConfig._Gunfig.Value("The Paradox's Affinity") == "Gather Glitches")
		{
			return 0.006f;
		}
		return curr;
	}

	public static void initialTonic(PlayerController arg1, PlayerController arg2, GameMode arg3)
	{
		if (MetaConfig._Gunfig.Value("Tonic's Affinity") == "Better than Bonus Stages")
		{
			GameStatsManager.Instance.SetFlag((GungeonFlags)57010, true);
		}
	}

	private static void SpawnCoopRainbow()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		bool flag = default(bool);
		Chest val = Chest.Spawn(GameManager.Instance.RewardManager.A_Chest, GameManager.Instance.Dungeon.data.Entrance.GetCenteredVisibleClearSpot(2, 2, ref flag, false));
		val.m_isMimic = false;
		val.IsRainbowChest = true;
		val.BecomeRainbowChest();
	}

	public static float AssignMagnificenceValue(float curr)
	{
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Vanilla" || MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Locked")
		{
			return curr;
		}
		float num = 0.8f;
		float num2 = 0.95f;
		float num3 = 0.986f;
		float num4 = 0.99f;
		int num5 = 0;
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence I")
		{
			num5 = 1;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence II Dawn of Souls")
		{
			num5 = 2;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence III 3D")
		{
			num5 = 3;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence IV The After Years")
		{
			num5 = 4;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence V Advance")
		{
			num5 = 5;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence VI Pixel Remaster")
		{
			num5 = 6;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence VII Remake")
		{
			num5 = 7;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence VIII Remastered")
		{
			num5 = 8;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence IX Steam Version")
		{
			num5 = 9;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence X HD")
		{
			num5 = 10;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence XI Online")
		{
			num5 = 11;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence XII The Zodiac Age")
		{
			num5 = 12;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence XIII Lightning Returns")
		{
			num5 = 13;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence XIV A Realm Reborn")
		{
			num5 = 14;
		}
		if (MetaConfig._Gunfig.Value("Frifle and Mauser's Affinity") == "Magnificence XV Royal Edition")
		{
			num5 = 15;
		}
		if (num5 >= 1)
		{
			num = 0.7f;
		}
		if (num5 >= 2)
		{
			num = 0.6f;
		}
		if (num5 >= 3)
		{
			num2 = 0.8f;
		}
		if (num5 >= 4)
		{
			num3 = 0.9f;
		}
		if (num5 >= 5)
		{
			num = 0.5f;
		}
		if (num5 >= 6)
		{
			num2 = 0.7f;
		}
		if (num5 >= 7)
		{
			num3 = 0.8f;
		}
		if (num5 >= 8)
		{
			num4 = 0.9f;
		}
		if (num5 >= 9)
		{
			num = 0.4f;
		}
		if (num5 >= 10)
		{
			num2 = 0.6f;
		}
		if (num5 >= 11)
		{
			num3 = 0.7f;
		}
		if (num5 >= 12)
		{
			num4 = 0.8f;
		}
		if (num5 >= 13)
		{
			num2 = 0.5f;
		}
		if (num5 >= 14)
		{
			num3 = 0.6f;
		}
		if (num5 >= 15)
		{
			num = 0.3f;
			num2 = 0.4f;
			num3 = 0.5f;
			num4 = 0.7f;
		}
		if (currMagnificence == 1f)
		{
			return 1f - num;
		}
		if (currMagnificence == 2f)
		{
			return 1f - num2;
		}
		if (currMagnificence == 3f)
		{
			return 1f - num3;
		}
		if (currMagnificence == 4f)
		{
			return 1f - num4;
		}
		return 1f - (1f - num4) / 2f;
	}

	private static void SpawnInitialChest()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		Chest val = null;
		bool flag = default(bool);
		if (MetaConfig._Gunfig.Value("The Gungeon's Affinity") == "Starter Chest")
		{
			val = Chest.Spawn(GameManager.Instance.RewardManager.D_Chest, GameManager.Instance.Dungeon.data.Entrance.GetCenteredVisibleClearSpot(2, 2, ref flag, false));
		}
		if (MetaConfig._Gunfig.Value("The Gungeon's Affinity") == "Evolved Chest")
		{
			val = Chest.Spawn(GameManager.Instance.RewardManager.C_Chest, GameManager.Instance.Dungeon.data.Entrance.GetCenteredVisibleClearSpot(2, 2, ref flag, false));
		}
		if (MetaConfig._Gunfig.Value("The Gungeon's Affinity") == "Final Chest")
		{
			val = Chest.Spawn(GameManager.Instance.RewardManager.B_Chest, GameManager.Instance.Dungeon.data.Entrance.GetCenteredVisibleClearSpot(2, 2, ref flag, false));
		}
		if ((Object)(object)val != (Object)null)
		{
			val.lootTable.Common_Chance = 0f;
			val.m_isMimic = false;
			val.IsLocked = false;
			if (MetaConfig._Gunfig.Value("Bowler's Affinity") == "Rainbow Blessing")
			{
				BecomeBlessedChest(val);
			}
		}
	}

	public static void BecomeBlessedChest(Chest chest)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		chest.IsRainbowChest = true;
		chest.lootTable.canDropMultipleItems = true;
		chest.lootTable.multipleItemDropChances = new WeightedIntCollection();
		chest.lootTable.multipleItemDropChances.elements = (WeightedInt[])(object)new WeightedInt[1];
		chest.lootTable.overrideItemLootTables = new List<GenericLootTable>();
		chest.lootTable.lootTable = GameManager.Instance.RewardManager.GunsLootTable;
		chest.lootTable.overrideItemLootTables.Add(GameManager.Instance.RewardManager.GunsLootTable);
		chest.lootTable.overrideItemLootTables.Add(GameManager.Instance.RewardManager.ItemsLootTable);
		chest.lootTable.overrideItemLootTables.Add(GameManager.Instance.RewardManager.GunsLootTable);
		WeightedInt val = new WeightedInt();
		val.weight = 1f;
		val.additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0];
		chest.lootTable.multipleItemDropChances.elements[0] = val;
		chest.lootTable.onlyOneGunCanDrop = false;
		((BraveBehaviour)chest).sprite.usesOverrideMaterial = true;
		tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)chest).spriteAnimator.GetClipByName(chest.spawnAnimName);
		((BraveBehaviour)chest).sprite.SetSprite(clipByName.frames[clipByName.frames.Length - 1].spriteId);
		((BraveBehaviour)((BraveBehaviour)chest).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/RainbowChestShader");
		if (chest.spawnAnimName.StartsWith("wood_"))
		{
			((BraveBehaviour)((BraveBehaviour)chest).sprite).renderer.material.SetFloat("_HueTestValue", -4f);
			val.value = 3;
		}
		if (chest.spawnAnimName.StartsWith("silver_"))
		{
			((BraveBehaviour)((BraveBehaviour)chest).sprite).renderer.material.SetFloat("_HueTestValue", -0.2f);
			chest.lootTable.C_Chance = 0.75f;
			chest.lootTable.D_Chance = 0.25f;
			val.value = 4;
			chest.lootTable.overrideItemLootTables.Add(GameManager.Instance.RewardManager.ItemsLootTable);
		}
		if (chest.spawnAnimName.StartsWith("green_"))
		{
			((BraveBehaviour)((BraveBehaviour)chest).sprite).renderer.material.SetFloat("_HueTestValue", -0.6f);
			chest.lootTable.B_Chance = 0.6f;
			chest.lootTable.C_Chance = 0.2f;
			chest.lootTable.D_Chance = 0.2f;
			val.value = 5;
			chest.lootTable.overrideItemLootTables.Add(GameManager.Instance.RewardManager.GunsLootTable);
		}
	}

	public static float AssignSynergyChestValue(float curr)
	{
		if (MetaConfig._Gunfig.Value("Sorceress's Affinity") == "Blessed Synergy")
		{
			return 0.2f;
		}
		return curr;
	}

	public static float MultSynergyFactor(float curr)
	{
		if (MetaConfig._Gunfig.Value("Tinker's Affinity") == "Vanilla")
		{
			return curr;
		}
		int numberOfSynergiesEncounteredThisRun = GameStatsManager.Instance.GetNumberOfSynergiesEncounteredThisRun();
		float num = 1f;
		curr -= 1f;
		int num2 = 0;
		if (MetaConfig._Gunfig.Value("Tinker's Affinity") == "Cadence")
		{
			num2 = 1;
		}
		if (MetaConfig._Gunfig.Value("Tinker's Affinity") == "SYNCHRONY")
		{
			num2 = 2;
		}
		if (MetaConfig._Gunfig.Value("Tinker's Affinity") == "Hatsune Miku")
		{
			num2 = 3;
		}
		if (numberOfSynergiesEncounteredThisRun == 1)
		{
			num = 5f;
		}
		if (numberOfSynergiesEncounteredThisRun == 2 && num2 > 1)
		{
			num = 15f;
		}
		if (num2 == 1 || num2 == 2)
		{
			num *= 2f;
		}
		if (num2 == 3)
		{
			num *= 3f;
		}
		return 1f + curr * num;
	}

	public static float SynergyFuseValue(float curr)
	{
		if (MetaConfig._Gunfig.Value("Tonic's Affinity") == "Faster than Fuses" || MetaConfig._Gunfig.Value("Tonic's Affinity") == "Better than Bonus Stages")
		{
			return curr;
		}
		return 1f;
	}

	private static void OnPlayerAwake(Action<PlayerController> orig, PlayerController player)
	{
		orig(player);
		player.OnAnyEnemyReceivedDamage = (Action<float, bool, HealthHaver>)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action<float, bool, HealthHaver>(DoHealthEffects));
	}

	private static void DoHealthEffects(float damageAmount, bool fatal, HealthHaver target)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Invalid comparison between Unknown and I4
		//IL_0073: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		if (GameManager.Instance.PrimaryPlayer.HasPassiveItem(ScouterId) || ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Instance.SecondaryPlayer.HasPassiveItem(ScouterId)))
		{
			return;
		}
		if (VFXHealthBar == null)
		{
			PickupObject byId = PickupObjectDatabase.GetById(ScouterId);
			VFXHealthBar = ((RatchetScouterItem)((byId is RatchetScouterItem) ? byId : null)).VFXHealthBar;
		}
		Vector3 position = ((BraveBehaviour)target).transform.position;
		float num = 1f;
		SpeculativeRigidbody component = ((Component)target).GetComponent<SpeculativeRigidbody>();
		if (component != null)
		{
			position = Vector2Extensions.ToVector3ZisY(component.UnitCenter, 0f);
			num = position.y - component.UnitBottomCenter.y;
			if (MetaConfig._Gunfig.Value("Ser Manuel's Affinity") == "Stats Studied" && Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) && !((BraveBehaviour)component).healthHaver.HasHealthBar && !((BraveBehaviour)component).healthHaver.HasRatchetHealthBar && !((BraveBehaviour)component).healthHaver.IsBoss)
			{
				((BraveBehaviour)component).healthHaver.HasRatchetHealthBar = true;
				Object.Instantiate<GameObject>(VFXHealthBar).GetComponent<SimpleHealthBarController>().Initialize(component, ((BraveBehaviour)component).healthHaver);
			}
			return;
		}
		AIActor component2 = ((Component)target).GetComponent<AIActor>();
		if (component2 != null)
		{
			position = Vector2Extensions.ToVector3ZisY(((GameActor)component2).CenterPosition, 0f);
			if (Object.op_Implicit((Object)(object)((BraveBehaviour)component2).sprite))
			{
				num = position.y - ((BraveBehaviour)component2).sprite.WorldBottomCenter.y;
			}
		}
	}

	public static bool InfiniteAmmoCheck(bool curr)
	{
		if (MetaConfig._Gunfig.Value("Ledge Goblin's Affinity") == "Frustrated Findings")
		{
			return false;
		}
		return curr;
	}

	public static void Log(string text, string color = "#00FFFF")
	{
		ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
	}
}