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 KookehsDropItem Fork v2.4.5
KookehsDropItemMod_Fork.dll
Decompiled 6 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using IL.RoR2; using IL.RoR2.UI; using KookehsDropItemMod_Fork; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KookehsDropItemMod_Fork")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+519afa4544a1b49dbe2884f23cca035b44aa7055")] [assembly: AssemblyProduct("KookehsDropItemMod_Fork")] [assembly: AssemblyTitle("KookehsDropItemMod_Fork")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace KookehsDropItemMod_Fork { public class MarkNonRecyclableComponent : MonoBehaviour { public void Start() { GenericPickupController component = ((Component)this).GetComponent<GenericPickupController>(); if (Object.op_Implicit((Object)(object)component)) { component.Duplicated = true; component.Recycled = true; Object.Destroy((Object)(object)this); } } } } namespace DropItems_Fork { public class DropItemHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { private Func<CharacterMaster> getMaster; private Func<PickupIndex> getPickupIndex; public void SetData(Func<CharacterMaster> getMaster, Func<PickupIndex> getPickupIndex) { this.getMaster = getMaster; this.getPickupIndex = getPickupIndex; } public void OnPointerClick(PointerEventData eventData) { //IL_0075: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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) KookehsDropItemMod.Logger.LogDebug((object)"KDI: Pointer click, trying to send network message"); CharacterMaster val = getMaster(); KookehsDropItemMod.Logger.LogDebug((object)"1"); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory) || !((NetworkBehaviour)val.inventory).hasAuthority) { return; } KookehsDropItemMod.Logger.LogDebug((object)"2"); PickupIndex pickupIndex = getPickupIndex(); KookehsDropItemMod.Logger.LogDebug((object)"2.1"); CharacterBody body = val.GetBody(); KookehsDropItemMod.Logger.LogDebug((object)"2.2"); if (!Object.op_Implicit((Object)(object)body)) { KookehsDropItemMod.Logger.LogDebug((object)"2.3"); return; } KookehsDropItemMod.Logger.LogDebug((object)"3"); NetworkIdentity component = ((Component)body).gameObject.GetComponent<NetworkIdentity>(); KookehsDropItemMod.Logger.LogDebug((object)"4"); if (VerifyIsDroppable(pickupIndex, val.inventory)) { KookehsDropItemMod.Logger.LogDebug((object)"KDI: Sending network message"); DropItemMessage dropItemMessage = new DropItemMessage(component.netId, pickupIndex); NetMessageExtensions.Send((INetMessage)(object)dropItemMessage, (NetworkDestination)2); } } public static void DropItem(Vector3 position, Vector3 direction, Inventory inventory, PickupIndex pickupIndex) { //IL_0001: 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_001f: 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_0043: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_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: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!VerifyIsDroppable(pickupIndex, inventory)) { return; } ManualLogSource logger = KookehsDropItemMod.Logger; Vector3 val = position; logger.LogDebug((object)("Position: " + ((object)(Vector3)(ref val)).ToString())); ManualLogSource logger2 = KookehsDropItemMod.Logger; val = direction; logger2.LogDebug((object)("Direction: " + ((object)(Vector3)(ref val)).ToString())); KookehsDropItemMod.Logger.LogDebug((object)("Inventory: " + ((Object)inventory).name)); KookehsDropItemMod.Logger.LogDebug((object)("Pickup Index: " + ((object)(PickupIndex)(ref pickupIndex)).ToString())); if ((int)PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex != -1) { if (inventory.GetEquipmentIndex() != PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex) { return; } inventory.SetEquipmentIndex((EquipmentIndex)(-1), true); } else { if (inventory.GetItemCountPermanent(PickupCatalog.GetPickupDef(pickupIndex).itemIndex) <= 0) { return; } inventory.RemoveItemPermanent(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, 1); } CreatePickupInfo val2 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val2)).pickupIndex = pickupIndex; val2.position = position; CreatePickupInfo pickupInfo = val2; CreatePickupDroplet(pickupInfo, Vector3.up * 20f + direction * 10f); } private static void CreatePickupDroplet(CreatePickupInfo pickupInfo, Vector3 velocity) { //IL_0006: 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_000c: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, pickupInfo.position, Quaternion.identity); PickupDropletController component = val.GetComponent<PickupDropletController>(); if (Object.op_Implicit((Object)(object)component)) { component.createPickupInfo = pickupInfo; component.NetworkpickupState = ((CreatePickupInfo)(ref pickupInfo)).pickup; } Rigidbody component2 = val.GetComponent<Rigidbody>(); component2.velocity = velocity; component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere); val.AddComponent<MarkNonRecyclableComponent>(); NetworkServer.Spawn(val); } private static bool VerifyIsDroppable(PickupIndex pickupIndex, Inventory inventory) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_00a6: 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_0123: Invalid comparison between Unknown and I4 //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Invalid comparison between Unknown and I4 //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Invalid comparison between Unknown and I4 //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Invalid comparison between Unknown and I4 //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Invalid comparison between Unknown and I4 //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Invalid comparison between Unknown and I4 //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)inventory)) { return false; } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return false; } if ((int)pickupDef.equipmentIndex != -1) { return true; } if ((int)pickupDef.itemIndex != -1 && inventory.GetItemCountPermanent(pickupDef.itemIndex) <= 0) { return false; } bool result = false; ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(pickupDef.itemTier); if ((Object)(object)itemTierDef != (Object)null) { if ((int)pickupDef.itemIndex != -1 && (Object)(object)ItemCatalog.GetItemDef(pickupDef.itemIndex) == (Object)(object)Items.ExtraStatsOnLevelUp) { return false; } if (!KookehsDropItemMod.allowInBazaar.Value) { SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && sceneDefForCurrentScene.baseSceneName == "bazaar") { return false; } } result = itemTierDef.isDroppable && (int)itemTierDef.tier != 5; if ((int)itemTierDef.tier == 3) { result = KookehsDropItemMod.allowDropLunar.Value || (int)pickupDef.equipmentIndex != -1; } else if ((int)itemTierDef.tier == 9 || (int)itemTierDef.tier == 6 || (int)itemTierDef.tier == 7 || (int)itemTierDef.tier == 8) { result = KookehsDropItemMod.allowDropVoid.Value; } } return result; } public static void CreateNotification(CharacterBody character, PickupIndex pickupIndex) { //IL_0001: 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: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) if ((int)PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex != -1) { CreateNotification(character, character.transform, PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex); } else { CreateNotification(character, character.transform, PickupCatalog.GetPickupDef(pickupIndex).itemIndex); } } private static void CreateNotification(CharacterBody character, Transform transform, EquipmentIndex equipmentIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex); string @string = Language.GetString(equipmentDef.nameToken); Texture pickupIconTexture = equipmentDef.pickupIconTexture; CreateNotification(character, transform, "Equipment dropped", @string, pickupIconTexture); } private static void CreateNotification(CharacterBody character, Transform transform, ItemIndex itemIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); string @string = Language.GetString(itemDef.nameToken); Texture pickupIconTexture = itemDef.pickupIconTexture; CreateNotification(character, transform, "Item dropped", @string, pickupIconTexture); } private static void CreateNotification(CharacterBody character, Transform transform, string title, string description, Texture texture) { DropItemNotification dropItemNotification = ((Component)character).gameObject.GetComponent<DropItemNotification>(); if ((Object)(object)dropItemNotification == (Object)null) { dropItemNotification = ((Component)character).gameObject.AddComponent<DropItemNotification>(); ((Component)dropItemNotification).transform.SetParent(transform); } dropItemNotification.SetNotification(title, description, texture); } } public class DropItemMessage : INetMessage, ISerializableObject { private NetworkInstanceId netId; private PickupIndex pickupIndex; public DropItemMessage() { } public DropItemMessage(NetworkInstanceId netId, PickupIndex pickupIndex) { //IL_0009: 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) //IL_0010: 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) this.netId = netId; this.pickupIndex = pickupIndex; } public void Serialize(NetworkWriter writer) { //IL_0003: 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) writer.Write(netId); PickupIndex.WriteToNetworkWriter(writer, pickupIndex); } public void Deserialize(NetworkReader reader) { //IL_0003: 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) //IL_000f: 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) netId = reader.ReadNetworkId(); pickupIndex = NetworkExtensions.ReadPickupIndex(reader); } public override string ToString() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return $"DropItemMessage: {pickupIndex}"; } private void Log(string message) { KookehsDropItemMod.Logger.LogDebug((object)message); } public void OnReceived() { //IL_0066: 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_00da: 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_00ef: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } Log("Received kookeh drop message"); Log("NetworkID" + ((object)(NetworkInstanceId)(ref netId)).ToString()); Log("PickupIndex" + ((object)(PickupIndex)(ref pickupIndex)).ToString()); GameObject val = Util.FindNetworkObject(netId); if (!Object.op_Implicit((Object)(object)val)) { return; } CharacterBody component = val.GetComponent<CharacterBody>(); Log("Body is null: " + ((Object)(object)component == (Object)null)); if (Object.op_Implicit((Object)(object)component)) { Inventory inventory = component.master.inventory; Transform transform = component.transform; Vector3 corePosition = component.corePosition; Vector3 direction = (Object.op_Implicit((Object)(object)component.characterDirection) ? component.characterDirection.forward : component.transform.forward); if (Object.op_Implicit((Object)(object)component.inputBank)) { Ray aimRay = component.inputBank.GetAimRay(); direction = ((Ray)(ref aimRay)).direction; direction.y = 0f; ((Vector3)(ref direction)).Normalize(); } DropItemHandler.DropItem(corePosition, direction, inventory, pickupIndex); if (KookehsDropItemMod.enableNotifications.Value) { DropItemHandler.CreateNotification(component, pickupIndex); } } } } public class DropItemNotification : MonoBehaviour { private Notification notification; private float startTime = 0f; private float duration = 3f; private void Update() { if ((Object)(object)notification != (Object)null && Run.instance.fixedTime - startTime > duration) { Object.Destroy((Object)(object)notification); Object.Destroy((Object)(object)this); } float notificationT = (Run.instance.fixedTime - startTime) / duration; notification.GenericNotification.SetNotificationT(notificationT); } private void OnDestroy() { if ((Object)(object)notification != (Object)null) { Object.Destroy((Object)(object)notification); } } public void SetNotification(string title, string description, Texture texture) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)notification == (Object)null) { notification = ((Component)this).gameObject.AddComponent<Notification>(); ((Component)notification).transform.SetParent(((Component)this).transform); notification.SetPosition(new Vector3((float)((double)Screen.width * 0.8), (float)((double)Screen.height * 0.25), 0f)); } startTime = Run.instance.fixedTime; notification.SetIcon(texture); notification.GetTitle = () => title; notification.GetDescription = () => description; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("KookehsDropItemMod_Fork", "Kookeh's Drop Item Mod (Fork)", "2.4.3")] [R2APISubmoduleDependency(new string[] { "NetworkingAPI", "CommandHelper" })] public class KookehsDropItemMod : BaseUnityPlugin { private const string ModGuid = "KookehsDropItemMod_Fork"; private const string ModName = "Kookeh's Drop Item Mod (Fork)"; private const string ModVersion = "2.4.3"; public static ConfigEntry<bool> allowDropLunar; public static ConfigEntry<bool> allowDropVoid; public static ConfigEntry<bool> enableNotifications; public static ConfigEntry<bool> allowInBazaar; public static GameObject RootObject { get; set; } public static DropItemHandler DropItemHandler { get; set; } internal static ManualLogSource Logger { get; set; } public static event Action<ItemIcon> OnItemIconAdded; public static event Action<EquipmentIcon> OnEquipmentIconAdded; public void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown ReadConfig(); Logger = ((BaseUnityPlugin)this).Logger; NetworkingAPI.RegisterMessageType<DropItemMessage>(); ItemInventoryDisplay.AllocateIcons += new Manipulator(OnItemIconAddedHook); ScoreboardStrip.SetMaster += new Manipulator(OnEquipmentIconAddedHook); RootObject = new GameObject("DropItemsMod"); Object.DontDestroyOnLoad((Object)(object)RootObject); DropItemHandler = RootObject.AddComponent<DropItemHandler>(); CommandHelper.AddToConsoleWhenReady(); OnItemIconAdded += delegate(ItemIcon itemIcon) { if (!((Object)(object)((Component)itemIcon).GetComponent<DropItemHandler>() != (Object)null)) { Func<CharacterMaster> getMaster = () => ((Component)((Component)((Transform)itemIcon.rectTransform).parent).GetComponent<ItemInventoryDisplay>().inventory).GetComponent<CharacterMaster>(); DropItemHandler dropItemHandler2 = ((Component)((Component)itemIcon).transform).gameObject.AddComponent<DropItemHandler>(); dropItemHandler2.SetData(getMaster, () => PickupCatalog.FindPickupIndex(itemIcon.itemIndex)); } }; OnEquipmentIconAdded += delegate(EquipmentIcon equipmentIcon) { if (!((Object)(object)((Component)equipmentIcon).GetComponent<DropItemHandler>() != (Object)null)) { DropItemHandler dropItemHandler = ((Component)((Component)equipmentIcon).transform).gameObject.AddComponent<DropItemHandler>(); dropItemHandler.SetData(() => ((Component)equipmentIcon.targetInventory).GetComponent<CharacterMaster>(), () => PickupCatalog.FindPickupIndex(equipmentIcon.targetInventory.GetEquipmentIndex())); } }; PickupDropletController.CreatePickup += new Manipulator(PickupDropletController_CreatePickup); } private void PickupDropletController_CreatePickup(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(GenericPickupController), "CreatePickup") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<GenericPickupController, PickupDropletController, GenericPickupController>>((Func<GenericPickupController, PickupDropletController, GenericPickupController>)delegate(GenericPickupController pickup, PickupDropletController self) { MarkNonRecyclableComponent component = ((Component)self).GetComponent<MarkNonRecyclableComponent>(); if (Object.op_Implicit((Object)(object)component)) { ((Component)pickup).gameObject.AddComponent<MarkNonRecyclableComponent>(); } return pickup; }); } private void ReadConfig() { //IL_0011: 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_002c: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown //IL_0041: 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_005c: Expected O, but got Unknown //IL_005c: Expected O, but got Unknown //IL_0071: 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_008c: Expected O, but got Unknown //IL_008c: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00bc: Expected O, but got Unknown enableNotifications = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Enable Notifications"), false, new ConfigDescription("Display a notification when an item is dropped. Not sure if this is even networked properly.", (AcceptableValueBase)null, Array.Empty<object>())); allowInBazaar = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Allow in Bazaar (Server-Side)"), true, new ConfigDescription("Allow items to be dropped while in the Bazaar.", (AcceptableValueBase)null, Array.Empty<object>())); allowDropLunar = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tiers (Server-Side)", "Allow Lunar"), false, new ConfigDescription("Allow items of this tier to be dropped.", (AcceptableValueBase)null, Array.Empty<object>())); allowDropVoid = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tiers (Server-Side)", "Allow Void"), false, new ConfigDescription("Allow items of this tier to be dropped.", (AcceptableValueBase)null, Array.Empty<object>())); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void RiskOfOptionsCompat() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableNotifications)); } private static void OnItemIconAddedHook(ILContext il) { //IL_0002: 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) ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false); int num = default(int); val.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons") }); val.Emit(OpCodes.Dup); val.EmitDelegate<Action<ItemIcon>>((Action<ItemIcon>)delegate(ItemIcon i) { KookehsDropItemMod.OnItemIconAdded?.Invoke(i); }); } private static void OnEquipmentIconAddedHook(ILContext il) { //IL_0008: 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) ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false); MethodInfo setSubscribedInventory = Reflection.GetMethodCached(typeof(ItemInventoryDisplay), "SetSubscribedInventory"); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)setSubscribedInventory) }); val.Index += 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip eq) { if ((Object)(object)eq != (Object)null && (Object)(object)eq.equipmentIcon != (Object)null) { KookehsDropItemMod.OnEquipmentIconAdded?.Invoke(eq.equipmentIcon); } }); } } }