Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of PressureDrop v2.1.0
plugins/PressureDrop/PressureDrop.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("PressureDrop")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+8d8920532f23a5ea7535505f67598ca90f62b13c")] [assembly: AssemblyProduct("PressureDrop")] [assembly: AssemblyTitle("PressureDrop")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.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 PressureDrop { internal static class ChatCommander { [CompilerGenerated] private static class <>O { public static hook_RunCmd <0>__Console_RunCmd; } private static readonly Dictionary<string, Action<NetworkUser, string[]>> Commands = new Dictionary<string, Action<NetworkUser, string[]>>(); private static bool _hooked = false; internal static void Hook() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!_hooked) { _hooked = true; object obj = <>O.<0>__Console_RunCmd; if (obj == null) { hook_RunCmd val = Console_RunCmd; <>O.<0>__Console_RunCmd = val; obj = (object)val; } Console.RunCmd += (hook_RunCmd)obj; } } private static void Console_RunCmd(orig_RunCmd orig, Console self, CmdSender sender, string concommandName, List<string> userArgs) { //IL_005b: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) string text = userArgs.FirstOrDefault(); string[] array = text?.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (!NetworkServer.active || !concommandName.Equals("say", StringComparison.InvariantCultureIgnoreCase) || string.IsNullOrWhiteSpace(text) || array == null || array.Length == 0 || !Commands.TryGetValue(array[0], out var value) || value == null) { orig.Invoke(self, sender, concommandName, userArgs); return; } Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)sender.networkUser).gameObject, text = text }); value(sender.networkUser, array); } public static bool Register(string token, Action<NetworkUser, string[]> action) { if (Commands.ContainsKey(token)) { Plugin.Logger.LogWarning((object)("ChatCommander> A chat command is already registered under '" + token + "'")); return false; } Commands[token] = action; string name = action.Method.DeclaringType.Assembly.GetName().Name; name = ((name != typeof(ChatCommander).Assembly.GetName().Name) ? (" [from " + name + ".dll]") : ""); Plugin.Logger.LogInfo((object)("ChatCommander> Registering a chat command under '" + token + "'" + name)); return true; } public static bool Unregister(string token, Action<NetworkUser, string[]> action) { if (Commands.TryGetValue(token, out var value)) { if (value == action) { Plugin.Logger.LogInfo((object)("ChatCommander> Unregistered '" + token + "' chat command.")); Commands.Remove(token); return true; } Plugin.Logger.LogWarning((object)("ChatCommander> Could not unregister chat command '" + token + "' as the action does not match.")); } else { Plugin.Logger.LogInfo((object)("ChatCommander> Could not unregister chat command '" + token + "' (not registered).")); } return false; } } public sealed class Config { private readonly ConfigFile file; private readonly ConfigEntry<bool> dropEnabled; private readonly ConfigEntry<bool> dropTeleporterEnabled; private readonly ConfigEntry<bool> dropDeadEnabled; private readonly ConfigEntry<bool> dropInvertDirection; private readonly ConfigEntry<bool> dropVoidAllowed; private readonly ConfigEntry<int> maxItemsToDropAtATime; private readonly ConfigEntry<bool> dropRecyclableWhite; private readonly ConfigEntry<bool> dropRecyclableGreen; private readonly ConfigEntry<bool> dropRecyclableRed; private readonly ConfigEntry<bool> dropRecyclableYellow; private readonly ConfigEntry<bool> dropRecyclableLunar; private readonly ConfigEntry<bool> dropRecyclableVoid; private readonly ConfigEntry<bool> dropRecyclableEquipment; private readonly ConfigEntry<bool> dropRecyclableEquipmentLunar; public bool DropEnabled => dropEnabled.Value; public bool DropTeleporterEnabled => dropTeleporterEnabled.Value; public bool DropDeadEnabled => dropDeadEnabled.Value; public bool DropInvertDirection => dropInvertDirection.Value; public bool DropVoidAllowed => dropVoidAllowed.Value; public int MaxItemsToDropAtATime { get { if (maxItemsToDropAtATime.Value <= 0) { return 1; } return maxItemsToDropAtATime.Value; } } public bool DropRecyclableWhite => dropRecyclableWhite.Value; public bool DropRecyclableGreen => dropRecyclableGreen.Value; public bool DropRecyclableRed => dropRecyclableRed.Value; public bool DropRecyclableYellow => dropRecyclableYellow.Value; public bool DropRecyclableLunar => dropRecyclableLunar.Value; public bool DropRecyclableVoid => dropRecyclableVoid.Value; public bool DropRecyclableEquipment => dropRecyclableEquipment.Value; public bool DropRecyclableEquipmentLunar => dropRecyclableEquipmentLunar.Value; internal void Reload() { Plugin.Logger.LogDebug((object)("Reloading " + file.ConfigFilePath.Substring(file.ConfigFilePath.LastIndexOf(Path.DirectorySeparatorChar) + 1))); file.Reload(); } internal Config(ConfigFile config) { file = config; dropEnabled = config.Bind<bool>("Drop Command", "dropEnabled", true, "Whether the /drop command should be enabled or not."); dropTeleporterEnabled = config.Bind<bool>("Drop Command", "dropTeleporterEnabled", true, "Whether players should be able to send their drops to the Teleporter or not."); dropDeadEnabled = config.Bind<bool>("Drop Command", "dropDeadEnabled", true, "Whether dead players should be able to drop items or not.\nRequires dropTeleporterEnabled to be true."); dropVoidAllowed = config.Bind<bool>("Drop Command", "dropVoidAllowed", false, "Whether void items are allowed to be dropped or not."); dropInvertDirection = config.Bind<bool>("Drop Command", "dropInvertDirection", false, "Whether items should be dropped opposite the aim direction or not."); maxItemsToDropAtATime = config.Bind<int>("Drop Command", "maxItemsToDropAtATime", 10, "The maximum amount of items to drop from the player at a time (similar to Scrappers).\nMinimum value is 1."); dropRecyclableWhite = config.Bind<bool>("Drop Recyclable", "dropRecyclableWhite", true, "Whether dropped white tier items should be recyclable."); dropRecyclableGreen = config.Bind<bool>("Drop Recyclable", "dropRecyclableGreen", true, "Whether dropped green tier items should be recyclable."); dropRecyclableRed = config.Bind<bool>("Drop Recyclable", "dropRecyclableRed", false, "Whether dropped red tier items should be recyclable."); dropRecyclableYellow = config.Bind<bool>("Drop Recyclable", "dropRecyclableYellow", false, "Whether dropped yellow tier items should be recyclable."); dropRecyclableLunar = config.Bind<bool>("Drop Recyclable", "dropRecyclableLunar", false, "Whether dropped lunar items should be recyclable."); dropRecyclableVoid = config.Bind<bool>("Drop Recyclable", "dropRecyclableVoid", false, "Whether dropped void items should be recyclable."); dropRecyclableEquipment = config.Bind<bool>("Drop Recyclable", "dropRecyclableEquipment", true, "Whether dropped equipment should be recyclable."); dropRecyclableEquipmentLunar = config.Bind<bool>("Drop Recyclable", "dropRecyclableEquipmentLunar", false, "Whether dropped lunar equipment should be recyclable."); } } public static class Drop { [CompilerGenerated] private static class <>O { public static hook_CreatePickup <0>__GenericPickupController_CreatePickup; } private static readonly Quaternion identifier = new Quaternion(-2f, -4f, -8f, -16f); private static bool _hooked = false; private static Action<CreatePickupInfo, Vector3> _CreatePickupDroplet_Devotion; private static Action<CreatePickupInfo, Vector3> CreatePickupDroplet_Devotion { get { if (_CreatePickupDroplet_Devotion == null) { Plugin.Logger.LogWarning((object)"MissingMethodException: Using Devotion Update version of PickupDropletController.CreatePickupDroplet"); _CreatePickupDroplet_Devotion = (Action<CreatePickupInfo, Vector3>)typeof(PickupDropletController).GetMethod("CreatePickupDroplet", new Type[2] { typeof(CreatePickupInfo), typeof(Vector3) }).CreateDelegate(typeof(Action<CreatePickupInfo, Vector3>)); } return _CreatePickupDroplet_Devotion; } } internal static void Hook() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!_hooked) { _hooked = true; object obj = <>O.<0>__GenericPickupController_CreatePickup; if (obj == null) { hook_CreatePickup val = GenericPickupController_CreatePickup; <>O.<0>__GenericPickupController_CreatePickup = val; obj = (object)val; } GenericPickupController.CreatePickup += (hook_CreatePickup)obj; DropCommand.Enable(); } } internal static void Unhook() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (_hooked) { _hooked = false; object obj = <>O.<0>__GenericPickupController_CreatePickup; if (obj == null) { hook_CreatePickup val = GenericPickupController_CreatePickup; <>O.<0>__GenericPickupController_CreatePickup = val; obj = (object)val; } GenericPickupController.CreatePickup -= (hook_CreatePickup)obj; DropCommand.Disable(); } } private static GenericPickupController GenericPickupController_CreatePickup(orig_CreatePickup orig, ref CreatePickupInfo createPickupInfo) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0026: Unknown result type (might be due to invalid IL or missing references) if (createPickupInfo.rotation == identifier) { createPickupInfo.rotation = Quaternion.identity; GenericPickupController val = orig.Invoke(ref createPickupInfo); if (!IsRecyclable(PickupCatalog.GetPickupDef(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex))) { val.Recycled = true; } return val; } return orig.Invoke(ref createPickupInfo); } private static bool IsRecyclable(PickupDef def) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Invalid comparison between Unknown and I4 //IL_000f: 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_0029: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) bool result = true; if ((int)def.itemIndex != -1) { if (((int)def.itemTier == 0 && !Plugin.Config.DropRecyclableWhite) || ((int)def.itemTier == 1 && !Plugin.Config.DropRecyclableGreen) || ((int)def.itemTier == 2 && !Plugin.Config.DropRecyclableRed) || ((int)def.itemTier == 4 && !Plugin.Config.DropRecyclableYellow) || ((int)def.itemTier == 3 && !Plugin.Config.DropRecyclableLunar) || (!Plugin.Config.DropRecyclableVoid && def.itemTier.IsVoidTier())) { result = false; } } else if ((int)def.equipmentIndex != -1) { if (def.isLunar) { if (!Plugin.Config.DropRecyclableEquipmentLunar) { result = false; } } else if (!Plugin.Config.DropRecyclableEquipment) { result = false; } } return result; } public static Vector3? GetAimDirection(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) InputBankTest val = ((body != null) ? body.inputBank : null); if ((Object)(object)val == (Object)null) { return null; } Vector3 aimDirection = val.aimDirection; aimDirection.y = 0f; return ((Vector3)(ref aimDirection)).normalized; } public static void DropStyleChest(Transform target, PickupIndex dropPickup, int dropCount, float forwardVelocity = 2f, float upVelocity = 20f, Vector3? forwardOverride = null) { //IL_0026: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (dropCount > 0) { float num = 360f / (float)dropCount; Vector3 val = (Vector3)(((??)forwardOverride) ?? target.forward); Vector3 position = target.position + Vector3.up * 1.5f; Vector3 val2 = Vector3.up * upVelocity + val * forwardVelocity; Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up); for (int i = 0; i < dropCount; i++) { CreatePickupInfo pickupInfo = default(CreatePickupInfo); pickupInfo.position = position; pickupInfo.rotation = identifier; ((CreatePickupInfo)(ref pickupInfo)).pickupIndex = dropPickup; CreatePickupDroplet(pickupInfo, val2); val2 = val3 * val2; } } } public static void DropStyleChest(Transform target, PickupIndex[] drops, float forwardVelocity = 2f, float upVelocity = 20f, Vector3? forwardOverride = null) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (drops.Length != 0) { float num = 360f / (float)drops.Length; Vector3 val = (Vector3)(((??)forwardOverride) ?? target.forward); Vector3 position = target.position + Vector3.up * 1.5f; Vector3 val2 = Vector3.up * upVelocity + val * forwardVelocity; Quaternion val3 = Quaternion.AngleAxis(num, Vector3.up); for (int i = 0; i < drops.Length; i++) { CreatePickupInfo pickupInfo = default(CreatePickupInfo); pickupInfo.position = position; pickupInfo.rotation = identifier; ((CreatePickupInfo)(ref pickupInfo)).pickupIndex = drops[i]; CreatePickupDroplet(pickupInfo, val2); val2 = val3 * val2; } } } private static void CreatePickupDroplet(CreatePickupInfo pickupInfo, Vector3 velocity) { //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_0010: Unknown result type (might be due to invalid IL or missing references) try { CreatePickupDroplet_Wrapper(pickupInfo, velocity); } catch (MissingMethodException) { CreatePickupDroplet_Devotion(pickupInfo, velocity); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void CreatePickupDroplet_Wrapper(CreatePickupInfo pickupInfo, Vector3 velocity) { //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_0002: 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) PickupDropletController.CreatePickupDroplet(pickupInfo, pickupInfo.position, velocity); } } internal static class DropCommand { internal static void Enable() { ChatCommander.Register("/d", Parse); ChatCommander.Register("/drop", Parse); } internal static void Disable() { ChatCommander.Unregister("/d", Parse); ChatCommander.Unregister("/drop", Parse); } private static void Parse(NetworkUser user, string[] args) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Run.instance == (Object)null) { return; } if (args.Length < 2) { ShowHelp(args); return; } bool dropAtTeleporter = false; if (args.Length > 2) { if (!(args[2] == "@")) { ShowHelp(args); return; } dropAtTeleporter = true; } ItemIndex val = user.master.inventory.FindItemInInventory(args[1]); if ((int)val == -1) { Feedback("Could not match '<color=#e5eefc>" + args[1] + "</color>' to an item in " + user.userName + "'s inventory."); } else { ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)itemDef == (Object)(object)Items.CaptainDefenseMatrix || (!Plugin.Config.DropVoidAllowed && itemDef.tier.IsVoidTier())) { Feedback(Utils.GetColoredPickupLanguageString(itemDef.itemIndex) + " can not be dropped."); } else { Execute(user, itemDef, dropAtTeleporter); } } } public static ItemIndex FindItemInInventory(this Inventory inventory, string query) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) List<ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder; if (itemAcquisitionOrder != null && itemAcquisitionOrder.Count > 0) { query = FormatStringForQuerying(query); for (int num = itemAcquisitionOrder.Count - 1; num >= 0; num--) { ItemDef itemDef = ItemCatalog.GetItemDef(itemAcquisitionOrder[num]); if (!itemDef.hidden && (itemDef.canRemove || OverrideCanRemoveFlag(itemDef)) && FormatStringForQuerying(Language.GetString(itemDef.nameToken)).Contains(query)) { return itemDef.itemIndex; } } return (ItemIndex)(-1); } return (ItemIndex)(-1); } internal static string FormatStringForQuerying(string input) { return Regex.Replace(input, "[ '_.,-]", string.Empty).ToLowerInvariant(); } private static bool OverrideCanRemoveFlag(ItemDef def) { if (!(def.nameToken == "ITEM_ONLEVELUPFREEUNLOCK_NAME")) { return false; } if (def.canRemove) { Plugin.Logger.LogWarning((object)("Item does not need to be manually whitelisted: ITEM_ONLEVELUPFREEUNLOCK_NAME | " + Language.GetString("ITEM_ONLEVELUPFREEUNLOCK_NAME"))); } return true; } private static void Execute(NetworkUser user, ItemDef itemDef, bool dropAtTeleporter) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) int num = user.master.inventory.GetItemCount(itemDef.itemIndex); if (num > Plugin.Config.MaxItemsToDropAtATime) { num = Plugin.Config.MaxItemsToDropAtATime; } CharacterBody currentBody = user.GetCurrentBody(); Transform val = ((currentBody != null) ? ((Component)currentBody).gameObject.transform : null); if ((Object)(object)val == (Object)null) { if (!Plugin.Config.DropDeadEnabled || !Plugin.Config.DropTeleporterEnabled) { Feedback("Dead players can't drop items <sprite name=\"Skull\" tint=1>"); return; } dropAtTeleporter = true; } if (dropAtTeleporter) { if (!Plugin.Config.DropTeleporterEnabled) { Feedback("Dropping at the Teleporter is disabled <sprite name=\"Skull\" tint=1>"); return; } TeleporterInteraction instance = TeleporterInteraction.instance; Transform val2 = ((instance != null) ? ((Component)instance).transform : null); if (!((Object)(object)val2 != (Object)null)) { Feedback("There is no Teleporter to drop at <sprite name=\"Skull\" tint=1>"); return; } val = val2; } if ((Object)(object)val == (Object)null) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cUtility>No drop target <sprite name=\"Skull\" tint=1></style>" }); return; } user.master.inventory.RemoveItem(itemDef.itemIndex, num); Vector3? forwardOverride = Drop.GetAimDirection((user != null) ? user.GetCurrentBody() : null); if (Plugin.Config.DropInvertDirection && forwardOverride.HasValue) { forwardOverride = -forwardOverride.Value; } Drop.DropStyleChest(val, PickupCatalog.FindPickupIndex(itemDef.itemIndex), num, 3.4f, 14f, forwardOverride); Feedback(user, itemDef, num, dropAtTeleporter); } private static void Feedback(NetworkUser user, ItemDef item, int count, bool dropAtTeleporter) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) string coloredPickupLanguageString = Utils.GetColoredPickupLanguageString(item.itemIndex); string text = ((count != 1) ? $"({count})" : ""); string text2 = (dropAtTeleporter ? " at the Teleporter" : ""); Feedback(user.userName + " dropped " + coloredPickupLanguageString + text + text2); } private static void Feedback(string message) { //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_0020: Expected O, but got Unknown Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cEvent>" + message + "</style>" }); } private static void ShowHelp(string[] args) { //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_0022: Expected O, but got Unknown Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cIsUtility><style=cDeath>Failed:</style> <color=#ffffff>" + args[0] + "</color> expects an item name (without spaces).</style>" }); } } [BepInPlugin("itsschwer.PressureDrop", "PressureDrop", "2.1.0")] public sealed class Plugin : BaseUnityPlugin { public const string GUID = "itsschwer.PressureDrop"; public const string Author = "itsschwer"; public const string Name = "PressureDrop"; public const string Version = "2.1.0"; internal static ManualLogSource Logger { get; private set; } public static Config Config { get; private set; } private void Awake() { Logger.Sources.Remove((ILogSource)(object)((BaseUnityPlugin)this).Logger); Logger = Logger.CreateLogSource("itsschwer.PressureDrop"); Config = new Config(((BaseUnityPlugin)this).Config); ChatCommander.Hook(); Run.onRunStartGlobal += SetPluginActiveState; Run.onRunDestroyGlobal += SetPluginActiveState; SetPluginActiveState(); Logger.LogMessage((object)"~awake."); } private void OnEnable() { ManageHooks(); ChatCommander.Register("/reload", ReloadConfig); Logger.LogMessage((object)"~enabled."); } private void OnDisable() { ManageHooks(); ChatCommander.Unregister("/reload", ReloadConfig); Logger.LogMessage((object)"~disabled."); } private void SetPluginActiveState(Run _ = null) { SetActive(NetworkServer.active); } private void SetActive(bool value) { ((Behaviour)this).enabled = value; Logger.LogMessage((object)("~" + (value ? "active" : "inactive") + ".")); } private void ReloadConfig(NetworkUser user, string[] args) { //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_0038: Expected O, but got Unknown if (!((Object)(object)user != (Object)(object)LocalUserManager.GetFirstLocalUser().currentNetworkUser)) { Config.Reload(); ManageHooks(); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cIsUtility>Reloaded configuration for <style=cWorldEvent>itsschwer.PressureDrop</style></style>" }); } } private void ManageHooks() { Drop.Unhook(); if (((Behaviour)this).enabled && Config.DropEnabled) { Drop.Hook(); } } } public static class Utils { public static bool IsVoidTier(this ItemTier tier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if ((int)tier != 6 && (int)tier != 7 && (int)tier != 8) { return (int)tier == 9; } return true; } public static string GetColoredPickupLanguageString(ItemIndex itemIndex) { //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) return GetColoredPickupLanguageString(PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(itemIndex))); } public static string GetColoredPickupLanguageString(PickupDef pickupDef) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Util.GenerateColoredString(Language.GetString(pickupDef.nameToken), Color32.op_Implicit(pickupDef.baseColor)); } } }