Pryaxis / TSAPI

🛠🌳 The TShock Scaffold API enables developers to build plugins that hook directly into the Terraria game engine.
http://tshock.co/
GNU General Public License v3.0
109 stars 67 forks source link

ServerApi.Hooks.DropBossBag Is Unavailable #252

Open ACaiCat opened 9 months ago

ACaiCat commented 9 months ago

It can just hook the drop of Defender Medals rather than Boss Bag

public override void Initialize()
{

    ServerApi.Hooks.DropBossBag.Register(this, test);

}

private void test(DropBossBagEventArgs args)
{
    TSPlayer.All.SendSuccessMessage($"Npc: {Lang.GetNPCName(args.NpcId)} {args.NpcId} " +
        $"=> {TShock.Utils.ItemTag(new Item() { netID = args.ItemId, stack = args.Stack })}");
}

protected override void Dispose(bool disposing)
{
    if (disposing)
    {
        //GetDataHandlers.NpcTalk.UnRegister(TalkNPC);
        ServerApi.Hooks.DropBossBag.Deregister(this, test);
    }
    base.Dispose(disposing);
}

Defeat the Slimes King: image Defeat the Old One's Army image