Code:
#include"StdAfx.h"
#include"Setup.h"
#ifdef WIN32
#pragmawarning(disable:4305)// warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
class SCRIPT_DECL WarpNPC : public GossipScript
{
public:
void Destroy()
{
deletethis;
}
void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(0,"Horde Cities", 1);
Menu->AddItem(0,"Alliance Cities", 2);
Menu->AddItem(0,"Neutral Locations", 3);
if(AutoSend)
Menu->SendTo(Plr);
}
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, constchar * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
if(pCreature==NULL)
return ;
GossipMenu *Menu;
switch(IntId)
{
case 1: //Horde Cities
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(5,"Orgrimmar",4);
Menu->AddItem(5,"Undercity",5);
Menu->AddItem(5,"Thunder Bluff",6);
Menu->AddItem(5,"Silvermoon",7);
Menu->SendTo(Plr);
}break;
case 2: //Alliance Cities
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(5,"The Exodar",8);
Menu->AddItem(5,"Stormwind",9);
Menu->AddItem(5,"Darnassus",10);
Menu->AddItem(5,"Ironforge",11);
Menu->SendTo(Plr);
}break;
case 3: //Neutral Locations
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(5,"Ratchet",12);
Menu->AddItem(5,"Area 52",13);
Menu->AddItem(5,"Booty Bay",14);
Menu->AddItem(5,"Shattrath",15);
Menu->AddItem(5,"Cenarion Hold",16);
Menu->AddItem(5,"Gadgetzan",17);
Menu->SendTo(Plr);
}break;
case 4: //Orgrimmar
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, 1675.256226, -4320.852539, 61.781357);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 5: //Undercity
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 0, 1574.920654, 270.494476, -43.100655);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 6: //Thunder Bluff
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, -1284.066528, 133.174835, 131.198471);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 7: //Silvermoon
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 530, 9491.975586, -7267.707031, 14.321875);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 8: //The Exodar
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 530, -3947.677002, -11532.128906, -138.653412);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 9: //Stormwind
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 0, -8840.163086, 343.456055, 120.935112);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 10: //Darnassus
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, 9948.172852, 2613.264893, 1316.289307);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 11: //Ironforge
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 0, -4921.870605, -941.203491, 501.577545);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 12: //Ratchet
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, -1050.975708, -3665.528809, 23.885082);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 13: //Area 52
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 530, 3056.677734, 3664.183838, 142.853165);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 14: //Booty Bay
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 0, -14298.539063, 438.659821, 31.175819);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 15: //Shattrath
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 530, -1862.487427, 5431.336914, -9.704870);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 16: //Cenarion Hold
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, -6819.844238, 819.056763, 49.883137);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
case 17: //Gadgetzan
{
//Get the ammount of gold the players
uint32 currentgold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE);
//Check if the player is enought gold.
if(currentgold>050000)
{
//Calculate the new ammount of he should have (his current gold - the price).
int32 newgold = currentgold - 050000;
//Set the players gold to the new ammount.
Plr->SetUInt32Value(PLAYER_FIELD_COINAGE,newgold);
//Teleport the player.
Plr->EventTeleport( 1, -7160.678223, -3843.414063, 8.697383);
}else{
pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry, you dont have enought gold.");
}
Plr->Gossip_Complete();
}break;
}
}
};
void SetupWarpnpc(ScriptMgr * mgr)
{
GossipScript *warp = (Warpnpc*) new WarpNPC();
mgr->register_gossip_script(37000, warp);
}