void BuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, RoR2.Run run) { Data.RefreshInfo(); if (Data.modEnabled) { DataShop.SetScrapStarting(); Data.SaveConfigProfile(); } orig(run); }
private void Run_BuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, Run self) { orig(self); if (NewtsWrathIsEnabled) { self.SetFieldValue("availableTier1DropList", self.availableLunarDropList); self.SetFieldValue("availableTier2DropList", self.availableLunarDropList); self.SetFieldValue("availableTier3DropList", self.availableLunarDropList); self.SetFieldValue("availableNormalEquipmentDropList", self.availableLunarEquipmentDropList); } }
static void BanItems(On.RoR2.Run.orig_BuildDropTable orig, Run self) { if (NetworkServer.active) { if (VoteAPI.VoteResults.HasVote(Settings.BanItems.Item2)) { foreach (ItemIndex itemIndex in Settings.BannedItems.Values) { Run.instance.availableItems.Remove(itemIndex); } foreach (EquipmentIndex equipmentIndex in Settings.BannedEquipments.Values) { Run.instance.availableEquipment.Remove(equipmentIndex); } } } orig(self); //Lists causes errors if left empty so add junk item to empty list if (self.availableTier1DropList.Count == 0) { self.availableTier1DropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableTier2DropList.Count == 0) { self.availableTier2DropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableTier3DropList.Count == 0) { self.availableTier3DropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableLunarDropList.Count == 0) { self.availableLunarDropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableEquipmentDropList.Count == 0) { self.availableEquipmentDropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableBossDropList.Count == 0) { self.availableBossDropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableLunarEquipmentDropList.Count == 0) { self.availableLunarEquipmentDropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } if (self.availableNormalEquipmentDropList.Count == 0) { self.availableNormalEquipmentDropList.Add(PickupCatalog.FindPickupIndex(RoR2Content.Items.ExtraLifeConsumed.itemIndex)); } }
//------------------------- //------------------------- void BuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, Run run) { System.Type type = typeof(R2API.ItemDropAPI); System.Reflection.MethodInfo runOnBuildDropTable = type.GetMethod("RunOnBuildDropTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); runOnBuildDropTable.Invoke(null, new object[2] { orig, run }); SetDefaultDropLists(run); orig(run); setDropLists(); monsterDropList.GenerateItems(run); playerDropList.ClearAllLists(run); playerDropList.GenerateItems(run); playerDropList.SetItems(run); DropList.AddChestChoices(run); playerInteractables.CalculateInvalidInteractables(playerItems); monsterInteractables.CalculateInvalidInteractables(monsterItems); }
private static void RunOnBuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, Run self) { orig(self); if (DefaultDrops) { // Setup default item lists DefaultItemDrops.AddDefaults(); } // These lists should be replaced soon. self.availableTier1DropList.Clear(); self.availableTier1DropList.AddRange(GetDefaultDropList(ItemTier.Tier1).Select(x => PickupCatalog.FindPickupIndex(x)) .ToList()); self.availableTier2DropList.Clear(); self.availableTier2DropList.AddRange(GetDefaultDropList(ItemTier.Tier2).Select(x => PickupCatalog.FindPickupIndex(x)) .ToList()); self.availableTier3DropList.Clear(); self.availableTier3DropList.AddRange(GetDefaultDropList(ItemTier.Tier3).Select(x => PickupCatalog.FindPickupIndex(x)) .ToList()); self.availableEquipmentDropList.Clear(); self.availableEquipmentDropList.AddRange(GetDefaultEquipmentDropList().Select(x => PickupCatalog.FindPickupIndex(x)) .ToList()); self.availableLunarDropList.Clear(); self.availableLunarDropList.AddRange(GetDefaultLunarDropList()); self.smallChestDropTierSelector.Clear(); self.smallChestDropTierSelector.AddChoice(self.availableTier1DropList, DefaultSmallChestTier1SelectorDropChance); self.smallChestDropTierSelector.AddChoice(self.availableTier2DropList, DefaultSmallChestTier2SelectorDropChance); self.smallChestDropTierSelector.AddChoice(self.availableTier3DropList, DefaultSmallChestTier3SelectorDropChance); self.mediumChestDropTierSelector.Clear(); self.mediumChestDropTierSelector.AddChoice(self.availableTier2DropList, DefaultMediumChestTier1SelectorDropChance); self.mediumChestDropTierSelector.AddChoice(self.availableTier3DropList, DefaultMediumChestTier2SelectorDropChance); self.largeChestDropTierSelector.Clear(); }
private void On_RunBuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, Run self) { var newItemMask = self.availableItems; var newEqpMask = self.availableEquipment; foreach (CatalogBoilerplate bpl in allInstances) { if (bpl is Item item) { bool shouldDrop = item.enabled && item.itemDef.DoesNotContainTag(ItemTag.WorldUnique); if (shouldDrop) { newItemMask.Add(item.catalogIndex); } else { newItemMask.Remove(item.catalogIndex); } } else if (bpl is Equipment equipment) { bool shouldDrop = equipment.enabled; if (shouldDrop) { newEqpMask.Add(equipment.catalogIndex); } else { newEqpMask.Remove(equipment.catalogIndex); } } } self.availableItems = newItemMask; self.availableEquipment = newEqpMask; orig(self); //should force-update most cached drop tables PickupDropTable.RegenerateAll(Run.instance); }
private void On_RunBuildDropTable(On.RoR2.Run.orig_BuildDropTable orig, Run self) { var newItemMask = self.availableItems; var newEqpMask = self.availableEquipment; foreach (CatalogBoilerplate bpl in allInstances) { if (!bpl.enabled) { if (bpl is Equipment_V2 eqp) { newEqpMask.Remove(eqp.catalogIndex); } else if (bpl is Item_V2 item) { newItemMask.Remove(item.catalogIndex); } } else { if (bpl is Equipment_V2 eqp) { newEqpMask.Add(eqp.catalogIndex); } else if (bpl is Item_V2 item) { newItemMask.Add(item.catalogIndex); } } } //ItemDropAPI completely overwrites drop tables; need to perform separate removal if (ItemDropAPI.Loaded) { ItemDropAPI.RemoveFromDefaultByTier( allInstances.Where(bpl => bpl is Item_V2 && !bpl.enabled) .Select(bpl => { return(new KeyValuePair <ItemIndex, ItemTier>(((Item_V2)bpl).catalogIndex, ((Item_V2)bpl).itemTier)); }) .ToArray()); ItemDropAPI.RemoveFromDefaultEquipment( allInstances.Where(bpl => bpl is Equipment_V2 && !bpl.enabled) .Select(bpl => ((Equipment_V2)bpl).catalogIndex) .ToArray()); ItemDropAPI.AddToDefaultByTier( allInstances.Where(bpl => bpl is Item_V2 && bpl.enabled) .Select(bpl => { return(new KeyValuePair <ItemIndex, ItemTier>(((Item_V2)bpl).catalogIndex, ((Item_V2)bpl).itemTier)); }) .ToArray()); ItemDropAPI.AddToDefaultEquipment( allInstances.Where(bpl => bpl is Equipment_V2 && bpl.enabled) .Select(bpl => ((Equipment_V2)bpl).catalogIndex) .ToArray()); } orig(self); //should force-update most cached drop tables PickupDropTable.RegenerateAll(Run.instance); //update existing Command droplets. part of an effort to disable items mid-stage, may not be necessary while that's prevented foreach (var picker in UnityEngine.Object.FindObjectsOfType <PickupPickerController>()) { picker.SetOptionsFromPickupForCommandArtifact(picker.options[0].pickupIndex); } }