Decompiled source of Syntheals Items v0.3.2

BepInEx/Plugins/Items Mod For Gamble.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Extensions;
using HarmonyLib;
using Items_Mod_For_Gamble.ModdedItem;
using Mirror;
using TryConnect;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[HarmonyPatch]
public static class NetworkManagerRegistrationPatch
{
	private static FieldInfo assetIdField = typeof(NetworkIdentity).GetField("_assetId", BindingFlags.Instance | BindingFlags.NonPublic);

	private static List<GameObject> registeredPrefabs = new List<GameObject>();

	[HarmonyPrefix]
	[HarmonyPatch(typeof(CustomNetworkManager), "OnStopServer")]
	public static void OnStopServer(CustomNetworkManager __instance)
	{
		Debug.Log((object)"[Armory] OnStopServer - Clearing custom prefabs from NetworkManager");
		for (int num = ((NetworkManager)__instance).spawnPrefabs.Count - 1; num >= 0; num--)
		{
			if (registeredPrefabs.Contains(((NetworkManager)__instance).spawnPrefabs[num]))
			{
				((NetworkManager)__instance).spawnPrefabs.RemoveAt(num);
			}
		}
		registeredPrefabs.Clear();
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(CustomNetworkManager), "OnStopClient")]
	public static void OnStopClient(CustomNetworkManager __instance)
	{
		Debug.Log((object)"[Armory] OnStopClient - Clearing custom prefabs from NetworkManager");
		for (int num = ((NetworkManager)__instance).spawnPrefabs.Count - 1; num >= 0; num--)
		{
			if (registeredPrefabs.Contains(((NetworkManager)__instance).spawnPrefabs[num]))
			{
				((NetworkManager)__instance).spawnPrefabs.RemoveAt(num);
			}
		}
		registeredPrefabs.Clear();
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(CustomNetworkManager), "OnStartServer")]
	public static void OnStartServer(CustomNetworkManager __instance)
	{
		RegisterAllCustomPrefabs(__instance);
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(CustomNetworkManager), "OnClientConnect")]
	public static void OnClientConnect(CustomNetworkManager __instance)
	{
		RegisterAllCustomPrefabs(__instance);
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(NetworkManager), "StartHost")]
	public static void OnStartHost(NetworkManager __instance)
	{
		CustomNetworkManager val = (CustomNetworkManager)(object)((__instance is CustomNetworkManager) ? __instance : null);
		if (val != null)
		{
			RegisterAllCustomPrefabs(val);
		}
	}

	private static void RegisterAllCustomPrefabs(CustomNetworkManager networkManager)
	{
		if ((Object)(object)networkManager == (Object)null)
		{
			return;
		}
		Debug.Log((object)"[Armory] Registering custom prefabs with NetworkManager");
		for (int num = ((NetworkManager)networkManager).spawnPrefabs.Count - 1; num >= 0; num--)
		{
			if ((Object)(object)((NetworkManager)networkManager).spawnPrefabs[num] == (Object)null)
			{
				((NetworkManager)networkManager).spawnPrefabs.RemoveAt(num);
			}
		}
		TryConnectRegisteredItemInfo[] registeredItems = TryConnectApi.GetRegisteredItems();
		int num2 = 0;
		TryConnectRegisteredItemInfo[] array = registeredItems;
		SpawnableSO val2 = default(SpawnableSO);
		foreach (TryConnectRegisteredItemInfo val in array)
		{
			if (TryConnectApi.TryGetCustomSpawnable(val.SpawnableId, ref val2) && (Object)(object)val2 != (Object)null && (Object)(object)val2.prefab != (Object)null)
			{
				uint num3 = ArmoryPlugin.GenerateDeterministicAssetId(val.OwnerGuid, val.Key);
				NetworkIdentity component = val2.prefab.GetComponent<NetworkIdentity>();
				if ((Object)(object)component != (Object)null && assetIdField != null && (uint)assetIdField.GetValue(component) == 0)
				{
					assetIdField.SetValue(component, num3);
					Debug.Log((object)$"[Armory] Set assetId for {val.Key} to {num3}");
				}
				if (!((NetworkManager)networkManager).spawnPrefabs.Contains(val2.prefab))
				{
					((NetworkManager)networkManager).spawnPrefabs.Add(val2.prefab);
					registeredPrefabs.Add(val2.prefab);
					Debug.Log((object)("[Armory] Added " + val.Key + " to NetworkManager spawnPrefabs"));
					num2++;
				}
				NetworkClient.RegisterPrefab(val2.prefab, num3);
			}
		}
		if (num2 > 0)
		{
			Debug.Log((object)$"[Armory] Registered {num2} custom prefabs with NetworkManager (total: {((NetworkManager)networkManager).spawnPrefabs.Count})");
		}
	}
}
[HarmonyPatch(typeof(Coordinator), "ServerThrow")]
public static class CoordinatorThrowPatch
{
	[HarmonyPostfix]
	private static void Postfix(Coordinator __instance)
	{
		string text = ((Object)((Component)__instance).gameObject).name.ToLower();
		if (text.Contains("voodoo doll"))
		{
			AccessTools.Field(typeof(Coordinator), "_isBreakable").SetValue(__instance, false);
		}
	}
}
[HarmonyPatch(typeof(Drink), "ServerThrow")]
public static class DrinkThrowPatch
{
	[HarmonyPostfix]
	private static void Postfix(Drink __instance)
	{
		string text = ((Object)((Component)__instance).gameObject).name.ToLower();
		if (text.Contains("blind luck"))
		{
			AccessTools.Field(typeof(Drink), "_isBreakable").SetValue(__instance, false);
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Armory-Mod", "Armory", "0.3.2")]
public sealed class ArmoryPlugin : BaseUnityPlugin
{
	[HarmonyPatch]
	public static class BlockTicketFizzFromShopPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch]
		public static void Postfix(GameObject fallbackPrefab, ref GameObject __result)
		{
			if ((Object)(object)__result != (Object)null && ((Object)__result).name.Contains("Ticket Fizz"))
			{
				Debug.Log((object)"[Armory] Blocked Ticket Fizz from shop");
				__result = fallbackPrefab;
			}
		}

		private static MethodBase TargetMethod()
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (assembly.GetName().Name.Contains("TryConnect"))
				{
					Type type = assembly.GetType("TryConnect.RuntimeItemRegistry");
					if (type != null)
					{
						return AccessTools.Method(type, "GetShopReplacement", (Type[])null, (Type[])null);
					}
				}
			}
			return null;
		}
	}

	[HarmonyPatch]
	public static class BlockLoadedChipFromShopPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch]
		public static void Postfix(GameObject fallbackPrefab, ref GameObject __result)
		{
			if ((Object)(object)__result != (Object)null && ((Object)__result).name.Contains("Loaded Chip"))
			{
				Debug.Log((object)"[Armory] Blocked Loaded Chip from shop");
				__result = fallbackPrefab;
			}
		}

		private static MethodBase TargetMethod()
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (assembly.GetName().Name.Contains("TryConnect"))
				{
					Type type = assembly.GetType("TryConnect.RuntimeItemRegistry");
					if (type != null)
					{
						return AccessTools.Method(type, "GetShopReplacement", (Type[])null, (Type[])null);
					}
				}
			}
			return null;
		}
	}

	[HarmonyPatch]
	public static class BlockTicketFizzAndLoadedChipSpawnPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch]
		public static bool Prefix(GameObject prefab, ref bool __result)
		{
			if ((Object)(object)prefab != (Object)null && (((Object)prefab).name.Contains("Ticket Fizz") || ((Object)prefab).name.Contains("Loaded Chip")))
			{
				Debug.Log((object)("[Armory] Blocked spawning of " + ((Object)prefab).name));
				__result = false;
				return false;
			}
			return true;
		}

		private static MethodBase TargetMethod()
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (assembly.GetName().Name.Contains("TryConnect"))
				{
					Type type = assembly.GetType("TryConnect.RuntimeItemRegistry");
					if (type != null)
					{
						return AccessTools.Method(type, "TrySpawnRegisteredPrefab", (Type[])null, (Type[])null);
					}
				}
			}
			return null;
		}
	}

	internal static ConfigEntry<bool> enableCursedCoin;

	internal static ConfigEntry<bool> enablePills;

	internal static ConfigEntry<bool> enableBlind;

	internal static ConfigEntry<bool> enableDoll;

	internal static ConfigEntry<bool> enableTaxes;

	internal static ConfigEntry<bool> enableEnergy;

	internal static ConfigEntry<bool> enableScroll;

	internal static ConfigEntry<bool> enableKey;

	internal static uint GenerateDeterministicAssetId(string ownerGuid, string key)
	{
		string text = ownerGuid + ":" + key;
		uint num = 5381u;
		string text2 = text;
		foreach (char c in text2)
		{
			num = (num << 5) + num + c;
		}
		return (num == 0) ? 1u : num;
	}

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: 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_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: 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)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Expected O, but got Unknown
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: 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_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Expected O, but got Unknown
		//IL_02ac: 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_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: 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_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0302: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Expected O, but got Unknown
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0408: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0439: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Expected O, but got Unknown
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04de: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0523: Unknown result type (might be due to invalid IL or missing references)
		//IL_052b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		//IL_053c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Expected O, but got Unknown
		//IL_0551: Unknown result type (might be due to invalid IL or missing references)
		//IL_0556: Unknown result type (might be due to invalid IL or missing references)
		//IL_0563: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_058f: Unknown result type (might be due to invalid IL or missing references)
		//IL_059b: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cb: 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_05d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_060c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0617: Unknown result type (might be due to invalid IL or missing references)
		//IL_061f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0627: Unknown result type (might be due to invalid IL or missing references)
		//IL_062f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Unknown result type (might be due to invalid IL or missing references)
		//IL_0641: Unknown result type (might be due to invalid IL or missing references)
		//IL_064b: Expected O, but got Unknown
		//IL_064e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_0660: Unknown result type (might be due to invalid IL or missing references)
		//IL_0687: Unknown result type (might be due to invalid IL or missing references)
		//IL_068c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: Expected O, but got Unknown
		//IL_0719: Unknown result type (might be due to invalid IL or missing references)
		//IL_071e: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0752: Unknown result type (might be due to invalid IL or missing references)
		//IL_0757: Unknown result type (might be due to invalid IL or missing references)
		//IL_0763: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_077b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0787: Unknown result type (might be due to invalid IL or missing references)
		//IL_0793: Unknown result type (might be due to invalid IL or missing references)
		//IL_0794: Unknown result type (might be due to invalid IL or missing references)
		//IL_079e: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07dc: 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_07ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f7: Expected O, but got Unknown
		//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_080c: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"[Armory] Loading Items");
		DisableUnwantedTryConnectItems();
		Harmony val = new Harmony("armory.mod");
		val.PatchAll();
		Debug.Log((object)"[Armory] Harmony patches applied");
		enableCursedCoin = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Cursed Coin", true, "Enable \"cursed coin\" to show up in shop");
		enablePills = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Experimental Pills", true, "Enable \"experimental pills\" to show up in the shop");
		enableBlind = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Blind Luck", true, "Enable \"Blind Luck\" to show up in the shop");
		enableDoll = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Voodoo Doll", true, "Enable \"Voodoo Doll\" to show up in the shop");
		enableTaxes = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Tax Fraud", true, "Enable \"Tax Fraud\" to show up in the shop");
		enableEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Energy Drink", true, "Enable \"Energy Drink\" to show up in the shop");
		enableScroll = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "Debt Contract", true, "Enable \"Debt Contract\" to show up in the shop");
		enableKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Custom Items", "R Key", true, "Enable \"R Key\" to show up in the shop");
		if (enableCursedCoin.Value)
		{
			TryConnectBundledItemRegistration val2 = new TryConnectBundledItemRegistration
			{
				Key = "cursed_coin",
				DisplayName = "Cursed Coin",
				Description = "Works like a golden chip but with a <color=#BC0508>25% chance to lose 1.5x max bet</color>\n<color=#00ffcc>3 Uses</color>",
				BundlePath = "armory.cursed_coin",
				VisualPrefabName = "cursed_coin",
				VisualLocalScale = Vector3.one * 7.5f,
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 40,
				ExtraBasePrice = 1,
				ExtraFloorPrice = 1
			};
			TryConnectRegistrationResult val3 = TryConnectApi.RegisterBundledCustomItem<GoldenChip, CursedCoin>((BaseUnityPlugin)(object)this, val2);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for cursed_coin: {val3}");
		}
		if (enablePills.Value)
		{
			TryConnectBundledItemRegistration val4 = new TryConnectBundledItemRegistration
			{
				Key = "exp_pills",
				DisplayName = "Experimental Pills",
				Description = "<color=#00ffcc>70%</color> to gain a body part\n<color=#BC0508>30%</color> to lose a body part",
				BundlePath = "armory.pills",
				VisualPrefabName = "pills",
				VisualLocalScale = Vector3.one * 0.32f,
				VisualLocalEulerAngles = new Vector3(0f, -180f, 0f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 25,
				ExtraBasePrice = 4,
				ExtraFloorPrice = -1
			};
			TryConnectRegistrationResult val5 = TryConnectApi.RegisterBundledCustomItem<Upgrade, Experimental_Pills>((BaseUnityPlugin)(object)this, val4);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for exp_pills: {val5}");
		}
		if (enableBlind.Value)
		{
			TryConnectBundledItemRegistration val6 = new TryConnectBundledItemRegistration
			{
				Key = "blind_eyes",
				DisplayName = "Blind Luck",
				Description = "<color=#BC0508>Lose</color> both your eyes\n<color=#23e82e>Gain</color> bonus income for the day",
				BundlePath = "armory.scooper",
				VisualPrefabName = "scooper",
				VisualLocalScale = Vector3.one * 0.13f,
				VisualLocalEulerAngles = new Vector3(-90f, 0f, 180f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 35,
				ExtraBasePrice = -3,
				ExtraFloorPrice = 0
			};
			TryConnectRegistrationResult val7 = TryConnectApi.RegisterBundledCustomItem<Drink, BlindLuck>((BaseUnityPlugin)(object)this, val6);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for blind_eyes: {val7}");
		}
		if (enableDoll.Value)
		{
			TryConnectBundledItemRegistration val8 = new TryConnectBundledItemRegistration
			{
				Key = "voodoo_doll",
				DisplayName = "Voodoo Doll",
				Description = "<color=#BC0508>80%</color> to lose all body parts\n<color=#23e82e>20%</color> to earn quota",
				BundlePath = "armory.doll",
				VisualPrefabName = "doll",
				VisualLocalScale = Vector3.one * 0.15f,
				VisualLocalEulerAngles = new Vector3(0f, -90f, 0f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 45,
				ExtraBasePrice = -3,
				ExtraFloorPrice = -1
			};
			TryConnectRegistrationResult val9 = TryConnectApi.RegisterBundledCustomItem<Coordinator, VoodooDoll>((BaseUnityPlugin)(object)this, val8);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for voodoo_doll: {val9}");
		}
		if (enableTaxes.Value)
		{
			TryConnectBundledItemRegistration val10 = new TryConnectBundledItemRegistration
			{
				Key = "taxes",
				DisplayName = "Tax Fraud",
				Description = "<color=#23e82e>Decrease</color> quota by 20%\n<color=#BC0508>5%</color> chance to get audited",
				BundlePath = "armory.taxes",
				VisualPrefabName = "taxes",
				VisualLocalScale = Vector3.one * 0.015f,
				VisualLocalEulerAngles = new Vector3(50f, 180f, -180f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 25,
				ExtraBasePrice = 1,
				ExtraFloorPrice = 3
			};
			TryConnectRegistrationResult val11 = TryConnectApi.RegisterBundledCustomItem<Taser, TaxFraud>((BaseUnityPlugin)(object)this, val10);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for taxes: {val11}");
		}
		if (enableTaxes.Value)
		{
			TryConnectBundledItemRegistration val12 = new TryConnectBundledItemRegistration
			{
				Key = "energy_drink",
				DisplayName = "Energy Drink",
				Description = "Makes wheels on the floor spin <color=#23e82e>3x</color> as fast for 90 seconds",
				BundlePath = "armory.energy_drink",
				VisualPrefabName = "energy_drink",
				VisualLocalScale = Vector3.one * 0.18f,
				VisualLocalEulerAngles = new Vector3(-90f, -90f, 0f),
				VisualLocalPosition = new Vector3(0f, -0.3f, 0f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 45,
				ExtraBasePrice = -2,
				ExtraFloorPrice = -1
			};
			TryConnectRegistrationResult val13 = TryConnectApi.RegisterBundledCustomItem<Microphone, EnergyDrink>((BaseUnityPlugin)(object)this, val12);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for energy drink: {val13}");
		}
		if (enableScroll.Value)
		{
			TryConnectBundledItemRegistration val14 = new TryConnectBundledItemRegistration
			{
				Key = "scroll",
				DisplayName = "Debt Contract",
				Description = "Instantly earn <color=#23e82e>25%</color> of quota\nPay it back tomorrow with interest",
				BundlePath = "armory.scroll",
				VisualPrefabName = "scroll",
				VisualLocalScale = new Vector3(0.8f, 0.8f, 1.15f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 35,
				ExtraBasePrice = -1,
				ExtraFloorPrice = 0
			};
			TryConnectRegistrationResult val15 = TryConnectApi.RegisterBundledCustomItem<TimeMachine, DebtContract>((BaseUnityPlugin)(object)this, val14);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for debt contract: {val15}");
		}
		if (enableKey.Value)
		{
			TryConnectBundledItemRegistration val16 = new TryConnectBundledItemRegistration
			{
				Key = "r_key",
				DisplayName = "R Key",
				Description = "Restart the day with\n<color=#BC0508>20% less</color>\nCash and Tickets",
				BundlePath = "armory.r_key",
				VisualPrefabName = "rKey",
				VisualLocalScale = Vector3.one * 1.25f,
				VisualLocalEulerAngles = new Vector3(-40f, -180f, 0f),
				ApplyVisualColor = false,
				ApplyTint = false,
				ReplaceColliders = true,
				ReplacementChancePercent = 20,
				ExtraBasePrice = -1,
				ExtraFloorPrice = 2
			};
			TryConnectRegistrationResult val17 = TryConnectApi.RegisterBundledCustomItem<AngelsReel, RKey>((BaseUnityPlugin)(object)this, val16);
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"TryConnect register result for r key: {val17}");
		}
	}

	private void DisableUnwantedTryConnectItems()
	{
		try
		{
			string path = Path.Combine(Paths.ConfigPath, "com.Try-4646.TryConnect.cfg");
			if (!File.Exists(path))
			{
				return;
			}
			Debug.Log((object)"[Armory] Found TryConnect config file, ensuring Ticket Fizz and Loaded Chip are disabled");
			string[] array = File.ReadAllLines(path);
			bool flag = false;
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].StartsWith("TicketFizzReplacementChance ="))
				{
					string text = array[i];
					array[i] = "TicketFizzReplacementChance = 0";
					if (text != array[i])
					{
						flag = true;
						Debug.Log((object)"[Armory] Set TicketFizzReplacementChance to 0");
					}
				}
				if (array[i].StartsWith("LoadedChipReplacementChance ="))
				{
					string text2 = array[i];
					array[i] = "LoadedChipReplacementChance = 0";
					if (text2 != array[i])
					{
						flag = true;
						Debug.Log((object)"[Armory] Set LoadedChipReplacementChance to 0");
					}
				}
			}
			if (flag)
			{
				File.WriteAllLines(path, array);
				Debug.Log((object)"[Armory] Successfully disabled unwanted TryConnect items");
			}
			else
			{
				Debug.Log((object)"[Armory] TryConnect items already disabled");
			}
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("[Armory] Failed to modify TryConnect config: " + ex.Message));
		}
	}
}
namespace Items_Mod_For_Gamble.Patches
{
	[HarmonyPatch(typeof(AngelsReel), "OnUseItem")]
	public static class RKeyUse
	{
		[CompilerGenerated]
		private sealed class <UseRKey>d__2 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public AngelsReel rKey;

			private SaveManager <saveManager>5__1;

			private MoneyManager <moneyManager>5__2;

			private long <currentMoney>5__3;

			private long <currentTickets>5__4;

			private long <moneyPenalty>5__5;

			private long <ticketsPenalty>5__6;

			private long <newMoney>5__7;

			private long <newTickets>5__8;

			private int <newSeed>5__9;

			private Type <saveManagerType>5__10;

			private FieldInfo <currentSaveDataField>5__11;

			private SaveData <currentSaveData>5__12;

			private MethodInfo <saveGameMethod>5__13;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <UseRKey>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<saveManager>5__1 = null;
				<moneyManager>5__2 = null;
				<saveManagerType>5__10 = null;
				<currentSaveDataField>5__11 = null;
				<currentSaveData>5__12 = null;
				<saveGameMethod>5__13 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c9: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.01f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						((ConsumableItem)rKey).DestroyItem();
						return false;
					}
					<saveManager>5__1 = NetworkSingleton<SaveManager>.Instance;
					<moneyManager>5__2 = NetworkSingleton<MoneyManager>.Instance;
					if ((Object)(object)<saveManager>5__1 == (Object)null || (Object)(object)<moneyManager>5__2 == (Object)null)
					{
						Debug.LogError((object)"[RKey] Required managers not found!");
						((ConsumableItem)rKey).DestroyItem();
						return false;
					}
					<currentMoney>5__3 = <moneyManager>5__2.balance;
					<currentTickets>5__4 = <moneyManager>5__2.ticketBalance;
					<moneyPenalty>5__5 = (long)((float)<currentMoney>5__3 * 0.2f);
					<ticketsPenalty>5__6 = (long)((float)<currentTickets>5__4 * 0.2f);
					<newMoney>5__7 = <currentMoney>5__3 - <moneyPenalty>5__5;
					<newTickets>5__8 = <currentTickets>5__4 - <ticketsPenalty>5__6;
					if (<newMoney>5__7 < 0)
					{
						<newMoney>5__7 = 0L;
					}
					if (<newTickets>5__8 < 0)
					{
						<newTickets>5__8 = 0L;
					}
					<moneyManager>5__2.SetBalance(<newMoney>5__7, (PlayerProfile)null, (ChangeType)2);
					<moneyManager>5__2.TrySetTicketBalance(<newTickets>5__8);
					<newSeed>5__9 = Random.Range(int.MinValue, int.MaxValue);
					<saveManagerType>5__10 = typeof(SaveManager);
					<currentSaveDataField>5__11 = <saveManagerType>5__10.GetField("currentSaveData", BindingFlags.Instance | BindingFlags.NonPublic);
					if (<currentSaveDataField>5__11 != null)
					{
						ref SaveData reference = ref <currentSaveData>5__12;
						object? value = <currentSaveDataField>5__11.GetValue(<saveManager>5__1);
						reference = (SaveData)((value is SaveData) ? value : null);
						if (<currentSaveData>5__12 != null)
						{
							<currentSaveData>5__12.seed = <newSeed>5__9;
							<currentSaveData>5__12.money = <newMoney>5__7;
							<currentSaveData>5__12.tickets = <newTickets>5__8;
							<saveGameMethod>5__13 = <saveManagerType>5__10.GetMethod("SaveGame", BindingFlags.Instance | BindingFlags.Public);
							<saveGameMethod>5__13?.Invoke(<saveManager>5__1, null);
							if ((Object)(object)NetworkSingleton<SeededRandomManager>.Instance != (Object)null)
							{
								NetworkSingleton<SeededRandomManager>.Instance.InitializeSeed(<newSeed>5__9);
							}
							<saveGameMethod>5__13 = null;
						}
						<currentSaveData>5__12 = null;
					}
					<>2__current = (object)new WaitForSeconds(0.01f);
					<>1__state = 2;
					return true;
				}
				case 2:
					<>1__state = -1;
					if ((Object)(object)NetworkManager.singleton != (Object)null)
					{
						NetworkManager.singleton.ServerChangeScene("HomeScene");
					}
					else
					{
						Debug.LogError((object)"[RKey] NetworkManager.singleton is null!");
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const float PENALTY_PERCENTAGE = 0.2f;

		[HarmonyPrefix]
		public static bool Prefix(AngelsReel __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("r key"))
			{
				((MonoBehaviour)__instance).StartCoroutine(UseRKey(__instance));
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<UseRKey>d__2))]
		private static IEnumerator UseRKey(AngelsReel rKey)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <UseRKey>d__2(0)
			{
				rKey = rKey
			};
		}
	}
	[HarmonyPatch(typeof(Coordinator), "OnUseItem")]
	public static class VoodooDollUse
	{
		[CompilerGenerated]
		private sealed class <DollRoutine>d__1 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Coordinator doll;

			private PlayerOrgans <organs>5__1;

			private PlayerProfile <profile>5__2;

			private bool <leftEye>5__3;

			private bool <rightEye>5__4;

			private bool <body>5__5;

			private bool <mouth>5__6;

			private OrganManager <mgr>5__7;

			private float <roll>5__8;

			private float <multiplier>5__9;

			private long <gainAmount>5__10;

			private MoneyManager <money>5__11;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DollRoutine>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<organs>5__1 = null;
				<profile>5__2 = null;
				<mgr>5__7 = null;
				<money>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_004e: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						((ConsumableItem)doll).DestroyItem();
						return false;
					}
					PlayerInventory networkHolder = ((Item)doll).NetworkHolder;
					<organs>5__1 = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerOrgans>() : null);
					PlayerInventory networkHolder2 = ((Item)doll).NetworkHolder;
					<profile>5__2 = ((networkHolder2 != null) ? ((Component)networkHolder2).GetComponent<PlayerProfile>() : null);
					if ((Object)(object)<organs>5__1 == (Object)null || (Object)(object)<profile>5__2 == (Object)null)
					{
						return false;
					}
					<leftEye>5__3 = PillsUse.GetField(<organs>5__1, "_localLeftEye");
					<rightEye>5__4 = PillsUse.GetField(<organs>5__1, "_localRightEye");
					<body>5__5 = PillsUse.GetField(<organs>5__1, "_localBody");
					<mouth>5__6 = PillsUse.GetField(<organs>5__1, "_localMouth");
					if (!<leftEye>5__3 && !<rightEye>5__4 && !<body>5__5 && !<mouth>5__6)
					{
						return false;
					}
					<mgr>5__7 = NetworkSingleton<OrganManager>.Instance;
					<roll>5__8 = Random.value;
					if (<roll>5__8 <= 0.8f)
					{
						<mgr>5__7.ServerToggleOrgan(<organs>5__1, (OrganType)0, false);
						<mgr>5__7.ServerToggleOrgan(<organs>5__1, (OrganType)1, false);
						<mgr>5__7.ServerToggleOrgan(<organs>5__1, (OrganType)2, false);
						<mgr>5__7.ServerToggleOrgan(<organs>5__1, (OrganType)3, false);
					}
					else
					{
						<multiplier>5__9 = NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(<profile>5__2.steamId, (PlayerUpgradeType)2);
						<gainAmount>5__10 = (long)((float)NetworkSingleton<GameManager>.Instance.currentQuota * <multiplier>5__9);
						<money>5__11 = NetworkSingleton<MoneyManager>.Instance;
						if ((Object)(object)<money>5__11 != (Object)null)
						{
							<money>5__11.TryChangeBalance(<gainAmount>5__10, <profile>5__2, (ChangeType)4);
						}
						<money>5__11 = null;
					}
					((ConsumableItem)doll).DestroyItem();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPrefix]
		public static bool Prefix(Coordinator __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("voodoo doll"))
			{
				((MonoBehaviour)__instance).StartCoroutine(DollRoutine(__instance));
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<DollRoutine>d__1))]
		private static IEnumerator DollRoutine(Coordinator doll)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DollRoutine>d__1(0)
			{
				doll = doll
			};
		}
	}
	[HarmonyPatch(typeof(Drink), "OnUseItem")]
	public static class BlindLuckUse
	{
		[CompilerGenerated]
		private sealed class <BlindRoutine>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Drink drink;

			private PlayerOrgans <organs>5__1;

			private OrganManager <mgr>5__2;

			private PlayerProfile <profile>5__3;

			private PlayerBuff <buff>5__4;

			private float <multiplier>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <BlindRoutine>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<organs>5__1 = null;
				<mgr>5__2 = null;
				<profile>5__3 = null;
				<buff>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					PlayerInventory networkHolder = ((Item)drink).NetworkHolder;
					<organs>5__1 = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerOrgans>() : null);
					if ((Object)(object)<organs>5__1 == (Object)null)
					{
						return false;
					}
					NetworkSingleton<OrganManager>.Instance.ServerToggleOrgan(<organs>5__1, (OrganType)0, false);
					NetworkSingleton<OrganManager>.Instance.ServerToggleOrgan(<organs>5__1, (OrganType)1, false);
					<mgr>5__2 = NetworkSingleton<OrganManager>.Instance;
					<mgr>5__2.ServerToggleOrgan(<organs>5__1, (OrganType)0, false);
					<mgr>5__2.ServerToggleOrgan(<organs>5__1, (OrganType)1, false);
					PlayerInventory networkHolder2 = ((Item)drink).NetworkHolder;
					<profile>5__3 = ((networkHolder2 != null) ? ((Component)networkHolder2).GetComponent<PlayerProfile>() : null);
					PlayerInventory networkHolder3 = ((Item)drink).NetworkHolder;
					<buff>5__4 = ((networkHolder3 != null) ? ((Component)networkHolder3).GetComponent<PlayerBuff>() : null);
					if ((Object)(object)<profile>5__3 != (Object)null && (Object)(object)<buff>5__4 != (Object)null)
					{
						<multiplier>5__5 = NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(<profile>5__3.steamId, (PlayerUpgradeType)2);
						<buff>5__4.ApplyBuff((PlayerBuffType)0, 1.5f * <multiplier>5__5, 9999f);
					}
					((ConsumableItem)drink).DestroyItem();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly FieldRef<Drink, Animator> AnimRef = AccessTools.FieldRefAccess<Drink, Animator>("anim");

		private static readonly FieldRef<Drink, SFXComponent> CantDrinkSfxRef = AccessTools.FieldRefAccess<Drink, SFXComponent>("cantDrinkSfx");

		private static readonly FieldRef<Drink, Coroutine> DrinkRoutineRef = AccessTools.FieldRefAccess<Drink, Coroutine>("_drinkRoutine");

		[HarmonyPrefix]
		public static bool Prefix(Drink __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("blind luck"))
			{
				BlindUse(__instance, isPressed);
				return false;
			}
			return true;
		}

		private static void BlindUse(Drink drink, bool isPressed)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "HomeScene")
			{
				((ConsumableItem)drink).DestroyItem();
				return;
			}
			PlayerInventory networkHolder = ((Item)drink).NetworkHolder;
			PlayerOrgans val = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerOrgans>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			bool field = PillsUse.GetField(val, "_localLeftEye");
			bool field2 = PillsUse.GetField(val, "_localRightEye");
			if (!field || !field2)
			{
				SFXComponent obj = CantDrinkSfxRef.Invoke(drink);
				if (obj != null)
				{
					obj.PlayOneShotAttached();
				}
				return;
			}
			AnimRef.Invoke(drink).SetBool("IsDrinking", isPressed);
			if (NetworkServer.active)
			{
				Coroutine val2 = DrinkRoutineRef.Invoke(drink);
				if (val2 != null)
				{
					((MonoBehaviour)drink).StopCoroutine(val2);
				}
				if (isPressed)
				{
					Coroutine val3 = ((MonoBehaviour)drink).StartCoroutine(BlindRoutine(drink));
					DrinkRoutineRef.Invoke(drink) = val3;
				}
			}
		}

		[IteratorStateMachine(typeof(<BlindRoutine>d__5))]
		private static IEnumerator BlindRoutine(Drink drink)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <BlindRoutine>d__5(0)
			{
				drink = drink
			};
		}
	}
	[HarmonyPatch(typeof(Microphone), "OnUseItem")]
	public static class EnergyDrinkUse
	{
		[HarmonyPatch(typeof(Microphone), "OnPickedUp")]
		public static class MicrophonePickupPatch
		{
			[HarmonyPrefix]
			public static bool Prefix(Microphone __instance, PlayerInventory playerInventory)
			{
				string text = ((Object)((Component)__instance).gameObject).name.ToLower();
				if (text.Contains("energy drink"))
				{
					return false;
				}
				return true;
			}
		}

		[CompilerGenerated]
		private sealed class <EnergyDrinkRoutine>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public float stakeholderMultiplier;

			private float <finalSpeedMultiplier>5__1;

			private float <finalDuration>5__2;

			private float <effectiveMultiplier>5__3;

			private Dictionary<Slots, (float duration, int count)> <slotsOriginalValues>5__4;

			private Dictionary<Wheel, float> <wheelOriginalDurations>5__5;

			private Dictionary<RouletteWheel, float> <rouletteOriginalDurations>5__6;

			private Dictionary<RouletteWheel, float> <rouletteOriginalBallDropDurations>5__7;

			private Slots[] <allSlots>5__8;

			private Wheel[] <allWheels>5__9;

			private RouletteWheel[] <allRouletteWheels>5__10;

			private float <startTime>5__11;

			private Slots[] <>s__12;

			private int <>s__13;

			private Slots <slot>5__14;

			private FieldInfo <durationField>5__15;

			private FieldInfo <countField>5__16;

			private float <originalDuration>5__17;

			private int <originalCount>5__18;

			private float <newDuration>5__19;

			private int <newCount>5__20;

			private Wheel[] <>s__21;

			private int <>s__22;

			private Wheel <wheel>5__23;

			private FieldInfo <spinDurationField>5__24;

			private float <originalDuration>5__25;

			private float <newDuration>5__26;

			private RouletteWheel[] <>s__27;

			private int <>s__28;

			private RouletteWheel <wheel>5__29;

			private FieldInfo <spinDurationField>5__30;

			private FieldInfo <ballDropDurationField>5__31;

			private float <originalSpinDuration>5__32;

			private float <newSpinDuration>5__33;

			private float <originalBallDropDuration>5__34;

			private float <newBallDropDuration>5__35;

			private Dictionary<Slots, (float duration, int count)>.Enumerator <>s__36;

			private KeyValuePair<Slots, (float duration, int count)> <kvp>5__37;

			private FieldInfo <durationField>5__38;

			private FieldInfo <countField>5__39;

			private Dictionary<Wheel, float>.Enumerator <>s__40;

			private KeyValuePair<Wheel, float> <kvp>5__41;

			private FieldInfo <spinDurationField>5__42;

			private Dictionary<RouletteWheel, float>.Enumerator <>s__43;

			private KeyValuePair<RouletteWheel, float> <kvp>5__44;

			private FieldInfo <spinDurationField>5__45;

			private Dictionary<RouletteWheel, float>.Enumerator <>s__46;

			private KeyValuePair<RouletteWheel, float> <kvp>5__47;

			private FieldInfo <ballDropDurationField>5__48;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <EnergyDrinkRoutine>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<slotsOriginalValues>5__4 = null;
				<wheelOriginalDurations>5__5 = null;
				<rouletteOriginalDurations>5__6 = null;
				<rouletteOriginalBallDropDurations>5__7 = null;
				<allSlots>5__8 = null;
				<allWheels>5__9 = null;
				<allRouletteWheels>5__10 = null;
				<>s__12 = null;
				<slot>5__14 = null;
				<durationField>5__15 = null;
				<countField>5__16 = null;
				<>s__21 = null;
				<wheel>5__23 = null;
				<spinDurationField>5__24 = null;
				<>s__27 = null;
				<wheel>5__29 = null;
				<spinDurationField>5__30 = null;
				<ballDropDurationField>5__31 = null;
				<>s__36 = default(Dictionary<Slots, (float, int)>.Enumerator);
				<kvp>5__37 = default(KeyValuePair<Slots, (float, int)>);
				<durationField>5__38 = null;
				<countField>5__39 = null;
				<>s__40 = default(Dictionary<Wheel, float>.Enumerator);
				<kvp>5__41 = default(KeyValuePair<Wheel, float>);
				<spinDurationField>5__42 = null;
				<>s__43 = default(Dictionary<RouletteWheel, float>.Enumerator);
				<kvp>5__44 = default(KeyValuePair<RouletteWheel, float>);
				<spinDurationField>5__45 = null;
				<>s__46 = default(Dictionary<RouletteWheel, float>.Enumerator);
				<kvp>5__47 = default(KeyValuePair<RouletteWheel, float>);
				<ballDropDurationField>5__48 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Expected O, but got Unknown
				//IL_004e: 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_05f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05fb: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						return false;
					}
					<finalSpeedMultiplier>5__1 = _speedMultiplier * stakeholderMultiplier;
					<finalDuration>5__2 = _boostDuration;
					<effectiveMultiplier>5__3 = <finalSpeedMultiplier>5__1;
					<slotsOriginalValues>5__4 = new Dictionary<Slots, (float, int)>();
					<wheelOriginalDurations>5__5 = new Dictionary<Wheel, float>();
					<rouletteOriginalDurations>5__6 = new Dictionary<RouletteWheel, float>();
					<rouletteOriginalBallDropDurations>5__7 = new Dictionary<RouletteWheel, float>();
					<allSlots>5__8 = Object.FindObjectsByType<Slots>((FindObjectsSortMode)0);
					<>s__12 = <allSlots>5__8;
					for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++)
					{
						<slot>5__14 = <>s__12[<>s__13];
						if ((Object)(object)<slot>5__14 != (Object)null)
						{
							<durationField>5__15 = typeof(Slots).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							<countField>5__16 = typeof(Slots).GetField("spinCount", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<durationField>5__15 != null && <countField>5__16 != null)
							{
								<originalDuration>5__17 = (float)<durationField>5__15.GetValue(<slot>5__14);
								<originalCount>5__18 = (int)<countField>5__16.GetValue(<slot>5__14);
								<slotsOriginalValues>5__4[<slot>5__14] = (<originalDuration>5__17, <originalCount>5__18);
								<newDuration>5__19 = <originalDuration>5__17 / <effectiveMultiplier>5__3;
								<newCount>5__20 = Mathf.RoundToInt((float)<originalCount>5__18 * <effectiveMultiplier>5__3);
								<newDuration>5__19 = Mathf.Clamp(<newDuration>5__19, 0.5f, 10f);
								<newCount>5__20 = Mathf.Clamp(<newCount>5__20, 5, 100);
								<durationField>5__15.SetValue(<slot>5__14, <newDuration>5__19);
								<countField>5__16.SetValue(<slot>5__14, <newCount>5__20);
							}
							<durationField>5__15 = null;
							<countField>5__16 = null;
						}
						<slot>5__14 = null;
					}
					<>s__12 = null;
					<allWheels>5__9 = Object.FindObjectsByType<Wheel>((FindObjectsSortMode)0);
					<>s__21 = <allWheels>5__9;
					for (<>s__22 = 0; <>s__22 < <>s__21.Length; <>s__22++)
					{
						<wheel>5__23 = <>s__21[<>s__22];
						if ((Object)(object)<wheel>5__23 != (Object)null && !(<wheel>5__23 is RouletteWheel))
						{
							<spinDurationField>5__24 = typeof(Wheel).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<spinDurationField>5__24 != null)
							{
								<originalDuration>5__25 = (float)<spinDurationField>5__24.GetValue(<wheel>5__23);
								<wheelOriginalDurations>5__5[<wheel>5__23] = <originalDuration>5__25;
								<newDuration>5__26 = <originalDuration>5__25 / <effectiveMultiplier>5__3;
								<newDuration>5__26 = Mathf.Clamp(<newDuration>5__26, 1f, 10f);
								<spinDurationField>5__24.SetValue(<wheel>5__23, <newDuration>5__26);
							}
							<spinDurationField>5__24 = null;
						}
						<wheel>5__23 = null;
					}
					<>s__21 = null;
					<allRouletteWheels>5__10 = Object.FindObjectsByType<RouletteWheel>((FindObjectsSortMode)0);
					<>s__27 = <allRouletteWheels>5__10;
					for (<>s__28 = 0; <>s__28 < <>s__27.Length; <>s__28++)
					{
						<wheel>5__29 = <>s__27[<>s__28];
						if ((Object)(object)<wheel>5__29 != (Object)null)
						{
							<spinDurationField>5__30 = typeof(Wheel).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							<ballDropDurationField>5__31 = typeof(RouletteWheel).GetField("ballDropDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<spinDurationField>5__30 != null)
							{
								<originalSpinDuration>5__32 = (float)<spinDurationField>5__30.GetValue(<wheel>5__29);
								<rouletteOriginalDurations>5__6[<wheel>5__29] = <originalSpinDuration>5__32;
								<newSpinDuration>5__33 = <originalSpinDuration>5__32 / <effectiveMultiplier>5__3;
								<newSpinDuration>5__33 = Mathf.Clamp(<newSpinDuration>5__33, 1f, 15f);
								<spinDurationField>5__30.SetValue(<wheel>5__29, <newSpinDuration>5__33);
							}
							if (<ballDropDurationField>5__31 != null)
							{
								<originalBallDropDuration>5__34 = (float)<ballDropDurationField>5__31.GetValue(<wheel>5__29);
								<rouletteOriginalBallDropDurations>5__7[<wheel>5__29] = <originalBallDropDuration>5__34;
								<newBallDropDuration>5__35 = <originalBallDropDuration>5__34 / <effectiveMultiplier>5__3;
								<newBallDropDuration>5__35 = Mathf.Clamp(<newBallDropDuration>5__35, 0.3f, 3f);
								<ballDropDurationField>5__31.SetValue(<wheel>5__29, <newBallDropDuration>5__35);
							}
							<spinDurationField>5__30 = null;
							<ballDropDurationField>5__31 = null;
						}
						<wheel>5__29 = null;
					}
					<>s__27 = null;
					<startTime>5__11 = Time.time;
					break;
				}
				case 2:
					<>1__state = -1;
					break;
				}
				if (Time.time - <startTime>5__11 < <finalDuration>5__2)
				{
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 2;
					return true;
				}
				<>s__36 = <slotsOriginalValues>5__4.GetEnumerator();
				try
				{
					while (<>s__36.MoveNext())
					{
						<kvp>5__37 = <>s__36.Current;
						if ((Object)(object)<kvp>5__37.Key != (Object)null)
						{
							<durationField>5__38 = typeof(Slots).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							<countField>5__39 = typeof(Slots).GetField("spinCount", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<durationField>5__38 != null && <countField>5__39 != null)
							{
								<durationField>5__38.SetValue(<kvp>5__37.Key, <kvp>5__37.Value.duration);
								<countField>5__39.SetValue(<kvp>5__37.Key, <kvp>5__37.Value.count);
							}
							<durationField>5__38 = null;
							<countField>5__39 = null;
						}
						<kvp>5__37 = default(KeyValuePair<Slots, (float, int)>);
					}
				}
				finally
				{
					((IDisposable)<>s__36).Dispose();
				}
				<>s__36 = default(Dictionary<Slots, (float, int)>.Enumerator);
				<>s__40 = <wheelOriginalDurations>5__5.GetEnumerator();
				try
				{
					while (<>s__40.MoveNext())
					{
						<kvp>5__41 = <>s__40.Current;
						if ((Object)(object)<kvp>5__41.Key != (Object)null)
						{
							<spinDurationField>5__42 = typeof(Wheel).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<spinDurationField>5__42 != null)
							{
								<spinDurationField>5__42.SetValue(<kvp>5__41.Key, <kvp>5__41.Value);
							}
							<spinDurationField>5__42 = null;
						}
						<kvp>5__41 = default(KeyValuePair<Wheel, float>);
					}
				}
				finally
				{
					((IDisposable)<>s__40).Dispose();
				}
				<>s__40 = default(Dictionary<Wheel, float>.Enumerator);
				<>s__43 = <rouletteOriginalDurations>5__6.GetEnumerator();
				try
				{
					while (<>s__43.MoveNext())
					{
						<kvp>5__44 = <>s__43.Current;
						if ((Object)(object)<kvp>5__44.Key != (Object)null)
						{
							<spinDurationField>5__45 = typeof(Wheel).GetField("spinDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<spinDurationField>5__45 != null)
							{
								<spinDurationField>5__45.SetValue(<kvp>5__44.Key, <kvp>5__44.Value);
							}
							<spinDurationField>5__45 = null;
						}
						<kvp>5__44 = default(KeyValuePair<RouletteWheel, float>);
					}
				}
				finally
				{
					((IDisposable)<>s__43).Dispose();
				}
				<>s__43 = default(Dictionary<RouletteWheel, float>.Enumerator);
				<>s__46 = <rouletteOriginalBallDropDurations>5__7.GetEnumerator();
				try
				{
					while (<>s__46.MoveNext())
					{
						<kvp>5__47 = <>s__46.Current;
						if ((Object)(object)<kvp>5__47.Key != (Object)null)
						{
							<ballDropDurationField>5__48 = typeof(RouletteWheel).GetField("ballDropDuration", BindingFlags.Instance | BindingFlags.NonPublic);
							if (<ballDropDurationField>5__48 != null)
							{
								<ballDropDurationField>5__48.SetValue(<kvp>5__47.Key, <kvp>5__47.Value);
							}
							<ballDropDurationField>5__48 = null;
						}
						<kvp>5__47 = default(KeyValuePair<RouletteWheel, float>);
					}
				}
				finally
				{
					((IDisposable)<>s__46).Dispose();
				}
				<>s__46 = default(Dictionary<RouletteWheel, float>.Enumerator);
				_activeBoostCoroutine = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static float _speedMultiplier = 3f;

		private static float _boostDuration = 90f;

		private static Coroutine _activeBoostCoroutine = null;

		[HarmonyPrefix]
		public static bool Prefix(Microphone __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("energy drink"))
			{
				if (isPressed && NetworkServer.active)
				{
					PlayerInventory networkHolder = ((Item)__instance).NetworkHolder;
					PlayerProfile val = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerProfile>() : null);
					float stakeholderMultiplier = 1f;
					if ((Object)(object)val != (Object)null)
					{
						stakeholderMultiplier = NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(val.steamId, (PlayerUpgradeType)2);
					}
					if (_activeBoostCoroutine != null)
					{
						GameManager instance = NetworkSingleton<GameManager>.Instance;
						if (instance != null)
						{
							((MonoBehaviour)instance).StopCoroutine(_activeBoostCoroutine);
						}
					}
					GameManager instance2 = NetworkSingleton<GameManager>.Instance;
					_activeBoostCoroutine = ((instance2 != null) ? ((MonoBehaviour)instance2).StartCoroutine(EnergyDrinkRoutine(stakeholderMultiplier)) : null);
					((ConsumableItem)__instance).DestroyItem();
				}
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<EnergyDrinkRoutine>d__5))]
		private static IEnumerator EnergyDrinkRoutine(float stakeholderMultiplier)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EnergyDrinkRoutine>d__5(0)
			{
				stakeholderMultiplier = stakeholderMultiplier
			};
		}
	}
	[HarmonyPatch(typeof(MysteryBox), "GetRandomSpawnableByWeight")]
	public static class MysteryBoxIncludeModdedItemsPatch
	{
		private class ModdedItemWeight
		{
			public string ItemName { get; }

			public float Weight { get; }

			public ModdedItemWeight(string itemName, float weight)
			{
				ItemName = itemName;
				Weight = weight;
			}
		}

		private static List<ModdedItemWeight> _cachedModdedItems;

		private static MethodInfo _getSeededRandomMethod;

		private static readonly ModdedItemWeight[] CUSTOM_WEIGHTS;

		static MysteryBoxIncludeModdedItemsPatch()
		{
			CUSTOM_WEIGHTS = new ModdedItemWeight[8]
			{
				new ModdedItemWeight("Cursed Coin", 2.5f),
				new ModdedItemWeight("R Key", 0.5f),
				new ModdedItemWeight("Experimental Pills", 1.2f),
				new ModdedItemWeight("Tax Fraud", 1.2f),
				new ModdedItemWeight("Voodoo Doll", 1.5f),
				new ModdedItemWeight("Debt Contract", 1f),
				new ModdedItemWeight("Energy Drink", 2f),
				new ModdedItemWeight("Blind Luck", 0.9f)
			};
			CacheModdedSpawnables();
			_getSeededRandomMethod = AccessTools.Method(typeof(MysteryBox), "GetSeededRandom", (Type[])null, (Type[])null);
		}

		private static void CacheModdedSpawnables()
		{
			_cachedModdedItems = new List<ModdedItemWeight>();
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (!assembly.GetName().Name.Contains("TryConnect"))
				{
					continue;
				}
				Type type = assembly.GetType("TryConnect.RuntimeItemRegistry");
				if (!(type != null))
				{
					continue;
				}
				MethodInfo methodInfo = AccessTools.Method(type, "GetRegisteredItemInfos", (Type[])null, (Type[])null);
				if (!(methodInfo != null) || !(methodInfo.Invoke(null, null) is Array array))
				{
					break;
				}
				{
					foreach (object item in array)
					{
						PropertyInfo property = item.GetType().GetProperty("Spawnable");
						PropertyInfo property2 = item.GetType().GetProperty("IsRegistered");
						if (!(property != null) || !(property2 != null))
						{
							continue;
						}
						bool flag = (bool)property2.GetValue(item);
						object? value = property.GetValue(item);
						SpawnableSO val = (SpawnableSO)((value is SpawnableSO) ? value : null);
						if (flag && (Object)(object)val != (Object)null && !val.spawnableName.Contains("Ticket Fizz") && !val.spawnableName.Contains("Loaded Chip"))
						{
							float customWeight = GetCustomWeight(val.spawnableName);
							if (customWeight > 0f)
							{
								_cachedModdedItems.Add(new ModdedItemWeight(val.spawnableName, customWeight));
							}
							else
							{
								Debug.Log((object)("[Armory] Skipped " + val.spawnableName + " - no custom weight defined"));
							}
						}
					}
					break;
				}
			}
		}

		private static float GetCustomWeight(string itemName)
		{
			return CUSTOM_WEIGHTS.FirstOrDefault((ModdedItemWeight w) => w.ItemName == itemName)?.Weight ?? (-1f);
		}

		[HarmonyPrefix]
		public static bool Prefix(MysteryBox __instance, ref SpawnableSO __result)
		{
			//IL_00a8: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_0167: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo fieldInfo = AccessTools.Field(typeof(MysteryBox), "spawnableList");
			if (!(fieldInfo.GetValue(__instance) is List<SpawnableEntry> list) || list.Count == 0)
			{
				return true;
			}
			if (_cachedModdedItems != null && _cachedModdedItems.Count > 0)
			{
				List<SpawnableEntry> list2 = new List<SpawnableEntry>();
				list2.AddRange(list);
				foreach (ModdedItemWeight cachedModdedItem in _cachedModdedItems)
				{
					SpawnableSO val = FindSpawnableByName(cachedModdedItem.ItemName);
					if ((Object)(object)val != (Object)null)
					{
						list2.Add(new SpawnableEntry
						{
							spawnable = val,
							chanceWeight = cachedModdedItem.Weight
						});
					}
				}
				float num = list2.Sum((SpawnableEntry e) => e.chanceWeight);
				Random random = _getSeededRandomMethod.Invoke(__instance, null) as Random;
				float num2 = (float)random.NextDouble() * num;
				foreach (SpawnableEntry item in list2)
				{
					num2 -= item.chanceWeight;
					if (num2 <= 0f)
					{
						__result = item.spawnable;
						return false;
					}
				}
			}
			return true;
		}

		private static SpawnableSO FindSpawnableByName(string name)
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				if (!assembly.GetName().Name.Contains("TryConnect"))
				{
					continue;
				}
				Type type = assembly.GetType("TryConnect.RuntimeItemRegistry");
				if (!(type != null))
				{
					continue;
				}
				MethodInfo methodInfo = AccessTools.Method(type, "GetRegisteredItemInfos", (Type[])null, (Type[])null);
				if (!(methodInfo != null) || !(methodInfo.Invoke(null, null) is Array array))
				{
					continue;
				}
				foreach (object item in array)
				{
					object? obj = item.GetType().GetProperty("Spawnable")?.GetValue(item);
					SpawnableSO val = (SpawnableSO)((obj is SpawnableSO) ? obj : null);
					if ((Object)(object)val != (Object)null && val.spawnableName == name)
					{
						return val;
					}
				}
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(Taser), "OnUseItem")]
	public static class TaxFraudUse
	{
		[CompilerGenerated]
		private sealed class <TaxesRoutine>d__1 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Taser taxes;

			private PlayerProfile <profile>5__1;

			private float <roll>5__2;

			private float <multiplier>5__3;

			private long <removeAmount>5__4;

			private MoneyManager <money>5__5;

			private GameManager <gm>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TaxesRoutine>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<profile>5__1 = null;
				<money>5__5 = null;
				<gm>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_004e: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						((ConsumableItem)taxes).DestroyItem();
						return false;
					}
					PlayerInventory networkHolder = ((Item)taxes).NetworkHolder;
					<profile>5__1 = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerProfile>() : null);
					<roll>5__2 = Random.value;
					<multiplier>5__3 = NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(<profile>5__1.steamId, (PlayerUpgradeType)2);
					<removeAmount>5__4 = (long)((float)NetworkSingleton<GameManager>.Instance.currentQuota * Mathf.Clamp(<multiplier>5__3 * 0.2f, 0.2f, 0.75f));
					<money>5__5 = NetworkSingleton<MoneyManager>.Instance;
					<gm>5__6 = NetworkSingleton<GameManager>.Instance;
					<gm>5__6.NetworkcurrentQuota = Math.Max(0L, <gm>5__6.NetworkcurrentQuota - <removeAmount>5__4);
					if ((double)<roll>5__2 <= 0.05)
					{
						<money>5__5.TryChangeBalance(-NetworkSingleton<MoneyManager>.Instance.balance, <profile>5__1, (ChangeType)4);
					}
					RefreshAllKeypadMinMaxBetTexts();
					((ConsumableItem)taxes).DestroyItem();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPrefix]
		public static bool Prefix(Taser __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("tax fraud"))
			{
				((MonoBehaviour)__instance).StartCoroutine(TaxesRoutine(__instance));
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<TaxesRoutine>d__1))]
		private static IEnumerator TaxesRoutine(Taser taxes)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TaxesRoutine>d__1(0)
			{
				taxes = taxes
			};
		}

		private static void RefreshAllKeypadMinMaxBetTexts()
		{
			Keypad[] array = Object.FindObjectsByType<Keypad>((FindObjectsSortMode)0);
			Keypad[] array2 = array;
			foreach (Keypad val in array2)
			{
				if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled && (Object)(object)val.NetworkcasinoGame != (Object)null)
				{
					long minBet = val.NetworkcasinoGame.MinBet;
					long maxBet = val.NetworkcasinoGame.MaxBet;
					val.ServerUpdateMinMaxBetText(minBet, maxBet);
				}
			}
		}
	}
	[HarmonyPatch(typeof(TimeMachine), "OnUseItem")]
	public static class DebtContractUse
	{
		[HarmonyPatch(typeof(GameManager), "ProgressNextQuota")]
		private class Patch_ProgressNextQuota
		{
			private static void Postfix()
			{
				MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
				instance.TryChangeBalance(-(long)((float)ToPay * 1.5f), (PlayerProfile)null, (ChangeType)4);
				ToPay = 0L;
			}
		}

		[CompilerGenerated]
		private sealed class <debtRoutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public TimeMachine debt;

			private PlayerProfile <profile>5__1;

			private float <multiplier>5__2;

			private long <giveAmount>5__3;

			private MoneyManager <money>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <debtRoutine>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<profile>5__1 = null;
				<money>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_004e: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						((ConsumableItem)debt).DestroyItem();
						return false;
					}
					PlayerInventory networkHolder = ((Item)debt).NetworkHolder;
					<profile>5__1 = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerProfile>() : null);
					<multiplier>5__2 = NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(<profile>5__1.steamId, (PlayerUpgradeType)2);
					<giveAmount>5__3 = (long)((float)(NetworkSingleton<GameManager>.Instance.currentQuota / 100 * 25) * <multiplier>5__2);
					<money>5__4 = NetworkSingleton<MoneyManager>.Instance;
					if ((Object)(object)<money>5__4 != (Object)null)
					{
						<money>5__4.TryChangeBalance(<giveAmount>5__3, <profile>5__1, (ChangeType)4);
						ToPay += <giveAmount>5__3;
					}
					((ConsumableItem)debt).DestroyItem();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static long ToPay;

		[HarmonyPrefix]
		public static bool Prefix(TimeMachine __instance, bool isPressed)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("debt contract"))
			{
				((MonoBehaviour)__instance).StartCoroutine(debtRoutine(__instance));
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<debtRoutine>d__2))]
		private static IEnumerator debtRoutine(TimeMachine debt)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <debtRoutine>d__2(0)
			{
				debt = debt
			};
		}
	}
	[HarmonyPatch(typeof(Upgrade), "UseRoutine")]
	public static class PillsUse
	{
		[CompilerGenerated]
		private sealed class <PillsRoutine>d__1 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public Upgrade item;

			private PlayerOrgans <organs>5__1;

			private PlayerOrganData <state>5__2;

			private bool <hasMissing>5__3;

			private float <roll>5__4;

			private OrganManager <mgr>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PillsRoutine>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<organs>5__1 = null;
				<state>5__2 = null;
				<mgr>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSecondsRealtime(0.05f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "HomeScene")
					{
						((ConsumableItem)item).DestroyItem();
						return false;
					}
					if (!NetworkServer.active)
					{
						return false;
					}
					PlayerInventory networkHolder = ((Item)item).NetworkHolder;
					<organs>5__1 = ((networkHolder != null) ? ((Component)networkHolder).GetComponent<PlayerOrgans>() : null);
					if ((Object)(object)<organs>5__1 == (Object)null)
					{
						return false;
					}
					<state>5__2 = GetCurrentState(<organs>5__1);
					<hasMissing>5__3 = !<state>5__2.leftEye || !<state>5__2.rightEye || !<state>5__2.body || !<state>5__2.mouth;
					if (!<hasMissing>5__3)
					{
						return false;
					}
					<roll>5__4 = Random.value;
					if (<roll>5__4 < 0.7f)
					{
						Repair(<state>5__2);
					}
					else
					{
						Remove(<state>5__2);
					}
					<organs>5__1.ServerSetBodyParts(<state>5__2);
					<mgr>5__5 = NetworkSingleton<OrganManager>.Instance;
					<mgr>5__5.ServerToggleOrgan(<organs>5__1, (OrganType)0, <state>5__2.leftEye);
					<mgr>5__5.ServerToggleOrgan(<organs>5__1, (OrganType)1, <state>5__2.rightEye);
					<mgr>5__5.ServerToggleOrgan(<organs>5__1, (OrganType)2, <state>5__2.body);
					<mgr>5__5.ServerToggleOrgan(<organs>5__1, (OrganType)3, <state>5__2.mouth);
					((ConsumableItem)item).DestroyItem();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPrefix]
		public static bool Prefix(Upgrade __instance, ref IEnumerator __result)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("experimental pills"))
			{
				__result = PillsRoutine(__instance);
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<PillsRoutine>d__1))]
		private static IEnumerator PillsRoutine(Upgrade item)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PillsRoutine>d__1(0)
			{
				item = item
			};
		}

		public static bool GetField(PlayerOrgans obj, string field)
		{
			FieldInfo field2 = typeof(PlayerOrgans).GetField(field, BindingFlags.Instance | BindingFlags.NonPublic);
			return (bool)field2.GetValue(obj);
		}

		private static PlayerOrganData GetCurrentState(PlayerOrgans organs)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			return new PlayerOrganData
			{
				leftEye = GetField(organs, "_localLeftEye"),
				rightEye = GetField(organs, "_localRightEye"),
				body = GetField(organs, "_localBody"),
				mouth = GetField(organs, "_localMouth")
			};
		}

		private static void Repair(PlayerOrganData d)
		{
			List<Action> list = new List<Action>();
			if (!d.mouth)
			{
				list.Add(delegate
				{
					d.mouth = true;
				});
			}
			if (!d.body)
			{
				list.Add(delegate
				{
					d.body = true;
				});
			}
			if (!d.leftEye)
			{
				list.Add(delegate
				{
					d.leftEye = true;
				});
			}
			if (!d.rightEye)
			{
				list.Add(delegate
				{
					d.rightEye = true;
				});
			}
			if (list.Count != 0)
			{
				list[Random.Range(0, list.Count)]();
			}
		}

		private static void Remove(PlayerOrganData d)
		{
			List<Action> list = new List<Action>();
			bool flag = d.leftEye || d.rightEye;
			bool flag2 = d.mouth || d.body;
			if (d.mouth)
			{
				list.Add(delegate
				{
					d.mouth = false;
				});
			}
			if (d.body)
			{
				list.Add(delegate
				{
					d.body = false;
				});
			}
			if (flag)
			{
				if (d.leftEye && d.rightEye)
				{
					list.Add(delegate
					{
						if (Random.value < 0.5f)
						{
							d.leftEye = false;
						}
						else
						{
							d.rightEye = false;
						}
					});
				}
				else if (!flag2)
				{
					if (d.leftEye)
					{
						list.Add(delegate
						{
							d.leftEye = false;
						});
					}
					if (d.rightEye)
					{
						list.Add(delegate
						{
							d.rightEye = false;
						});
					}
				}
			}
			if (list.Count != 0)
			{
				list[Random.Range(0, list.Count)]();
			}
		}
	}
	[HarmonyPatch(typeof(GoldenChip), "ApplyChipRoutine")]
	public static class CursedCoinUse
	{
		[CompilerGenerated]
		private sealed class <CursedRoutine>d__3 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GoldenChip chip;

			private GameBase <game>5__1;

			private int <uses>5__2;

			private bool <cursed>5__3;

			private long <loseAmount>5__4;

			private MoneyManager <money>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CursedRoutine>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<game>5__1 = null;
				<money>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<game>5__1 = chip.Network_targetGame;
					if ((Object)(object)<game>5__1 == (Object)null)
					{
						return false;
					}
					if (!CursedUses.ContainsKey(chip))
					{
						CursedUses[chip] = 3;
					}
					<uses>5__2 = CursedUses[chip];
					<uses>5__2--;
					CursedUses[chip] = <uses>5__2;
					<cursed>5__3 = Random.value <= 0.25f;
					if (<cursed>5__3)
					{
						<loseAmount>5__4 = (long)((float)<game>5__1.MaxBet * 1.5f * NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(((Component)((Item)chip).NetworkHolder).GetComponent<PlayerProfile>().steamId, (PlayerUpgradeType)2));
						<money>5__5 = NetworkSingleton<MoneyManager>.Instance;
						if ((Object)(object)<money>5__5 != (Object)null && (Object)(object)((Item)chip).NetworkHolder != (Object)null)
						{
							<money>5__5.TryChangeBalance(-<loseAmount>5__4, ((Component)((Item)chip).NetworkHolder).GetComponent<PlayerProfile>(), (ChangeType)4);
						}
						((ConsumableItem)chip).DestroyItem();
						<money>5__5 = null;
					}
					else
					{
						<game>5__1.ServerSetBet(<game>5__1.MaxBet);
						<game>5__1.ApplyGoldenChip(NetworkSingleton<UpgradeManager>.Instance.GetUpgradeData(((Component)((Item)chip).NetworkHolder).GetComponent<PlayerProfile>().steamId, (PlayerUpgradeType)2));
					}
					((InteractableBase)chip).TooltipMessage = $"<color=#00ffcc>{<uses>5__2} Uses Left</color>";
					if (<uses>5__2 <= 0)
					{
						CursedUses.Remove(chip);
						((ConsumableItem)chip).DestroyItem();
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly Dictionary<GoldenChip, int> CursedUses = new Dictionary<GoldenChip, int>();

		private const int CursedMaxUses = 3;

		[HarmonyPrefix]
		public static bool Prefix(GoldenChip __instance, ref IEnumerator __result)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("cursed coin"))
			{
				__result = CursedRoutine(__instance);
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<CursedRoutine>d__3))]
		private static IEnumerator CursedRoutine(GoldenChip chip)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CursedRoutine>d__3(0)
			{
				chip = chip
			};
		}
	}
	[HarmonyPatch(typeof(InteractableBase), "get_InteractableName")]
	public static class InteractableNamePatch
	{
		public static bool Prefix(InteractableBase __instance, ref string __result)
		{
			string text = ((Object)((Component)__instance).gameObject).name.ToLower();
			if (text.Contains("cursed coin"))
			{
				__result = "Cursed Coin";
				return false;
			}
			if (text.Contains("experimental pills"))
			{
				__result = "Experimental Pills";
				return false;
			}
			if (text.Contains("blind luck"))
			{
				__result = "Blind Luck";
				return false;
			}
			if (text.Contains("voodoo doll"))
			{
				__result = "Voodoo Doll";
				return false;
			}
			if (text.Contains("tax fraud"))
			{
				__result = "Tax Fraud";
				return false;
			}
			if (text.Contains("energy drink"))
			{
				__result = "Energy Drink";
				return false;
			}
			if (text.Contains("debt contract"))
			{
				__result = "Debt Contract";
				return false;
			}
			if (text.Contains("r key"))
			{
				__result = "R Key";
				return false;
			}
			if (text.Contains("microphone"))
			{
				__result = "Microphone";
				return false;
			}
			return true;
		}
	}
}
namespace Items_Mod_For_Gamble.ModdedItem
{
	public sealed class RKey : AngelsReel
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class rKeyAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			AngelsReel val = (AngelsReel)(object)((__instance is AngelsReel) ? __instance : null);
			if (!((Object)(object)val == (Object)null))
			{
				string text = ((Object)((Component)val).gameObject).name.ToLower();
				if (text.Contains("r key") && ((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Restart";
				}
			}
		}
	}
	public sealed class EnergyDrink : Microphone
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class EnergyDrinkAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			Microphone val = (Microphone)(object)((__instance is Microphone) ? __instance : null);
			if (!((Object)(object)val == (Object)null))
			{
				string text = ((Object)((Component)val).gameObject).name.ToLower();
				if (text.Contains("energy drink") && ((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Consume";
				}
			}
		}
	}
	internal sealed class BlindLuck : Drink
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class BlindAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			Drink val = (Drink)(object)((__instance is Drink) ? __instance : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			if (text.Contains("blind luck"))
			{
				((InteractableBase)val).TooltipMessage = "Only works if you have both eyes";
				if (((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Scoop your eyes";
				}
				AccessTools.Field(typeof(Drink), "_canDrink").SetValue(val, true);
				AccessTools.Field(typeof(Drink), "_isBreakable").SetValue(val, false);
			}
		}
	}
	public sealed class CursedCoin : GoldenChip
	{
	}
	internal sealed class Experimental_Pills : Upgrade
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class PillAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			Upgrade val = (Upgrade)(object)((__instance is Upgrade) ? __instance : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			if (text.Contains("experimental pills"))
			{
				((InteractableBase)val).TooltipMessage = "Only works if you are missing body parts";
				if (((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Take a pill";
				}
			}
		}
	}
	internal sealed class TaxFraud : Taser
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class TaxAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			Taser val = (Taser)(object)((__instance is Taser) ? __instance : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			if (text.Contains("tax fraud"))
			{
				((InteractableBase)val).TooltipMessage = "Lose all cash when audited";
				if (((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Falsify Taxes";
				}
			}
		}
	}
	internal sealed class DebtContract : TimeMachine
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class DebtContractPatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			TimeMachine val = (TimeMachine)(object)((__instance is TimeMachine) ? __instance : null);
			if (!((Object)(object)val == (Object)null))
			{
				string text = ((Object)((Component)val).gameObject).name.ToLower();
				((InteractableBase)val).TooltipMessage = "Interest is 50%";
				if (text.Contains("debt contract") && ((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Sign";
				}
			}
		}
	}
	internal sealed class VoodooDoll : Coordinator
	{
	}
	[HarmonyPatch(typeof(Item), "OnAwake")]
	public static class DollAwakePatch
	{
		[HarmonyPostfix]
		private static void Postfix(Item __instance)
		{
			Coordinator val = (Coordinator)(object)((__instance is Coordinator) ? __instance : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			if (text.Contains("voodoo doll"))
			{
				((InteractableBase)val).TooltipMessage = "Only works if you have body parts to lose";
				if (((Item)val).itemActions != null && ((Item)val).itemActions.Count > 0)
				{
					((Item)val).itemActions.First().actionName = "Poke";
					((Item)val).itemActions.Last().actionName = "Throw";
					((Item)val).itemActions.RemoveAt(1);
				}
				AccessTools.Field(typeof(Coordinator), "_isBreakable").SetValue(val, false);
			}
		}
	}
}
namespace TimeMachineOrganPatch
{
	[HarmonyPatch(typeof(TimeMachine))]
	public static class TimeMachineOrganPatch
	{
		public static class CoroutineHelper
		{
			private class CoroutineRunner : MonoBehaviour
			{
			}

			private static MonoBehaviour _coroutineRunner;

			public static void Initialize()
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				if ((Object)(object)_coroutineRunner == (Object)null)
				{
					GameObject val = new GameObject("TimeMachineCoroutineRunner");
					Object.DontDestroyOnLoad((Object)(object)val);
					_coroutineRunner = (MonoBehaviour)(object)val.AddComponent<CoroutineRunner>();
					Debug.Log((object)"[TimeMachine] CoroutineHelper initialized");
				}
			}

			public static void RunCoroutine(IEnumerator coroutine)
			{
				if ((Object)(object)_coroutineRunner == (Object)null)
				{
					Debug.LogError((object)"[TimeMachine] CoroutineRunner is null! Cannot run coroutine.");
				}
				else
				{
					_coroutineRunner.StartCoroutine(coroutine);
				}
			}
		}

		[CompilerGenerated]
		private sealed class <RollbackBuffs>d__9 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public float rollbackSeconds;

			private PlayerBuff[] <allPlayerBuffs>5__1;

			private bool <anyRollbackPerformed>5__2;

			private PlayerBuff[] <>s__3;

			private int <>s__4;

			private PlayerBuff <playerBuff>5__5;

			private BuffHistoryTracker <historyComponent>5__6;

			private float <cutoffTime>5__7;

			private List<(float timestamp, Dictionary<PlayerBuffType, float> state)> <snapshots>5__8;

			private Dictionary<PlayerBuffType, float> <targetBuffState>5__9;

			private Dictionary<PlayerBuffType, float>.Enumerator <>s__10;

			private KeyValuePair<PlayerBuffType, float> <kvp>5__11;

			private float <currentValue>5__12;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RollbackBuffs>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<allPlayerBuffs>5__1 = null;
				<>s__3 = null;
				<playerBuff>5__5 = null;
				<historyComponent>5__6 = null;
				<snapshots>5__8 = null;
				<targetBuffState>5__9 = null;
				<>s__10 = default(Dictionary<PlayerBuffType, float>.Enumerator);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_016d: 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_01ef: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<allPlayerBuffs>5__1 = Object.FindObjectsByType<PlayerBuff>((FindObjectsSortMode)0);
					Debug.Log((object)$"[TimeMachine] Found {<allPlayerBuffs>5__1.Length} PlayerBuff components in scene");
					if (<allPlayerBuffs>5__1.Length == 0)
					{
						Debug.LogWarning((object)"[TimeMachine] No PlayerBuff components found!");
						return false;
					}
					<anyRollbackPerformed>5__2 = false;
					<>s__3 = <allPlayerBuffs>5__1;
					for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
					{
						<playerBuff>5__5 = <>s__3[<>s__4];
						<historyComponent>5__6 = ((Component)<playerBuff>5__5).GetComponent<BuffHistoryTracker>();
						if (!((Object)(object)<historyComponent>5__6 == (Object)null) && <historyComponent>5__6.IsTracking)
						{
							<cutoffTime>5__7 = Time.time - rollbackSeconds;
							<snapshots>5__8 = <historyComponent>5__6.GetSnapshotsSince(<cutoffTime>5__7);
							if (<snapshots>5__8 != null && <snapshots>5__8.Count != 0)
							{
								<targetBuffState>5__9 = <snapshots>5__8[0].state;
								<>s__10 = <targetBuffState>5__9.GetEnumerator();
								try
								{
									while (<>s__10.MoveNext())
									{
										<kvp>5__11 = <>s__10.Current;
										<currentValue>5__12 = GetBuffValue(<playerBuff>5__5, <kvp>5__11.Key);
										if (Mathf.Abs(<currentValue>5__12 - <kvp>5__11.Value) > 0.01f)
										{
											Debug.Log((object)$"[TimeMachine] ROLLING BACK buff {<kvp>5__11.Key} from {<currentValue>5__12} to {<kvp>5__11.Value}");
											<anyRollbackPerformed>5__2 = true;
											SetBuffValue(<playerBuff>5__5, <kvp>5__11.Key, <kvp>5__11.Value);
										}
									}
								}
								finally
								{
									((IDisposable)<>s__10).Dispose();
								}
								<>s__10 = default(Dictionary<PlayerBuffType, float>.Enumerator);
								<historyComponent>5__6 = null;
								<snapshots>5__8 = null;
								<targetBuffState>5__9 = null;
								<playerBuff>5__5 = null;
							}
						}
					}
					<>s__3 = null;
					if (!<anyRollbackPerformed>5__2)
					{
						Debug.Log((object)"[TimeMachine] No buff rollbacks were performed");
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <RollbackOrgans>d__8 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public float rollbackSeconds;

			private OrganManager <organManager>5__1;

			private PlayerOrgans[] <allPlayerOrgans>5__2;

			private bool <anyRollbackPerformed>5__3;

			private PlayerOrgans[] <>s__4;

			private int <>s__5;

			private PlayerOrgans <organs>5__6;

			private OrganHistoryTracker <historyComponent>5__7;

			private float <cutoffTime>5__8;

			private List<(float timestamp, PlayerOrganData state)> <snapshots>5__9;

			private PlayerOrganData <targetState>5__10;

			private PlayerOrganData <currentState>5__11;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RollbackOrgans>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<organManager>5__1 = null;
				<allPlayerOrgans>5__2 = null;
				<>s__4 = null;
				<organs>5__6 = null;
				<historyComponent>5__7 = null;
				<snapshots>5__9 = null;
				<targetState>5__10 = null;
				<currentState>5__11 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0248: Unknown result type (might be due to invalid IL or missing references)
				//IL_0252: Expected O, but got Unknown
				int num = <>1__state;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_0263;
				}
				<>1__state = -1;
				<organManager>5__1 = NetworkSingleton<OrganManager>.Instance;
				if ((Object)(object)<organManager>5__1 == (Object)null)
				{
					Debug.LogError((object)"[TimeMachine] OrganManager is null! Cannot rollback organs.");
					return false;
				}
				<allPlayerOrgans>5__2 = Object.FindObjectsByType<PlayerOrgans>((FindObjectsSortMode)0);
				Debug.Log((object)$"[TimeMachine] Found {<allPlayerOrgans>5__2.Length} PlayerOrgans in scene");
				if (<allPlayerOrgans>5__2.Length == 0)
				{
					Debug.LogWarning((object)"[TimeMachine] No PlayerOrgans found!");
					return false;
				}
				<anyRollbackPerformed>5__3 = false;
				<>s__4 = <allPlayerOrgans>5__2;
				<>s__5 = 0;
				goto IL_0295;
				IL_0263:
				<historyComponent>5__7 = null;
				<snapshots>5__9 = null;
				<targetState>5__10 = null;
				<currentState>5__11 = null;
				<organs>5__6 = null;
				goto IL_0287;
				IL_0295:
				if (<>s__5 < <>s__4.Length)
				{
					<organs>5__6 = <>s__4[<>s__5];
					<historyComponent>5__7 = ((Component)<organs>5__6).GetComponent<OrganHistoryTracker>();
					if (!((Object)(object)<historyComponent>5__7 == (Object)null) && <historyComponent>5__7.IsTracking)
					{
						<