Advertisement
randy336

[Trinity] Exchange NPC

Apr 7th, 2013
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.67 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3.  - Developer(s): Ghostcrawler336
  4.  - Complete: 100%
  5.  - ScriptName: 'Exchange NPC'
  6.  - Comment: Untested
  7. <--------------------------------------------------------------------------->
  8. */
  9.  
  10. #include "ScriptPCH.h"
  11.  
  12. class npc_exchanger : public CreatureScript
  13. {
  14. public:
  15.     npc_exchanger() : CreatureScript("npc_exchanger") { }
  16.  
  17.     bool OnGossipHello(Player *player, Creature *_creature)
  18.     {
  19.         if (player->isInCombat())
  20.         {
  21.             player->CLOSE_GOSSIP_MENU();
  22.             _creature->MonsterWhisper("You are in combat!", player->GetGUID());
  23.             return true;
  24.         }
  25.         else
  26.         {
  27.             player->ADD_GOSSIP_ITEM( 4, "Exchange Honor Points For Gold", GOSSIP_SENDER_MAIN, 3); // Honor Points Main Menu
  28.             player->ADD_GOSSIP_ITEM( 8, "Exchange Arena Points For Gold", GOSSIP_SENDER_MAIN, 4); // Arena Points Main Menu
  29.  
  30.         }
  31.  
  32.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());        
  33.         return true;
  34.     }
  35.  
  36.     bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 sender, uint32 uiAction)
  37.     {
  38.             if (sender == GOSSIP_SENDER_MAIN)
  39.        
  40.             pPlayer->PlayerTalkClass->ClearMenus();
  41.             switch(uiAction)
  42.            
  43.             {
  44.             case 3: // Exchange Honor Points Sub-Menu
  45.                 {
  46.                     pPlayer->ADD_GOSSIP_ITEM( 4, "2000 honor -> 4 gold", GOSSIP_SENDER_MAIN, 5);
  47.                     pPlayer->ADD_GOSSIP_ITEM( 4, "4000 Honor -> 8 gold", GOSSIP_SENDER_MAIN, 6);
  48.                     pPlayer->ADD_GOSSIP_ITEM( 4, "6000 Honor -> 12 Gold", GOSSIP_SENDER_MAIN, 7);
  49.                     pPlayer->ADD_GOSSIP_ITEM( 4, "8000 Honor -> 16 Gold", GOSSIP_SENDER_MAIN, 8);
  50.                     pPlayer->ADD_GOSSIP_ITEM( 4, "10000 Honor -> 20 Gold", GOSSIP_SENDER_MAIN, 9);
  51.                     pPlayer->ADD_GOSSIP_ITEM( 4, "20000 Honor -> 40 Gold", GOSSIP_SENDER_MAIN, 10);
  52.                 }
  53.             case 4: // Exchange Arena Points Sub-Menu
  54.                 {
  55.                     pPlayer->ADD_GOSSIP_ITEM( 4, "100 arena points -> 100 Gold ", GOSSIP_SENDER_MAIN, 11);
  56.                     pPlayer->ADD_GOSSIP_ITEM( 4, "200 Arena Points -> 200 Gold", GOSSIP_SENDER_MAIN, 12);
  57.                     pPlayer->ADD_GOSSIP_ITEM( 4, "300 Arena Points -> 300 Gold", GOSSIP_SENDER_MAIN, 13);
  58.                     pPlayer->ADD_GOSSIP_ITEM( 4, "400 Arena Points -> 400 Gold", GOSSIP_SENDER_MAIN, 14);
  59.                     pPlayer->ADD_GOSSIP_ITEM( 4, "500 Arena Points -> 500 Gold", GOSSIP_SENDER_MAIN, 15);
  60.                     pPlayer->ADD_GOSSIP_ITEM( 4, "600 Arena Points -> 600 Gold", GOSSIP_SENDER_MAIN, 16);
  61.                 }
  62.  
  63.             case 5: // 2000 honor points -> 4 gold
  64.                 if (pPlayer->GetHonorPoints() >= 2000)
  65.                 {
  66.                     pPlayer->CLOSE_GOSSIP_MENU();
  67.                     pPlayer->ModifyHonorPoints(-2000);
  68.                     pPlayer->ModifyMoney(4000);
  69.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  70.                 }
  71.                 else
  72.                 {
  73.                     pPlayer->CLOSE_GOSSIP_MENU();
  74.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  75.                     return false;
  76.                 }break;
  77.              case 6: //4000 honor points -> 8 gold
  78.                 if (pPlayer->GetHonorPoints() >= 4000)
  79.                 {
  80.                     pPlayer->CLOSE_GOSSIP_MENU();
  81.                     pPlayer->ModifyHonorPoints(-4000);
  82.                     pPlayer->ModifyMoney(+8000);
  83.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  84.                 }
  85.                 else
  86.                 {
  87.                     pPlayer->CLOSE_GOSSIP_MENU();
  88.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  89.                     return false;
  90.                 }break;
  91.              case 7: //6000 honor points -> 12 gold
  92.                 if (pPlayer->GetHonorPoints() >= 6000)
  93.                 {
  94.                     pPlayer->CLOSE_GOSSIP_MENU();
  95.                     pPlayer->ModifyHonorPoints(-6000);
  96.                     pPlayer->ModifyMoney(+12000);
  97.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  98.                 }
  99.                 else
  100.                 {
  101.                     pPlayer->CLOSE_GOSSIP_MENU();
  102.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  103.                     return false;
  104.                 }break;
  105.              case 8: //8000 honor points -> 16 gold
  106.                 if (pPlayer->GetHonorPoints() >= 8000)
  107.                 {
  108.                     pPlayer->CLOSE_GOSSIP_MENU();
  109.                     pPlayer->ModifyHonorPoints(-8000);
  110.                     pPlayer->ModifyMoney(+16000);
  111.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  112.                 }
  113.                 else
  114.                 {
  115.                     pPlayer->CLOSE_GOSSIP_MENU();
  116.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  117.                     return false;
  118.                 }break;
  119.              case 9: //10000 honor points -> 20 gold
  120.                 if (pPlayer->GetHonorPoints() >= 10000)
  121.                 {
  122.                     pPlayer->CLOSE_GOSSIP_MENU();
  123.                     pPlayer->ModifyHonorPoints(-10000);
  124.                     pPlayer->ModifyMoney(+20000);
  125.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  126.                 }
  127.                 else
  128.                 {
  129.                     pPlayer->CLOSE_GOSSIP_MENU();
  130.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  131.                     return false;
  132.                 }break;
  133.             case 10: //20000 honor points -> 40 gold
  134.                 if (pPlayer->GetHonorPoints() >= 20000)
  135.                 {
  136.                     pPlayer->CLOSE_GOSSIP_MENU();
  137.                     pPlayer->ModifyHonorPoints(-20000);
  138.                     pPlayer->ModifyMoney(+40000);
  139.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  140.                 }
  141.                 else
  142.                 {
  143.                     pPlayer->CLOSE_GOSSIP_MENU();
  144.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough honor points to make this exchange.", pPlayer->GetGUID());
  145.                     return false;
  146.                 }break;
  147.  
  148.             case 11: //100 arena points -> 100 Gold
  149.                 if (pPlayer->GetArenaPoints() >= 100)
  150.                 {
  151.                     pPlayer->CLOSE_GOSSIP_MENU();
  152.                     pPlayer->ModifyArenaPoints(-100);
  153.                     pPlayer->ModifyMoney(+100000);
  154.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  155.                 }
  156.                 else
  157.                 {
  158.                     pPlayer->CLOSE_GOSSIP_MENU();
  159.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  160.                     return false;
  161.                 }break;
  162.             case 12: //300 arena points -> 200 Gold
  163.                 if (pPlayer->GetArenaPoints() >= 200)
  164.                 {
  165.                     pPlayer->CLOSE_GOSSIP_MENU();
  166.                     pPlayer->ModifyArenaPoints(-200);
  167.                     pPlayer->ModifyMoney(+200000);
  168.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  169.                 }
  170.                 else
  171.                 {
  172.                     pPlayer->CLOSE_GOSSIP_MENU();
  173.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  174.                     return false;
  175.                 }break;
  176.             case 13: //300 arena points -> 300 Gold
  177.                 if (pPlayer->GetArenaPoints() >= 300)
  178.                 {
  179.                     pPlayer->CLOSE_GOSSIP_MENU();
  180.                     pPlayer->ModifyArenaPoints(-300);
  181.                     pPlayer->ModifyMoney(+300000);
  182.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  183.                 }
  184.                 else
  185.                 {
  186.                     pPlayer->CLOSE_GOSSIP_MENU();
  187.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  188.                     return false;
  189.                 }break;
  190.             case 14: //400 arena points -> 400 Gold
  191.                 if (pPlayer->GetArenaPoints() >= 400)
  192.                 {
  193.                     pPlayer->CLOSE_GOSSIP_MENU();
  194.                     pPlayer->ModifyArenaPoints(-400);
  195.                     pPlayer->ModifyMoney(+400000);
  196.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  197.                 }
  198.                 else
  199.                 {
  200.                     pPlayer->CLOSE_GOSSIP_MENU();
  201.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  202.                     return false;
  203.                 }break;
  204.             case 15: //500 arena points -> 500 Gold
  205.                 if (pPlayer->GetArenaPoints() >= 500)
  206.                 {
  207.                     pPlayer->CLOSE_GOSSIP_MENU();
  208.                     pPlayer->ModifyArenaPoints(-500);
  209.                     pPlayer->ModifyMoney(+500000);
  210.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  211.                 }
  212.                 else
  213.                 {
  214.                     pPlayer->CLOSE_GOSSIP_MENU();
  215.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  216.                     return false;
  217.                 }break;
  218.             case 16: //600 arena points -> 600 Gold
  219.                 if (pPlayer->GetArenaPoints() >= 600)
  220.                 {
  221.                     pPlayer->CLOSE_GOSSIP_MENU();
  222.                     pPlayer->ModifyArenaPoints(-600);
  223.                     pPlayer->ModifyMoney(+600000);
  224.                     pCreature->MonsterWhisper("You exchanged succesfully!", pPlayer->GetGUID());
  225.                 }
  226.                 else
  227.                 {
  228.                     pPlayer->CLOSE_GOSSIP_MENU();
  229.                     pCreature->MonsterWhisper("I'm sorry, but you don't have enough arena points to make this exchange.", pPlayer->GetGUID());
  230.                     return false;
  231.                 }break;
  232.                 }
  233.         return true;
  234.         }
  235. };
  236.  
  237. void AddSC_npc_exchanger()
  238. {
  239.     new npc_exchanger();
  240. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement