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 RiskofDroppingEverything v2.7.1
RiskofDroppingEverything.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using R2API.Networking; using R2API.Networking.Interfaces; 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("RiskofDroppingEverything")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RiskofDroppingEverything")] [assembly: AssemblyTitle("RiskofDroppingEverything")] [assembly: AssemblyVersion("1.0.0.0")] namespace RiskofDroppingEverything; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.YourName.RiskofDroppingEverything", "Risk of Dropping Everything", "2.7.1")] public class RiskofDroppingEverythingPlugin : BaseUnityPlugin { public static ConfigEntry<bool> ModEnabled; public static ConfigEntry<bool> EnableNormalDrop; public static ConfigEntry<bool> EnableScrapDrop; public static ConfigEntry<bool> UseCommandCubes; public static ConfigEntry<bool> ScrapGivesChoice; public static ConfigEntry<KeyboardShortcut> DropButton; public static ConfigEntry<KeyboardShortcut> ScrapKey; public static ManualLogSource Log; private static FieldInfo itemIndexField; private static bool fieldSearched; public void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "Mod Enabled", true, "Turns the entire mod on or off."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ModEnabled)); DropButton = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. General", "Drop Button", new KeyboardShortcut((KeyCode)324, Array.Empty<KeyCode>()), "The key or mouse button that drops the item under your cursor in the inventory. Default: Mouse1 (right click). If the in-game binder does not accept a mouse button, edit this entry in the .cfg file (Mouse0 = left, Mouse1 = right, Mouse2 = middle)."); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(DropButton)); ScrapKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. General", "Scrap Modifier Key", new KeyboardShortcut((KeyCode)306, Array.Empty<KeyCode>()), "Hold this key while clicking to turn the item into scrap. Left and right variants of Ctrl, Shift and Alt are both accepted."); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ScrapKey)); EnableNormalDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Features", "Normal Drop", true, "Allows dropping the selected item normally."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableNormalDrop)); EnableScrapDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Features", "Scrap Drop (Modifier Key + Click)", true, "Allows turning the item into scrap when dropping it."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableScrapDrop)); ScrapGivesChoice = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Features", "Scrap Drops Item Choice", true, "If ON and Artifact of Command is active: Clicking a scrap (without the modifier key) drops a cube where you can choose any item of that color. Otherwise the original item is returned."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ScrapGivesChoice)); UseCommandCubes = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Artifacts", "Drop as Command Cube", false, "If OFF: Drops the exact item (bypasses Command cubes). If ON: The item turns into a selectable cube if the Artifact of Command is active."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UseCommandCubes)); ModSettingsManager.SetModDescription("Press the drop button while hovering an item in your inventory display to drop it, or hold the scrap key to turn it into scrap. Drop a scrap to get the original item back (or choose an item with Artifact of Command). Drop button and scrap key are configurable."); NetworkingAPI.RegisterMessageType<DropItemMessage>(); Run.onRunStartGlobal += delegate { DropItemMessage.ClearHistory(); }; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Risk of Dropping Everything geladen."); } private static bool IsScrapKeyHeld() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0023: 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_0026: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = ScrapKey.Value; KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey; if ((int)mainKey == 0) { return false; } KeyCode val = mainKey; KeyCode val2 = val; switch (val2 - 303) { case 2: case 3: return Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); case 0: case 1: return Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); case 4: case 5: return Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307); default: return Input.GetKey(mainKey); } } public void Update() { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_003c: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Invalid comparison between Unknown and I4 //IL_0198: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if (!ModEnabled.Value) { return; } KeyboardShortcut value = DropButton.Value; KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey; if ((int)mainKey == 0 || !Input.GetKeyDown(mainKey)) { return; } bool flag = IsScrapKeyHeld(); if ((flag && !EnableScrapDrop.Value) || (!flag && !EnableNormalDrop.Value)) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null || (Object)(object)firstLocalUser.eventSystem == (Object)null) { return; } NetworkUser currentNetworkUser = firstLocalUser.currentNetworkUser; if ((Object)(object)currentNetworkUser == (Object)null || (Object)(object)currentNetworkUser.master == (Object)null || (Object)(object)currentNetworkUser.master.inventory == (Object)null) { return; } PointerEventData val = new PointerEventData((EventSystem)(object)firstLocalUser.eventSystem) { position = Vector2.op_Implicit(Input.mousePosition) }; List<RaycastResult> list = new List<RaycastResult>(); ((EventSystem)firstLocalUser.eventSystem).RaycastAll(val, list); foreach (RaycastResult item in list) { RaycastResult current = item; if ((Object)(object)((RaycastResult)(ref current)).gameObject == (Object)null) { continue; } ItemIcon componentInParent = ((RaycastResult)(ref current)).gameObject.GetComponentInParent<ItemIcon>(); if ((Object)(object)componentInParent == (Object)null) { continue; } ItemIndex itemIndex = GetItemIndex(componentInParent); if ((int)itemIndex != -1 && currentNetworkUser.master.inventory.GetItemCountEffective(itemIndex) > 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Droppe Item {itemIndex} (Scrap: {flag})"); NetMessageExtensions.Send((INetMessage)(object)new DropItemMessage(((NetworkBehaviour)currentNetworkUser.master).netId, itemIndex, flag), (NetworkDestination)2); } break; } } private ItemIndex GetItemIndex(ItemIcon icon) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (!fieldSearched) { fieldSearched = true; FieldInfo[] fields = typeof(ItemIcon).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(ItemIndex)) { itemIndexField = fieldInfo; ((BaseUnityPlugin)this).Logger.LogInfo((object)("ItemIndex-Feld gefunden: " + fieldInfo.Name)); break; } } if (itemIndexField == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Kein ItemIndex-Feld in ItemIcon gefunden!"); } } if (itemIndexField == null) { return (ItemIndex)(-1); } return (ItemIndex)itemIndexField.GetValue(icon); } } public class DropItemMessage : INetMessage, ISerializableObject { private static readonly Dictionary<NetworkInstanceId, Dictionary<ItemIndex, Stack<ItemIndex>>> scrapHistory = new Dictionary<NetworkInstanceId, Dictionary<ItemIndex, Stack<ItemIndex>>>(); private NetworkInstanceId masterNetId; private ItemIndex itemIndex; private bool convertToScrap; public static void ClearHistory() { scrapHistory.Clear(); } private static void RecordScrap(NetworkInstanceId netId, ItemIndex scrap, ItemIndex original) { //IL_0006: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!scrapHistory.TryGetValue(netId, out var value)) { value = new Dictionary<ItemIndex, Stack<ItemIndex>>(); scrapHistory[netId] = value; } if (!value.TryGetValue(scrap, out var value2)) { value2 = (value[scrap] = new Stack<ItemIndex>()); } value2.Push(original); } private static bool TryPopOriginal(NetworkInstanceId netId, ItemIndex scrap, out ItemIndex original) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected I4, but got Unknown original = (ItemIndex)(-1); if (scrapHistory.TryGetValue(netId, out var value) && value.TryGetValue(scrap, out var value2) && value2.Count > 0) { original = (ItemIndex)(int)value2.Pop(); return true; } return false; } private static bool IsScrapItem(ItemIndex item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(item); return (Object)(object)itemDef != (Object)null && (((Object)itemDef).name == "ScrapWhite" || ((Object)itemDef).name == "ScrapGreen" || ((Object)itemDef).name == "ScrapRed" || ((Object)itemDef).name == "ScrapYellow"); } private static bool IsCommandActive() { return (Object)(object)RunArtifactManager.instance != (Object)null && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.commandArtifactDef); } public DropItemMessage() { } public DropItemMessage(NetworkInstanceId netId, ItemIndex item, bool asScrap) { //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) masterNetId = netId; itemIndex = item; convertToScrap = asScrap; } 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) //IL_001a: Expected I4, but got Unknown writer.Write(masterNetId); writer.Write((int)itemIndex); writer.Write(convertToScrap); } 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_0014: Unknown result type (might be due to invalid IL or missing references) masterNetId = reader.ReadNetworkId(); itemIndex = (ItemIndex)reader.ReadInt32(); convertToScrap = reader.ReadBoolean(); } private static List<PickupIndex> GetDropListForScrap(ItemIndex item) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_010c: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) ItemDef itemDef = ItemCatalog.GetItemDef(item); if ((Object)(object)itemDef == (Object)null) { return null; } ItemTier val; switch (((Object)itemDef).name) { case "ScrapWhite": val = (ItemTier)0; break; case "ScrapGreen": val = (ItemTier)1; break; case "ScrapRed": val = (ItemTier)2; break; case "ScrapYellow": val = (ItemTier)4; break; default: return null; } List<PickupIndex> list = new List<PickupIndex>(); for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemDef itemDef2 = ItemCatalog.GetItemDef((ItemIndex)i); if (!((Object)(object)itemDef2 == (Object)null) && itemDef2.tier == val && !itemDef2.hidden && !((Object)itemDef2).name.StartsWith("Scrap") && !itemDef2.ContainsTag((ItemTag)9) && (!((Object)(object)Run.instance != (Object)null) || Run.instance.IsItemAvailable(itemDef2.itemIndex))) { PickupIndex val2 = PickupCatalog.FindPickupIndex(itemDef2.itemIndex); if (val2 != PickupIndex.none) { list.Add(val2); } } } return list; } public unsafe void OnReceived() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected I4, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } GameObject val = Util.FindNetworkObject(masterNetId); if (!Object.op_Implicit((Object)(object)val)) { return; } CharacterMaster component = val.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.inventory)) { return; } CharacterBody body = component.GetBody(); if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inputBank)) { return; } if (component.inventory.GetItemCountPermanent(itemIndex) <= 0) { RiskofDroppingEverythingPlugin.Log.LogWarning((object)("Item ist nicht permanent im Inventar, Drop abgebrochen: " + ((object)Unsafe.As<ItemIndex, ItemIndex>(ref itemIndex)/*cast due to .constrained prefix*/).ToString())); return; } Vector3 val2 = body.corePosition + body.inputBank.aimDirection * 2f; Vector3 val3 = Vector3.up * 20f + body.inputBank.aimDirection * 10f; RiskofDroppingEverythingPlugin.Log.LogInfo((object)$"Drop-Anfrage: Item={itemIndex}, Scrap-Modus={convertToScrap}, CommandAktiv={IsCommandActive()}, ScrapGivesChoice={RiskofDroppingEverythingPlugin.ScrapGivesChoice.Value}"); if (!convertToScrap && RiskofDroppingEverythingPlugin.ScrapGivesChoice.Value && IsCommandActive()) { List<PickupIndex> dropListForScrap = GetDropListForScrap(itemIndex); if (dropListForScrap != null && dropListForScrap.Count > 0) { PickupIndex val4 = dropListForScrap[0]; component.inventory.RemoveItemPermanent(itemIndex, 1); PickupDropletController.CreatePickupDroplet(val4, val2, val3); TryPopOriginal(((NetworkBehaviour)component).netId, itemIndex, out var _); RiskofDroppingEverythingPlugin.Log.LogInfo((object)("Command-Cube per Droplet gedroppt (Farbe von Item " + ((object)(*(PickupIndex*)(&val4))/*cast due to .constrained prefix*/).ToString() + ", " + dropListForScrap.Count + " Items in der Farbe).")); return; } RiskofDroppingEverythingPlugin.Log.LogWarning((object)"Keine Drop-Liste fuer diesen Scrap, es wird normal gedroppt."); } ItemIndex val5 = itemIndex; ItemIndex original2; if (convertToScrap) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if ((Object)(object)itemDef != (Object)null) { ItemTier tier = itemDef.tier; ItemTier val6 = tier; switch ((int)val6) { case 0: val5 = Items.ScrapWhite.itemIndex; break; case 1: val5 = Items.ScrapGreen.itemIndex; break; case 2: val5 = Items.ScrapRed.itemIndex; break; case 4: val5 = Items.ScrapYellow.itemIndex; break; } } if (val5 != itemIndex) { RecordScrap(((NetworkBehaviour)component).netId, val5, itemIndex); } } else if (IsScrapItem(itemIndex) && TryPopOriginal(((NetworkBehaviour)component).netId, itemIndex, out original2)) { RiskofDroppingEverythingPlugin.Log.LogInfo((object)("Scrap wird zurückgetauscht zu: " + ((object)(*(ItemIndex*)(&original2))/*cast due to .constrained prefix*/).ToString())); val5 = original2; } component.inventory.RemoveItemPermanent(itemIndex, 1); PickupIndex val7 = PickupCatalog.FindPickupIndex(val5); if (RiskofDroppingEverythingPlugin.UseCommandCubes.Value) { PickupDropletController.CreatePickupDroplet(val7, val2, val3); return; } CreatePickupInfo val8 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val8)).pickupIndex = val7; val8.position = val2; val8.rotation = Quaternion.identity; CreatePickupInfo val9 = val8; GenericPickupController.CreatePickup(ref val9); } }