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 DeadPlayerCatchup v2.0.0
DeadPlayerCatchup.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using On.RoR2; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("DeadPlayerCatchup")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeadPlayerCatchup")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1c4cbe8f-81f8-49a0-9a30-44ef055885e7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.yourname.deadplayercatchup", "DeadPlayerCatchup", "2.2.0")] public class DeadPlayerCatchupPlugin : BaseUnityPlugin { private readonly HashSet<ShopTerminalBehavior> suppressMachineDrops = new HashSet<ShopTerminalBehavior>(); public void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown GenericPickupController.AttemptGrant += new hook_AttemptGrant(OnAttemptGrant); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnPurchaseInteractionBegin); ShopTerminalBehavior.DropPickup_bool += new hook_DropPickup_bool(OnShopTerminalDropPickup); ((BaseUnityPlugin)this).Logger.LogInfo((object)"DeadPlayerCatchup loaded!"); } private void OnAttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { //IL_0044: 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_005b: 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_0079: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, body); if ((Object)(object)self == (Object)null || (Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } UniquePickup pickup = self.pickup; if (((UniquePickup)(ref pickup)).isTempItem) { return; } PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickupIndex); if (pickupDef == null || (int)pickupDef.equipmentIndex != -1) { return; } ItemIndex itemIndex = pickupDef.itemIndex; if ((int)itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (IsAllowedItem(itemDef)) { GiveRandomSameTierItemsToDeadPlayers(body.inventory, itemDef.tier); } } } private void OnPurchaseInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_004e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self == (Object)null || (Object)(object)activator == (Object)null) { orig.Invoke(self, activator); return; } ShopTerminalBehavior component = ((Component)self).GetComponent<ShopTerminalBehavior>(); if ((Object)(object)component == (Object)null) { orig.Invoke(self, activator); return; } if (!IsPrinterScrapperOrCauldronCost(self.costType)) { orig.Invoke(self, activator); return; } CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>(); if ((Object)(object)component2 == (Object)null || (Object)(object)component2.inventory == (Object)null) { orig.Invoke(self, activator); return; } PickupIndex val = component.CurrentPickupIndex(); PickupDef pickupDef = PickupCatalog.GetPickupDef(val); if (pickupDef != null && (int)pickupDef.itemIndex != -1) { component2.inventory.GiveItem(pickupDef.itemIndex, 1); } suppressMachineDrops.Add(component); orig.Invoke(self, activator); } private void OnShopTerminalDropPickup(orig_DropPickup_bool orig, ShopTerminalBehavior self, bool isDuplicated) { if ((Object)(object)self != (Object)null && suppressMachineDrops.Contains(self)) { suppressMachineDrops.Remove(self); } else { orig.Invoke(self, isDuplicated); } } private bool IsPrinterScrapperOrCauldronCost(CostTypeIndex costType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown int num = (int)costType; return num == 4 || num == 5 || num == 6 || num == 9 || num == 10; } private void GiveRandomSameTierItemsToDeadPlayers(Inventory pickerInventory, ItemTier tier) { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!((Object)(object)readOnlyInstances == (Object)null) && !((Object)(object)readOnlyInstances.inventory == (Object)null) && IsDeadOrRemoteOperationPlayer(readOnlyInstances) && !((Object)(object)readOnlyInstances.inventory == (Object)(object)pickerInventory)) { ItemIndex randomItemFromTier = GetRandomItemFromTier(tier); if ((int)randomItemFromTier != -1) { readOnlyInstances.inventory.GiveItem(randomItemFromTier, 1); SendPickupMessage(randomItemFromTier); } } } } private bool IsAllowedItem(ItemDef itemDef) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 if ((Object)(object)itemDef == (Object)null) { return false; } if (itemDef.hidden) { return false; } if (((Object)itemDef).name.ToLowerInvariant().Contains("scrap")) { return false; } if ((int)itemDef.tier == 3) { return false; } if ((int)itemDef.tier == 6 || (int)itemDef.tier == 7 || (int)itemDef.tier == 8 || (int)itemDef.tier == 9) { return false; } if (itemDef.ContainsTag((ItemTag)13)) { return false; } string text = ((Object)itemDef).name.ToLowerInvariant(); if (text.Contains("temporary") || text.Contains("temp")) { return false; } return (int)itemDef.tier == 0 || (int)itemDef.tier == 1 || (int)itemDef.tier == 2 || (int)itemDef.tier == 4; } private bool IsDeadOrRemoteOperationPlayer(CharacterMaster master) { if ((Object)(object)master == (Object)null) { return false; } if ((Object)(object)master.playerCharacterMasterController == (Object)null) { return false; } if (!master.hasBody) { return true; } CharacterBody body = master.GetBody(); if ((Object)(object)body == (Object)null) { return true; } string text = ((Object)body).name.ToLowerInvariant(); if (text.Contains("drone") || text.Contains("turret") || text.Contains("beetleguard") || text.Contains("equipmentdrone") || text.Contains("emergencydrone") || text.Contains("flamedrone") || text.Contains("missiledrone") || text.Contains("megadrone") || text.Contains("roboball") || text.Contains("squidturret")) { return true; } return false; } private ItemIndex GetRandomItemFromTier(ItemTier tier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0022: 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_0045: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) List<ItemIndex> list = new List<ItemIndex>(); 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 (IsAllowedItem(itemDef) && itemDef.tier == tier) { list.Add(current); } } } finally { ((IDisposable)(AllItemsEnumerator)(ref enumerator)).Dispose(); } if (list.Count == 0) { return (ItemIndex)(-1); } int index = Random.Range(0, list.Count); return list[index]; } private void SendPickupMessage(ItemIndex itemIndex) { //IL_0001: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!((Object)(object)itemDef == (Object)null)) { string text = Language.GetString(itemDef.nameToken); if (string.IsNullOrEmpty(text)) { text = ((Object)itemDef).name; } Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<color=#7CFF95>A dead player received " + text + "</color>" }); } } }