Decompiled source of ShareSuite v2.12.0

ShareSuite.dll

Decompiled 19 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Timers;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.GoldGat;
using EntityStates.ScavBackpack;
using HG.Reflection;
using IL.EntityStates.GoldGat;
using IL.RoR2;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.GoldGat;
using On.EntityStates.ScavBackpack;
using On.RoR2;
using On.RoR2.Artifacts;
using On.RoR2.Networking;
using R2API.Utils;
using RoR2;
using RoR2.Networking;
using ShareSuite.Networking;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ShareSuite
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.funkfrog_sipondo.sharesuite", "ShareSuite", "2.12.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ShareSuite : BaseUnityPlugin
	{
		public static string MessageSendVer = "2.10.1";

		public static ConfigEntry<bool> ModIsEnabled;

		public static ConfigEntry<bool> MoneyIsShared;

		public static ConfigEntry<bool> WhiteItemsShared;

		public static ConfigEntry<bool> GreenItemsShared;

		public static ConfigEntry<bool> RedItemsShared;

		public static ConfigEntry<bool> EquipmentShared;

		public static ConfigEntry<bool> LunarItemsShared;

		public static ConfigEntry<bool> BossItemsShared;

		public static ConfigEntry<bool> VoidItemsShared;

		public static ConfigEntry<bool> CursedItemsShared;

		public static ConfigEntry<bool> PageItemsShared;

		public static ConfigEntry<bool> HexItemsShared;

		public static ConfigEntry<bool> TemporaryItemsShared;

		public static ConfigEntry<bool> RentalItemsShared;

		public static ConfigEntry<bool> RichMessagesEnabled;

		public static ConfigEntry<bool> DropBlacklistedEquipmentOnShare;

		public static ConfigEntry<bool> PrinterCauldronFixEnabled;

		public static ConfigEntry<bool> DeadPlayersGetItems;

		public static ConfigEntry<bool> OverridePlayerScalingEnabled;

		public static ConfigEntry<bool> OverrideBossLootScalingEnabled;

		public static ConfigEntry<bool> OverrideVoidFieldLootScalingEnabled;

		public static ConfigEntry<bool> OverrideSimulacrumLootScalingEnabled;

		public static ConfigEntry<bool> SacrificeFixEnabled;

		public static ConfigEntry<bool> MoneyScalarEnabled;

		public static ConfigEntry<bool> RandomizeSharedPickups;

		public static ConfigEntry<bool> LunarItemsRandomized;

		public static ConfigEntry<bool> BossItemsRandomized;

		public static ConfigEntry<bool> VoidItemsRandomized;

		public static ConfigEntry<bool> OverrideMultiplayerCheck;

		public static ConfigEntry<bool> HalcyoniteShrineDropModified;

		public static ConfigEntry<int> BossLootCredit;

		public static ConfigEntry<int> VoidFieldLootCredit;

		public static ConfigEntry<int> SimulacrumLootCredit;

		public static ConfigEntry<int> InteractablesOffset;

		public static ConfigEntry<double> InteractablesCredit;

		public static ConfigEntry<double> MoneyScalar;

		public static ConfigEntry<string> ItemBlacklist;

		public static ConfigEntry<string> EquipmentBlacklist;

		public static ConfigEntry<string> LastMessageSent;

		public static ConfigEntry<short> NetworkMessageType;

		private bool _previouslyEnabled;

		public static int DefaultMaxScavItemDropCount = 0;

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			InitConfig();
			CommandHelper.AddToConsoleWhenReady();
			ReloadHooks();
			MoneySharingHooks.SharedMoneyValue = 15;
		}

		public void Update()
		{
			if (!ModIsEnabled.Value || !MoneyIsShared.Value || MoneySharingHooks.MapTransitionActive || !GeneralHooks.IsMultiplayer())
			{
				return;
			}
			NetworkHandler.RegisterHandlers();
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (!ItemSharingHooks.IsDeadAndNotADrone(instance.master) && instance.master.money != MoneySharingHooks.SharedMoneyValue)
				{
					instance.master.money = (uint)MoneySharingHooks.SharedMoneyValue;
				}
			}
		}

		private void ReloadHooks(object _ = null, EventArgs __ = null)
		{
			if (_previouslyEnabled && !ModIsEnabled.Value)
			{
				GeneralHooks.UnHook();
				MoneySharingHooks.UnHook();
				ItemSharingHooks.UnHook();
				EquipmentSharingHooks.UnHook();
				ChatHandler.UnHook();
				_previouslyEnabled = false;
			}
			if (!_previouslyEnabled && ModIsEnabled.Value)
			{
				_previouslyEnabled = true;
				GeneralHooks.Hook();
				MoneySharingHooks.Hook();
				ItemSharingHooks.Hook();
				EquipmentSharingHooks.Hook();
				ChatHandler.Hook();
			}
		}

		private void InitConfig()
		{
			ModIsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ModEnabled", true, "Toggles whether or not the mod is enabled. If turned off while in-game, it will unhook everything and reset the game to it's default behaviors.");
			ModIsEnabled.SettingChanged += ReloadHooks;
			MoneyIsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "MoneyShared", true, "Toggles money sharing between teammates. Every player gains money together and spends it from one central pool of money.");
			WhiteItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "WhiteItemsShared", true, "Toggles item sharing for common (white color) items.");
			GreenItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "GreenItemsShared", true, "Toggles item sharing for rare (green color) items.");
			RedItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RedItemsShared", true, "Toggles item sharing for legendary (red color) items.");
			EquipmentShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "EquipmentShared", false, "Toggles item sharing for equipment.");
			LunarItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "LunarItemsShared", false, "Toggles item sharing for Lunar (blue color) items.");
			BossItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "BossItemsShared", true, "Toggles item sharing for boss (yellow color) items.");
			VoidItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "VoidItemsShared", false, "Toggles item sharing for void (purple/corrupted) items.");
			CursedItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "CursedItemsShared", false, "Toggles item sharing for cursed (Purple) items.");
			PageItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "PageItemsShared", false, "Toggles item sharing for page (Blue) items.");
			HexItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "HexItemsShared", false, "Toggles item sharing for hex (Yellowish) items.");
			TemporaryItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "TemporaryItemsShared", false, "Toggles item sharing for temporary items.");
			RentalItemsShared = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RentalItemsShared", false, "Toggles item sharing for rental items.");
			RichMessagesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RichMessagesEnabled", true, "Toggles detailed item pickup messages with information on who picked the item up and who all received the item.");
			DropBlacklistedEquipmentOnShare = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "DropBlacklistedEquipmentOnShare", false, "Changes the way shared equipment handles blacklisted equipment. If true, blacklisted equipment will be dropped on the ground once a new equipment is shared. If false, blacklisted equipment is left untouched when new equipment is shared.");
			RandomizeSharedPickups = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "RandomizeSharedPickups", true, "When enabled each player (except the player who picked up the item) will get a randomized item of the same rarity.");
			LunarItemsRandomized = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "LunarItemsRandomized", true, "Toggles randomizing Lunar items in RandomizeSharedPickups mode.");
			BossItemsRandomized = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "BossItemsRandomized", false, "Toggles randomizing Boss items in RandomizeSharedPickups mode.");
			VoidItemsRandomized = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "VoidItemsRandomized", false, "Toggles randomizing Void items in RandomizeSharedPickups mode.");
			PrinterCauldronFixEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "PrinterCauldronFix", true, "Toggles 3D printer and Cauldron item dupe fix by giving the item directly instead of dropping it on the ground.");
			DeadPlayersGetItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "DeadPlayersGetItems", false, "Toggles whether or not dead players should get copies of picked up items.");
			OverridePlayerScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "OverridePlayerScaling", true, "Toggles override of the scalar of interactables (chests, shrines, etc) that spawn in the world to your configured credit.");
			InteractablesCredit = ((BaseUnityPlugin)this).Config.Bind<double>("Balance", "InteractablesCredit", 1.0, "If player scaling via this mod is enabled, the amount of players the game should think are playing in terms of chest spawns.");
			InteractablesOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "InteractablesOffset", 0, "If player scaling via this mod is enabled, the offset from base scaling for interactables credit (e.g. 100 would add 100 interactables credit (not 100 interactables), can also be negative).");
			OverrideBossLootScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "OverrideBossLootScaling", true, "Toggles override of the scalar of boss loot drops to your configured balance.");
			BossLootCredit = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "BossLootCredit", 1, "Specifies the amount of boss items dropped when the boss drop override is true.");
			OverrideVoidFieldLootScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "OverrideVoidLootScaling", true, "Toggles override of the scalar of Void Field loot drops to your configured balance.");
			OverrideSimulacrumLootScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "OverrideSimulacrumLootScaling", true, "Toggles override of the scalar of Simulacrum loot drops to your configured balance.");
			OverrideMultiplayerCheck = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "OverrideMultiplayerCheck", false, "Forces ShareSuite to think that the game is running in a multiplayer instance.");
			LastMessageSent = ((BaseUnityPlugin)this).Config.Bind<string>("Debug", "LastMessageSent", "none", "Keeps track of the last mod version that sent you a message. Prevents spam, don't touch.");
			VoidFieldLootCredit = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "VoidFieldLootCredit", 1, "Specifies the amount of items dropped from completed Void Fields when the Void Field scaling override is true.");
			SimulacrumLootCredit = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "SimulacrumLootCredit", 1, "Specifies the amount of items dropped after each Simulacrum round when the Simulacrum scaling override is true.");
			SacrificeFixEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "SacrificeFixEnabled", true, "Toggles the reduction in sacrifice loot drops to be balanced with shared items enabled.");
			MoneyScalarEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "MoneyScalarEnabled", false, "Toggles the money scalar, set MoneyScalar to an amount to fine-tune the amount of gold you recieve.");
			MoneyScalar = ((BaseUnityPlugin)this).Config.Bind<double>("Settings", "MoneyScalar", 1.0, "Modifies player count used in calculations of gold earned when money sharing is on.");
			ItemBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "ItemBlacklistDLC3+", "BeetleGland,TreasureCache,TitanGoldDuringTP,TPHealingNova,ArtifactKey,FreeChest,RoboBallBuddy,MinorConstructOnKill,ScrapRed,ScrapWhite,ScrapYellow,ScrapGreen,DronesDropDynamite,PhysicsProjectile,PowerPyramid,PowerCube,MasterBattery,MasterCore,BonusHealthBoost,CookedSteak,Stew,UltimateMeal,WyrmOnHit,LowerPricedChests,ItemDropChanceOnKill,BarrageOnBoss", "Items (by internal name) that you do not want to share, comma separated. Please find the item \"Code Names\" at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names");
			ItemBlacklist.SettingChanged += delegate
			{
				Blacklist.Recalculate();
			};
			EquipmentBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "EquipmentBlacklist", "", "Equipment (by internal name) that you do not want to share, comma separated. Please find the \"Code Names\"s at: https://github.com/risk-of-thunder/R2Wiki/wiki/Item-&-Equipment-IDs-and-Names");
			EquipmentBlacklist.SettingChanged += delegate
			{
				Blacklist.Recalculate();
			};
			NetworkMessageType = ((BaseUnityPlugin)this).Config.Bind<short>("Settings", "NetworkMessageType", (short)1021, "The identifier for network message for this mod. Must be unique across all mods.");
			HalcyoniteShrineDropModified = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "HalcyoniteShrineDropModified", true, "Toggles whether the Halcyonite Shrine drops are modified by item sharing and randomization.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcModIsEnabled(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)ModIsEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			ModIsEnabled.Value = flag.Value;
			Debug.Log((object)$"Mod status set to {ModIsEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcMoneyIsShared(ConCommandArgs args)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)MoneyIsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			if (MoneyIsShared.Value != flag.Value)
			{
				if (MoneyIsShared.Value && !flag.Value)
				{
					GoldGatFire.FireBullet -= new Manipulator(MoneySharingHooks.RemoveGoldGatMoneyLine);
				}
				else if (GeneralHooks.IsMultiplayer())
				{
					GoldGatFire.FireBullet += new Manipulator(MoneySharingHooks.RemoveGoldGatMoneyLine);
				}
			}
			MoneyIsShared.Value = flag.Value;
			Debug.Log((object)$"Money sharing status set to {MoneyIsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcMoneyScalarEnabled(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)MoneyScalarEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			MoneyScalarEnabled.Value = flag.Value;
			Debug.Log((object)$"Money sharing scalar status set to {MoneyScalarEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcMoneyScalar(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)MoneyScalar.Value);
				return;
			}
			double? num = ((ConCommandArgs)(ref args)).TryGetArgDouble(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to a number.");
				return;
			}
			MoneyScalar.Value = num.Value;
			Debug.Log((object)$"Mod status set to {MoneyScalar.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcWhiteShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)WhiteItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			WhiteItemsShared.Value = flag.Value;
			Debug.Log((object)$"White items sharing set to {WhiteItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcGreenShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)GreenItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			GreenItemsShared.Value = flag.Value;
			Debug.Log((object)$"Green items sharing set to {GreenItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcRedShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)RedItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			RedItemsShared.Value = flag.Value;
			Debug.Log((object)$"Red item sharing set to {RedItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcEquipmentShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)EquipmentShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			EquipmentShared.Value = flag.Value;
			Debug.Log((object)$"Equipment sharing set to {EquipmentShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcLunarShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)LunarItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			LunarItemsShared.Value = flag.Value;
			Debug.Log((object)$"Lunar item sharing set to {LunarItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcBossShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)BossItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			BossItemsShared.Value = flag.Value;
			Debug.Log((object)$"Boss item sharing set to {BossItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcVoidItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)VoidItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			VoidItemsShared.Value = flag.Value;
			Debug.Log((object)$"Void item sharing set to {VoidItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcCursedItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)CursedItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			CursedItemsShared.Value = flag.Value;
			Debug.Log((object)$"Cursed item sharing set to {CursedItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcPageItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)PageItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			PageItemsShared.Value = flag.Value;
			Debug.Log((object)$"Page item sharing set to {PageItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcHexItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)HexItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			HexItemsShared.Value = flag.Value;
			Debug.Log((object)$"Hex item sharing set to {HexItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcTemporaryItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)TemporaryItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			TemporaryItemsShared.Value = flag.Value;
			Debug.Log((object)$"Temporary item sharing set to {TemporaryItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcRentalItemsShared(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)RentalItemsShared.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			RentalItemsShared.Value = flag.Value;
			Debug.Log((object)$"Rental item sharing set to {RentalItemsShared.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcMessagesEnabled(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)RichMessagesEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			RichMessagesEnabled.Value = flag.Value;
			Debug.Log((object)$"Rich Messages Enabled set to {RichMessagesEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcDropBlacklistedEquipmentOnShare(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)DropBlacklistedEquipmentOnShare.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			DropBlacklistedEquipmentOnShare.Value = flag.Value;
			Debug.Log((object)$"Drop Blacklisted Equipment on Share set to {DropBlacklistedEquipmentOnShare.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcRandomizeSharedPickups(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)RandomizeSharedPickups.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			RandomizeSharedPickups.Value = flag.Value;
			Debug.Log((object)$"Randomize pickups per player set to {RandomizeSharedPickups.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcPrinterCauldronFix(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)PrinterCauldronFixEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			PrinterCauldronFixEnabled.Value = flag.Value;
			Debug.Log((object)$"Printer and cauldron fix set to {PrinterCauldronFixEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcDisablePlayerScaling(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)OverridePlayerScalingEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			OverridePlayerScalingEnabled.Value = flag.Value;
			Debug.Log((object)$"Player scaling disable set to {OverridePlayerScalingEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcInteractablesCredit(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)InteractablesCredit.Value);
				return;
			}
			double? num = ((ConCommandArgs)(ref args)).TryGetArgDouble(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to a number.");
				return;
			}
			InteractablesCredit.Value = num.Value;
			Debug.Log((object)$"Interactible credit set to {InteractablesCredit.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcInteractablesOffset(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)InteractablesOffset.Value);
				return;
			}
			int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to a number.");
				return;
			}
			InteractablesOffset.Value = num.Value;
			Debug.Log((object)$"Interactible offset set to {InteractablesOffset.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcBossLoot(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)OverrideBossLootScalingEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			OverrideBossLootScalingEnabled.Value = flag.Value;
			Debug.Log((object)$"Boss loot scaling disable set to {OverrideBossLootScalingEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcBossLootCredit(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)BossLootCredit.Value);
				return;
			}
			int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to an integer number.");
				return;
			}
			BossLootCredit.Value = num.Value;
			Debug.Log((object)$"Boss loot credit set to {BossLootCredit.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcVoidFieldLoot(ConCommandArgs args)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)OverrideVoidFieldLootScalingEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			if (OverrideVoidFieldLootScalingEnabled.Value != flag.Value)
			{
				if (OverrideVoidFieldLootScalingEnabled.Value && !flag.Value)
				{
					ArenaMissionController.EndRound -= new Manipulator(ItemSharingHooks.ArenaDropEnable);
				}
				else
				{
					ArenaMissionController.EndRound += new Manipulator(ItemSharingHooks.ArenaDropEnable);
				}
			}
			OverrideVoidFieldLootScalingEnabled.Value = flag.Value;
			Debug.Log((object)$"Void Field loot scaling disable set to {OverrideVoidFieldLootScalingEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcSimulacrumLoot(ConCommandArgs args)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)OverrideSimulacrumLootScalingEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			if (OverrideSimulacrumLootScalingEnabled.Value != flag.Value)
			{
				if (OverrideSimulacrumLootScalingEnabled.Value && !flag.Value)
				{
					InfiniteTowerWaveController.DropRewards -= new Manipulator(ItemSharingHooks.SimulacrumArenaDropEnable);
				}
				else
				{
					InfiniteTowerWaveController.DropRewards += new Manipulator(ItemSharingHooks.SimulacrumArenaDropEnable);
				}
			}
			OverrideSimulacrumLootScalingEnabled.Value = flag.Value;
			Debug.Log((object)$"Void Field loot scaling disable set to {OverrideSimulacrumLootScalingEnabled.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcVoidFieldCredit(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)VoidFieldLootCredit.Value);
				return;
			}
			int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to an integer number.");
				return;
			}
			VoidFieldLootCredit.Value = num.Value;
			Debug.Log((object)$"Void Field loot credit set to {VoidFieldLootCredit.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcSimulacrumCredit(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)SimulacrumLootCredit.Value);
				return;
			}
			int? num = ((ConCommandArgs)(ref args)).TryGetArgInt(0);
			if (!num.HasValue)
			{
				Debug.Log((object)"Couldn't parse to an integer number.");
				return;
			}
			SimulacrumLootCredit.Value = num.Value;
			Debug.Log((object)$"Simulacrum loot credit set to {SimulacrumLootCredit.Value}.");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcSacrificeFixEnabled(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)SacrificeFixEnabled.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			SacrificeFixEnabled.Value = flag.Value;
			Debug.Log((object)$"Sacrifice fix set to {SacrificeFixEnabled.Value}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcDeadPlayersGetItems(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)DeadPlayersGetItems.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			DeadPlayersGetItems.Value = flag.Value;
			Debug.Log((object)$"Dead player getting shared items set to {DeadPlayersGetItems.Value}");
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CcHalcyoniteShrineDropModified(ConCommandArgs args)
		{
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.Log((object)HalcyoniteShrineDropModified.Value);
				return;
			}
			bool? flag = TryGetBool(((ConCommandArgs)(ref args))[0]);
			if (!flag.HasValue)
			{
				Debug.Log((object)"Couldn't parse to boolean.");
				return;
			}
			HalcyoniteShrineDropModified.Value = flag.Value;
			Debug.Log((object)$"Halcyonite Shrine drop modification set to {HalcyoniteShrineDropModified.Value}");
		}

		private static bool? TryGetBool(string arg)
		{
			string[] source = new string[3] { "yes", "true", "1" };
			string[] source2 = new string[4] { "no", "false", "0", "-1" };
			if (source.Contains(arg.ToLower()))
			{
				return true;
			}
			if (source2.Contains(arg.ToLower()))
			{
				return false;
			}
			return null;
		}
	}
	public static class ItemSharingHooks
	{
		private static bool _itemLock = false;

		private static readonly List<CostTypeIndex> PrinterCosts = new List<CostTypeIndex>
		{
			(CostTypeIndex)4,
			(CostTypeIndex)5,
			(CostTypeIndex)6,
			(CostTypeIndex)10,
			(CostTypeIndex)9
		};

		public static event Func<GenericPickupController, CharacterBody, bool> AdditionalPickupValidityChecks;

		public static void UnHook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(OnShopPurchase);
			ShopTerminalBehavior.DropPickup_bool -= new hook_DropPickup_bool(OnPurchaseDrop);
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(OnGrantItem);
			Opening.OnEnter -= new hook_OnEnter(OnScavengerDrop);
			PlayerPickupChatMessage.ConstructChatString -= new hook_ConstructChatString(FixZeroItemCount);
			HalcyoniteShrineInteractable.DropRewards -= new hook_DropRewards(HalcyoniteShrineDropRewards);
			ArenaMissionController.EndRound -= new Manipulator(ArenaDropEnable);
			InfiniteTowerWaveController.DropRewards -= new Manipulator(SimulacrumArenaDropEnable);
		}

		public static void Hook()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			Log.Debug("Sharesuite: Hooking itemsharing");
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnShopPurchase);
			ShopTerminalBehavior.DropPickup_bool += new hook_DropPickup_bool(OnPurchaseDrop);
			GenericPickupController.AttemptGrant += new hook_AttemptGrant(OnGrantItem);
			Opening.OnEnter += new hook_OnEnter(OnScavengerDrop);
			PlayerPickupChatMessage.ConstructChatString += new hook_ConstructChatString(FixZeroItemCount);
			HalcyoniteShrineInteractable.DropRewards += new hook_DropRewards(HalcyoniteShrineDropRewards);
			if (ShareSuite.OverrideVoidFieldLootScalingEnabled.Value)
			{
				ArenaMissionController.EndRound += new Manipulator(ArenaDropEnable);
				InfiniteTowerWaveController.DropRewards += new Manipulator(SimulacrumArenaDropEnable);
			}
		}

		private static void OnGrantItem(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: 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_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickupIndex);
			ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
			Dictionary<CharacterMaster, PickupDef> dictionary = new Dictionary<CharacterMaster, PickupDef>();
			object obj = ((body != null) ? body.master : null);
			if (obj == null)
			{
				Inventory inventory = body.inventory;
				obj = ((inventory != null) ? ((Component)inventory).GetComponent<CharacterMaster>() : null);
			}
			CharacterMaster val = (CharacterMaster)obj;
			Scene activeScene = SceneManager.GetActiveScene();
			Log.Debug("ActiveScene: " + ((Scene)(ref activeScene)).name);
			if (((Scene)(ref activeScene)).name == "computationalexchange")
			{
				Log.Debug("Sharesuite: Computational Exchange detected, skipping item sharing.");
				orig.Invoke(self, body);
				return;
			}
			UniquePickup pickup;
			if (!Blacklist.HasItem(pickupDef.itemIndex) && NetworkServer.active && IsValidItemPickup(self.pickupIndex) && IsValidPickupObject(self, body) && GeneralHooks.IsMultiplayer())
			{
				pickup = self.pickup;
				if ((!((UniquePickup)(ref pickup)).isTempItem || ShareSuite.TemporaryItemsShared.Value) && (!self.pickup.isRental || ShareSuite.RentalItemsShared.Value))
				{
					if (ShareSuite.RandomizeSharedPickups.Value)
					{
						dictionary.Add(val, pickupDef);
					}
					foreach (CharacterMaster item in PlayerCharacterMasterController.instances.Select((PlayerCharacterMasterController p) => p.master))
					{
						if (!ShareSuite.DeadPlayersGetItems.Value && IsDeadAndNotADrone(item))
						{
							continue;
						}
						if ((Object)(object)item.inventory == (Object)(object)body.inventory)
						{
							if (!((NetworkBehaviour)item).isLocalPlayer)
							{
								NetworkHandler.SendItemPickupMessage(((NetworkBehaviour)item.playerCharacterMasterController.networkUser).connectionToClient.connectionId, pickupDef.pickupIndex);
							}
						}
						else if (ShareSuite.RandomizeSharedPickups.Value)
						{
							PickupIndex? randomItemOfTier = GetRandomItemOfTier(itemDef.tier, pickupDef.pickupIndex);
							if (randomItemOfTier.HasValue)
							{
								PickupDef pickupDef2 = PickupCatalog.GetPickupDef(randomItemOfTier.Value);
								pickup = self.pickup;
								HandleGiveItem(item, pickupDef2, ((UniquePickup)(ref pickup)).isTempItem, self.pickup.isRental);
								dictionary.Add(item, pickupDef2);
							}
						}
						else
						{
							pickup = self.pickup;
							HandleGiveItem(item, pickupDef, ((UniquePickup)(ref pickup)).isTempItem, self.pickup.isRental);
						}
					}
					if (ShareSuite.RandomizeSharedPickups.Value)
					{
						orig.Invoke(self, body);
						pickup = self.pickup;
						ChatHandler.SendRichRandomizedPickupMessage(val, pickupDef, dictionary, ((UniquePickup)(ref pickup)).isTempItem, self.pickup.isRental);
						return;
					}
				}
			}
			orig.Invoke(self, body);
			pickup = self.pickup;
			ChatHandler.SendRichPickupMessage(val, pickupDef, ((UniquePickup)(ref pickup)).isTempItem, self.pickup.isRental);
			HandleRichMessageUnlockAndNotification(val, pickupDef.pickupIndex);
		}

		private static void HalcyoniteShrineDropRewards(orig_DropRewards orig, HalcyoniteShrineInteractable self)
		{
			Log.Debug("Sharesuite: HalcyoniteShrineDropRewards triggered");
			if (!NetworkServer.active)
			{
				Log.Debug("Sharesuite: Not server, returning");
				orig.Invoke(self);
			}
			else if (!GeneralHooks.IsMultiplayer() || !ShareSuite.HalcyoniteShrineDropModified.Value)
			{
				Log.Debug("Sharesuite: Not multiplayer or HalcyoniteDropModified not enabled, returning");
				orig.Invoke(self);
			}
			else
			{
				Object.op_Implicit((Object)(object)((Component)self).GetComponentInParent<HalcyoniteShrineInteractable>());
				orig.Invoke(self);
			}
		}

		public static bool IsDeadAndNotADrone(CharacterMaster master)
		{
			if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.GetBody()))
			{
				return true;
			}
			if (master.IsDeadAndOutOfLivesServer())
			{
				return !master.GetBody().IsDrone;
			}
			return false;
		}

		private static string FixZeroItemCount(orig_ConstructChatString orig, PlayerPickupChatMessage self)
		{
			self.pickupQuantity = Math.Max(1u, self.pickupQuantity);
			return orig.Invoke(self);
		}

		private unsafe static void OnPurchaseDrop(orig_DropPickup_bool orig, ShopTerminalBehavior self, bool isDuplicated)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			Log.Debug("Sharesuite: OnPurchaseDrop triggered");
			if (!NetworkServer.active)
			{
				Log.Debug("Sharesuite: Not server, returning");
				orig.Invoke(self, isDuplicated);
				return;
			}
			CostTypeIndex costType = ((Component)self).GetComponent<PurchaseInteraction>().costType;
			Log.Debug("Sharesuite: CostType: " + ((object)(*(CostTypeIndex*)(&costType))/*cast due to .constrained prefix*/).ToString());
			Log.Debug("Sharesuite: Multiplayer: " + GeneralHooks.IsMultiplayer() + " | ValidItemPickup: " + IsValidItemPickup(self.CurrentPickupIndex()) + " | PrinterCauldronFixEnabled: " + ShareSuite.PrinterCauldronFixEnabled.Value);
			if (!GeneralHooks.IsMultiplayer() || (!IsValidItemPickup(self.CurrentPickupIndex()) && !ShareSuite.PrinterCauldronFixEnabled.Value) || (int)self.itemTier == 3 || (int)costType == 1 || (int)costType == 0)
			{
				Log.Debug("Sharesuite: Origin branch 1");
				orig.Invoke(self, isDuplicated);
			}
			else if (!ShareSuite.PrinterCauldronFixEnabled.Value && PrinterCosts.Contains(costType))
			{
				Log.Debug("Sharesuite: Origin branch 2");
				orig.Invoke(self, isDuplicated);
			}
		}

		private static void OnShopPurchase(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_001c: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Invalid comparison between Unknown and I4
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			Log.Debug("Sharesuite: OnShopPurchase triggered");
			if (!self.CanBeAffordedByInteractor(activator))
			{
				return;
			}
			if (!GeneralHooks.IsMultiplayer() || (int)self.costType == 0)
			{
				orig.Invoke(self, activator);
				return;
			}
			ShopTerminalBehavior component = ((Component)self).GetComponent<ShopTerminalBehavior>();
			if (PrinterCosts.Contains(self.costType))
			{
				Log.Debug("Sharesuite: PrinterCauldronfix branch");
				if (ShareSuite.PrinterCauldronFixEnabled.Value)
				{
					CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>();
					Inventory inventory = component2.inventory;
					if (!(PickupCatalog.GetPickupDef(component.CurrentPickupIndex())?.itemIndex).HasValue)
					{
						Log.Debug("ShareSuite: PickupCatalog is null.");
					}
					else if (((Object)((Component)component).gameObject).name.Contains("Duplicator"))
					{
						HandleGiveItem(component2.master, PickupCatalog.GetPickupDef(component.CurrentPickupIndex()), tempItem: false, rentalItem: false, self.cost);
					}
					else
					{
						Log.Debug("Sharesuite: handling give item");
						HandleGiveItem(component2.master, PickupCatalog.GetPickupDef(component.CurrentPickupIndex()), tempItem: false, rentalItem: false);
					}
					Log.Debug("Sharesuite: orig");
					orig.Invoke(self, activator);
					Log.Debug("Sharesuite: rich cauldron message");
					ChatHandler.SendRichCauldronMessage(((Component)inventory).GetComponent<CharacterMaster>(), component.CurrentPickupIndex());
					return;
				}
			}
			if (ShareSuite.EquipmentShared.Value && (int)self.costType == 7)
			{
				Log.Debug("Sharesuite: equipment drone fix thing");
				orig.Invoke(self, activator);
				EquipmentSharingHooks.RemoveAllUnBlacklistedEquipment();
			}
			Log.Debug("Sharesuite: ending orig call");
			orig.Invoke(self, activator);
		}

		private static void OnScavengerDrop(orig_OnEnter orig, Opening self)
		{
			orig.Invoke(self);
			ShareSuite.DefaultMaxScavItemDropCount = Math.Max(Opening.maxItemDropCount, ShareSuite.DefaultMaxScavItemDropCount);
			if (Reflection.GetFieldValue<ChestBehavior>((object)self, "chestBehavior").tier1Chance > 0f)
			{
				Opening.maxItemDropCount = Math.Min(Math.Max((int)Math.Ceiling((double)ShareSuite.DefaultMaxScavItemDropCount / (double)Run.instance.participatingPlayerCount), 2), ShareSuite.DefaultMaxScavItemDropCount);
			}
			else
			{
				Opening.maxItemDropCount = ShareSuite.DefaultMaxScavItemDropCount;
			}
		}

		public static void ArenaDropEnable(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			int num = default(int);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num)
			});
			int index = val.Index;
			val.Index = index + 1;
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int i) => ShareSuite.VoidFieldLootCredit.Value));
		}

		public static void SimulacrumArenaDropEnable(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			float num = default(float);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1)
			});
			int index = val.Index;
			val.Index = index + 1;
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int i) => ShareSuite.SimulacrumLootCredit.Value));
		}

		public static bool IsValidItemPickup(PickupIndex pickup)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Invalid comparison between Unknown and I4
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup);
			if (pickupDef != null && (int)pickupDef.itemIndex != -1)
			{
				ItemTier tier = ItemCatalog.GetItemDef(pickupDef.itemIndex).tier;
				switch ((int)tier)
				{
				default:
					if ((int)tier != 1000)
					{
						goto case 10;
					}
					return true;
				case 0:
					return ShareSuite.WhiteItemsShared.Value;
				case 1:
					return ShareSuite.GreenItemsShared.Value;
				case 2:
					return ShareSuite.RedItemsShared.Value;
				case 3:
					return ShareSuite.LunarItemsShared.Value;
				case 4:
					return ShareSuite.BossItemsShared.Value;
				case 6:
					return ShareSuite.VoidItemsShared.Value;
				case 7:
					return ShareSuite.VoidItemsShared.Value;
				case 8:
					return ShareSuite.VoidItemsShared.Value;
				case 9:
					return ShareSuite.VoidItemsShared.Value;
				case 11:
					return ShareSuite.CursedItemsShared.Value;
				case 12:
					return ShareSuite.PageItemsShared.Value;
				case 13:
					return ShareSuite.HexItemsShared.Value;
				case 10:
					return false;
				case 5:
					break;
				}
			}
			if (pickupDef != null)
			{
				_ = pickupDef.equipmentIndex;
				_ = -1;
				return false;
			}
			return false;
		}

		public static bool IsValidPickupObject(GenericPickupController pickup, CharacterBody picker)
		{
			if (ItemSharingHooks.AdditionalPickupValidityChecks == null)
			{
				return true;
			}
			bool flag = true;
			Delegate[] invocationList = ItemSharingHooks.AdditionalPickupValidityChecks.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				Func<GenericPickupController, CharacterBody, bool> func = (Func<GenericPickupController, CharacterBody, bool>)invocationList[i];
				flag &= func(pickup, picker);
			}
			return flag;
		}

		private static PickupIndex? GetRandomItemOfTier(ItemTier tier, PickupIndex orDefault)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected I4, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			switch ((int)tier)
			{
			case 0:
				return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier1DropList);
			case 1:
				return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier2DropList);
			case 2:
				return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier3DropList);
			case 3:
				if (ShareSuite.LunarItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableLunarDropList);
				}
				break;
			case 4:
				if (ShareSuite.BossItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableBossDropList);
				}
				break;
			case 9:
				if (ShareSuite.VoidItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList);
				}
				break;
			case 6:
				if (ShareSuite.VoidItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList);
				}
				break;
			case 7:
				if (ShareSuite.VoidItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList);
				}
				break;
			case 8:
				if (ShareSuite.VoidItemsRandomized.Value)
				{
					return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList);
				}
				break;
			}
			if (Blacklist.HasItem(PickupCatalog.GetPickupDef(orDefault).itemIndex))
			{
				return null;
			}
			return orDefault;
		}

		internal static object GetInstanceField(Type type, object instance, string fieldName)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField;
			return type.GetField(fieldName, bindingAttr).GetValue(instance);
		}

		internal static void SetInstanceField(Type type, object instance, string fieldName, object value)
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			type.GetField(fieldName, bindingAttr).SetValue(instance, value);
		}

		private static T? PickRandomOf<T>(IList<T> collection) where T : struct
		{
			if (collection.Count <= 0)
			{
				return null;
			}
			return collection[Random.Range(0, collection.Count)];
		}

		private static void HandleGiveItem(CharacterMaster characterMaster, PickupDef pickupDef, bool tempItem, bool rentalItem, int amount = 1)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			if (tempItem && rentalItem)
			{
				Log.Debug("Both tempItem and rentalItem are true. The fudge? Resorting to temp item.");
				characterMaster.inventory.GiveItemTemp(pickupDef.itemIndex, (float)amount);
			}
			else if (tempItem)
			{
				characterMaster.inventory.GiveItemTemp(pickupDef.itemIndex, (float)amount);
			}
			else if (rentalItem)
			{
				characterMaster.inventory.GiveItemRented(pickupDef.itemIndex, amount);
			}
			else
			{
				characterMaster.inventory.GiveItemPermanent(pickupDef.itemIndex, amount);
			}
			NetworkUser networkUser = characterMaster.playerCharacterMasterController.networkUser;
			int? num = ((networkUser == null) ? ((int?)null) : ((NetworkBehaviour)networkUser).connectionToClient?.connectionId);
			if (num.HasValue)
			{
				NetworkHandler.SendItemPickupMessage(num.Value, pickupDef.pickupIndex);
			}
		}

		public static void HandleRichMessageUnlockAndNotification(CharacterMaster characterMaster, PickupIndex pickupIndex)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (!ShareSuite.RichMessagesEnabled.Value || !((NetworkBehaviour)characterMaster).isLocalPlayer)
			{
				return;
			}
			PlayerCharacterMasterController playerCharacterMasterController = characterMaster.playerCharacterMasterController;
			if (playerCharacterMasterController != null)
			{
				NetworkUser networkUser = playerCharacterMasterController.networkUser;
				if (networkUser != null)
				{
					LocalUser localUser = networkUser.localUser;
					if (localUser != null)
					{
						localUser.userProfile.DiscoverPickup(pickupIndex);
					}
				}
			}
			if (characterMaster.inventory.GetItemCount(PickupCatalog.GetPickupDef(pickupIndex).itemIndex) <= 1)
			{
				CharacterMasterNotificationQueue.PushPickupNotification(characterMaster, pickupIndex);
			}
		}
	}
	public static class MoneySharingHooks
	{
		public static bool MapTransitionActive;

		public static int SharedMoneyValue;

		internal static void UnHook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			SceneDirector.Start -= new hook_Start(ResetClassValues);
			HealthComponent.TakeDamage -= new hook_TakeDamage(BrittleCrownDamageHook);
			GlobalEventManager.OnHitEnemy -= new hook_OnHitEnemy(BrittleCrownOnHitHook);
			DeathRewards.OnKilledServer -= new hook_OnKilledServer(ShareKillMoney);
			BarrelInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(ShareBarrelMoney);
			MoneyPickup.OnTriggerStay -= new hook_OnTriggerStay(ShareTomeMoney);
			SceneExitController.Begin -= new hook_Begin(SplitExitMoney);
			PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(OnShopPurchase);
			GoldGatFire.FireBullet -= new hook_FireBullet(GoldGatFireHook);
			NetworkManagerSystem.OnClientConnect -= new hook_OnClientConnect(GoldGatConnect);
			NetworkManagerSystem.OnClientDisconnect -= new hook_OnClientDisconnect(GoldGatDisconnect);
			HealthComponent.TakeDamage -= new hook_TakeDamage(RollOfPenniesDamageHook);
			GoldSiphonNearbyBodyController.DrainGold -= new hook_DrainGold(SiphonGold);
			GoldGatFire.FireBullet -= new Manipulator(RemoveGoldGatMoneyLine);
		}

		internal static void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			SceneDirector.Start += new hook_Start(ResetClassValues);
			HealthComponent.TakeDamage += new hook_TakeDamage(BrittleCrownDamageHook);
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(BrittleCrownOnHitHook);
			DeathRewards.OnKilledServer += new hook_OnKilledServer(ShareKillMoney);
			BarrelInteraction.OnInteractionBegin += new hook_OnInteractionBegin(ShareBarrelMoney);
			MoneyPickup.OnTriggerStay += new hook_OnTriggerStay(ShareTomeMoney);
			SceneExitController.Begin += new hook_Begin(SplitExitMoney);
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnShopPurchase);
			GoldGatFire.FireBullet += new hook_FireBullet(GoldGatFireHook);
			NetworkManagerSystem.OnClientConnect += new hook_OnClientConnect(GoldGatConnect);
			NetworkManagerSystem.OnClientDisconnect += new hook_OnClientDisconnect(GoldGatDisconnect);
			HealthComponent.TakeDamage += new hook_TakeDamage(RollOfPenniesDamageHook);
			GoldSiphonNearbyBodyController.DrainGold += new hook_DrainGold(SiphonGold);
			if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer())
			{
				GoldGatFire.FireBullet += new Manipulator(RemoveGoldGatMoneyLine);
			}
		}

		private static void ShareTomeMoney(orig_OnTriggerStay orig, MoneyPickup self, Collider other)
		{
			if ((Object)(object)self.baseObject == (Object)null || !ShareSuite.MoneyIsShared.Value)
			{
				orig.Invoke(self, other);
				return;
			}
			int num = ((!self.shouldScale) ? self.baseGoldReward : ((int)((float)self.baseGoldReward * Mathf.Pow(Run.instance.difficultyCoefficient, 1.25f))));
			orig.Invoke(self, other);
			if (!Reflection.GetFieldValue<bool>((object)self, "alive"))
			{
				SharedMoneyValue += num;
				if (ShareSuite.MoneyScalarEnabled.Value && NetworkServer.active)
				{
					AddToSharedMoneyValue(num);
				}
			}
		}

		public static void AddMoneyExternal(int amount)
		{
			if (ShareSuite.MoneyIsShared.Value)
			{
				SharedMoneyValue += amount;
				return;
			}
			foreach (CharacterMaster item in PlayerCharacterMasterController.instances.Select((PlayerCharacterMasterController p) => p.master))
			{
				item.money += (uint)amount;
			}
		}

		public static bool SharedMoneyEnabled()
		{
			return ShareSuite.MoneyIsShared.Value;
		}

		private static void SiphonGold(orig_DrainGold orig, GoldSiphonNearbyBodyController self)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if (!GeneralHooks.IsMultiplayer() || !ShareSuite.MoneyIsShared.Value)
			{
				orig.Invoke(self);
				return;
			}
			HalcyoniteShrineInteractable componentInParent = ((Component)self).GetComponentInParent<HalcyoniteShrineInteractable>();
			if (!Object.op_Implicit((Object)(object)componentInParent))
			{
				orig.Invoke(self);
				return;
			}
			int num = 0;
			Vector3 position = ((Component)self).transform.position;
			float num2 = componentInParent.radius * componentInParent.radius;
			int num3 = 0;
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(self.siphonTeamIndex))
			{
				if (Object.op_Implicit((Object)(object)((teamMember != null) ? teamMember.body : null)))
				{
					CharacterBody body = teamMember.body;
					Vector3 val = position - body.corePosition;
					if (!(((Vector3)(ref val)).sqrMagnitude > num2) && body.healthComponent.alive && Object.op_Implicit((Object)(object)body.master) && body.isPlayerControlled)
					{
						num3 = num3++;
						num += (int)Math.Min(body.master.money, (uint)componentInParent.goldDrainValue);
					}
				}
			}
			if (num == 0)
			{
				orig.Invoke(self);
			}
			else if (SharedMoneyValue >= num)
			{
				SharedMoneyValue -= num;
				orig.Invoke(self);
			}
		}

		private static void OnShopPurchase(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer() && Object.op_Implicit((Object)(object)self))
			{
				CostTypeIndex costType = self.costType;
				if ((int)costType == 1)
				{
					if (self.cost <= SharedMoneyValue)
					{
						orig.Invoke(self, activator);
						SharedMoneyValue -= self.cost;
					}
					return;
				}
				if ((int)costType == 2)
				{
					orig.Invoke(self, activator);
					int num = 0;
					foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
					{
						float maxHealth = instance.master.GetBody().maxHealth;
						if (maxHealth > (float)num)
						{
							num = (int)maxHealth;
						}
					}
					PurchaseInteraction component = ((Component)self).GetComponent<PurchaseInteraction>();
					ShrineBloodBehavior component2 = ((Component)self).GetComponent<ShrineBloodBehavior>();
					if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
					{
						uint num2 = (uint)((double)(num * component.cost) / 100.0 * (double)component2.goldToPaidHpRatio);
						if (ShareSuite.MoneyScalarEnabled.Value)
						{
							num2 = (uint)((double)num2 * ShareSuite.MoneyScalar.Value);
						}
						SharedMoneyValue += (int)num2;
					}
					else if ((Object)(object)component != (Object)null)
					{
						Log.Debug("PurchaseInteraction is not null, but ShrineBloodBehavior is null. What is happening?");
					}
					else if ((Object)(object)component2 != (Object)null)
					{
						Log.Debug("ShrineBloodBehavior is not null, but PurchaseInteraction is null. What is happening?");
					}
					return;
				}
				Debug.LogWarning((object)$"Unhandled cost type: {self.costType}.");
			}
			orig.Invoke(self, activator);
		}

		private static void SplitExitMoney(orig_Begin orig, SceneExitController self)
		{
			MapTransitionActive = true;
			if (!ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer())
			{
				orig.Invoke(self);
				return;
			}
			int count = PlayerCharacterMasterController.instances.Count;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				instance.master.money = (uint)Mathf.FloorToInt((float)(instance.master.money / count));
			}
			orig.Invoke(self);
		}

		private static void ShareBarrelMoney(orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
		{
			orig.Invoke(self, activator);
			if (GeneralHooks.IsMultiplayer())
			{
				SharedMoneyValue += self.goldReward;
				if (ShareSuite.MoneyScalarEnabled.Value && NetworkServer.active)
				{
					AddToSharedMoneyValue(self.goldReward);
				}
			}
		}

		private static void ShareKillMoney(orig_OnKilledServer orig, DeathRewards self, DamageReport damageReport)
		{
			orig.Invoke(self, damageReport);
			if (GeneralHooks.IsMultiplayer())
			{
				SharedMoneyValue += (int)self.goldReward;
				if (ShareSuite.MoneyScalarEnabled.Value && NetworkServer.active)
				{
					AddToSharedMoneyValue(self.goldReward);
				}
			}
		}

		private static void ResetClassValues(orig_Start orig, SceneDirector self)
		{
			SetTeleporterActive(active: false);
			if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer())
			{
				SharedMoneyValue = 15;
			}
			orig.Invoke(self);
		}

		private static void GoldGatFireHook(orig_FireBullet orig, GoldGatFire self)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!GeneralHooks.IsMultiplayer() || !ShareSuite.MoneyIsShared.Value)
			{
				orig.Invoke(self);
				return;
			}
			CharacterMaster fieldValue = Reflection.GetFieldValue<CharacterMaster>((object)self, "bodyMaster");
			int num = (int)((float)GoldGatFire.baseMoneyCostPerBullet * (1f + ((float)TeamManager.instance.GetTeamLevel(fieldValue.teamIndex) - 1f) * 0.25f));
			SharedMoneyValue = Math.Max(SharedMoneyValue - num, 0);
			orig.Invoke(self);
		}

		public static void RemoveGoldGatMoneyLine(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			float num = default(float);
			MethodReference val2 = default(MethodReference);
			val.GotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val2)
			});
			val.RemoveRange(14);
		}

		private static void GoldGatDisconnect(orig_OnClientDisconnect orig, NetworkManagerSystem self, NetworkConnection conn)
		{
			bool wasMultiplayer = GeneralHooks.IsMultiplayer();
			orig.Invoke(self, conn);
			ToggleGoldGat(wasMultiplayer);
		}

		private static void GoldGatConnect(orig_OnClientConnect orig, NetworkManagerSystem self, NetworkConnection conn)
		{
			bool wasMultiplayer = GeneralHooks.IsMultiplayer();
			orig.Invoke(self, conn);
			ToggleGoldGat(wasMultiplayer);
		}

		private static void ToggleGoldGat(bool wasMultiplayer)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			bool flag = GeneralHooks.IsMultiplayer();
			if (wasMultiplayer != flag)
			{
				if (ShareSuite.MoneyIsShared.Value && flag)
				{
					GoldGatFire.FireBullet += new Manipulator(RemoveGoldGatMoneyLine);
				}
				else
				{
					GoldGatFire.FireBullet -= new Manipulator(RemoveGoldGatMoneyLine);
				}
			}
		}

		private static void BrittleCrownDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				orig.Invoke(self, info);
				return;
			}
			if (!ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !Object.op_Implicit((Object)(object)self.body) || !Object.op_Implicit((Object)(object)self.body.inventory))
			{
				orig.Invoke(self, info);
				return;
			}
			CharacterBody body = self.body;
			uint money = self.body.master.money;
			orig.Invoke(self, info);
			if (!self.alive)
			{
				return;
			}
			uint money2 = self.body.master.money;
			if (body.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHit")) <= 0)
			{
				return;
			}
			SharedMoneyValue += (int)(money2 - money);
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance.master.GetBody()) && !((Object)(object)instance.master.GetBody() == (Object)(object)body))
				{
					EffectManager.SimpleImpactEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/CoinImpact"), instance.master.GetBody().corePosition, Vector3.up, true);
				}
			}
		}

		private static void RollOfPenniesDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, info);
			if (!NetworkServer.active || !ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !self.alive)
			{
				return;
			}
			CharacterBody body = self.body;
			if (!Object.op_Implicit((Object)(object)((body != null) ? body.inventory : null)))
			{
				return;
			}
			int itemCount = self.body.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHurt"));
			if (itemCount <= 0)
			{
				return;
			}
			CharacterBody val = null;
			if (Object.op_Implicit((Object)(object)info.attacker))
			{
				val = info.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)self.body)
			{
				return;
			}
			SharedMoneyValue += Mathf.FloorToInt((float)(itemCount * 3) * Run.instance.difficultyCoefficient);
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance.master.GetBody()) && !((Object)(object)instance.master.GetBody() == (Object)(object)self.body))
				{
					EffectManager.SimpleImpactEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/CoinImpact"), instance.master.GetBody().corePosition, Vector3.up, true);
				}
			}
		}

		private static void BrittleCrownOnHitHook(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo info, GameObject victim)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (!ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !Object.op_Implicit((Object)(object)info.attacker) || !Object.op_Implicit((Object)(object)info.attacker.GetComponent<CharacterBody>()) || !Object.op_Implicit((Object)(object)info.attacker.GetComponent<CharacterBody>().master))
			{
				orig.Invoke(self, info, victim);
				return;
			}
			CharacterBody component = info.attacker.GetComponent<CharacterBody>();
			uint money = component.master.money;
			orig.Invoke(self, info, victim);
			uint money2 = component.master.money;
			if (Object.op_Implicit((Object)(object)component.inventory) && component.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHit")) > 0)
			{
				SharedMoneyValue += (int)(money2 - money);
			}
		}

		private static void AddToSharedMoneyValue(float goldReward)
		{
			SharedMoneyValue = Math.Max(SharedMoneyValue + (int)Mathf.Floor(goldReward * (float)ShareSuite.MoneyScalar.Value - goldReward), 0);
		}

		public static void SetTeleporterActive(bool active)
		{
			MapTransitionActive = active;
		}
	}
	public static class Blacklist
	{
		private static ItemMask _cachedAvailableItems = new ItemMask();

		private static ItemMask _items = new ItemMask();

		private static EquipmentMask _equipment = new EquipmentMask();

		private static readonly List<PickupIndex> _availableTier1DropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableTier2DropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableTier3DropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableLunarDropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableBossDropList = new List<PickupIndex>();

		private static readonly List<PickupIndex> _availableVoidDropList = new List<PickupIndex>();

		public static List<PickupIndex> AvailableTier1DropList => Get(_availableTier1DropList);

		public static List<PickupIndex> AvailableTier2DropList => Get(_availableTier2DropList);

		public static List<PickupIndex> AvailableTier3DropList => Get(_availableTier3DropList);

		public static List<PickupIndex> AvailableLunarDropList => Get(_availableLunarDropList);

		public static List<PickupIndex> AvailableBossDropList => Get(_availableBossDropList);

		public static List<PickupIndex> AvailableVoidDropList => Get(_availableVoidDropList);

		private static void LoadBlackListItems()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			_items = new ItemMask();
			string[] array = ShareSuite.ItemBlacklist.Value.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				ItemIndex val = ItemCatalog.FindItemIndex(array[i]);
				if ((int)val != -1)
				{
					_items.Add(val);
				}
			}
		}

		private static void LoadBlackListEquipment()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			_equipment = new EquipmentMask();
			string[] array = ShareSuite.EquipmentBlacklist.Value.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(array[i]);
				if ((int)val != -1)
				{
					_equipment.Add(val);
				}
			}
		}

		public static bool HasItem(ItemIndex itemIndex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ValidateItemCache();
			return _items.Contains(itemIndex);
		}

		public static bool HasEquipment(EquipmentIndex equipmentIndex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ValidateItemCache();
			return _equipment.Contains(equipmentIndex);
		}

		public static void Recalculate()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			_cachedAvailableItems = new ItemMask();
		}

		private static void ValidateItemCache()
		{
			if ((Object)(object)Run.instance == (Object)null)
			{
				Recalculate();
			}
			else
			{
				if (((object)_cachedAvailableItems).Equals((object?)Run.instance.availableItems))
				{
					return;
				}
				_cachedAvailableItems = Run.instance.availableItems;
				LoadBlackListItems();
				LoadBlackListEquipment();
				IEnumerable<PickupIndex> item = new List<PickupIndex>().Concat(Run.instance.availableVoidTier1DropList).Concat(Run.instance.availableVoidTier2DropList).Concat(Run.instance.availableVoidTier3DropList)
					.Concat(Run.instance.availableVoidBossDropList);
				(List<PickupIndex>, IEnumerable<PickupIndex>)[] array = new(List<PickupIndex>, IEnumerable<PickupIndex>)[6]
				{
					(_availableTier1DropList, Run.instance.availableTier1DropList),
					(_availableTier2DropList, Run.instance.availableTier2DropList),
					(_availableTier3DropList, Run.instance.availableTier3DropList),
					(_availableLunarDropList, Run.instance.availableLunarItemDropList),
					(_availableBossDropList, Run.instance.availableBossDropList),
					(_availableVoidDropList, item)
				};
				for (int i = 0; i < array.Length; i++)
				{
					var (list, source) = array[i];
					list.Clear();
					list.AddRange(source.Where(delegate(PickupIndex pickupIndex)
					{
						//IL_0000: Unknown result type (might be due to invalid IL or missing references)
						//IL_0010: Unknown result type (might be due to invalid IL or missing references)
						PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
						return pickupDef != null && !_items.Contains(pickupDef.itemIndex);
					}));
				}
			}
		}

		private static List<PickupIndex> Get(List<PickupIndex> list)
		{
			ValidateItemCache();
			return list;
		}
	}
	public static class EquipmentSharingHooks
	{
		public static void UnHook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(OnGrantEquipment);
		}

		public static void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			GenericPickupController.AttemptGrant += new hook_AttemptGrant(OnGrantEquipment);
		}

		private static void OnGrantEquipment(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			//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)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			if (!ShareSuite.EquipmentShared.Value || !GeneralHooks.IsMultiplayer() || !NetworkServer.active)
			{
				orig.Invoke(self, body);
				return;
			}
			EquipmentIndex currentEquipmentIndex = body.inventory.currentEquipmentIndex;
			PickupIndex pickupIndex = GetPickupIndex(currentEquipmentIndex);
			EquipmentIndex equip = PickupCatalog.GetPickupDef(self.pickupIndex).equipmentIndex;
			if (!IsEquipment(equip))
			{
				return;
			}
			ChatHandler.SendPickupMessage(body.master, new UniquePickup(self.pickupIndex));
			body.inventory.SetEquipmentIndex(equip);
			Object.Destroy((Object)(object)((Component)self).gameObject);
			if (!EquipmentShared(currentEquipmentIndex) && EquipmentShared(equip))
			{
				CreateDropletIfExists(pickupIndex, ((Component)self).transform.position);
				DropAllOtherSharedEquipment(self, body, currentEquipmentIndex);
			}
			else
			{
				if ((EquipmentShared(currentEquipmentIndex) && !EquipmentShared(equip) && GetLivingPlayersWithEquipment(currentEquipmentIndex) < 1) || (!EquipmentShared(currentEquipmentIndex) && !EquipmentShared(equip)))
				{
					CreateDropletIfExists(pickupIndex, ((Component)self).transform.position);
					return;
				}
				if (!EquipmentShared(equip))
				{
					return;
				}
				CreateDropletIfExists(pickupIndex, ((Component)self).transform.position);
			}
			foreach (CharacterMaster item in from p in PlayerCharacterMasterController.instances
				select p.master into p
				where Object.op_Implicit((Object)(object)p.inventory) && (Object)(object)p != (Object)(object)body.master
				select p)
			{
				Inventory inventory = item.inventory;
				EquipmentIndex currentEquipmentIndex2 = inventory.currentEquipmentIndex;
				if (!EquipmentShared(currentEquipmentIndex2))
				{
					if (!ShareSuite.DropBlacklistedEquipmentOnShare.Value)
					{
						continue;
					}
					Transform transform = item.GetBodyObject().transform;
					PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(currentEquipmentIndex2), transform.position, transform.forward * 20f);
				}
				inventory.SetEquipmentIndex(equip, true);
				SyncToolbotEquip(item, ref equip);
			}
		}

		private static void DropAllOtherSharedEquipment(GenericPickupController self, CharacterBody body, EquipmentIndex originalEquip)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			List<EquipmentIndex> list = new List<EquipmentIndex>();
			foreach (CharacterMaster item in from p in PlayerCharacterMasterController.instances
				select p.master into p
				where Object.op_Implicit((Object)(object)p.inventory) && (Object)(object)p != (Object)(object)body.master
				select p)
			{
				EquipmentIndex equipmentIndex = item.inventory.GetEquipmentIndex();
				if (EquipmentShared(equipmentIndex) && !list.Contains(equipmentIndex) && equipmentIndex != originalEquip)
				{
					CreateDropletIfExists(GetPickupIndex(equipmentIndex), ((Component)self).transform.position);
					list.Add(equipmentIndex);
				}
			}
		}

		private static PickupIndex GetPickupIndex(EquipmentIndex originalEquip)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			if ((int)originalEquip == -1)
			{
				return PickupIndex.none;
			}
			return PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(originalEquip)).pickupIndex;
		}

		public static void RemoveAllUnBlacklistedEquipment()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			foreach (CharacterMaster item in from p in PlayerCharacterMasterController.instances
				select p.master into p
				where Object.op_Implicit((Object)(object)p.inventory)
				select p)
			{
				if (!Blacklist.HasEquipment(item.inventory.currentEquipmentIndex))
				{
					item.inventory.SetEquipmentIndex((EquipmentIndex)(-1));
				}
			}
		}

		private static void SetEquipmentIndex(Inventory self, EquipmentIndex newEquipmentIndex, uint slot)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && self.currentEquipmentIndex != newEquipmentIndex)
			{
				EquipmentState equipment = self.GetEquipment(0u);
				byte b = equipment.charges;
				if ((int)equipment.equipmentIndex == -1)
				{
					b = 1;
				}
				self.SetEquipment(new EquipmentState(newEquipmentIndex, equipment.chargeFinishTime, b, false), slot);
			}
		}

		private static void SyncToolbotEquip(CharacterMaster characterMaster, ref EquipmentIndex equip)
		{
			if (!(((Object)characterMaster.bodyPrefab).name != "ToolbotBody"))
			{
				SetEquipmentIndex(characterMaster.inventory, equip, (uint)(characterMaster.inventory.activeEquipmentSlot + 1) % 2u);
			}
		}

		private static void CreateDropletIfExists(PickupIndex pickupIndex, Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (pickupIndex != PickupIndex.none)
			{
				PickupDropletController.CreatePickupDroplet(pickupIndex, position, new Vector3(Random.Range(-200f, 200f), 50f, Random.Range(-200f, 200f)));
			}
		}

		private static int GetLivingPlayersWithEquipment(EquipmentIndex originalEquip)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return (from p in PlayerCharacterMasterController.instances
				select p.master into p
				where Object.op_Implicit((Object)(object)p.inventory) && !ItemSharingHooks.IsDeadAndNotADrone(p)
				select p).Count((CharacterMaster master) => master.inventory.currentEquipmentIndex == originalEquip);
		}

		private static bool EquipmentShared(EquipmentIndex pickup)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if ((int)pickup == -1)
			{
				return true;
			}
			return !Blacklist.HasEquipment(pickup);
		}

		private static bool IsEquipment(EquipmentIndex index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return ((IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment).Contains(index);
		}
	}
	public static class GeneralHooks
	{
		private static int _sacrificeOffset = 1;

		private static int _bossItems = 1;

		private static List<string> NoInteractibleOverrideScenes = new List<string> { "MAP_BAZAAR_TITLE", "MAP_ARENA_TITLE", "MAP_LIMBO_TITLE", "MAP_MYSTERYSPACE_TITLE" };

		internal static void Hook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			BossGroup.DropRewards += new hook_DropRewards(BossGroup_DropRewards);
			SceneDirector.PlaceTeleporter += new hook_PlaceTeleporter(InteractibleCreditOverride);
			TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OverrideBossLootScaling);
			SacrificeArtifactManager.OnPrePopulateSceneServer += new hook_OnPrePopulateSceneServer(SetSacrificeOffset);
			Util.GetExpAdjustedDropChancePercent += new hook_GetExpAdjustedDropChancePercent(GetExpAdjustedDropChancePercent);
		}

		internal static void UnHook()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			BossGroup.DropRewards -= new hook_DropRewards(BossGroup_DropRewards);
			SceneDirector.PlaceTeleporter -= new hook_PlaceTeleporter(InteractibleCreditOverride);
			TeleporterInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(OverrideBossLootScaling);
			SacrificeArtifactManager.OnPrePopulateSceneServer -= new hook_OnPrePopulateSceneServer(SetSacrificeOffset);
			Util.GetExpAdjustedDropChancePercent -= new hook_GetExpAdjustedDropChancePercent(GetExpAdjustedDropChancePercent);
		}

		private static void BossGroup_DropRewards(orig_DropRewards orig, BossGroup group)
		{
			group.scaleRewardsByPlayerCount = false;
			group.bonusRewardCount += _bossItems - 1;
			orig.Invoke(group);
		}

		private static void SetSacrificeOffset(orig_OnPrePopulateSceneServer orig, SceneDirector sceneDirector)
		{
			_sacrificeOffset = 2;
			orig.Invoke(sceneDirector);
		}

		private static void OverrideBossLootScaling(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator)
		{
			_bossItems = (ShareSuite.OverrideBossLootScalingEnabled.Value ? ShareSuite.BossLootCredit.Value : Run.instance.participatingPlayerCount);
			orig.Invoke(self, activator);
		}

		public static bool IsMultiplayer()
		{
			if (!ShareSuite.OverrideMultiplayerCheck.Value)
			{
				return PlayerCharacterMasterController.instances.Count > 1;
			}
			return true;
		}

		private static void InteractibleCreditOverride(orig_PlaceTeleporter orig, SceneDirector self)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Debug.Log((object)SceneInfo.instance.sceneDef.nameToken);
			int num = 200;
			ClassicStageInfo component = ((Component)SceneInfo.instance).GetComponent<ClassicStageInfo>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Log.Debug("Current gamemode; " + GameModeCatalog.GetGameModeName(Run.instance.gameModeIndex));
				num = ((!(GameModeCatalog.GetGameModeName(Run.instance.gameModeIndex) == "InfiniteTowerRun")) ? component.sceneDirectorInteractibleCredits : 600);
				int num2 = Math.Min(Run.instance.participatingPlayerCount, 8);
				float num3 = (float)(0.95 + (double)num2 * 0.05);
				num3 *= (float)Math.Max(1.0 + 0.1 * (double)Math.Min(Run.instance.participatingPlayerCount * 2 - Run.instance.stageClearCount - 2, 3), 1.0);
				num = (int)((float)num / num3);
				if (component.bonusInteractibleCreditObjects != null)
				{
					BonusInteractibleCreditObject[] bonusInteractibleCreditObjects = component.bonusInteractibleCreditObjects;
					foreach (BonusInteractibleCreditObject val in bonusInteractibleCreditObjects)
					{
						if (val.objectThatGrantsPointsIfEnabled.activeSelf)
						{
							num += val.points / num2;
						}
					}
				}
			}
			if (ShareSuite.OverridePlayerScalingEnabled.Value && (!Object.op_Implicit((Object)(object)SceneInfo.instance) || !NoInteractibleOverrideScenes.Contains(SceneInfo.instance.sceneDef.nameToken)))
			{
				self.interactableCredit = (int)((double)num * ShareSuite.InteractablesCredit.Value / (double)_sacrificeOffset) + ShareSuite.InteractablesOffset.Value;
			}
			_sacrificeOffset = 1;
		}

		private static float GetExpAdjustedDropChancePercent(orig_GetExpAdjustedDropChancePercent orig, float baseChancePercent, GameObject characterBodyObject)
		{
			if (ShareSuite.SacrificeFixEnabled.Value)
			{
				baseChancePercent /= (float)PlayerCharacterMasterController.instances.Count;
			}
			return orig.Invoke(baseChanc