private void Inventory_OnItemAdded(On.RoR2.Inventory.orig_RpcItemAdded orig, Inventory self, ItemIndex item)
 {
     orig(self, item);
     if (item == RoR2Content.Items.ExtraLifeConsumed.itemIndex)
     {
         for (int i = 0; i < self.GetItemCount(RoR2Content.Items.ExtraLifeConsumed.itemIndex);)
         {
             if (Config_GiveDiff.Value)
             {
                 for (int f = 0; f < Config_GiveAmount.Value; f++)
                 {
                     ItemIndex givenitem = GetRandomItemFromTier(Config_ItemTier.Value);
                     self.GiveItem(givenitem, 1);
                     if (Config_Debug.Value)
                     {
                         Logger.LogInfo("Gained " + ItemCatalog.GetItemDef(givenitem).name + " from consumed Dio.");
                     }
                 }
                 self.GiveItem(RoR2Content.Items.ExtraLifeConsumed.itemIndex, -1);
             }
             else
             {
                 ItemIndex givenitem = GetRandomItemFromTier(Config_ItemTier.Value);
                 self.GiveItem(givenitem, Config_GiveAmount.Value);
                 self.GiveItem(RoR2Content.Items.ExtraLifeConsumed.itemIndex, -1);
                 if (Config_Debug.Value)
                 {
                     Logger.LogInfo("Gained " + Config_GiveAmount.Value + "x " + ItemCatalog.GetItemDef(givenitem).name + " from consumed Dio.");
                 }
             }
         }
     }
 }
예제 #2
0
 void RpcItemAdded(On.RoR2.Inventory.orig_RpcItemAdded orig, RoR2.Inventory inventory, ItemIndex itemIndex)
 {
     if (Data.modEnabled)
     {
         if (Data.mode == DataShop.mode)
         {
             if (Data.modEnabled)
             {
                 if (Data.mode == DataShop.mode)
                 {
                     if (inventoryLocal != null)
                     {
                         if (inventoryLocal == inventory)
                         {
                             //if (!Data.scrapItems.Contains(itemIndex)) {
                             DataShop.AddScrap(characterBody, Data.GetItemTier(Data.allItemsIndexes[itemIndex]));
                             //}
                         }
                     }
                 }
             }
         }
     }
     orig(inventory, itemIndex);
 }