All pastes #550249 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-08 11:19 UTC
rendered paste body
#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);

    if( pCreature->GetUInt32Value(UNIT_NPC_FLAGS) & UNIT_NPC_FLAG_VENDOR )
        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
        Plr->SetLevel()->70; //what function to use here, chance of mine being wrong = 101%
        break;
    }
}

void LevelUpGossip::GossipEnd(Creature* pCreature, Player* Plr)
{
    GossipScript::GossipEnd(pCreature, Plr);
}

void SetupLevelUp(ScriptMgr * mgr)
{
    /* LevelUp List */
    mgr->register_gossip_script(15174, &LevelUpGossip::Create);      //Alliance NPC
    mgr->register_gossip_script(18251, &LevelUpGossip::Create);      //Horde NPC
}