#include "StdAfx.h" #include "Setup.h" class SCRIPT_DECL LevelUpGossip : public GossipScript { public: ADD_GOSSIP_FACTORY_FUNCTION(LevelUpGossip); void GossipHello(Creature* pCreature, Player* Plr, bool AutoSend); void GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId); void GossipEnd(Creature* pCreature, Player* Plr); }; void LevelUpGossip::GossipHello(Creature* pCreature, Player* Plr, bool AutoSend) { sLog.outDetail("Gossip-LevelUps.cpp : Hello by %s", Plr->GetName()); GossipMenu *Menu; uint32 TextID = 820; // Hello (First) Menu. objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), TextID, Plr); Menu->AddItem( 1, "Level me up.", 1 ); if(AutoSend) Menu->SendTo(Plr); } #define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), textid, Plr); \ Menu->SendTo(Plr); void LevelUpGossip::GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId) { sLog.outDebug("Gossip-LevelUp.cpp : Select option %u by %s", IntId, Plr->GetName()); switch(IntId) { case 1: // LEVEL UP TIME /* lookup level information */ LevelInfo * Info = objmgr.GetLevelInfo(Plr->getRace(), Plr->getClass(), 70); if(Info == 0) { return; } Plr->ApplyLevelInfo(Info, 70); break; } } void LevelUpGossip::GossipEnd(Creature* pCreature, Player* Plr) { GossipScript::GossipEnd(pCreature, Plr); } void SetupLevelUp(ScriptMgr * mgr) { /* LevelUp List */ mgr->register_gossip_script(241, &LevelUpGossip::Create); //Alliance NPC mgr->register_gossip_script(17630, &LevelUpGossip::Create); //Horde NPC }