Any reason why this is not working? It's register and the mob is casting the spell, but the gossip menu isn't being sent.
Code:
#include "StdAfx.h"
#include "Setup.h"
class SCRIPT_DECL PortNPC : public GossipScript
{
public:
void Destroy()
{
delete(this);
}
void GossipHello(ObjectPointer pObj, PlayerPointer pPlayer, bool autosend)
{
uint32 TextID = 820;
GossipMenu* gm;
pObj->CastSpell((ObjectPointer)pPlayer, 20217, true);
objmgr.CreateGossipMenuForPlayer(&gm, pObj->GetGUID(), TextID, pPlayer);
gm->AddItem(5, "Hi!", 1);
if(autosend)
gm->SendTo(pPlayer);
}
void GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
{
switch(IntId)
{
case 1:
{
Plr->CastSpell(Plr, 20217, true);
break;
}
default:
{
break;
}
}
}
};
void SetupPortNPC(ScriptMgr* mgr)
{
GossipScript* npc = (GossipScript*)new PortNPC();
mgr->register_gossip_script(250008, npc);
}