Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- <--------------------------------------------------------------------------->
- - Developer(s): Ghostcrawler336
- - Complete: 100%
- - ScriptName: 'Exchange NPC'
- - Comment: Untested
- <--------------------------------------------------------------------------->
- */
- #include "ScriptPCH.h"
- class npc_exchanger : public CreatureScript
- {
- public:
- npc_exchanger() : CreatureScript("npc_exchanger") { }
- bool OnGossipHello(Player *player, Creature *_creature)
- {
- if (player->isInCombat())
- {
- player->CLOSE_GOSSIP_MENU();
- _creature->MonsterWhisper("You are in combat!", player->GetGUID());
- return true;
- }
- else
- {
- player->ADD_GOSSIP_ITEM( 4, "Exchange Honor Points For Gold", GOSSIP_SENDER_MAIN, 3); // Honor Points Main Menu
- player->ADD_GOSSIP_ITEM( 8, "Exchange Arena Points For Gold", GOSSIP_SENDER_MAIN, 4); // Arena Points Main Menu
- }
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 uiAction)
- {
- if (sender == GOSSIP_SENDER_MAIN)
- pPlayer->PlayerTalkClass->ClearMenus();
- switch(uiAction)
- {
- case 3: // Exchange Honor Points Sub-Menu
- {
- pPlayer->ADD_GOSSIP_ITEM( 4, "2000 honor -> 4 gold", GOSSIP_SENDER_MAIN, 5);
- pPlayer->ADD_GOSSIP_ITEM( 4, "4000 Honor -> 8 gold", GOSSIP_SENDER_MAIN, 6);
- pPlayer->ADD_GOSSIP_ITEM( 4, "6000 Honor -> 12 Gold", GOSSIP_SENDER_MAIN, 7);
- pPlayer->ADD_GOSSIP_ITEM( 4, "8000 Honor -> 16 Gold", GOSSIP_SENDER_MAIN, 8);
- pPlayer->ADD_GOSSIP_ITEM( 4, "10000 Honor -> 20 Gold", GOSSIP_SENDER_MAIN, 9);
- pPlayer->ADD_GOSSIP_ITEM( 4, "20000 Honor -> 40 Gold", GOSSIP_SENDER_MAIN, 10);
- }
- case 4: // Exchange Arena Points Sub-Menu
- {
- pPlayer->ADD_GOSSIP_ITEM( 4, "100 arena points -> 100 Gold ", GOSSIP_SENDER_MAIN, 11);
- pPlayer->ADD_GOSSIP_ITEM( 4, "200 Arena Points -> 200 Gold", GOSSIP_SENDER_MAIN, 12);
- pPlayer->ADD_GOSSIP_ITEM( 4, "300 Arena Points -> 300 Gold", GOSSIP_SENDER_MAIN, 13);
- pPlayer->ADD_GOSSIP_ITEM( 4, "400 Arena Points -> 400 Gold", GOSSIP_SENDER_MAIN, 14);
- pPlayer->ADD_GOSSIP_ITEM( 4, "500 Arena Points -> 500 Gold", GOSSIP_SENDER_MAIN, 15);
- pPlayer->ADD_GOSSIP_ITEM( 4, "600 Arena Points -> 600 Gold", GOSSIP_SENDER_MAIN, 16);
- }
- case 5: // 2000 honor points -> 4 gold
- if (pPlayer->GetHonorPoints() >= 2000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-2000);
- pPlayer->ModifyMoney(4000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 6: //4000 honor points -> 8 gold
- if (pPlayer->GetHonorPoints() >= 4000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-4000);
- pPlayer->ModifyMoney(+8000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 7: //6000 honor points -> 12 gold
- if (pPlayer->GetHonorPoints() >= 6000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-6000);
- pPlayer->ModifyMoney(+12000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 8: //8000 honor points -> 16 gold
- if (pPlayer->GetHonorPoints() >= 8000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-8000);
- pPlayer->ModifyMoney(+16000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 9: //10000 honor points -> 20 gold
- if (pPlayer->GetHonorPoints() >= 10000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-10000);
- pPlayer->ModifyMoney(+20000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 10: //20000 honor points -> 40 gold
- if (pPlayer->GetHonorPoints() >= 20000)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyHonorPoints(-20000);
- pPlayer->ModifyMoney(+40000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 11: //100 arena points -> 100 Gold
- if (pPlayer->GetArenaPoints() >= 100)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-100);
- pPlayer->ModifyMoney(+100000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 12: //300 arena points -> 200 Gold
- if (pPlayer->GetArenaPoints() >= 200)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-200);
- pPlayer->ModifyMoney(+200000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 13: //300 arena points -> 300 Gold
- if (pPlayer->GetArenaPoints() >= 300)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-300);
- pPlayer->ModifyMoney(+300000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 14: //400 arena points -> 400 Gold
- if (pPlayer->GetArenaPoints() >= 400)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-400);
- pPlayer->ModifyMoney(+400000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 15: //500 arena points -> 500 Gold
- if (pPlayer->GetArenaPoints() >= 500)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-500);
- pPlayer->ModifyMoney(+500000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- case 16: //600 arena points -> 600 Gold
- if (pPlayer->GetArenaPoints() >= 600)
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pPlayer->ModifyArenaPoints(-600);
- pPlayer->ModifyMoney(+600000);
- pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
- }
- else
- {
- pPlayer->CLOSE_GOSSIP_MENU();
- pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
- return false;
- }break;
- }
- return true;
- }
- };
- void AddSC_npc_exchanger()
- {
- new npc_exchanger();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement