rendered paste body#include "StdAfx.h"
#include "Setup.h"
class SCRIPT_DECL Tier6Gossip : public GossipScript
{
public:
ADD_GOSSIP_FACTORY_FUNCTION(Tier6Gossip);
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 Tier6Gossip::GossipHello(Creature* pCreature, Player* Plr, bool AutoSend)
{
sLog.outDetail("Gossip_Tier6Gossip.cpp : Hello by %s", Plr->GetName());
GossipMenu *Menu;
uint32 TextID = 820;
// Hello (First) Menu.
objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), TextID, Plr);
Menu->AddItem( 1, "Warrior T6 Set", 1 );
Menu->AddItem( 2, "Paladin T6 Set", 2 );
Menu->AddItem( 3, "Warlock T6 Set", 3 );
Menu->AddItem( 4, "Priest T6 Set", 4 );
Menu->AddItem( 5, "Hunter T6 Set", 5 );
Menu->AddItem( 6, "Druid T6 Set", 6 );
Menu->AddItem( 7, "Mage T6 Set", 7 );
Menu->AddItem( 8, "Rogue T6 Set", 8 );
if(AutoSend)
Menu->SendTo(Plr);
}
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), textid, Plr); \
Menu->SendTo(Plr);
void Tier6Gossip::GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId)
{
sLog.outDebug("Gossip_Tier6.cpp : Select option %u by %s", IntId, Plr->GetName());
uint32 setid;
uint32 ItemId;
switch(IntId)
{
case 1:
setid = 670;
break;
case 2:
setid = 671;
break;
}
ItemSetEntry *entry = sItemSetStore.LookupEntry(setid);
std::list<ItemPrototype*>* l = objmgr.GetListForItemSet(setid);
if(!entry || !l)
{
return;
}
const char* setname = sItemSetStore.LookupString(entry->name);
for(std::list<ItemPrototype*>::iterator itr = l->begin(); itr != l->end(); ++itr)
{
Item *itm = objmgr.CreateItem((*itr)->ItemId, Plr);
if(!itm) continue;
if(!Plr->GetItemInterface()->AddItemToFreeSlot(itm))
{
delete itm;
}
}
}
void Tier6Gossip::GossipEnd(Creature* pCreature, Player* Plr)
{
GossipScript::GossipEnd(pCreature, Plr);
}
void SetupTier6Gossip(ScriptMgr * mgr)
{
/* Tier 6 List */
mgr->register_gossip_script(21699, &Tier6Gossip::Create); //Alliance NPC
}