Decompiled source of ShareSuite v2.9.0

BepInEx/plugins/ShareSuite/ShareSuite.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Timers;
using BepInEx;
using BepInEx.Configuration;
using EntityStates.GoldGat;
using EntityStates.ScavBackpack;
using EntityStates.Scrapper;
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.EntityStates.Scrapper;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ShareSuite")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+955b058ebd223933c8912abe4c4cd70cf3b9f9c6")]
[assembly: AssemblyProduct("ShareSuite")]
[assembly: AssemblyTitle("ShareSuite")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShareSuite
{
	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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0031: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			_items = new ItemMask();
			string[] array = ShareSuite.ItemBlacklist.Value.Split(new char[1] { ',' });
			foreach (string text in array)
			{
				ItemIndex val = ItemCatalog.FindItemIndex(text);
				if ((int)val != -1)
				{
					_items.Add(val);
				}
			}
		}

		private static void LoadBlackListEquipment()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0031: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			_equipment = new EquipmentMask();
			string[] array = ShareSuite.EquipmentBlacklist.Value.Split(new char[1] { ',' });
			foreach (string text in array)
			{
				EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(text);
				if ((int)val != -1)
				{
					_equipment.Add(val);
				}
			}
		}

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

		public static bool HasEquipment(EquipmentIndex equipmentIndex)
		{
			//IL_000c: 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)
				};
				(List<PickupIndex>, IEnumerable<PickupIndex>)[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					var (list, source) = array2[i];
					list.Clear();
					list.AddRange(source.Where(delegate(PickupIndex pickupIndex)
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0011: 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 ChatHandler
	{
		public delegate void SendPickupMessageDelegate(CharacterMaster master, PickupIndex pickupIndex);

		private const string GrayColor = "7e91af";

		private const string RedColor = "ed4c40";

		private const string LinkColor = "5cb1ed";

		private const string ErrorColor = "ff0000";

		private const string NotSharingColor = "f07d6e";

		private static readonly string[] PlayerColors = new string[8] { "f23030", "2083fc", "f1f41a", "4dc344", "f27b0c", "3cdede", "db46bd", "9400ea" };

		public static readonly SendPickupMessageDelegate SendPickupMessage = (SendPickupMessageDelegate)Delegate.CreateDelegate(typeof(SendPickupMessageDelegate), typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.Public) ?? throw new MissingMethodException("Unable to find SendPickupMessage"));

		public static void UnHook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GenericPickupController.SendPickupMessage -= new hook_SendPickupMessage(RemoveDefaultPickupMessage);
			Chat.SendPlayerConnectedMessage -= new hook_SendPlayerConnectedMessage(SendIntroMessage);
		}

		public static void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			GenericPickupController.SendPickupMessage += new hook_SendPickupMessage(RemoveDefaultPickupMessage);
			Chat.SendPlayerConnectedMessage += new hook_SendPlayerConnectedMessage(SendIntroMessage);
		}

		public static void SendIntroMessage(orig_SendPlayerConnectedMessage orig, NetworkUser user)
		{
			orig.Invoke(user);
			if (!ShareSuite.LastMessageSent.Value.Equals(ShareSuite.MessageSendVer))
			{
				ShareSuite.LastMessageSent.Value = ShareSuite.MessageSendVer;
				string notRepeatedMessage = "<color=#7e91af>(This message will </color><color=#ed4c40>NOT</color><color=#7e91af> display again!) </color>";
				string message = "<color=#7e91af>Hey there! Thanks for installing </color><color=#ed4c40>ShareSuite 2.9.0 CommandHelper Beta</color><color=#7e91af>! This release may still contain problems. Have fun!</color>";
				string clickChatBox = "<color=#ed4c40>(Click the chat box to view the full message)</color>";
				Timer timer = new Timer(5000.0);
				timer.Elapsed += delegate
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Expected O, but got Unknown
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Expected O, but got Unknown
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					//IL_0045: Expected O, but got Unknown
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = notRepeatedMessage
					});
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = message
					});
					Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
					{
						baseToken = clickChatBox
					});
				};
				timer.AutoReset = false;
				timer.Start();
			}
		}

		public static void RemoveDefaultPickupMessage(orig_SendPickupMessage orig, CharacterMaster master, PickupIndex pickupIndex)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (!ShareSuite.RichMessagesEnabled.Value)
			{
				orig.Invoke(master, pickupIndex);
			}
		}

		public static void SendRichPickupMessage(CharacterMaster player, PickupDef pickupDef)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0051: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_01cb: 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_01dd: Expected O, but got Unknown
			CharacterBody val = (player.hasBody ? player.GetBody() : null);
			if (!GeneralHooks.IsMultiplayer() || (Object)(object)val == (Object)null || !ShareSuite.RichMessagesEnabled.Value)
			{
				if (ShareSuite.RichMessagesEnabled.Value)
				{
					SendPickupMessage(player, pickupDef.pickupIndex);
				}
				return;
			}
			Color baseColor = pickupDef.baseColor;
			string @string = Language.GetString(pickupDef.nameToken);
			string playerColor = GetPlayerColor(player.playerCharacterMasterController);
			int itemCount = player.inventory.GetItemCount(pickupDef.itemIndex);
			if (pickupDef.coinValue != 0)
			{
				string baseToken = "<color=#" + playerColor + ">" + val.GetUserName() + "</color> <color=#7e91af>picked up</color> <color=#" + ColorUtility.ToHtmlStringRGB(baseColor) + ">" + string.Format("{0} ({1})</color> <color=#{2}>for themselves.</color>", string.IsNullOrEmpty(@string) ? "???" : @string, pickupDef.coinValue, "7e91af");
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = baseToken
				});
			}
			else if (Blacklist.HasItem(pickupDef.itemIndex) || !ItemSharingHooks.IsValidItemPickup(pickupDef.pickupIndex))
			{
				string baseToken2 = "<color=#" + playerColor + ">" + val.GetUserName() + "</color> <color=#7e91af>picked up</color> <color=#" + ColorUtility.ToHtmlStringRGB(baseColor) + ">" + string.Format("{0} ({1})</color> <color=#{2}>for themselves. </color>", string.IsNullOrEmpty(@string) ? "???" : @string, itemCount, "7e91af") + "<color=#f07d6e>(Item Set to NOT be Shared)</color>";
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = baseToken2
				});
			}
			else
			{
				string baseToken3 = "<color=#" + playerColor + ">" + val.GetUserName() + "</color> <color=#7e91af>picked up</color> <color=#" + ColorUtility.ToHtmlStringRGB(baseColor) + ">" + string.Format("{0} ({1})</color> <color=#{2}>for themselves</color>", string.IsNullOrEmpty(@string) ? "???" : @string, itemCount, "7e91af") + ItemPickupFormatter(val) + "<color=#7e91af>.</color>";
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = baseToken3
				});
			}
		}

		public static void SendRichCauldronMessage(CharacterMaster player, PickupIndex index)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			CharacterBody val = (player.hasBody ? player.GetBody() : null);
			if (!GeneralHooks.IsMultiplayer() || (Object)(object)val == (Object)null || !ShareSuite.RichMessagesEnabled.Value)
			{
				if (ShareSuite.RichMessagesEnabled.Value)
				{
					SendPickupMessage(player, index);
				}
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(index);
			Color baseColor = pickupDef.baseColor;
			string @string = Language.GetString(pickupDef.nameToken);
			string playerColor = GetPlayerColor(player.playerCharacterMasterController);
			int itemCount = player.inventory.GetItemCount(pickupDef.itemIndex);
			string baseToken = "<color=#" + playerColor + ">" + val.GetUserName() + "</color> <color=#7e91af>traded for</color> <color=#" + ColorUtility.ToHtmlStringRGB(baseColor) + ">" + string.Format("{0} ({1})</color><color=#{2}>.</color>", string.IsNullOrEmpty(@string) ? "???" : @string, itemCount, "7e91af");
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = baseToken
			});
		}

		public static void SendRichRandomizedPickupMessage(CharacterMaster origPlayer, PickupDef origPickup, Dictionary<CharacterMaster, PickupDef> pickupIndices)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			if (!GeneralHooks.IsMultiplayer() || !ShareSuite.RichMessagesEnabled.Value)
			{
				if (ShareSuite.RichMessagesEnabled.Value)
				{
					SendPickupMessage(origPlayer, origPickup.pickupIndex);
				}
				return;
			}
			if (pickupIndices.Count == 1)
			{
				SendRichPickupMessage(origPlayer, origPickup);
				return;
			}
			int num = pickupIndices.Count;
			string text = "";
			foreach (KeyValuePair<CharacterMaster, PickupDef> pickupIndex in pickupIndices)
			{
				Color baseColor = pickupIndex.Value.baseColor;
				string @string = Language.GetString(pickupIndex.Value.nameToken);
				string playerColor = GetPlayerColor(pickupIndex.Key.playerCharacterMasterController);
				int itemCount = pickupIndex.Key.playerCharacterMasterController.master.inventory.GetItemCount(pickupIndex.Value.itemIndex);
				if (num != pickupIndices.Count)
				{
					if (num > 1)
					{
						text += "<color=#7e91af>,</color> ";
					}
					else if (num == 1)
					{
						text += "<color=#7e91af>, and</color> ";
					}
				}
				num--;
				text = text + "<color=#" + playerColor + ">" + pickupIndex.Key.playerCharacterMasterController.GetDisplayName() + "</color> <color=#7e91af>got</color> <color=#" + ColorUtility.ToHtmlStringRGB(baseColor) + ">" + string.Format("{0} ({1})</color>", string.IsNullOrEmpty(@string) ? "???" : @string, itemCount);
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = text
			});
		}

		private static string ItemPickupFormatter(CharacterBody body)
		{
			int num = GetEligiblePlayers(body);
			if (num < 1)
			{
				return " <color=#7e91af>and no-one else</color>";
			}
			if (num == 1)
			{
				foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
				{
					CharacterMaster master = instance.master;
					if (!master.hasBody || (Object)(object)master.GetBody() == (Object)(object)body)
					{
						continue;
					}
					string playerColor = GetPlayerColor(instance);
					return " <color=#7e91af>and</color> <color=#" + playerColor + ">" + instance.GetDisplayName() + "</color>";
				}
				return "<color=#ff0000>???</color>";
			}
			string text = "";
			foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances)
			{
				CharacterMaster master2 = instance2.master;
				if (master2.hasBody && !((Object)(object)master2.GetBody() == (Object)(object)body) && (!master2.IsDeadAndOutOfLivesServer() || ShareSuite.DeadPlayersGetItems.Value))
				{
					string playerColor2 = GetPlayerColor(instance2);
					if (num > 1)
					{
						text += "<color=#7e91af>,</color> ";
					}
					else if (num == 1)
					{
						text += "<color=#7e91af>, and</color> ";
					}
					num--;
					text = text + "<color=#" + playerColor2 + ">" + instance2.GetDisplayName() + "</color>";
				}
			}
			return text;
		}

		private static string GetPlayerColor(PlayerCharacterMasterController controllerMaster)
		{
			int num = PlayerCharacterMasterController.instances.IndexOf(controllerMaster);
			return PlayerColors[num % 8];
		}

		private static int GetEligiblePlayers(CharacterBody body)
		{
			int num = 0;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				CharacterMaster master = instance.master;
				if (Object.op_Implicit((Object)(object)master.inventory) && !((Object)(object)master.GetBody() == (Object)(object)body) && (!master.IsDeadAndOutOfLivesServer() || ShareSuite.DeadPlayersGetItems.Value))
				{
					num++;
				}
			}
			return num;
		}
	}
	public static class EquipmentSharingHooks
	{
		public static void UnHook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(OnGrantEquipment);
		}

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

		private static void OnGrantEquipment(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0105: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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;
			ChatHandler.SendPickupMessage(body.master, 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;
					PickupIndex val = PickupCatalog.FindPickupIndex(currentEquipmentIndex2);
					PickupDropletController.CreatePickupDroplet(val, transform.position, transform.forward * 20f);
				}
				inventory.SetEquipmentIndex(equip);
				self.NetworkpickupIndex = PickupCatalog.FindPickupIndex(equip);
				SyncToolbotEquip(item, ref equip);
			}
		}

		private static void DropAllOtherSharedEquipment(GenericPickupController self, CharacterBody body, EquipmentIndex originalEquip)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return ((int)originalEquip != -1) ? PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(originalEquip)).pickupIndex : PickupIndex.none;
		}

		public static void RemoveAllUnBlacklistedEquipment()
		{
			//IL_0065: 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_0010: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//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_0034: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0047: 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), 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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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) && !p.IsDeadAndOutOfLivesServer()
				select p).Count((CharacterMaster master) => master.inventory.currentEquipmentIndex == originalEquip);
		}

		private static bool EquipmentShared(EquipmentIndex pickup)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_000d: 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)
			if ((int)pickup == -1)
			{
				return true;
			}
			return IsEquipment(pickup) && !Blacklist.HasEquipment(pickup);
		}

		private static bool IsEquipment(EquipmentIndex index)
		{
			//IL_0001: 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)
			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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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()
		{
			return ShareSuite.OverrideMultiplayerCheck.Value || PlayerCharacterMasterController.instances.Count > 1;
		}

		private static void InteractibleCreditOverride(orig_PlaceTeleporter orig, SceneDirector self)
		{
			//IL_00df: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			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))
			{
				num = component.sceneDirectorInteractibleCredits;
				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(baseChancePercent, characterBodyObject);
		}
	}
	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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(OnShopPurchase);
			ShopTerminalBehavior.DropPickup -= new hook_DropPickup(OnPurchaseDrop);
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(OnGrantItem);
			Opening.OnEnter -= new hook_OnEnter(OnScavengerDrop);
			PlayerPickupChatMessage.ConstructChatString -= new hook_ConstructChatString(FixZeroItemCount);
			ScrappingToIdle.OnEnter -= new hook_OnEnter(ScrappingToIdle_OnEnter);
			PickupCatalog.FindPickupIndex_string -= new hook_FindPickupIndex_string(ItemLock);
			ArenaMissionController.EndRound -= new Manipulator(ArenaDropEnable);
			InfiniteTowerWaveController.DropRewards -= new Manipulator(SimulacrumArenaDropEnable);
		}

		public static void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnShopPurchase);
			ShopTerminalBehavior.DropPickup += new hook_DropPickup(OnPurchaseDrop);
			GenericPickupController.AttemptGrant += new hook_AttemptGrant(OnGrantItem);
			Opening.OnEnter += new hook_OnEnter(OnScavengerDrop);
			PlayerPickupChatMessage.ConstructChatString += new hook_ConstructChatString(FixZeroItemCount);
			ScrappingToIdle.OnEnter += new hook_OnEnter(ScrappingToIdle_OnEnter);
			PickupCatalog.FindPickupIndex_string += new hook_FindPickupIndex_string(ItemLock);
			if (ShareSuite.OverrideVoidFieldLootScalingEnabled.Value)
			{
				ArenaMissionController.EndRound += new Manipulator(ArenaDropEnable);
				InfiniteTowerWaveController.DropRewards += new Manipulator(SimulacrumArenaDropEnable);
			}
		}

		private static PickupIndex ItemLock(orig_FindPickupIndex_string orig, string pickupName)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			if (_itemLock)
			{
				_itemLock = false;
				return orig.Invoke("This is not an item!");
			}
			return orig.Invoke(pickupName);
		}

		private static void ScrappingToIdle_OnEnter(orig_OnEnter orig, ScrappingToIdle self)
		{
			//IL_007f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected I4, but got Unknown
			//IL_013d: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			if (!ShareSuite.PrinterCauldronFixEnabled.Value || !NetworkServer.active || !GeneralHooks.IsMultiplayer())
			{
				orig.Invoke(self);
				return;
			}
			_itemLock = true;
			orig.Invoke(self);
			object instanceField = GetInstanceField(typeof(ScrapperBaseState), self, "scrapperController");
			ScrapperController val = (ScrapperController)((instanceField is ScrapperController) ? instanceField : null);
			Debug.Log((object)val);
			Debug.Log((object)_itemLock);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			PickupIndex val2 = PickupIndex.none;
			ItemDef itemDef = ItemCatalog.GetItemDef(val.lastScrappedItemIndex);
			if ((Object)(object)itemDef != (Object)null)
			{
				ItemTier tier = itemDef.tier;
				ItemTier val3 = tier;
				switch ((int)val3)
				{
				case 0:
					val2 = PickupCatalog.FindPickupIndex("ItemIndex.ScrapWhite");
					break;
				case 1:
					val2 = PickupCatalog.FindPickupIndex("ItemIndex.ScrapGreen");
					break;
				case 2:
					val2 = PickupCatalog.FindPickupIndex("ItemIndex.ScrapRed");
					break;
				case 4:
					val2 = PickupCatalog.FindPickupIndex("ItemIndex.ScrapYellow");
					break;
				}
			}
			if (!(val2 == PickupIndex.none))
			{
				object instanceField2 = GetInstanceField(typeof(ScrapperController), val, "interactor");
				Interactor val4 = (Interactor)((instanceField2 is Interactor) ? instanceField2 : null);
				Debug.Log((object)"Interactor Established");
				PickupDef pickupDef = PickupCatalog.GetPickupDef(val2);
				if (Object.op_Implicit((Object)(object)val4))
				{
					SetInstanceField(typeof(ScrappingToIdle), self, "foundValidScrap", true);
					CharacterBody component = ((Component)val4).GetComponent<CharacterBody>();
					HandleGiveItem(component.master, pickupDef);
					ChatHandler.SendRichCauldronMessage(((Component)component.inventory).GetComponent<CharacterMaster>(), val2);
					val.itemsEaten -= 1;
				}
			}
		}

		private static void OnGrantItem(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			//IL_0002: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			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;
			if (!Blacklist.HasItem(pickupDef.itemIndex) && NetworkServer.active && IsValidItemPickup(self.pickupIndex) && IsValidPickupObject(self, body) && GeneralHooks.IsMultiplayer())
			{
				if (ShareSuite.RandomizeSharedPickups.Value)
				{
					dictionary.Add(val, pickupDef);
				}
				foreach (CharacterMaster item in PlayerCharacterMasterController.instances.Select((PlayerCharacterMasterController p) => p.master))
				{
					if (!ShareSuite.DeadPlayersGetItems.Value && item.IsDeadAndOutOfLivesServer())
					{
						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);
							HandleGiveItem(item, pickupDef2);
							dictionary.Add(item, pickupDef2);
						}
					}
					else
					{
						HandleGiveItem(item, pickupDef);
					}
				}
				if (ShareSuite.RandomizeSharedPickups.Value)
				{
					orig.Invoke(self, body);
					ChatHandler.SendRichRandomizedPickupMessage(val, pickupDef, dictionary);
					return;
				}
			}
			orig.Invoke(self, body);
			ChatHandler.SendRichPickupMessage(val, pickupDef);
			HandleRichMessageUnlockAndNotification(val, pickupDef.pickupIndex);
		}

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

		private static void OnPurchaseDrop(orig_DropPickup orig, ShopTerminalBehavior self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_004b: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			if (!NetworkServer.active)
			{
				orig.Invoke(self);
				return;
			}
			CostTypeIndex costType = ((Component)self).GetComponent<PurchaseInteraction>().costType;
			if (!GeneralHooks.IsMultiplayer() || (!IsValidItemPickup(self.CurrentPickupIndex()) && !ShareSuite.PrinterCauldronFixEnabled.Value) || (int)self.itemTier == 3 || (int)costType == 1 || (int)costType == 0)
			{
				orig.Invoke(self);
			}
			else if (!ShareSuite.PrinterCauldronFixEnabled.Value && PrinterCosts.Contains(costType))
			{
				orig.Invoke(self);
			}
		}

		private static void OnShopPurchase(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Invalid comparison between Unknown and I4
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			if (!self.CanBeAffordedByInteractor(activator))
			{
				return;
			}
			if (!GeneralHooks.IsMultiplayer())
			{
				orig.Invoke(self, activator);
				return;
			}
			if ((int)self.costType == 0)
			{
				orig.Invoke(self, activator);
				return;
			}
			ShopTerminalBehavior component = ((Component)self).GetComponent<ShopTerminalBehavior>();
			if (PrinterCosts.Contains(self.costType) && ShareSuite.PrinterCauldronFixEnabled.Value)
			{
				CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>();
				Inventory inventory = component2.inventory;
				if (!(PickupCatalog.GetPickupDef(component.CurrentPickupIndex())?.itemIndex).HasValue)
				{
					MonoBehaviour.print((object)"ShareSuite: PickupCatalog is null.");
				}
				else
				{
					HandleGiveItem(component2.master, PickupCatalog.GetPickupDef(component.CurrentPickupIndex()));
				}
				orig.Invoke(self, activator);
				ChatHandler.SendRichCauldronMessage(((Component)inventory).GetComponent<CharacterMaster>(), component.CurrentPickupIndex());
				return;
			}
			if (ShareSuite.EquipmentShared.Value && (int)self.costType == 7)
			{
				Xoroshiro128Plus component3 = ((Component)self).GetComponent<Xoroshiro128Plus>();
				ItemIndex val = (ItemIndex)(-1);
				CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef(self.costType);
				if (Object.op_Implicit((Object)(object)component))
				{
					val = PickupCatalog.GetPickupDef(component.CurrentPickupIndex()).itemIndex;
				}
				PayCostResults val2 = costTypeDef.PayCost(self.cost, activator, ((Component)self).gameObject, component3, val);
				if (val2.equipmentTaken.Count >= 1)
				{
					orig.Invoke(self, activator);
					EquipmentSharingHooks.RemoveAllUnBlacklistedEquipment();
					return;
				}
			}
			orig.Invoke(self, activator);
		}

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

		public static void ArenaDropEnable(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			int num3 = default(int);
			float num2 = default(float);
			int num = default(int);
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num3),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2),
				(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_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0023: 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_0034: 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)
			//IL_0038: 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_006b: Expected I4, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Invalid comparison between Unknown and I4
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup);
			if (pickupDef != null && (int)pickupDef.itemIndex != -1)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
				ItemTier tier = itemDef.tier;
				ItemTier val = tier;
				switch ((int)val)
				{
				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 10:
					return true;
				default:
					return false;
				case 5:
					break;
				}
			}
			if (pickupDef != null && (int)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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(orDefault);
			if (Blacklist.HasItem(pickupDef.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;
			FieldInfo field = type.GetField(fieldName, bindingAttr);
			return field.GetValue(instance);
		}

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

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

		private static void HandleGiveItem(CharacterMaster characterMaster, PickupDef pickupDef)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			characterMaster.inventory.GiveItem(pickupDef.itemIndex, 1);
			NetworkUser networkUser = characterMaster.playerCharacterMasterController.networkUser;
			int? num = ((networkUser == null) ? null : ((NetworkBehaviour)networkUser).connectionToClient?.connectionId);
			if (num.HasValue)
			{
				NetworkHandler.SendItemPickupMessage(num.Value, pickupDef.pickupIndex);
			}
		}

		public static void HandleRichMessageUnlockAndNotification(CharacterMaster characterMaster, PickupIndex pickupIndex)
		{
			//IL_0054: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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);
			GoldGatFire.FireBullet -= new Manipulator(RemoveGoldGatMoneyLine);
		}

		internal static void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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);
			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 OnShopPurchase(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0026: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//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_0030: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer() && Object.op_Implicit((Object)(object)self))
			{
				CostTypeIndex costType = self.costType;
				CostTypeIndex val = costType;
				if ((int)val == 1)
				{
					if (self.cost <= SharedMoneyValue)
					{
						orig.Invoke(self, activator);
						SharedMoneyValue -= self.cost;
					}
					return;
				}
				if ((int)val == 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>();
					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;
					return;
				}
			}
			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_0044: 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_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			FieldReference val4 = default(FieldReference);
			float num = default(float);
			FieldReference val3 = default(FieldReference);
			MethodReference val2 = default(MethodReference);
			val.GotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val4),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val3),
				(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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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
			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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_00a5: 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;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.funkfrog_sipondo.sharesuite", "ShareSuite", "2.9.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ShareSuite : BaseUnityPlugin
	{
		public static string MessageSendVer = "2.9";

		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> 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<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 Update()
		{
			if (!ModIsEnabled.Value || !MoneyIsShared.Value || MoneySharingHooks.MapTransitionActive || !GeneralHooks.IsMultiplayer())
			{
				return;
			}
			NetworkHandler.RegisterHandlers();
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (!instance.master.IsDeadAndOutOfLivesServer() && instance.master.money != MoneySharingHooks.SharedMoneyValue)
				{
					instance.master.money = (uint)MoneySharingHooks.SharedMoneyValue;
				}
			}
		}

		public ShareSuite()
		{
			InitConfig();
			CommandHelper.AddToConsoleWhenReady();
			ReloadHooks();
			MoneySharingHooks.SharedMoneyValue = 15;
		}

		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.");
			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", false, "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", "ItemBlacklist", "BeetleGland,TreasureCache,TitanGoldDuringTP,TPHealingNova,ArtifactKey,FreeChest,RoboBallBuddy,MinorConstructOnKill", "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.");
		}

		[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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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 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(