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 DroppableThings v1.0.7
DroppableThings.dll
Decompiled 2 years agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DroppableThings.Properties; using HarmonyLib; using R2API.Networking; using R2API.Networking.Interfaces; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using RoR2.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DroppableThings")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DroppableThings")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dde6bced-877a-4e2a-b8ba-a7f4a52d3261")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace DroppableThings { public static class ModdedScraps { public static void Register(ItemTier targetTier, ItemIndex scrapItemIndex) { //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) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0065: 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) PickupIndex val = PickupCatalog.FindScrapIndexForItemTier(targetTier); if (val != PickupIndex.none || Plugin.instance.moddedScraps.ContainsKey(targetTier)) { Plugin.instance.logger.LogMessage((object)("This tier \"" + ((object)(ItemTier)(ref targetTier)).ToString() + "\" already has a scrap.")); } else { Plugin.instance.moddedScraps.Add(targetTier, scrapItemIndex); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bulletbot.droppablethings", "DroppableThings", "1.0.7")] public class Plugin : BaseUnityPlugin { private static class RiskOfOptions { public static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } public static void OnAwake() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_009f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown Bitmap icon = Resources.icon; using (MemoryStream memoryStream = new MemoryStream()) { ((Image)icon).Save((Stream)memoryStream, ImageFormat.Png); Texture2D val = new Texture2D(((Image)icon).Width, ((Image)icon).Height, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, memoryStream.ToArray()); ((Texture)val).filterMode = (FilterMode)0; ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropItems)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropEquipments)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.useCommandEssence)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.dropCoins)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.scrapItems)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.scrapDropOnGround)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(instance.rightClick)); } } internal class ClickHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public PickupIndex pickupIndex; private void Awake() { if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<GraphicRaycaster>())) { ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); } } public void OnPointerClick(PointerEventData eventData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: 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_005c: Invalid comparison between Unknown and I4 //IL_0070: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_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_00dd: Unknown result type (might be due to invalid IL or missing references) //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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0140: Invalid comparison between Unknown and I4 //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Invalid comparison between Unknown and I4 //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Invalid comparison between Unknown and I4 //IL_0225: Unknown result type (might be due to invalid IL or missing references) CharacterBody cachedBody = LocalUserManager.GetFirstLocalUser().cachedBody; if (((PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex) == pickupIndex || PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex) == pickupIndex) && !instance.dropCoins.Value) || ((((int)eventData.button != 1 && instance.rightClick.Value) || ((int)eventData.button != 0 && !instance.rightClick.Value)) && pickupIndex != PickupIndex.none && (Object)(object)cachedBody != (Object)null && (Object)(object)cachedBody.currentVehicle == (Object)null)) { return; } ItemIndex val = (ItemIndex)(-1); GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems; AllItemsEnumerator enumerator = allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; if (PickupCatalog.FindPickupIndex(current) == pickupIndex && (Object)(object)ItemTierCatalog.GetItemTierDef(ItemCatalog.GetItemDef(current).tier) != (Object)null) { val = current; break; } } } finally { ((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose(); } if (Input.GetKey((KeyCode)308) && (int)val != -1) { if (instance.scrapItems.Value) { instance.TryScrap(cachedBody, val, instance.scrapDropOnGround.Value); } return; } EquipmentIndex val2 = (EquipmentIndex)(-1); GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment; AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext()) { EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current; if (PickupCatalog.FindPickupIndex(current2) == pickupIndex) { val2 = current2; break; } } } finally { ((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose(); } if (((int)val == -1 || instance.dropItems.Value) && ((int)val2 == -1 || instance.dropEquipments.Value)) { instance.TryDrop(cachedBody, pickupIndex, instance.useCommandEssence.Value); } } } internal class DropRequest : INetMessage, ISerializableObject { public CharacterBody body; public PickupIndex pickupIndex; public bool useCommandEssence; public void Serialize(NetworkWriter writer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) writer.Write(((Component)body).gameObject); NetworkExtensions.Write(writer, pickupIndex); writer.Write(useCommandEssence); } public void Deserialize(NetworkReader reader) { //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) body = reader.ReadGameObject().GetComponent<CharacterBody>(); pickupIndex = NetworkExtensions.ReadPickupIndex(reader); useCommandEssence = reader.ReadBoolean(); } public void OnReceived() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { instance.TryDrop(body, pickupIndex, useCommandEssence); } } } internal class ScrapRequest : INetMessage, ISerializableObject { public CharacterBody body; public ItemIndex itemIndex; public bool dropOnGround; public void Serialize(NetworkWriter writer) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) writer.Write(((Component)body).gameObject); NetworkExtensions.Write(writer, itemIndex); writer.Write(dropOnGround); } public void Deserialize(NetworkReader reader) { //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) body = reader.ReadGameObject().GetComponent<CharacterBody>(); itemIndex = NetworkExtensions.ReadItemIndex(reader); dropOnGround = reader.ReadBoolean(); } public void OnReceived() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { instance.TryScrap(body, itemIndex, dropOnGround); } } } private const string modGUID = "bulletbot.droppablethings"; private const string modName = "DroppableThings"; private const string modVer = "1.0.7"; private const string riskOfOptionsModGUID = "com.rune580.riskofoptions"; internal static Plugin instance; internal ManualLogSource logger; private readonly Harmony harmony = new Harmony("bulletbot.droppablethings"); private ConfigEntry<bool> dropItems; private ConfigEntry<bool> dropEquipments; private ConfigEntry<bool> useCommandEssence; private ConfigEntry<bool> dropCoins; private ConfigEntry<bool> scrapItems; private ConfigEntry<bool> scrapDropOnGround; private ConfigEntry<bool> rightClick; private Dictionary<EquipmentIcon, EquipmentIndex> equipmentIcons = new Dictionary<EquipmentIcon, EquipmentIndex>(); internal Dictionary<ItemTier, ItemIndex> moddedScraps = new Dictionary<ItemTier, ItemIndex>(); private void Awake() { instance = this; logger = Logger.CreateLogSource("DroppableThings"); string text = "General"; dropItems = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Items", true, "Determines whether to be able to drop items."); dropEquipments = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Equipments", true, "Determines whether to be able to drop equipments."); useCommandEssence = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Use Command Essence", false, "Determines whether the dropped item becomes an essence when the Artifact of Command is enabled. Note: If the item didn't turn into an essence, only one item was available for selection."); dropCoins = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Coins", true, "Determines whether to be able to drop coins."); scrapItems = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Scrap Items", true, "Determines whether to be able to scrap items. Note: To scrap items, hold left-alt and click on them."); scrapDropOnGround = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Drop Scrap On Ground", true, "Determines whether the scrapped item should drop on the ground."); rightClick = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Right-click Instead Of Left-click", false, "Determines whether to drop/scrap with right-click instead of left-click."); NetworkingAPI.RegisterMessageType<DropRequest>(); NetworkingAPI.RegisterMessageType<ScrapRequest>(); if (RiskOfOptions.IsLoaded()) { RiskOfOptions.OnAwake(); } Stage.onStageStartGlobal += delegate { equipmentIcons.Clear(); }; harmony.PatchAll(); } internal void HandleEquipmentIcon(EquipmentIcon equipmentIcon) { //IL_0002: 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_0049: Expected O, but got Unknown //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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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) EquipmentIndex val = (EquipmentIndex)(-1); if (equipmentIcon.hasEquipment) { object value = AccessTools.Field(typeof(EquipmentIcon), "currentDisplayData").GetValue(equipmentIcon); EquipmentDef val2 = (EquipmentDef)AccessTools.Field(value.GetType(), "equipmentDef").GetValue(value); val = val2.equipmentIndex; } if (!equipmentIcons.ContainsKey(equipmentIcon) || equipmentIcons[equipmentIcon] != val) { equipmentIcons[equipmentIcon] = val; if ((int)val == -1) { equipmentIcon.tooltipProvider.overrideTitleText = ""; equipmentIcon.tooltipProvider.overrideBodyText = ""; EventSystem current = EventSystem.current; TooltipController.RemoveTooltip((MPEventSystem)(object)((current is MPEventSystem) ? current : null), equipmentIcon.tooltipProvider); } GameObject gameObject = ((Component)equipmentIcon).gameObject; ClickHandler clickHandler = gameObject.GetComponent<ClickHandler>(); if ((Object)(object)clickHandler == (Object)null) { clickHandler = gameObject.AddComponent<ClickHandler>(); } clickHandler.pickupIndex = (((int)val == -1) ? PickupIndex.none : PickupCatalog.FindPickupIndex(val)); } } private void TryDrop(CharacterBody body, PickupIndex pickupIndex, bool useCommandEssence) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body == (Object)null || (Object)(object)body.currentVehicle != (Object)null) { return; } if (!NetworkServer.active) { NetMessageExtensions.Send((INetMessage)(object)new DropRequest { body = body, pickupIndex = pickupIndex, useCommandEssence = useCommandEssence }, (NetworkDestination)2); return; } CharacterMaster master = body.master; if (PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex) == pickupIndex) { NetworkUser networkUser = master.playerCharacterMasterController.networkUser; if (networkUser.lunarCoins == 0) { return; } networkUser.DeductLunarCoins(1u); } else if (PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex) == pickupIndex) { if (master.voidCoins == 0) { return; } uint voidCoins = master.voidCoins; master.voidCoins = voidCoins - 1; } else { Inventory inventory = master.inventory; bool flag = false; GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems; AllItemsEnumerator enumerator = allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; ItemDef itemDef = ItemCatalog.GetItemDef(current); if (PickupCatalog.FindPickupIndex(current) == pickupIndex && (Object)(object)ItemTierCatalog.GetItemTierDef(itemDef.tier) != (Object)null) { if (inventory.GetItemCount(current) > 0 && !itemDef.hidden) { inventory.RemoveItem(current, 1); flag = true; } break; } } } finally { ((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose(); } GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment; AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext()) { EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current; if (flag) { break; } if (!(PickupCatalog.FindPickupIndex(current2) == pickupIndex)) { continue; } int num = -1; for (uint num2 = 0u; num2 < inventory.GetEquipmentSlotCount(); num2++) { if (inventory.GetEquipment(num2).equipmentIndex == current2) { num = (int)num2; break; } } if (num != -1) { inventory.SetEquipmentIndexForSlot((EquipmentIndex)(-1), (uint)num); flag = true; break; } } } finally { ((IDisposable)(AllEquipmentEnumerator)(ref enumerator2)).Dispose(); } if (!flag) { return; } } CreateDroplet(body, pickupIndex, useCommandEssence); } private void TryScrap(CharacterBody body, ItemIndex itemIndex, bool dropOnGround) { //IL_0059: 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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) if ((Object)(object)body == (Object)null || (Object)(object)body.currentVehicle != (Object)null) { return; } if (!NetworkServer.active) { NetMessageExtensions.Send((INetMessage)(object)new ScrapRequest { body = body, itemIndex = itemIndex, dropOnGround = dropOnGround }, (NetworkDestination)2); return; } PickupIndex none = PickupIndex.none; ItemIndex val = (ItemIndex)(-1); ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if ((Object)(object)itemDef == (Object)null) { return; } ItemTier tier = itemDef.tier; if (moddedScraps.ContainsKey(tier)) { ItemIndex val2 = moddedScraps[tier]; none = PickupCatalog.FindPickupIndex(val2); val = val2; } else { none = PickupCatalog.FindScrapIndexForItemTier(tier); PickupDef pickupDef = PickupCatalog.GetPickupDef(none); if (pickupDef == null) { return; } val = pickupDef.itemIndex; } if ((int)val != -1 && val != itemIndex) { Inventory inventory = body.inventory; inventory.RemoveItem(itemIndex, 1); if (dropOnGround) { CreateDroplet(body, none, useCommandEssence: false); } else { inventory.GiveItem(val, 1); } } } private void CreateDroplet(CharacterBody body, PickupIndex pickupIndex, bool useCommandEssence) { //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_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_001f: 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_002b: 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_0033: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)body).transform.position; CreatePickupInfo val = default(CreatePickupInfo); val.position = position; val.rotation = Quaternion.identity; ((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex; CreatePickupInfo pickupInfo = val; CreateDroplet(pickupInfo, position, body.inputBank.aimDirection, useCommandEssence); } private void CreateDroplet(CreatePickupInfo pickupInfo, Vector3 position, Vector3 direction, bool useCommandEssence) { //IL_007e: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0115: 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_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_012e: 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) //IL_014e: 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_00c8: Unknown result type (might be due to invalid IL or missing references) if (useCommandEssence && CommandArtifactManager.IsCommandArtifactEnabled) { Option[] array = (Option[])AccessTools.Method(typeof(PickupPickerController), "GetOptionsFromPickupIndex", (Type[])null, (Type[])null).Invoke(null, new object[1] { ((CreatePickupInfo)(ref pickupInfo)).pickupIndex }); if (array.Length > 1) { ref PickupArtifactFlag artifactFlag = ref pickupInfo.artifactFlag; artifactFlag = (PickupArtifactFlag)((uint)artifactFlag | 1u); } } GameObject val = Object.Instantiate<GameObject>((GameObject)AccessTools.Field(typeof(PickupDropletController), "pickupDropletPrefab").GetValue(null), position, Quaternion.identity); PickupDropletController component = val.GetComponent<PickupDropletController>(); if ((Object)(object)component != (Object)null) { AccessTools.Field(typeof(PickupDropletController), "createPickupInfo").SetValue(component, pickupInfo); component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex; } Rigidbody component2 = val.GetComponent<Rigidbody>(); component2.velocity = Quaternion.AngleAxis(Vector3.SignedAngle(Vector3.forward, new Vector3(direction.x, 0f, direction.z), Vector3.up), Vector3.up) * (Vector3.up * 15f + Vector3.forward * 5f); component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere); NetworkServer.Spawn(val); } } } namespace DroppableThings.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("DroppableThings.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static Bitmap icon { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown object @object = ResourceManager.GetObject("icon", resourceCulture); return (Bitmap)@object; } } internal Resources() { } } } namespace DroppableThings.Patches { [HarmonyPatch(typeof(ScoreboardStrip))] internal class ScoreboardStripPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(EquipmentIcon ___equipmentIcon, CharacterMaster ___userPlayerCharacterMasterController) { if (!((Object)(object)LocalUserManager.GetFirstLocalUser().cachedMasterController != (Object)(object)___userPlayerCharacterMasterController)) { Plugin.instance.HandleEquipmentIcon(___equipmentIcon); } } } [HarmonyPatch(typeof(EquipmentIcon))] internal class EquipmentIconPatch { [HarmonyPatch("SetDisplayData")] [HarmonyPostfix] private static void SetDisplayData(EquipmentIcon __instance, CharacterMaster ___playerCharacterMasterController) { if (!((Object)(object)LocalUserManager.GetFirstLocalUser().cachedMasterController != (Object)(object)___playerCharacterMasterController)) { Plugin.instance.HandleEquipmentIcon(__instance); } } } [HarmonyPatch(typeof(ItemInventoryDisplay))] internal class ItemInventoryDisplayPatch { [HarmonyPatch("UpdateDisplay")] [HarmonyPostfix] private static void UpdateDisplay(List<ItemIcon> ___itemIcons) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) foreach (ItemIcon ___itemIcon in ___itemIcons) { GameObject gameObject = ((Component)___itemIcon).gameObject; Plugin.ClickHandler clickHandler = gameObject.GetComponent<Plugin.ClickHandler>(); if ((Object)(object)clickHandler == (Object)null) { clickHandler = gameObject.AddComponent<Plugin.ClickHandler>(); } clickHandler.pickupIndex = PickupCatalog.FindPickupIndex((ItemIndex)AccessTools.Field(typeof(ItemIcon), "itemIndex").GetValue(___itemIcon)); } } } [HarmonyPatch(typeof(HUD))] internal class HUDPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake(HUD __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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_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_003a: Unknown result type (might be due to invalid IL or missing references) __instance.lunarCoinContainer.AddComponent<Plugin.ClickHandler>().pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex); __instance.voidCoinContainer.AddComponent<Plugin.ClickHandler>().pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.VoidCoin.miscPickupIndex); } } }