All pastes #554539 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-10 05:26 UTC
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, "gief item newb", 1 );
    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());
    switch(IntId)
    {
		case 1:
			//ItemPrototype * proto = objmgr.GetItemPrototype(1327);
			//Item * pItem = objmgr.CreateItem(1327, Plr);
			//if(!Plr->GetItemInterface()->AddItemToFreeSlot(pItem))
			ItemSetEntry *entry = sItemSetStore.LookupEntry(672);
			std::list<ItemPrototype*>* l = objmgr.GetListForItemSet(672);
			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, m_session->GetPlayer()); //m_session shouldnt be here but what to replace it with?
			if(!itm) //itm should be linking to all relevant items in set :/
			if(!Plr->GetItemInterface()->AddItemToFreeSlot(itm)) // linking with the above
			break;		
	}
}


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
}