Dinoza

npc_modify_price

Jan 15th, 2012
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.86 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. #define TEXT_HI "Привет"
  4. #define TEXT_NO "У тебя нету столько валюты"
  5. #define TEXT_COMBAT "Ты в режиме боя"
  6. #define TEXT_YES "Поменял"
  7. #define GOSSIP_TEXT_1 "Поменят 50к хонора на 1к апа"
  8. #define GOSSIP_TEXT_2 "Поменят 1к апа на 50к хонорa"
  9.  
  10. #define HONOR 50000  //сколько хонора меняем
  11. #define ARENA 1000 //сколько апа
  12.  
  13. class npc_modify_price : public CreatureScript
  14.  
  15. {
  16.     public:
  17.     npc_modify_price() : CreatureScript("npc_modify_price") { }
  18.  
  19.                 bool OnGossipHello(Player *player, Creature *creature)
  20.                         {
  21.                             creature->MonsterWhisper(TEXT_HI, player->GetGUID());
  22.                             player->PlayerTalkClass->ClearMenus();
  23.                             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_1, GOSSIP_SENDER_MAIN, 1);
  24.                             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_2, GOSSIP_SENDER_MAIN, 2);
  25.                             player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE,creature->GetGUID());
  26.                             return true;
  27.                         }
  28.  
  29.                 bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action )
  30.                         {
  31.                                if (!player->getAttackers().empty())
  32.                                {
  33.                                       player->CLOSE_GOSSIP_MENU();
  34.                                       creature->MonsterTextEmote(TEXT_COMBAT, 0, true);
  35.                                       return false;  
  36.                                      }
  37.                                
  38.  
  39.   switch(action)
  40.   {
  41.        case 1:
  42.         if (player->GetHonorPoints() < HONOR)
  43.                     {
  44.                           player->CLOSE_GOSSIP_MENU();
  45.                           creature->MonsterWhisper(TEXT_NO, player->GetGUID());
  46.                     }else{
  47.                           player->ModifyArenaPoints(+ ARENA);                  
  48.                           player->ModifyHonorPoints(- HONOR);
  49.                           player->CLOSE_GOSSIP_MENU();
  50.                           creature->MonsterTextEmote(TEXT_YES, 0, true);
  51.                           break;
  52.                          }
  53.        case 2:     
  54.         if (player->GetArenaPoints() < ARENA)
  55.                     {
  56.                           player->CLOSE_GOSSIP_MENU();
  57.                           creature->MonsterWhisper(TEXT_NO, player->GetGUID());
  58.                     }else{
  59.                           player->ModifyArenaPoints(- ARENA);
  60.                           player->ModifyHonorPoints(+ HONOR);
  61.                           player->CLOSE_GOSSIP_MENU();
  62.                           creature->MonsterTextEmote(TEXT_YES, 0, true);
  63.                           break;                                     
  64.                          }
  65.                    
  66.     }
  67.   return false;
  68.                         }
  69. };
  70.  
  71. void AddSC_npc_modify_price()
  72.  
  73. {
  74.  
  75.     new npc_modify_price;
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment