Code:
// A satirical NPC with Gossip Menu and Emotes that gives away free money
// Scripted by Pepsi1x1
// Do as you like with this, just scripted for fun, credit me if you like.
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
class SCRIPT_DECL FreeMoneyNPC : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void FreeMoneyNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
Menu->AddItem(0, "1 Gold", 1);
Menu->AddItem(0, "10 Gold", 2);
Menu->AddItem(0, "100 Gold", 3);
Menu->AddItem(0, "1000 Gold", 4);
Menu->AddItem(0, "10000 Gold", 5);
Menu->AddItem(0, "Greedy Phat B4stard Gold", 6);
if(AutoSend)
Menu->SendTo(Plr);
}
void FreeMoneyNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
if(pCreature==NULL)
return;
switch(IntId)
{
case 1:
{
uint32 amount = 10000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = currentgold + amount;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Dont spend it all in one shop!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
case 2:
{
uint32 amount = 100000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = currentgold + amount;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "A modest choice my friend!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
case 3:
{
uint32 amount = 1000000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = currentgold + amount;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Go forth my friend and spend!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
case 4:
{
uint32 amount = 10000000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = currentgold + amount;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Have a bag o' sand!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
break;
case 5:
{
uint32 amount = 100000000;
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
int32 newgold = currentgold + amount;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "A big sack of cash!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
case 6:
{
uint32 amount = 999999999;
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,amount);
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "WOW, but...im considerably richer than yow!");
pCreature->Emote(EMOTE_ONESHOT_CHEER);
}
break;
}
};
void FreeMoneyNPC::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupFreeMoneyNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new FreeMoneyNPC();
mgr->register_gossip_script(40000, gs);
}
don't forget to modify setup.cpp add this
Code:
insert into `creature_names` (`entry`, `name`, `subname`, `mouseFlags`, `Flags1`, `type`, `family`, `rank`, `unk4`, `spelldataid`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `civilian`, `leader`) values('40000','Mr Free Free','Moneybags','0','0','7','0','0','0',NULL,'1140','0','0','0','1','1','0',NULL);
insert into `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `mindamage`, `maxdamage`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `mountdisplayid`, `equipmodel1`, `equipinfo1`, `equipslot1`, `equipmodel2`, `equipinfo2`, `equipslot2`, `equipmodel3`, `equipinfo3`, `equipslot3`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `death_state`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`) values('40000','1','1','35','2300','2300','0','1','1','1400','3','3.87','0','0','0','0','0','0','0','0','0','0','0','0','0','0','20','0','0','0','0','0','0','2','1','0','0','0','0','0','2.5','8','14','0');