Glasia 森の魔王🌳
The Destroyer
Good evening,
I have a question about tweaking boss bag loot via TML:
What IItemDropRule is used for the Dev items in the hardmode expert boss bags (except QS)?
I try to replace the dev items drops with that blueprints are dropped that are used to craft the dev items,
the blueprint giveout works but however the dev items are not removed out of the loot table:
Item drop tweaks
Here the code of the blueprint item itself
If you need more info, do not hesitate to let me know.
I thank you for your answer.
Glasia
I have a question about tweaking boss bag loot via TML:
What IItemDropRule is used for the Dev items in the hardmode expert boss bags (except QS)?
I try to replace the dev items drops with that blueprints are dropped that are used to craft the dev items,
the blueprint giveout works but however the dev items are not removed out of the loot table:
Item drop tweaks
C#:
using DeveloperItemBlueprintMod.Content.Items;
using System;
using System.Linq;
using Terraria;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.ModLoader;
namespace DeveloperItemBlueprintMod.Common.CommonItems
{
public class BossBagLoot : GlobalItem
{
static int[] bossBagsWithDeveloperItems = new int[] {
ItemID.DestroyerBossBag, ItemID.TwinsBossBag, ItemID.SkeletronPrimeBossBag,
ItemID.PlanteraBossBag, ItemID.GolemBossBag,
ItemID.MoonLordBossBag, ItemID.BossBagBetsy,
ItemID.FairyQueenBossBag, ItemID.FishronBossBag
};
public override void ModifyItemLoot(Item item, ItemLoot itemLoot)
{
if (bossBagsWithDeveloperItems.Contains(item.type))
{
foreach (var rule in itemLoot.Get())
{
/* Here it is supposed that the replacement happens: The dev item rule is removed, then replaced by the item drop*/
if (rule is OneFromOptionsDropRule oneFromOptionsDrop oneFromOptionsDrop.dropIds.Contains(ItemID.RedsHelmet))
{
itemLoot.Remove(rule);
}
}
/*Chance is 100% for test/debug purposes*/
itemLoot.Add(new CommonDrop(ModContent.ItemType<DeveloperBlueprint>(), 1, 8, 13, 1));
}
}
}
}
Here the code of the blueprint item itself
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace DeveloperItemBlueprintMod.Content.Items
{
public class DeveloperBlueprint : ModItem
{
public override void SetStaticDefaults()
{
Item.ResearchUnlockCount = 100;
}
public override void SetDefaults()
{
Item.width = 24;
Item.height = 24;
Item.rare = ItemRarityID.Cyan;
Item.maxStack = Item.CommonMaxStack;
Item.value = Item.buyPrice(silver: 25);
}
}
}
If you need more info, do not hesitate to let me know.
I thank you for your answer.
Glasia
