Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ShareSuite KOFFE Fix v1.15.2
ShareSuite.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
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.Security; using System.Security.Permissions; 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 Microsoft.CodeAnalysis; 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.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ShareSuite")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A Risk of Rain 2 Mod")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+99572dcb97bd4a695454f89eb5a07a74a4af2e65")] [assembly: AssemblyProduct("ShareSuite")] [assembly: AssemblyTitle("ShareSuite")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace R2API.Utils { public static class CommandHelper { public static CharacterBody FindBody(string name, int index) { List<CharacterBody> list = (from b in Object.FindObjectsOfType<CharacterBody>() where ((Object)b).name == name select b).ToList(); if (list.Count <= index) { return null; } return list[index]; } public static void RegisterCommands(Console self) { } } } 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) _items = new ItemMask(); string[] array = ShareSuite.ItemBlacklist.Value.Split(','); for (int i = 0; i < array.Length; i++) { ItemIndex val = ItemCatalog.FindItemIndex(array[i]); if ((int)val != -1) { _items.Add(val); } } } private static void LoadBlackListEquipment() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) _equipment = new EquipmentMask(); string[] array = ShareSuite.EquipmentBlacklist.Value.Split(','); for (int i = 0; i < array.Length; i++) { EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(array[i]); if ((int)val != -1) { _equipment.Add(val); } } } public static bool HasItem(ItemIndex itemIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ValidateItemCache(); return _items.Contains(itemIndex); } public static bool HasEquipment(EquipmentIndex equipmentIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ValidateItemCache(); return _equipment.Contains(equipmentIndex); } public static void Recalculate() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown _cachedAvailableItems = new ItemMask(); } private static void ValidateItemCache() { if ((Object)(object)Run.instance == (Object)null) { Recalculate(); } else { if (((object)_cachedAvailableItems).Equals((object?)Run.instance.availableItems)) { return; } _cachedAvailableItems = Run.instance.availableItems; LoadBlackListItems(); LoadBlackListEquipment(); IEnumerable<PickupIndex> item = new List<PickupIndex>().Concat(Run.instance.availableVoidTier1DropList).Concat(Run.instance.availableVoidTier2DropList).Concat(Run.instance.availableVoidTier3DropList) .Concat(Run.instance.availableVoidBossDropList); (List<PickupIndex>, IEnumerable<PickupIndex>)[] array = new(List<PickupIndex>, IEnumerable<PickupIndex>)[6] { (_availableTier1DropList, Run.instance.availableTier1DropList), (_availableTier2DropList, Run.instance.availableTier2DropList), (_availableTier3DropList, Run.instance.availableTier3DropList), (_availableLunarDropList, Run.instance.availableLunarItemDropList), (_availableBossDropList, Run.instance.availableBossDropList), (_availableVoidDropList, item) }; for (int i = 0; i < array.Length; i++) { var (list, source) = array[i]; list.Clear(); list.AddRange(source.Where(delegate(PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); return pickupDef != null && !_items.Contains(pickupDef.itemIndex); })); } } } private static List<PickupIndex> Get(List<PickupIndex> list) { ValidateItemCache(); return list; } } public static class ChatHandler { public delegate void SendPickupMessageDelegate(CharacterMaster master, PickupIndex pickupIndex); [CompilerGenerated] private static class <>O { public static hook_SendPlayerConnectedMessage <0>__SendIntroMessage; } 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 void UnHook() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__SendIntroMessage; if (obj == null) { hook_SendPlayerConnectedMessage val = SendIntroMessage; <>O.<0>__SendIntroMessage = val; obj = (object)val; } Chat.SendPlayerConnectedMessage -= (hook_SendPlayerConnectedMessage)obj; } public static void Hook() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__SendIntroMessage; if (obj == null) { hook_SendPlayerConnectedMessage val = SendIntroMessage; <>O.<0>__SendIntroMessage = val; obj = (object)val; } Chat.SendPlayerConnectedMessage += (hook_SendPlayerConnectedMessage)obj; } 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_0000: 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_0016: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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 SendRichPickupMessage(CharacterMaster player, PickupIndex pickupIndex) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown CharacterBody val = (player.hasBody ? player.GetBody() : null); PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (!GeneralHooks.IsMultiplayer() || (Object)(object)val == (Object)null || !ShareSuite.RichMessagesEnabled.Value) { if (ShareSuite.RichMessagesEnabled.Value) { SendPickupMessage(player, 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_0024: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown CharacterBody body = player.GetBody(); if (GeneralHooks.IsMultiplayer() && !((Object)(object)body == (Object)null) && ShareSuite.RichMessagesEnabled.Value) { 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 + ">" + body.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, PickupIndex> pickupIndices) { //IL_0021: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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.pickupIndex); return; } int num = pickupIndices.Count; string text = ""; foreach (KeyValuePair<CharacterMaster, PickupIndex> pickupIndex in pickupIndices) { PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex.Value); Color baseColor = pickupDef.baseColor; string @string = Language.GetString(pickupDef.nameToken); string playerColor = GetPlayerColor(pickupIndex.Key.playerCharacterMasterController); int itemCount = pickupIndex.Key.inventory.GetItemCount(pickupDef.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)) { 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 (master.hasBody && !((Object)(object)master.GetBody() == (Object)(object)body) && (!master.IsDeadAndOutOfLivesServer() || ShareSuite.DeadPlayersGetItems.Value)) { num++; } } return num; } public static void SendPickupMessage(CharacterMaster master, PickupIndex pickupIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); SubjectFormatChatMessage val = new SubjectFormatChatMessage(); ((SubjectChatMessage)val).subjectAsCharacterBody = master.GetBody(); ((SubjectChatMessage)val).baseToken = "PLAYER_PICKUP"; val.paramTokens = new string[1] { pickupDef.nameToken }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } } public static class EquipmentSharingHooks { [CompilerGenerated] private static class <>O { public static hook_AttemptGrant <0>__OnGrantEquipment; } public static void UnHook() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__OnGrantEquipment; if (obj == null) { hook_AttemptGrant val = OnGrantEquipment; <>O.<0>__OnGrantEquipment = val; obj = (object)val; } GenericPickupController.AttemptGrant -= (hook_AttemptGrant)obj; } public static void Hook() { //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_001b: Expected O, but got Unknown object obj = <>O.<0>__OnGrantEquipment; if (obj == null) { hook_AttemptGrant val = OnGrantEquipment; <>O.<0>__OnGrantEquipment = val; obj = (object)val; } GenericPickupController.AttemptGrant += (hook_AttemptGrant)obj; } private static void OnGrantEquipment(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0091: 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_0099: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00b9: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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 equipmentIndex = body.inventory.GetEquipmentIndex(); PickupIndex pickupIndex = GetPickupIndex(equipmentIndex); EquipmentIndex equip = PickupCatalog.GetPickupDef(self.pickupIndex).equipmentIndex; ChatHandler.SendRichPickupMessage(body.master, self.pickupIndex); body.inventory.SetEquipmentIndex(equip, true); Object.Destroy((Object)(object)((Component)self).gameObject); if (!EquipmentShared(equipmentIndex) && EquipmentShared(equip)) { CreateDropletIfExists(pickupIndex, ((Component)self).transform.position); DropAllOtherSharedEquipment(self, body, equipmentIndex); } else { if ((EquipmentShared(equipmentIndex) && !EquipmentShared(equip) && GetLivingPlayersWithEquipment(equipmentIndex) < 1) || (!EquipmentShared(equipmentIndex) && !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 equipmentIndex2 = inventory.GetEquipmentIndex(); if (!EquipmentShared(equipmentIndex2)) { if (!ShareSuite.DropBlacklistedEquipmentOnShare.Value) { continue; } Transform transform = ((Component)item.GetBody()).transform; UniquePickup val = default(UniquePickup); val.pickupIndex = PickupCatalog.FindPickupIndex(equipmentIndex2); PickupDropletController.CreatePickupDroplet(val, transform.position, transform.forward * 20f); } inventory.SetEquipmentIndex(equip, true); SyncToolbotEquip(item, ref equip); } } private static void DropAllOtherSharedEquipment(GenericPickupController self, CharacterBody body, EquipmentIndex originalEquip) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) List<EquipmentIndex> list = new List<EquipmentIndex>(); foreach (CharacterMaster item in from p in PlayerCharacterMasterController.instances select p.master into p where Object.op_Implicit((Object)(object)p.inventory) && (Object)(object)p != (Object)(object)body.master select p) { EquipmentIndex equipmentIndex = item.inventory.GetEquipmentIndex(); if (EquipmentShared(equipmentIndex) && !list.Contains(equipmentIndex) && equipmentIndex != originalEquip) { CreateDropletIfExists(GetPickupIndex(equipmentIndex), ((Component)self).transform.position); list.Add(equipmentIndex); } } } private static PickupIndex GetPickupIndex(EquipmentIndex originalEquip) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)originalEquip == -1) { return PickupIndex.none; } return PickupCatalog.FindPickupIndex(originalEquip); } public static void RemoveAllUnBlacklistedEquipment() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterMaster item in from p in PlayerCharacterMasterController.instances select p.master into p where Object.op_Implicit((Object)(object)p.inventory) select p) { if (!Blacklist.HasEquipment(item.inventory.GetEquipmentIndex())) { item.inventory.SetEquipmentIndex((EquipmentIndex)(-1), true); } } } private static void SetEquipmentIndex(Inventory self, EquipmentIndex newEquipmentIndex, uint slot) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && self.GetEquipmentIndex() != newEquipmentIndex) { EquipmentState equipment = self.GetEquipment(0u); byte b = equipment.charges; if ((int)equipment.equipmentIndex == -1) { b = 1; } self.SetEquipment(new EquipmentState(newEquipmentIndex, equipment.chargeFinishTime, b, false), slot); } } private static void SyncToolbotEquip(CharacterMaster characterMaster, ref EquipmentIndex equip) { if (!(((Object)characterMaster.bodyPrefab).name != "ToolbotBody")) { SetEquipmentIndex(characterMaster.inventory, equip, (uint)(characterMaster.inventory.activeEquipmentSlot + 1) % 2u); } } private static void CreateDropletIfExists(PickupIndex pickupIndex, Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (pickupIndex != PickupIndex.none) { UniquePickup val = default(UniquePickup); val.pickupIndex = pickupIndex; PickupDropletController.CreatePickupDroplet(val, 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.GetEquipmentIndex() == originalEquip); } private static bool EquipmentShared(EquipmentIndex pickup) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)pickup == -1) { return true; } if (IsEquipment(pickup)) { return !Blacklist.HasEquipment(pickup); } return false; } private static bool IsEquipment(EquipmentIndex index) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) return ((IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment).Contains(index); } } public static class GeneralHooks { [CompilerGenerated] private static class <>O { public static hook_DropRewards <0>__BossGroup_DropRewards; public static hook_OnInteractionBegin <1>__OverrideBossLootScaling; public static hook_OnPrePopulateSceneServer <2>__SetSacrificeOffset; public static hook_GetExpAdjustedDropChancePercent <3>__GetExpAdjustedDropChancePercent; } 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_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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__BossGroup_DropRewards; if (obj == null) { hook_DropRewards val = BossGroup_DropRewards; <>O.<0>__BossGroup_DropRewards = val; obj = (object)val; } BossGroup.DropRewards += (hook_DropRewards)obj; object obj2 = <>O.<1>__OverrideBossLootScaling; if (obj2 == null) { hook_OnInteractionBegin val2 = OverrideBossLootScaling; <>O.<1>__OverrideBossLootScaling = val2; obj2 = (object)val2; } TeleporterInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; object obj3 = <>O.<2>__SetSacrificeOffset; if (obj3 == null) { hook_OnPrePopulateSceneServer val3 = SetSacrificeOffset; <>O.<2>__SetSacrificeOffset = val3; obj3 = (object)val3; } SacrificeArtifactManager.OnPrePopulateSceneServer += (hook_OnPrePopulateSceneServer)obj3; object obj4 = <>O.<3>__GetExpAdjustedDropChancePercent; if (obj4 == null) { hook_GetExpAdjustedDropChancePercent val4 = GetExpAdjustedDropChancePercent; <>O.<3>__GetExpAdjustedDropChancePercent = val4; obj4 = (object)val4; } Util.GetExpAdjustedDropChancePercent += (hook_GetExpAdjustedDropChancePercent)obj4; } internal static void UnHook() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__BossGroup_DropRewards; if (obj == null) { hook_DropRewards val = BossGroup_DropRewards; <>O.<0>__BossGroup_DropRewards = val; obj = (object)val; } BossGroup.DropRewards -= (hook_DropRewards)obj; object obj2 = <>O.<1>__OverrideBossLootScaling; if (obj2 == null) { hook_OnInteractionBegin val2 = OverrideBossLootScaling; <>O.<1>__OverrideBossLootScaling = val2; obj2 = (object)val2; } TeleporterInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj2; object obj3 = <>O.<2>__SetSacrificeOffset; if (obj3 == null) { hook_OnPrePopulateSceneServer val3 = SetSacrificeOffset; <>O.<2>__SetSacrificeOffset = val3; obj3 = (object)val3; } SacrificeArtifactManager.OnPrePopulateSceneServer -= (hook_OnPrePopulateSceneServer)obj3; object obj4 = <>O.<3>__GetExpAdjustedDropChancePercent; if (obj4 == null) { hook_GetExpAdjustedDropChancePercent val4 = GetExpAdjustedDropChancePercent; <>O.<3>__GetExpAdjustedDropChancePercent = val4; obj4 = (object)val4; } Util.GetExpAdjustedDropChancePercent -= (hook_GetExpAdjustedDropChancePercent)obj4; } private static void BossGroup_DropRewards(orig_DropRewards orig, BossGroup group) { group.scaleRewardsByPlayerCount = false; group.bonusRewardCount += _bossItems - 1; orig.Invoke(group); } private static void SetSacrificeOffset(orig_OnPrePopulateSceneServer orig, SceneDirector sceneDirector) { _sacrificeOffset = 2; orig.Invoke(sceneDirector); } private static void OverrideBossLootScaling(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { _bossItems = (ShareSuite.OverrideBossLootScalingEnabled.Value ? ShareSuite.BossLootCredit.Value : Run.instance.participatingPlayerCount); orig.Invoke(self, activator); } public static bool IsMultiplayer() { if (!ShareSuite.OverrideMultiplayerCheck.Value) { return PlayerCharacterMasterController.instances.Count > 1; } return true; } private static void InteractibleCreditOverride(orig_PlaceTeleporter orig, SceneDirector self) { //IL_00b8: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); 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 { [CompilerGenerated] private static class <>O { public static hook_OnInteractionBegin <0>__OnShopPurchase; public static hook_DropPickup <1>__OnPurchaseDrop; public static hook_AttemptGrant <2>__OnGrantItem; public static hook_OnEnter <3>__OnScavengerDrop; public static hook_ConstructChatString <4>__FixZeroItemCount; public static hook_OnEnter <5>__ScrappingToIdle_OnEnter; public static hook_FindPickupIndex_string <6>__ItemLock; public static Manipulator <7>__ArenaDropEnable; public static Manipulator <8>__SimulacrumArenaDropEnable; } private static bool _itemLock = false; public 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_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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //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_00db: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown object obj = <>O.<0>__OnShopPurchase; if (obj == null) { hook_OnInteractionBegin val = OnShopPurchase; <>O.<0>__OnShopPurchase = val; obj = (object)val; } PurchaseInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj; object obj2 = <>O.<1>__OnPurchaseDrop; if (obj2 == null) { hook_DropPickup val2 = OnPurchaseDrop; <>O.<1>__OnPurchaseDrop = val2; obj2 = (object)val2; } ShopTerminalBehavior.DropPickup -= (hook_DropPickup)obj2; object obj3 = <>O.<2>__OnGrantItem; if (obj3 == null) { hook_AttemptGrant val3 = OnGrantItem; <>O.<2>__OnGrantItem = val3; obj3 = (object)val3; } GenericPickupController.AttemptGrant -= (hook_AttemptGrant)obj3; object obj4 = <>O.<3>__OnScavengerDrop; if (obj4 == null) { hook_OnEnter val4 = OnScavengerDrop; <>O.<3>__OnScavengerDrop = val4; obj4 = (object)val4; } Opening.OnEnter -= (hook_OnEnter)obj4; object obj5 = <>O.<4>__FixZeroItemCount; if (obj5 == null) { hook_ConstructChatString val5 = FixZeroItemCount; <>O.<4>__FixZeroItemCount = val5; obj5 = (object)val5; } PlayerPickupChatMessage.ConstructChatString -= (hook_ConstructChatString)obj5; object obj6 = <>O.<5>__ScrappingToIdle_OnEnter; if (obj6 == null) { hook_OnEnter val6 = ScrappingToIdle_OnEnter; <>O.<5>__ScrappingToIdle_OnEnter = val6; obj6 = (object)val6; } ScrappingToIdle.OnEnter -= (hook_OnEnter)obj6; object obj7 = <>O.<6>__ItemLock; if (obj7 == null) { hook_FindPickupIndex_string val7 = ItemLock; <>O.<6>__ItemLock = val7; obj7 = (object)val7; } PickupCatalog.FindPickupIndex_string -= (hook_FindPickupIndex_string)obj7; object obj8 = <>O.<7>__ArenaDropEnable; if (obj8 == null) { Manipulator val8 = ArenaDropEnable; <>O.<7>__ArenaDropEnable = val8; obj8 = (object)val8; } ArenaMissionController.EndRound -= (Manipulator)obj8; object obj9 = <>O.<8>__SimulacrumArenaDropEnable; if (obj9 == null) { Manipulator val9 = SimulacrumArenaDropEnable; <>O.<8>__SimulacrumArenaDropEnable = val9; obj9 = (object)val9; } InfiniteTowerWaveController.DropRewards -= (Manipulator)obj9; } public static void Hook() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //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_00db: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown object obj = <>O.<0>__OnShopPurchase; if (obj == null) { hook_OnInteractionBegin val = OnShopPurchase; <>O.<0>__OnShopPurchase = val; obj = (object)val; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj; object obj2 = <>O.<1>__OnPurchaseDrop; if (obj2 == null) { hook_DropPickup val2 = OnPurchaseDrop; <>O.<1>__OnPurchaseDrop = val2; obj2 = (object)val2; } ShopTerminalBehavior.DropPickup += (hook_DropPickup)obj2; object obj3 = <>O.<2>__OnGrantItem; if (obj3 == null) { hook_AttemptGrant val3 = OnGrantItem; <>O.<2>__OnGrantItem = val3; obj3 = (object)val3; } GenericPickupController.AttemptGrant += (hook_AttemptGrant)obj3; object obj4 = <>O.<3>__OnScavengerDrop; if (obj4 == null) { hook_OnEnter val4 = OnScavengerDrop; <>O.<3>__OnScavengerDrop = val4; obj4 = (object)val4; } Opening.OnEnter += (hook_OnEnter)obj4; object obj5 = <>O.<4>__FixZeroItemCount; if (obj5 == null) { hook_ConstructChatString val5 = FixZeroItemCount; <>O.<4>__FixZeroItemCount = val5; obj5 = (object)val5; } PlayerPickupChatMessage.ConstructChatString += (hook_ConstructChatString)obj5; object obj6 = <>O.<5>__ScrappingToIdle_OnEnter; if (obj6 == null) { hook_OnEnter val6 = ScrappingToIdle_OnEnter; <>O.<5>__ScrappingToIdle_OnEnter = val6; obj6 = (object)val6; } ScrappingToIdle.OnEnter += (hook_OnEnter)obj6; object obj7 = <>O.<6>__ItemLock; if (obj7 == null) { hook_FindPickupIndex_string val7 = ItemLock; <>O.<6>__ItemLock = val7; obj7 = (object)val7; } PickupCatalog.FindPickupIndex_string += (hook_FindPickupIndex_string)obj7; if (ShareSuite.OverrideVoidFieldLootScalingEnabled.Value) { object obj8 = <>O.<7>__ArenaDropEnable; if (obj8 == null) { Manipulator val8 = ArenaDropEnable; <>O.<7>__ArenaDropEnable = val8; obj8 = (object)val8; } ArenaMissionController.EndRound += (Manipulator)obj8; object obj9 = <>O.<8>__SimulacrumArenaDropEnable; if (obj9 == null) { Manipulator val9 = SimulacrumArenaDropEnable; <>O.<8>__SimulacrumArenaDropEnable = val9; obj9 = (object)val9; } InfiniteTowerWaveController.DropRewards += (Manipulator)obj9; } } private static PickupIndex ItemLock(orig_FindPickupIndex_string orig, string pickupName) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected I4, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_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_0167: 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((ItemIndex)GetInstanceField(typeof(ScrapperController), val, "_lastScrappedItemIndex")); if ((Object)(object)itemDef != (Object)null) { ItemTier tier = itemDef.tier; switch ((int)tier) { 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 val3 = (Interactor)((instanceField2 is Interactor) ? instanceField2 : null); Debug.Log((object)"Interactor Established"); PickupDef pickupDef = PickupCatalog.GetPickupDef(val2); if (Object.op_Implicit((Object)(object)val3)) { SetInstanceField(typeof(ScrappingToIdle), self, "foundValidScrap", true); CharacterBody component = ((Component)val3).GetComponent<CharacterBody>(); HandleGiveItem(component.master, pickupDef); ChatHandler.SendRichCauldronMessage(component.master, val2); int num = (int)GetInstanceField(typeof(ScrapperController), val, "_itemsEaten"); SetInstanceField(typeof(ScrapperController), val, "_itemsEaten", num - 1); } } } private static void OnGrantItem(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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, PickupIndex> dictionary = new Dictionary<CharacterMaster, PickupIndex>(); 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(pickupDef.pickupIndex) && IsValidPickupObject(self, body) && GeneralHooks.IsMultiplayer()) { if (ShareSuite.RandomizeSharedPickups.Value) { dictionary.Add(val, pickupDef.pickupIndex); } 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.pickupIndex); } } 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, self.pickupIndex); HandleRichMessageUnlockAndNotification(val, self.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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0049: 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_0069: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(self); return; } CostTypeIndex costType = ((Component)self).GetComponent<PurchaseInteraction>().costType; if (!GeneralHooks.IsMultiplayer() || (!IsValidItemPickup(self.CurrentPickup().pickupIndex) && !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_001b: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //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_0082: 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) //IL_00c2: 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>(); _ = component2.inventory; PickupDef pickupDef = PickupCatalog.GetPickupDef(component.CurrentPickup().pickupIndex); if (!(pickupDef?.itemIndex).HasValue) { MonoBehaviour.print((object)"ShareSuite: PickupCatalog is null."); } else { HandleGiveItem(component2.master, pickupDef); } orig.Invoke(self, activator); ChatHandler.SendRichCauldronMessage(component2.master, component.CurrentPickup().pickupIndex); } else if (ShareSuite.EquipmentShared.Value && (int)self.costType == 7) { orig.Invoke(self, activator); EquipmentSharingHooks.RemoveAllUnBlacklistedEquipment(); } else { orig.Invoke(self, activator); } } private static void OnScavengerDrop(orig_OnEnter orig, Opening self) { orig.Invoke(self); ShareSuite.DefaultMaxScavItemDropCount = Math.Max(Opening.maxItemDropCount, ShareSuite.DefaultMaxScavItemDropCount); if (Reflection.GetFieldValue<ChestBehavior>((object)self, "chestBehavior").tier1Chance > 0f) { Opening.maxItemDropCount = Math.Min(Math.Max((int)Math.Ceiling((double)ShareSuite.DefaultMaxScavItemDropCount / (double)Run.instance.participatingPlayerCount), 2), ShareSuite.DefaultMaxScavItemDropCount); } else { Opening.maxItemDropCount = ShareSuite.DefaultMaxScavItemDropCount; } } public static void ArenaDropEnable(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); int 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); float num = default(float); val.GotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1) }); int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int i) => ShareSuite.SimulacrumLootCredit.Value)); } public static bool IsValidItemPickup(PickupIndex pickup) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected I4, but got Unknown PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup); if (pickupDef != null && (int)pickupDef.itemIndex != -1) { ItemTier tier = ItemCatalog.GetItemDef(pickupDef.itemIndex).tier; switch ((int)tier) { case 0: return ShareSuite.WhiteItemsShared.Value; case 1: return ShareSuite.GreenItemsShared.Value; case 2: return ShareSuite.RedItemsShared.Value; case 3: return ShareSuite.LunarItemsShared.Value; case 4: return ShareSuite.BossItemsShared.Value; case 6: return ShareSuite.VoidItemsShared.Value; case 7: return ShareSuite.VoidItemsShared.Value; case 8: return ShareSuite.VoidItemsShared.Value; case 9: return ShareSuite.VoidItemsShared.Value; case 11: return true; default: return false; case 5: break; } } if (pickupDef != null) { _ = pickupDef.equipmentIndex; _ = -1; return false; } return false; } public static bool IsValidPickupObject(GenericPickupController pickup, CharacterBody picker) { if (ItemSharingHooks.AdditionalPickupValidityChecks == null) { return true; } bool flag = true; Delegate[] invocationList = ItemSharingHooks.AdditionalPickupValidityChecks.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Func<GenericPickupController, CharacterBody, bool> func = (Func<GenericPickupController, CharacterBody, bool>)invocationList[i]; flag &= func(pickup, picker); } return flag; } private static PickupIndex? GetRandomItemOfTier(ItemTier tier, PickupIndex orDefault) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) switch ((int)tier) { case 0: return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier1DropList); case 1: return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier2DropList); case 2: return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableTier3DropList); case 3: if (ShareSuite.LunarItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableLunarDropList); } break; case 4: if (ShareSuite.BossItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableBossDropList); } break; case 9: if (ShareSuite.VoidItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList); } break; case 6: if (ShareSuite.VoidItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList); } break; case 7: if (ShareSuite.VoidItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList); } break; case 8: if (ShareSuite.VoidItemsRandomized.Value) { return PickRandomOf<PickupIndex>((IList<PickupIndex>)Blacklist.AvailableVoidDropList); } break; } if (Blacklist.HasItem(PickupCatalog.GetPickupDef(orDefault).itemIndex)) { return null; } return orDefault; } internal static object GetInstanceField(Type type, object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField; return type.GetField(fieldName, bindingAttr).GetValue(instance); } internal static void SetInstanceField(Type type, object instance, string fieldName, object value) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; type.GetField(fieldName, bindingAttr).SetValue(instance, value); } private static T? PickRandomOf<T>(IList<T> collection) where T : struct { if (collection.Count <= 0) { return null; } return collection[Random.Range(0, collection.Count)]; } private static void HandleGiveItem(CharacterMaster characterMaster, PickupDef pickupDef) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) characterMaster.inventory.GiveItemPermanent(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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!ShareSuite.RichMessagesEnabled.Value || !((NetworkBehaviour)characterMaster).isLocalPlayer) { return; } PlayerCharacterMasterController playerCharacterMasterController = characterMaster.playerCharacterMasterController; if (playerCharacterMasterController != null) { NetworkUser networkUser = playerCharacterMasterController.networkUser; if (networkUser != null) { LocalUser localUser = networkUser.localUser; if (localUser != null) { localUser.userProfile.DiscoverPickup(pickupIndex); } } } if (characterMaster.inventory.GetItemCount(PickupCatalog.GetPickupDef(pickupIndex).itemIndex) <= 1) { CharacterMasterNotificationQueue.PushPickupNotification(characterMaster, pickupIndex); } } } public static class MoneySharingHooks { [CompilerGenerated] private static class <>O { public static hook_Start <0>__ResetClassValues; public static hook_TakeDamage <1>__BrittleCrownDamageHook; public static hook_OnHitEnemy <2>__BrittleCrownOnHitHook; public static hook_OnKilledServer <3>__ShareKillMoney; public static hook_OnInteractionBegin <4>__ShareBarrelMoney; public static hook_OnTriggerStay <5>__ShareTomeMoney; public static hook_Begin <6>__SplitExitMoney; public static hook_OnInteractionBegin <7>__OnShopPurchase; public static hook_FireBullet <8>__GoldGatFireHook; public static hook_OnClientConnect <9>__GoldGatConnect; public static hook_OnClientDisconnect <10>__GoldGatDisconnect; public static hook_TakeDamage <11>__RollOfPenniesDamageHook; public static Manipulator <12>__RemoveGoldGatMoneyLine; } public static bool MapTransitionActive; public static int SharedMoneyValue; internal static void UnHook() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //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_00db: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown object obj = <>O.<0>__ResetClassValues; if (obj == null) { hook_Start val = ResetClassValues; <>O.<0>__ResetClassValues = val; obj = (object)val; } SceneDirector.Start -= (hook_Start)obj; object obj2 = <>O.<1>__BrittleCrownDamageHook; if (obj2 == null) { hook_TakeDamage val2 = BrittleCrownDamageHook; <>O.<1>__BrittleCrownDamageHook = val2; obj2 = (object)val2; } HealthComponent.TakeDamage -= (hook_TakeDamage)obj2; object obj3 = <>O.<2>__BrittleCrownOnHitHook; if (obj3 == null) { hook_OnHitEnemy val3 = BrittleCrownOnHitHook; <>O.<2>__BrittleCrownOnHitHook = val3; obj3 = (object)val3; } GlobalEventManager.OnHitEnemy -= (hook_OnHitEnemy)obj3; object obj4 = <>O.<3>__ShareKillMoney; if (obj4 == null) { hook_OnKilledServer val4 = ShareKillMoney; <>O.<3>__ShareKillMoney = val4; obj4 = (object)val4; } DeathRewards.OnKilledServer -= (hook_OnKilledServer)obj4; object obj5 = <>O.<4>__ShareBarrelMoney; if (obj5 == null) { hook_OnInteractionBegin val5 = ShareBarrelMoney; <>O.<4>__ShareBarrelMoney = val5; obj5 = (object)val5; } BarrelInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj5; object obj6 = <>O.<5>__ShareTomeMoney; if (obj6 == null) { hook_OnTriggerStay val6 = ShareTomeMoney; <>O.<5>__ShareTomeMoney = val6; obj6 = (object)val6; } MoneyPickup.OnTriggerStay -= (hook_OnTriggerStay)obj6; object obj7 = <>O.<6>__SplitExitMoney; if (obj7 == null) { hook_Begin val7 = SplitExitMoney; <>O.<6>__SplitExitMoney = val7; obj7 = (object)val7; } SceneExitController.Begin -= (hook_Begin)obj7; object obj8 = <>O.<7>__OnShopPurchase; if (obj8 == null) { hook_OnInteractionBegin val8 = OnShopPurchase; <>O.<7>__OnShopPurchase = val8; obj8 = (object)val8; } PurchaseInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj8; object obj9 = <>O.<8>__GoldGatFireHook; if (obj9 == null) { hook_FireBullet val9 = GoldGatFireHook; <>O.<8>__GoldGatFireHook = val9; obj9 = (object)val9; } GoldGatFire.FireBullet -= (hook_FireBullet)obj9; object obj10 = <>O.<9>__GoldGatConnect; if (obj10 == null) { hook_OnClientConnect val10 = GoldGatConnect; <>O.<9>__GoldGatConnect = val10; obj10 = (object)val10; } NetworkManagerSystem.OnClientConnect -= (hook_OnClientConnect)obj10; object obj11 = <>O.<10>__GoldGatDisconnect; if (obj11 == null) { hook_OnClientDisconnect val11 = GoldGatDisconnect; <>O.<10>__GoldGatDisconnect = val11; obj11 = (object)val11; } NetworkManagerSystem.OnClientDisconnect -= (hook_OnClientDisconnect)obj11; object obj12 = <>O.<11>__RollOfPenniesDamageHook; if (obj12 == null) { hook_TakeDamage val12 = RollOfPenniesDamageHook; <>O.<11>__RollOfPenniesDamageHook = val12; obj12 = (object)val12; } HealthComponent.TakeDamage -= (hook_TakeDamage)obj12; object obj13 = <>O.<12>__RemoveGoldGatMoneyLine; if (obj13 == null) { Manipulator val13 = RemoveGoldGatMoneyLine; <>O.<12>__RemoveGoldGatMoneyLine = val13; obj13 = (object)val13; } GoldGatFire.FireBullet -= (Manipulator)obj13; } internal static void Hook() { //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_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //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_00db: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown object obj = <>O.<0>__ResetClassValues; if (obj == null) { hook_Start val = ResetClassValues; <>O.<0>__ResetClassValues = val; obj = (object)val; } SceneDirector.Start += (hook_Start)obj; object obj2 = <>O.<1>__BrittleCrownDamageHook; if (obj2 == null) { hook_TakeDamage val2 = BrittleCrownDamageHook; <>O.<1>__BrittleCrownDamageHook = val2; obj2 = (object)val2; } HealthComponent.TakeDamage += (hook_TakeDamage)obj2; object obj3 = <>O.<2>__BrittleCrownOnHitHook; if (obj3 == null) { hook_OnHitEnemy val3 = BrittleCrownOnHitHook; <>O.<2>__BrittleCrownOnHitHook = val3; obj3 = (object)val3; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj3; object obj4 = <>O.<3>__ShareKillMoney; if (obj4 == null) { hook_OnKilledServer val4 = ShareKillMoney; <>O.<3>__ShareKillMoney = val4; obj4 = (object)val4; } DeathRewards.OnKilledServer += (hook_OnKilledServer)obj4; object obj5 = <>O.<4>__ShareBarrelMoney; if (obj5 == null) { hook_OnInteractionBegin val5 = ShareBarrelMoney; <>O.<4>__ShareBarrelMoney = val5; obj5 = (object)val5; } BarrelInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj5; object obj6 = <>O.<5>__ShareTomeMoney; if (obj6 == null) { hook_OnTriggerStay val6 = ShareTomeMoney; <>O.<5>__ShareTomeMoney = val6; obj6 = (object)val6; } MoneyPickup.OnTriggerStay += (hook_OnTriggerStay)obj6; object obj7 = <>O.<6>__SplitExitMoney; if (obj7 == null) { hook_Begin val7 = SplitExitMoney; <>O.<6>__SplitExitMoney = val7; obj7 = (object)val7; } SceneExitController.Begin += (hook_Begin)obj7; object obj8 = <>O.<7>__OnShopPurchase; if (obj8 == null) { hook_OnInteractionBegin val8 = OnShopPurchase; <>O.<7>__OnShopPurchase = val8; obj8 = (object)val8; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj8; object obj9 = <>O.<8>__GoldGatFireHook; if (obj9 == null) { hook_FireBullet val9 = GoldGatFireHook; <>O.<8>__GoldGatFireHook = val9; obj9 = (object)val9; } GoldGatFire.FireBullet += (hook_FireBullet)obj9; object obj10 = <>O.<9>__GoldGatConnect; if (obj10 == null) { hook_OnClientConnect val10 = GoldGatConnect; <>O.<9>__GoldGatConnect = val10; obj10 = (object)val10; } NetworkManagerSystem.OnClientConnect += (hook_OnClientConnect)obj10; object obj11 = <>O.<10>__GoldGatDisconnect; if (obj11 == null) { hook_OnClientDisconnect val11 = GoldGatDisconnect; <>O.<10>__GoldGatDisconnect = val11; obj11 = (object)val11; } NetworkManagerSystem.OnClientDisconnect += (hook_OnClientDisconnect)obj11; object obj12 = <>O.<11>__RollOfPenniesDamageHook; if (obj12 == null) { hook_TakeDamage val12 = RollOfPenniesDamageHook; <>O.<11>__RollOfPenniesDamageHook = val12; obj12 = (object)val12; } HealthComponent.TakeDamage += (hook_TakeDamage)obj12; if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer()) { object obj13 = <>O.<12>__RemoveGoldGatMoneyLine; if (obj13 == null) { Manipulator val13 = RemoveGoldGatMoneyLine; <>O.<12>__RemoveGoldGatMoneyLine = val13; obj13 = (object)val13; } GoldGatFire.FireBullet += (Manipulator)obj13; } } 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (ShareSuite.MoneyIsShared.Value && GeneralHooks.IsMultiplayer() && Object.op_Implicit((Object)(object)self)) { CostTypeIndex costType = self.costType; if ((int)costType == 1) { if (self.cost <= SharedMoneyValue) { orig.Invoke(self, activator); SharedMoneyValue -= self.cost; } return; } if ((int)costType == 2) { orig.Invoke(self, activator); int num = PlayerCharacterMasterController.instances.Select((PlayerCharacterMasterController playerCharacterMasterController) => (int)playerCharacterMasterController.master.GetBody().maxHealth).Concat(new int[1]).Max(); 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_0038: Unknown result type (might be due to invalid IL or missing references) if (!GeneralHooks.IsMultiplayer() || !ShareSuite.MoneyIsShared.Value) { orig.Invoke(self); return; } CharacterMaster fieldValue = Reflection.GetFieldValue<CharacterMaster>((object)self, "bodyMaster"); int num = (int)((float)GoldGatFire.baseMoneyCostPerBullet * (1f + ((float)TeamManager.instance.GetTeamLevel(fieldValue.teamIndex) - 1f) * 0.25f)); SharedMoneyValue = Math.Max(SharedMoneyValue - num, 0); orig.Invoke(self); } public static void RemoveGoldGatMoneyLine(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0029: 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: Expected O, but got Unknown bool flag = GeneralHooks.IsMultiplayer(); if (wasMultiplayer == flag) { return; } if (ShareSuite.MoneyIsShared.Value && flag) { object obj = <>O.<12>__RemoveGoldGatMoneyLine; if (obj == null) { Manipulator val = RemoveGoldGatMoneyLine; <>O.<12>__RemoveGoldGatMoneyLine = val; obj = (object)val; } GoldGatFire.FireBullet += (Manipulator)obj; } else { object obj2 = <>O.<12>__RemoveGoldGatMoneyLine; if (obj2 == null) { Manipulator val2 = RemoveGoldGatMoneyLine; <>O.<12>__RemoveGoldGatMoneyLine = val2; obj2 = (object)val2; } GoldGatFire.FireBullet -= (Manipulator)obj2; } } private static void BrittleCrownDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo info) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { orig.Invoke(self, info); return; } if (!ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !Object.op_Implicit((Object)(object)self.body) || !Object.op_Implicit((Object)(object)self.body.inventory)) { orig.Invoke(self, info); return; } CharacterBody body = self.body; uint money = self.body.master.money; orig.Invoke(self, info); if (!self.alive) { return; } uint money2 = self.body.master.money; if (body.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHit")) <= 0) { return; } SharedMoneyValue += (int)(money2 - money); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.master.GetBody()) && !((Object)(object)instance.master.GetBody() == (Object)(object)body)) { EffectManager.SimpleImpactEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/CoinImpact"), instance.master.GetBody().corePosition, Vector3.up, true); } } } private static void RollOfPenniesDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo info) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, info); if (!NetworkServer.active || !ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !self.alive) { return; } CharacterBody body = self.body; if (!Object.op_Implicit((Object)(object)((body != null) ? body.inventory : null))) { return; } int itemCount = self.body.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHurt")); if (itemCount <= 0) { return; } CharacterBody val = null; if (Object.op_Implicit((Object)(object)info.attacker)) { val = info.attacker.GetComponent<CharacterBody>(); } if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)self.body) { return; } SharedMoneyValue += Mathf.FloorToInt((float)(itemCount * 3) * Run.instance.difficultyCoefficient); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.master.GetBody()) && !((Object)(object)instance.master.GetBody() == (Object)(object)self.body)) { EffectManager.SimpleImpactEffect(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/CoinImpact"), instance.master.GetBody().corePosition, Vector3.up, true); } } } private static void BrittleCrownOnHitHook(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo info, GameObject victim) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!ShareSuite.MoneyIsShared.Value || !GeneralHooks.IsMultiplayer() || !Object.op_Implicit((Object)(object)info.attacker) || !Object.op_Implicit((Object)(object)info.attacker.GetComponent<CharacterBody>()) || !Object.op_Implicit((Object)(object)info.attacker.GetComponent<CharacterBody>().master)) { orig.Invoke(self, info, victim); return; } CharacterBody component = info.attacker.GetComponent<CharacterBody>(); uint money = component.master.money; orig.Invoke(self, info, victim); uint money2 = component.master.money; if (Object.op_Implicit((Object)(object)component.inventory) && component.inventory.GetItemCount(ItemCatalog.FindItemIndex("GoldOnHit")) > 0) { SharedMoneyValue += (int)(money2 - money); } } private static void AddToSharedMoneyValue(float goldReward) { SharedMoneyValue = Math.Max(SharedMoneyValue + (int)Mathf.Floor(goldReward * (float)ShareSuite.MoneyScalar.Value - goldReward), 0); } public static void SetTeleporterActive(bool active) { MapTransitionActive = active; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.funkfrog_sipondo.sharesuite", "ShareSuite", "1.15.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ShareSuite : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Manipulator <0>__RemoveGoldGatMoneyLine; public static Manipulator <1>__ArenaDropEnable; public static Manipulator <2>__SimulacrumArenaDropEnable; } public static string MessageSendVer = "1.15.1"; public static ConfigEntry<bool> ModIsEnabled; public static ConfigEntry<bool> MoneyIsShared; public static ConfigEntry<bool> WhiteItemsShared; public static ConfigEntry<bool> GreenItemsShared; public static ConfigEntry<bool> RedItemsShared; public static ConfigEntry<bool> EquipmentShared; public static ConfigEntry<bool> LunarItemsShared; public static ConfigEntry<bool> BossItemsShared; public static ConfigEntry<bool> VoidItemsShared; public static ConfigEntry<bool> 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 void Awake() { InitConfig(); CommandHelper.RegisterCommands(Console.instance); 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", tr