Decompiled source of Jolly Coop v1.3.0

JollyCoop.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Dungeonator;
using Gunfiguration;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
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("JollyCoop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JollyCoop")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("825bc8e2-2faf-496c-803c-3f3e31eba1a0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace JollyCoop;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kleirof.etg.jollycoop", "Jolly Coop", "1.3.0")]
public class JollyCoopModule : BaseUnityPlugin
{
	public const string GUID = "kleirof.etg.jollycoop";

	public const string NAME = "Jolly Coop";

	public const string VERSION = "1.3.0";

	public const string TEXT_COLOR = "#00CED1";

	public void Start()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
		Harmony val = new Harmony("kleirof.etg.jollycoop");
		val.PatchAll();
	}

	public void GMStart(GameManager g)
	{
		Log("Jolly Coop v1.3.0 started successfully.", "#00CED1");
		JollyCoopManager.InitializeGunfig();
	}

	public static void Log(string text, string color = "FFFFFF")
	{
		ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
	}
}
internal class JollyCoopManager
{
	internal static Gunfig gunfig = null;

	internal const string jollyCoopOnStr = "Jolly Coop On";

	internal const string itemDistribLockStr = "Item Distribution Lock";

	internal const string chestItemDoubledStr = "Chest Item Doubled";

	internal const string roomItemDropIncStr = "Room Item Drop Increace";

	internal const string masterDoubledStr = "Master Doubled";

	internal const string normalBossRewardDoubledStr = "Normal Boss Reward Doubled";

	internal const string extraEnemyHealthStr = "Extra Enemy Health";

	private const string m_onStr = "<color=#7FFFD4>on</color>";

	private const string m_offStr = "<color=#DAA520>off</color>";

	private static string[] extraEnemyHealthStrings = new string[4] { "<color=#8B4513>0</color>", "<color=#6495ED>0.1</color>", "<color=#3CB371>0.2</color>", "<color=#FF0000>0.3</color>" };

	private static int extraEnemyHealthIndex;

	private static List<string> extraEnemyHealthStringList = new List<string> { "@8B45130", "@6495ED0.1", "@3CB3710.2", "@FF00000.3" };

	public static float EnemyHealth
	{
		get
		{
			if (!gunfig.Enabled("Jolly Coop On"))
			{
				return 1.4f;
			}
			float num = 1.4f;
			if (gunfig.Enabled("Chest Item Doubled"))
			{
				num += 0.1f;
			}
			if (gunfig.Enabled("Room Item Drop Increace"))
			{
				num += 0.075f;
			}
			if (gunfig.Enabled("Master Doubled"))
			{
				num += 0.1f;
			}
			if (gunfig.Enabled("Normal Boss Reward Doubled"))
			{
				num += 0.025f;
			}
			return num + (float)extraEnemyHealthIndex * 0.1f;
		}
	}

	public static float EnemyProjectileSpeed
	{
		get
		{
			if (!gunfig.Enabled("Jolly Coop On"))
			{
				return 0.95f;
			}
			float num = 0.95f;
			if (gunfig.Enabled("Chest Item Doubled"))
			{
				num += 0.02f;
			}
			if (gunfig.Enabled("Room Item Drop Increace"))
			{
				num += 0.005f;
			}
			if (gunfig.Enabled("Master Doubled"))
			{
				num += 0.02f;
			}
			if (gunfig.Enabled("Normal Boss Reward Doubled"))
			{
				num += 0.005f;
			}
			return num;
		}
	}

	public static float ItemRecyclingPrice
	{
		get
		{
			if (!gunfig.Enabled("Jolly Coop On"))
			{
				return 1f;
			}
			float num = 1f;
			if (gunfig.Enabled("Chest Item Doubled"))
			{
				num *= 0.6f;
			}
			return num;
		}
	}

	internal static void InitializeGunfig()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Invalid comparison between Unknown and I4
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Invalid comparison between Unknown and I4
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Invalid comparison between Unknown and I4
		//IL_00b5: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Invalid comparison between Unknown and I4
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Invalid comparison between Unknown and I4
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Invalid comparison between Unknown and I4
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Invalid comparison between Unknown and I4
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Invalid comparison between Unknown and I4
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Invalid comparison between Unknown and I4
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Invalid comparison between Unknown and I4
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Invalid comparison between Unknown and I4
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Invalid comparison between Unknown and I4
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Invalid comparison between Unknown and I4
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Invalid comparison between Unknown and I4
		//IL_0352: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Invalid comparison between Unknown and I4
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Invalid comparison between Unknown and I4
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d1: Invalid comparison between Unknown and I4
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0408: Invalid comparison between Unknown and I4
		//IL_0420: Unknown result type (might be due to invalid IL or missing references)
		//IL_040f: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Invalid comparison between Unknown and I4
		//IL_0459: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_0480: Invalid comparison between Unknown and I4
		//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Invalid comparison between Unknown and I4
		//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04be: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Invalid comparison between Unknown and I4
		gunfig = Gunfig.Get(GunfigHelpers.WithColor("Jolly Coop", Color.white));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 ×= (1.4 + 以下所有之和)", Color.green) : GunfigHelpers.WithColor("Enemy Health ×= (1.4 + sum of all below)", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("(1.4是合作模式原本的数值)", Color.green) : GunfigHelpers.WithColor("(1.4 is the original value in coop)", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 ×= (0.95 + 以下所有之和)", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed ×= (0.95 + sum of all below)", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("(0.95是合作模式原本的数值)", Color.green) : GunfigHelpers.WithColor("(0.95 is the original value in coop)", Color.green));
		gunfig.AddToggle("Jolly Coop On", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "开启Jolly Coop" : "Jolly Coop On", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("无负面作用", Color.green) : GunfigHelpers.WithColor("No negative effects", Color.green));
		gunfig.AddToggle("Item Distribution Lock", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "物品分发锁" : "Item Distribution Lock", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.1", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.1", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.02", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.02", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("物品回收价格 ×= 0.6", Color.green) : GunfigHelpers.WithColor("Item Recycling Price ×= 0.6", Color.green));
		gunfig.AddToggle("Chest Item Doubled", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "箱子双倍物品" : "Chest Item Doubled", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.075", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.075", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.005", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.005", Color.green));
		gunfig.AddToggle("Room Item Drop Increace", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "房间掉落增加" : "Room Item Drop Increace", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.1", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.1", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.02", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.02", Color.green));
		gunfig.AddToggle("Master Doubled", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "胜者之弹双倍" : "Master Doubled", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人血量 += 0.025", Color.green) : GunfigHelpers.WithColor("Enemy Health += 0.025", Color.green));
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("敌人弹速 += 0.005", Color.green) : GunfigHelpers.WithColor("Enemy Projectile Speed += 0.005", Color.green));
		gunfig.AddToggle("Normal Boss Reward Doubled", true, ((int)GameManager.Options.CurrentLanguage == 11) ? "Boss普通奖励双倍" : "Normal Boss Reward Doubled", (Action<string, string>)null, (Update)1);
		gunfig.AddLabel(" ");
		gunfig.AddLabel(((int)GameManager.Options.CurrentLanguage == 11) ? GunfigHelpers.WithColor("对我们来说还是太简单了!", Color.red) : GunfigHelpers.WithColor("Still too easy for us!", Color.red));
		Gunfig obj = gunfig;
		string text = (((int)GameManager.Options.CurrentLanguage == 11) ? "额外敌人血量增量" : "Extra Enemy Health");
		obj.AddScrollBox("Extra Enemy Health", extraEnemyHealthStringList, text, (Action<string, string>)delegate(string optionKey, string optionValue)
		{
			UpdateExtraEnemyHealth(optionValue);
		}, (List<string>)null, (Update)1);
		UpdateExtraEnemyHealth(null);
		ETGModConsole.Log((object)"<color=#FFFACD>Enter 'jollycoop' to see Jolly Coop status. Switch options in Mod Config.</color>", false);
		ListStatus();
		ETGModConsole.Commands.AddGroup("jollycoop", (Action<string[]>)delegate
		{
			ListStatus();
		});
		ETGModConsole.Commands.GetGroup("jollycoop").AddUnit("status", (Action<string[]>)delegate
		{
			ListStatus();
		});
	}

	private static void ListStatus()
	{
		ETGModConsole.Log((object)("Jolly Coop is " + (gunfig.Enabled("Jolly Coop On") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Item Distribution Lock " + (gunfig.Enabled("Item Distribution Lock") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Chest Item Doubled " + (gunfig.Enabled("Chest Item Doubled") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Room Item Drop Increase " + (gunfig.Enabled("Room Item Drop Increace") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Master Doubled " + (gunfig.Enabled("Master Doubled") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Normal Boss Reward Doubled " + (gunfig.Enabled("Normal Boss Reward Doubled") ? "<color=#7FFFD4>on</color>" : "<color=#DAA520>off</color>")), false);
		ETGModConsole.Log((object)("   Extra Enemy Health " + extraEnemyHealthStrings[extraEnemyHealthIndex]), false);
		ETGModConsole.Log((object)"<color=#00CED1>In coop:</color>", false);
		ETGModConsole.Log((object)("<color=#FFFACD> -- Enemy Health multiplies </color>" + EnemyHealth.ToString("F3")), false);
		ETGModConsole.Log((object)("<color=#FFFACD> -- Enemy Projectile Speed multiplies </color>" + EnemyProjectileSpeed.ToString("F3")), false);
		ETGModConsole.Log((object)("<color=#FFFACD> -- Item Recycling Price multiplies </color>" + ItemRecyclingPrice.ToString("F3")), false);
	}

	private static void UpdateExtraEnemyHealth(string value)
	{
		if (value == null)
		{
			value = gunfig.Value("Extra Enemy Health");
		}
		switch (value)
		{
		case "@8B45130":
			extraEnemyHealthIndex = 0;
			break;
		case "@6495ED0.1":
			extraEnemyHealthIndex = 1;
			break;
		case "@3CB3710.2":
			extraEnemyHealthIndex = 2;
			break;
		case "@FF00000.3":
			extraEnemyHealthIndex = 3;
			break;
		case "0":
			extraEnemyHealthIndex = 0;
			break;
		case "0.1":
			extraEnemyHealthIndex = 1;
			break;
		case "0.2":
			extraEnemyHealthIndex = 2;
			break;
		case "0.3":
			extraEnemyHealthIndex = 3;
			break;
		default:
			extraEnemyHealthIndex = 0;
			break;
		}
	}

	public static PlayerItem GetRandomActiveOfQualities(Random usedRandom, List<int> excludedIDs, params ItemQuality[] qualities)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Invalid comparison between Unknown and I4
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Invalid comparison between Unknown and I4
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		List<PlayerItem> list = new List<PlayerItem>();
		for (int i = 0; i < ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects.Count; i++)
		{
			if ((Object)(object)((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i] != (Object)null && ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i] is PlayerItem && (int)((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i].quality != -100 && (int)((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i].quality != -50 && !(((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i] is ContentTeaserItem) && Array.IndexOf(qualities, ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i].quality) != -1 && !excludedIDs.Contains(((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i].PickupObjectId))
			{
				EncounterTrackable component = ((Component)((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i]).GetComponent<EncounterTrackable>();
				if (Object.op_Implicit((Object)(object)component) && component.PrerequisitesMet())
				{
					PickupObject obj = ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i];
					list.Add((PlayerItem)(object)((obj is PlayerItem) ? obj : null));
				}
			}
		}
		int num = usedRandom.Next(list.Count);
		if (num < 0 || num >= list.Count)
		{
			return null;
		}
		return list[num];
	}

	public static void AddItem(Chest c)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Invalid comparison between Unknown and I4
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Invalid comparison between Unknown and I4
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Invalid comparison between Unknown and I4
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Invalid comparison between Unknown and I4
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		if (!gunfig.Enabled("Jolly Coop On") || !gunfig.Enabled("Chest Item Doubled") || (int)GameManager.Instance.CurrentGameType != 1)
		{
			return;
		}
		int count = c.contents.Count;
		for (int i = 0; i < count; i++)
		{
			if ((int)c.contents[i].quality == 4 || (int)c.contents[i].quality == 3 || (int)c.contents[i].quality == 2 || (int)c.contents[i].quality == 1 || (int)c.contents[i].quality == 5)
			{
				RewardManager rewardManager = GameManager.Instance.RewardManager;
				GenericLootTable val = ((c.contents[i] is Gun) ? rewardManager.GunsLootTable : rewardManager.ItemsLootTable);
				PickupObject component = rewardManager.GetItemForPlayer(GameManager.Instance.SecondaryPlayer, val, c.contents[i].quality, (List<GameObject>)null, false, (Random)null, false, (List<GameObject>)null, false, (RewardSource)0).GetComponent<PickupObject>();
				c.contents.Add(component);
				JollyCoopPatches.playerOneExclusiveLoots.Add(component);
				JollyCoopPatches.playerTwoExclusiveLoots.Add(c.contents[i]);
			}
			else if (c.contents[i] is PassiveItem)
			{
				PickupObject component = Object.Instantiate<PickupObject>(c.contents[i]);
				c.contents.Add(component);
				JollyCoopPatches.playerOneExclusiveLoots.Add(component);
				JollyCoopPatches.playerTwoExclusiveLoots.Add(c.contents[i]);
			}
			else if (!(c.contents[i] is KeyBulletPickup))
			{
				c.contents.Add(c.contents[i]);
			}
		}
	}

	public static IEnumerator SpawnChest(Vector3 v, RoomHandler room)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		yield return (object)new WaitForSeconds(0.45f);
		Chest c = Chest.Spawn(GameManager.Instance.RewardManager.A_Chest, v, room, true);
		c.IsRainbowChest = true;
		c.BecomeRainbowChest();
		JollyCoopPatches.playerOneExclusiveChests.Add(c);
	}
}
public static class JollyCoopPatches
{
	[HarmonyPatch(typeof(Chest), "Open")]
	public class OpenPatchClass
	{
		[HarmonyILManipulator]
		public static void OpenPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<PlayerController>(x, "TriggerItemAcquisition")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<OpenPatchClass>("OpenPatchCall");
			}
		}

		private static void OpenPatchCall(Chest self)
		{
			if (!self.IsRainbowChest)
			{
				JollyCoopManager.AddItem(self);
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class HandleSynergyGambleChestPatchClass
	{
		[HarmonyILManipulator]
		public static void HandleSynergyGambleChestPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<PlayerController>(x, "TriggerItemAcquisition")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<HandleSynergyGambleChestPatchClass>("HandleSynergyGambleChestPatchCall");
			}
		}

		private static void HandleSynergyGambleChestPatchCall(object selfObject)
		{
			JollyCoopManager.AddItem(GetFieldInEnumerator<Chest>(selfObject, "this"));
		}
	}

	[HarmonyPatch(typeof(Chest), "OnBroken")]
	public class OnBrokenPatchClass
	{
		[HarmonyILManipulator]
		public static void OnBrokenPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			for (int i = 0; i < 6; i++)
			{
				if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Chest>(x, "PresentItem")
				}))
				{
					val.Emit(OpCodes.Ldarg_0);
					val.EmitCall<JollyCoopManager>("AddItem");
				}
				val.Index += 3;
			}
		}
	}

	[HarmonyPatch(typeof(RoomHandler), "HandleRoomClearReward")]
	public class HandleRoomClearRewardPatchClass
	{
		[HarmonyILManipulator]
		public static void HandleRoomClearRewardPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Ble_Un)
			}))
			{
				val.EmitCall<HandleRoomClearRewardPatchClass>("HandleRoomClearRewardPatchCall");
			}
		}

		private static float HandleRoomClearRewardPatchCall(float orig)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Room Item Drop Increace") && (int)GameManager.Instance.CurrentGameType == 1)
			{
				return orig * 1.5f;
			}
			return orig;
		}
	}

	[HarmonyPatch(typeof(RoomHandler), "HandleBossClearReward")]
	public class HandleBossClearRewardPatchClass
	{
		[HarmonyILManipulator]
		public static void HandleBossClearRewardPatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			ILCursor crs = new ILCursor(ctx);
			if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Brfalse)
			}), 7))
			{
				crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_1");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2)
			}), 5))
			{
				crs.Emit(OpCodes.Ldloca_S, (byte)2);
				crs.Emit(OpCodes.Ldloc_S, (byte)12);
				crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_2");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<CellData>(x, "isOccupied")
			}), 3))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.Emit(OpCodes.Ldloca_S, (byte)2);
				crs.Emit(OpCodes.Ldloc_S, (byte)10);
				crs.Emit(OpCodes.Ldloc_S, (byte)13);
				crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_3");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.Match(x, OpCodes.Brfalse)
			}), 12))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.Emit(OpCodes.Ldloca_S, (byte)2);
				crs.Emit(OpCodes.Ldloc_S, (byte)10);
				crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_4");
			}
			crs.Index = 0;
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStfld<RewardPedestal>(x, "MimicGuid")
			}))
			{
				crs.Emit(OpCodes.Ldloc_S, (byte)18);
				crs.EmitCall<HandleBossClearRewardPatchClass>("HandleBossClearRewardPatchCall_5");
			}
		}

		private static bool HandleBossClearRewardPatchCall_1(bool orig)
		{
			return true;
		}

		private static void HandleBossClearRewardPatchCall_2(ref IntVector2 orig, bool flag2)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			orig -= IntVector2.Left;
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
			{
				orig += IntVector2.Left;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Master Doubled") && GameManager.Instance.Dungeon.BossMasteryTokenItemId >= 0 && (int)GameManager.Instance.CurrentGameType == 1)
			{
				if (!playerOneHasTakenDamageInThisRoom && !playerOneHasGivenMasteryToken)
				{
					playerOneHasGivenMasteryToken = true;
					for (int i = 0; i < playerOneSpawnMasterFlags.Length; i++)
					{
						playerOneSpawnMasterFlags[i] = true;
					}
					orig += IntVector2.Left;
				}
				if (!playerTwoHasTakenDamageInThisRoom && !playerTwoHasGivenMasteryToken)
				{
					playerTwoHasGivenMasteryToken = true;
					for (int j = 0; j < playerTwoSpawnMasterFlags.Length; j++)
					{
						playerTwoSpawnMasterFlags[j] = true;
					}
					orig += IntVector2.Left;
				}
			}
			else if (flag2)
			{
				orig += IntVector2.Left;
			}
		}

		private static void HandleBossClearRewardPatchCall_3(RoomHandler self, ref IntVector2 intVector, RewardPedestal component, RewardPedestal rewardPedestal)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
			{
				Dungeon dungeon = GameManager.Instance.Dungeon;
				intVector += new IntVector2(2, 0);
				RewardPedestal val = RewardPedestal.Spawn(component, intVector, self);
				val.SpawnsTertiarySet = false;
				val.IsBossRewardPedestal = true;
				val.lootTable.lootTable = self.OverrideBossRewardTable;
				val.RegisterChestOnMinimap(self);
				dungeon.data[intVector].isOccupied = true;
				dungeon.data[intVector + IntVector2.Right].isOccupied = true;
				dungeon.data[intVector + IntVector2.Up].isOccupied = true;
				dungeon.data[intVector + IntVector2.One].isOccupied = true;
				if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
				{
					playerTwoExclusivePedestals.Add(rewardPedestal);
					playerOneExclusivePedestals.Add(val);
				}
			}
		}

		private static bool HandleBossClearRewardPatchCall_4(bool orig, RoomHandler self, ref IntVector2 intVector, RewardPedestal component)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			if ((int)GameManager.Instance.CurrentGameType == 0)
			{
				return orig;
			}
			if (!JollyCoopManager.gunfig.Enabled("Jolly Coop On") || !JollyCoopManager.gunfig.Enabled("Master Doubled"))
			{
				return orig;
			}
			if (playerTwoSpawnMasterFlags[0])
			{
				playerTwoSpawnMasterFlags[0] = false;
				Dungeon dungeon = GameManager.Instance.Dungeon;
				if (!playerOneHasTakenDamageInThisRoom)
				{
					intVector += new IntVector2(4, 0);
				}
				else
				{
					GameStatsManager.Instance.RegisterStatChange((TrackedStats)94, 1f);
					PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer;
					int masteryTokensCollectedThisRun = primaryPlayer.MasteryTokensCollectedThisRun;
					primaryPlayer.MasteryTokensCollectedThisRun = masteryTokensCollectedThisRun + 1;
					dungeon.HasGivenMasteryToken = true;
					intVector += new IntVector2(2, 0);
				}
				RewardPedestal val = RewardPedestal.Spawn(component, intVector, self);
				dungeon.data[intVector].isOccupied = true;
				dungeon.data[intVector + IntVector2.Right].isOccupied = true;
				dungeon.data[intVector + IntVector2.Up].isOccupied = true;
				dungeon.data[intVector + IntVector2.One].isOccupied = true;
				val.SpawnsTertiarySet = false;
				val.contents = PickupObjectDatabase.GetById(dungeon.BossMasteryTokenItemId);
				val.MimicGuid = null;
				if (!playerOneHasTakenDamageInThisRoom)
				{
					intVector -= new IntVector2(4, 0);
				}
				if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
				{
					playerOneExclusivePedestals.Add(val);
				}
			}
			return playerOneSpawnMasterFlags[0];
		}

		private static void HandleBossClearRewardPatchCall_5(RewardPedestal rewardPedestal3)
		{
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On"))
			{
				playerOneSpawnMasterFlags[0] = false;
				if (JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
				{
					playerTwoExclusivePedestals.Add(rewardPedestal3);
				}
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class SpawnBehavior_CRPatchClass
	{
		[HarmonyILManipulator]
		public static void SpawnBehavior_CRPatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			ILCursor crs = new ILCursor(ctx);
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, -3f)
			}))
			{
				crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_1");
			}
			crs.Index = 0;
			if (crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 2f)
			}))
			{
				crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_2");
			}
			crs.Index = 0;
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f)
			}), 4))
			{
				crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_3");
			}
			crs.Index = 0;
			if (crs.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall<RewardPedestal>(x, "DetermineContents")
			}))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<SpawnBehavior_CRPatchClass>("SpawnBehavior_CRPatchCall_4");
			}
		}

		private static float SpawnBehavior_CRPatchCall_1(float orig)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			orig = -4f;
			int num = 0;
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
			{
				num++;
			}
			if (playerOneSpawnMasterFlags[1])
			{
				playerOneSpawnMasterFlags[1] = false;
				num++;
			}
			if (playerTwoSpawnMasterFlags[1])
			{
				playerTwoSpawnMasterFlags[1] = false;
				num++;
			}
			if (num != 3)
			{
				orig += 1f;
			}
			return orig;
		}

		private static float SpawnBehavior_CRPatchCall_2(float orig)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			orig = 1f;
			int num = 0;
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
			{
				num++;
			}
			if (playerOneSpawnMasterFlags[2])
			{
				playerOneSpawnMasterFlags[2] = false;
				num++;
			}
			if (playerTwoSpawnMasterFlags[2])
			{
				playerTwoSpawnMasterFlags[2] = false;
				num++;
			}
			orig += (float)num * 2f;
			if (num != 3)
			{
				orig += 1f;
			}
			return orig;
		}

		private static float SpawnBehavior_CRPatchCall_3(float orig)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			int num = 0;
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && (int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Normal Boss Reward Doubled"))
			{
				num++;
			}
			if (playerOneSpawnMasterFlags[3])
			{
				playerOneSpawnMasterFlags[3] = false;
				num++;
			}
			if (playerTwoSpawnMasterFlags[3])
			{
				playerTwoSpawnMasterFlags[3] = false;
				num++;
			}
			orig += (float)num * 1f;
			return orig;
		}

		private static PlayerController SpawnBehavior_CRPatchCall_4(PlayerController orig, object selfObject)
		{
			if (playerOneExclusivePedestals.Contains(GetFieldInEnumerator<RewardPedestal>(selfObject, "this")))
			{
				return GameManager.Instance.SecondaryPlayer;
			}
			return orig;
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class RegeneratePatchClass
	{
		[HarmonyILManipulator]
		public static void RegeneratePatch(ILContext ctx)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			MethodInfo methodInfo = AccessTools.Method(typeof(Vector3?), "get_Value", (Type[])null, (Type[])null);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)methodInfo)
			}))
			{
				val.EmitCall<RegeneratePatchClass>("RegeneratePatchCall_1");
			}
			val.Index = 0;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Chest>(x, "BecomeRainbowChest")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldloc, 10);
				val.Emit(OpCodes.Ldloc, 15);
				val.EmitCall<RegeneratePatchClass>("RegeneratePatchCall_2");
			}
		}

		private static Vector3 RegeneratePatchCall_1(Vector3 orig)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
			{
				return orig - new Vector3(4f, 0f, 0f);
			}
			return orig;
		}

		private static void RegeneratePatchCall_2(object selfObject, Vector3? vector, Chest firstChest)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled") && (int)GameManager.Instance.CurrentGameType == 1)
			{
				playerTwoExclusiveChests.Add(firstChest);
				Vector3? val = vector;
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(4f, 0f, 0f);
				Vector3? val3 = (val.HasValue ? new Vector3?(val.GetValueOrDefault() + val2) : null);
				Dungeon fieldInEnumerator = GetFieldInEnumerator<Dungeon>(selfObject, "this");
				((MonoBehaviour)fieldInEnumerator).StartCoroutine(JollyCoopManager.SpawnChest(val3.Value, fieldInEnumerator.data.Entrance));
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class get_BaseLevelHealthModifierPatchClass
	{
		[HarmonyILManipulator]
		public static void get_BaseLevelHealthModifierPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_HEALTH_MULTIPLIER")
			}))
			{
				val.EmitCall<get_BaseLevelHealthModifierPatchClass>("get_BaseLevelHealthModifierPatchCall");
			}
		}

		private static float get_BaseLevelHealthModifierPatchCall(float orig)
		{
			return JollyCoopManager.EnemyHealth;
		}
	}

	[HarmonyPatch(typeof(HealthHaver), "Start")]
	public class HealthHaverStartPatchClass
	{
		[HarmonyILManipulator]
		public static void HealthHaverStartPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_HEALTH_MULTIPLIER")
			}))
			{
				val.EmitCall<HealthHaverStartPatchClass>("HealthHaverStartPatchCall");
			}
		}

		private static float HealthHaverStartPatchCall(float orig)
		{
			return JollyCoopManager.EnemyHealth;
		}
	}

	[HarmonyPatch(typeof(Projectile), "UpdateEnemyBulletSpeedMultiplier")]
	public class UpdateEnemyBulletSpeedMultiplierPatchClass
	{
		[HarmonyILManipulator]
		public static void UpdateEnemyBulletSpeedMultiplierPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<GameManager>(x, "COOP_ENEMY_PROJECTILE_SPEED_MULTIPLIER")
			}))
			{
				val.EmitCall<UpdateEnemyBulletSpeedMultiplierPatchClass>("UpdateEnemyBulletSpeedMultiplierPatchCall");
			}
		}

		private static float UpdateEnemyBulletSpeedMultiplierPatchCall(float orig)
		{
			return JollyCoopManager.EnemyProjectileSpeed;
		}
	}

	[HarmonyPatch(typeof(LootEngine), "SpewLoot", new Type[]
	{
		typeof(List<GameObject>),
		typeof(Vector3)
	})]
	public class SpewLootPatchClass
	{
		[HarmonyILManipulator]
		public static void SpewLootPatch(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 5)
			}))
			{
				val.Emit(OpCodes.Ldloc_3);
				val.Emit(OpCodes.Ldloc_S, (byte)5);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitCall<SpewLootPatchClass>("SpewLootPatchCall");
			}
		}

		private static void SpewLootPatchCall(int index, GameObject gameObject, List<GameObject> list)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerOneExclusiveLoots.Contains(list[index].gameObject.GetComponent<PickupObject>()))
				{
					playerOneExclusiveLoots.Remove(list[index].gameObject.GetComponent<PickupObject>());
					playerOneExclusivePickups.Add(gameObject.GetComponent<PickupObject>(), GameManager.Instance.SecondaryPlayer.CurrentRoom == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(gameObject.transform.position, (VectorConversions)2)));
				}
				if (playerTwoExclusiveLoots.Contains(list[index].gameObject.GetComponent<PickupObject>()))
				{
					playerTwoExclusiveLoots.Remove(list[index].gameObject.GetComponent<PickupObject>());
					playerTwoExclusivePickups.Add(gameObject.GetComponent<PickupObject>(), GameManager.Instance.PrimaryPlayer.CurrentRoom == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(gameObject.transform.position, (VectorConversions)2)));
				}
			}
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class Set_IsLoadingLevelPatchClass
	{
		[HarmonyPrefix]
		public static void Set_IsLoadingLevelPrefix(bool value)
		{
			if (value)
			{
				playerOneExclusivePickups.Clear();
				playerTwoExclusivePickups.Clear();
				playerOneExclusiveLoots.Clear();
				playerTwoExclusiveLoots.Clear();
				playerOneExclusivePedestals.Clear();
				playerTwoExclusivePedestals.Clear();
				playerOneExclusiveChests.Clear();
				playerTwoExclusiveChests.Clear();
				playerOneHasGivenMasteryToken = false;
				playerTwoHasGivenMasteryToken = false;
				playerOneHasTakenDamageInThisRoom = false;
				playerTwoHasTakenDamageInThisRoom = false;
				Array.Clear(playerOneSpawnMasterFlags, 0, playerOneSpawnMasterFlags.Length);
				Array.Clear(playerTwoSpawnMasterFlags, 0, playerTwoSpawnMasterFlags.Length);
			}
		}
	}

	[HarmonyPatch(typeof(PassiveItem), "Interact")]
	public class PassiveItemInteractPatchClass
	{
		[HarmonyPrefix]
		public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			if (playerTwoExclusivePickups.ContainsKey(__instance))
			{
				playerTwoExclusivePickups.Remove(__instance);
			}
			if (playerOneExclusivePickups.ContainsKey(__instance))
			{
				playerOneExclusivePickups.Remove(__instance);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PassiveItem), "GetRidOfMinimapIcon")]
	public class PassiveItemGetRidOfMinimapIconPatchClass
	{
		[HarmonyPostfix]
		public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance))
				{
					playerTwoExclusivePickups.Remove(__instance);
				}
				if (playerOneExclusivePickups.ContainsKey(__instance))
				{
					playerOneExclusivePickups.Remove(__instance);
				}
			}
		}
	}

	[HarmonyPatch(typeof(PassiveItem), "OnEnteredRange")]
	public class PassiveItemOnEnteredRangePatchClass
	{
		[HarmonyPrefix]
		public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Gun), "Interact")]
	public class GunInteractPatchClass
	{
		[HarmonyPrefix]
		public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			if (playerTwoExclusivePickups.ContainsKey(__instance))
			{
				playerTwoExclusivePickups.Remove(__instance);
			}
			if (playerOneExclusivePickups.ContainsKey(__instance))
			{
				playerOneExclusivePickups.Remove(__instance);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Gun), "GetRidOfMinimapIcon")]
	public class GunGetRidOfMinimapIconPatchClass
	{
		[HarmonyPostfix]
		public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance))
				{
					playerTwoExclusivePickups.Remove(__instance);
				}
				if (playerOneExclusivePickups.ContainsKey(__instance))
				{
					playerOneExclusivePickups.Remove(__instance);
				}
			}
		}
	}

	[HarmonyPatch(typeof(Gun), "OnEnteredRange")]
	public class GunOnEnteredRangePatchClass
	{
		[HarmonyPrefix]
		public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerItem), "Interact")]
	public class PlayerItemInteractPatchClass
	{
		[HarmonyPrefix]
		public static bool InteractPrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			if (playerTwoExclusivePickups.ContainsKey(__instance))
			{
				playerTwoExclusivePickups.Remove(__instance);
			}
			if (playerOneExclusivePickups.ContainsKey(__instance))
			{
				playerOneExclusivePickups.Remove(__instance);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerItem), "GetRidOfMinimapIcon")]
	public class PlayerItemGetRidOfMinimapIconPatchClass
	{
		[HarmonyPostfix]
		public static void GetRidOfMinimapIconPostfix(PickupObject __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance))
				{
					playerTwoExclusivePickups.Remove(__instance);
				}
				if (playerOneExclusivePickups.ContainsKey(__instance))
				{
					playerOneExclusivePickups.Remove(__instance);
				}
			}
		}
	}

	[HarmonyPatch(typeof(PlayerItem), "OnEnteredRange")]
	public class PlayerItemOnEnteredRangePatchClass
	{
		[HarmonyPrefix]
		public static bool OnEnteredRangePrefix(PickupObject __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePickups.ContainsKey(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(RoomHandler), "PlayerEnter")]
	public class PlayerEnterPatchClass
	{
		[HarmonyPostfix]
		public static void PlayerEnterPostfix(RoomHandler __instance, PlayerController playerEntering)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return;
			}
			if ((Object)(object)playerEntering == (Object)(object)GameManager.Instance.PrimaryPlayer)
			{
				playerOneHasTakenDamageInThisRoom = false;
				List<PickupObject> list = new List<PickupObject>();
				foreach (PickupObject key in playerTwoExclusivePickups.Keys)
				{
					if (!playerTwoExclusivePickups[key] && __instance == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(((BraveBehaviour)key).transform.position, (VectorConversions)2)))
					{
						list.Add(key);
					}
				}
				{
					foreach (PickupObject item in list)
					{
						playerTwoExclusivePickups[item] = true;
					}
					return;
				}
			}
			playerTwoHasTakenDamageInThisRoom = false;
			List<PickupObject> list2 = new List<PickupObject>();
			foreach (PickupObject key2 in playerOneExclusivePickups.Keys)
			{
				if (!playerOneExclusivePickups[key2] && __instance == GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(((BraveBehaviour)key2).transform.position, (VectorConversions)2)))
				{
					list2.Add(key2);
				}
			}
			foreach (PickupObject item2 in list2)
			{
				playerOneExclusivePickups[item2] = true;
			}
		}
	}

	[HarmonyPatch(typeof(PickupObject), "ShouldBeTakenByRat")]
	public class ShouldBeTakenByRatClass
	{
		[HarmonyPrefix]
		public static bool ShouldBeTakenByRatPrefix(PickupObject __instance, ref bool __result)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (playerTwoExclusivePickups.TryGetValue(__instance, out var value) || playerOneExclusivePickups.TryGetValue(__instance, out value))
			{
				if (!value)
				{
					__result = false;
					return false;
				}
				return true;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(PlayerController), "Damaged")]
	public class DamagedPatchClass
	{
		[HarmonyPrefix]
		public static void DamagedPrefix(PlayerController __instance)
		{
			if ((Object)(object)__instance == (Object)(object)GameManager.Instance.PrimaryPlayer)
			{
				playerOneHasTakenDamageInThisRoom = true;
			}
			else
			{
				playerTwoHasTakenDamageInThisRoom = true;
			}
		}
	}

	[HarmonyPatch(typeof(RewardPedestal), "Interact")]
	public class RewardPedestalInteractPatchClass
	{
		[HarmonyPrefix]
		public static bool RewardPedestalInteractPrefix(RewardPedestal __instance, PlayerController player)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePedestals.Contains(__instance) && (Object)(object)player == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePedestals.Contains(__instance) && (Object)(object)player == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			if (playerTwoExclusivePedestals.Contains(__instance))
			{
				playerTwoExclusivePedestals.Remove(__instance);
			}
			if (playerOneExclusivePedestals.Contains(__instance))
			{
				playerOneExclusivePedestals.Remove(__instance);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(RewardPedestal), "OnEnteredRange")]
	public class RewardPedestalOnEnteredRangePatchClass
	{
		[HarmonyPrefix]
		public static bool RewardPedestalOnEnteredRangePrefix(RewardPedestal __instance, PlayerController interactor)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1)
			{
				return true;
			}
			if (JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Item Distribution Lock"))
			{
				if (playerTwoExclusivePedestals.Contains(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.SecondaryPlayer)
				{
					return false;
				}
				if (playerOneExclusivePedestals.Contains(__instance) && (Object)(object)interactor == (Object)(object)GameManager.Instance.PrimaryPlayer)
				{
					return false;
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Chest), "SpewContentsOntoGround")]
	public class SpewContentsOntoGroundPatchClass
	{
		[HarmonyPrefix]
		public static void SpewContentsOntoGroundPrefix(Chest __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType != 1 || !JollyCoopManager.gunfig.Enabled("Jolly Coop On") || !JollyCoopManager.gunfig.Enabled("Item Distribution Lock") || !JollyCoopManager.gunfig.Enabled("Chest Item Doubled"))
			{
				return;
			}
			if (playerTwoExclusiveChests.Contains(__instance))
			{
				foreach (PickupObject content in __instance.contents)
				{
					playerTwoExclusiveLoots.Add(content);
				}
				playerTwoExclusiveChests.Remove(__instance);
			}
			if (!playerOneExclusiveChests.Contains(__instance))
			{
				return;
			}
			foreach (PickupObject content2 in __instance.contents)
			{
				playerOneExclusiveLoots.Add(content2);
			}
			playerOneExclusiveChests.Remove(__instance);
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class HandleSoldItemPatchClass
	{
		[HarmonyILManipulator]
		public static void HandleSoldItemPatch(ILContext ctx)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			ILCursor crs = new ILCursor(ctx);
			MethodInfo methodInfo = AccessTools.Method(typeof(Vector3?), "get_Value", (Type[])null, (Type[])null);
			if (TheNthTime(() => crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<tk2dBaseSprite>(x, "get_WorldCenter")
			}), 2))
			{
				crs.Emit(OpCodes.Ldarg_0);
				crs.EmitCall<HandleSoldItemPatchClass>("HandleSoldItemPatchCall");
			}
		}

		private static void HandleSoldItemPatchCall(object selfObject)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)GameManager.Instance.CurrentGameType == 1 && JollyCoopManager.gunfig.Enabled("Jolly Coop On") && JollyCoopManager.gunfig.Enabled("Chest Item Doubled"))
			{
				int fieldInEnumerator = GetFieldInEnumerator<int>(selfObject, "sellPrice");
				SetFieldInEnumerator(selfObject, "sellPrice", (int)((float)fieldInEnumerator * JollyCoopManager.ItemRecyclingPrice));
			}
		}
	}

	private static bool[] playerOneSpawnMasterFlags = new bool[4];

	private static bool[] playerTwoSpawnMasterFlags = new bool[4];

	internal static bool playerOneHasTakenDamageInThisRoom = false;

	internal static bool playerTwoHasTakenDamageInThisRoom = false;

	internal static bool playerOneHasGivenMasteryToken = false;

	internal static bool playerTwoHasGivenMasteryToken = false;

	internal static Dictionary<PickupObject, bool> playerOneExclusivePickups = new Dictionary<PickupObject, bool>();

	internal static List<PickupObject> playerOneExclusiveLoots = new List<PickupObject>();

	internal static Dictionary<PickupObject, bool> playerTwoExclusivePickups = new Dictionary<PickupObject, bool>();

	internal static List<PickupObject> playerTwoExclusiveLoots = new List<PickupObject>();

	internal static List<RewardPedestal> playerOneExclusivePedestals = new List<RewardPedestal>();

	internal static List<RewardPedestal> playerTwoExclusivePedestals = new List<RewardPedestal>();

	internal static List<Chest> playerOneExclusiveChests = new List<Chest>();

	internal static List<Chest> playerTwoExclusiveChests = new List<Chest>();

	public static void EmitCall<T>(this ILCursor iLCursor, string methodName, Type[] parameters = null, Type[] generics = null)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		MethodInfo methodInfo = AccessTools.Method(typeof(T), methodName, parameters, generics);
		iLCursor.Emit(OpCodes.Call, (MethodBase)methodInfo);
	}

	public static T GetFieldInEnumerator<T>(object instance, string fieldNamePattern)
	{
		return (T)instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.Name.Contains("$" + fieldNamePattern) || f.Name.Contains("<" + fieldNamePattern + ">"))
			.GetValue(instance);
	}

	public static void SetFieldInEnumerator<T>(object instance, string fieldNamePattern, T value)
	{
		instance.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.Name.Contains("$" + fieldNamePattern) || f.Name.Contains("<" + fieldNamePattern + ">"))
			.SetValue(instance, value);
	}

	public static bool TheNthTime(this Func<bool> predict, int n = 1)
	{
		for (int i = 0; i < n; i++)
		{
			if (!predict())
			{
				return false;
			}
		}
		return true;
	}
}