rendered paste body#include "StdAfx.h"
#include "Setup.h"
class SCRIPT_DECL GoldUpGossip : public GossipScript
{
public:
ADD_GOSSIP_FACTORY_FUNCTION(GoldUpGossip);
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 GoldUpGossip::GossipHello(Creature* pCreature, Player* Plr, bool AutoSend)
{
sLog.outDetail("Gossip-GoldUps.cpp : Hello by %s", Plr->GetName());
GossipMenu *Menu;
uint32 TextID = 820;
// Hello (First) Menu.
objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), TextID, Plr);
Menu->AddItem( 1, "Give me gold.", 1 );
if(AutoSend)
Menu->SendTo(Plr);
}
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), textid, Plr); \
Menu->SendTo(Plr);
void GoldUpGossip::GossipSelectOption(Creature* pCreature, Player* Plr, uint32 Id, uint32 IntId)
{
sLog.outDebug("Gossip-GoldUp.cpp : Select option %u by %s", IntId, Plr->GetName());
switch(IntId)
{
case 1: // MONEY TIME
/* adding gold to player */
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = 5000000;
if(newgold < 0)
{
return;
}
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, newgold);
break;
}
}
void GoldUpGossip::GossipEnd(Creature* pCreature, Player* Plr)
{
GossipScript::GossipEnd(pCreature, Plr);
}
void SetupGoldUp(ScriptMgr * mgr)
{
/* GoldUp List */
mgr->register_gossip_script(197, &GoldUpGossip::Create); //Alliance NPC
mgr->register_gossip_script(21968, &GoldUpGossip::Create); //Horde NPC
}