Advertisement
SkullCrack

[TRINITY] Doctor ( Hp,mana,cd,buffs ) C++

Jun 27th, 2011
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.82 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. class custom_npc_doctor : public CreatureScript
  4. {
  5. private:
  6.     void SendMainMenu(Player *player, Creature *_creature)
  7.     {
  8.         player->ADD_GOSSIP_ITEM(5, "Restore Health", GOSSIP_SENDER_MAIN, 101);
  9.         player->ADD_GOSSIP_ITEM(5, "Restore Mana", GOSSIP_SENDER_MAIN, 102);
  10.         player->ADD_GOSSIP_ITEM(5, "Remove Cooldown", GOSSIP_SENDER_MAIN, 103);
  11.  
  12.         switch(player->GetTeam())
  13.         {
  14.         case ALLIANCE:
  15.             player->ADD_GOSSIP_ITEM(5, "Remove Exhaustion", GOSSIP_SENDER_MAIN, 104);
  16.             break;
  17.         case HORDE:
  18.             player->ADD_GOSSIP_ITEM(5, "Remove Sated", GOSSIP_SENDER_MAIN, 105);
  19.             break;
  20.         default:
  21.             break;
  22.         }
  23.  
  24.         player->ADD_GOSSIP_ITEM(7, "Buffs", GOSSIP_SENDER_MAIN, 200);
  25.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());
  26.     }
  27.  
  28.     void SendSubMenu(Player *player, Creature *_creature)
  29.     {
  30.         player->ADD_GOSSIP_ITEM( 5, "Arcane Intellect",              GOSSIP_SENDER_MAIN, 201);
  31.         player->ADD_GOSSIP_ITEM( 5, "Mark of the Wild",              GOSSIP_SENDER_MAIN, 202);
  32.         player->ADD_GOSSIP_ITEM( 5, "Thorns",                        GOSSIP_SENDER_MAIN, 203);
  33.         player->ADD_GOSSIP_ITEM( 5, "Greater Blessing of Sanctuary", GOSSIP_SENDER_MAIN, 204);
  34.         player->ADD_GOSSIP_ITEM( 5, "Greater Blessing of Might",     GOSSIP_SENDER_MAIN, 205);
  35.         player->ADD_GOSSIP_ITEM( 5, "Greater Blessing of Kings",     GOSSIP_SENDER_MAIN, 206);
  36.         player->ADD_GOSSIP_ITEM( 5, "Greater Blessing of Wisdom",    GOSSIP_SENDER_MAIN, 207);
  37.         player->ADD_GOSSIP_ITEM( 5, "Divine Spirit",                 GOSSIP_SENDER_MAIN, 208);
  38.         player->ADD_GOSSIP_ITEM( 5, "Shadow Protection",             GOSSIP_SENDER_MAIN, 209);
  39.         player->ADD_GOSSIP_ITEM( 5, "Power Word: Fortitude",         GOSSIP_SENDER_MAIN, 210);
  40.         player->ADD_GOSSIP_ITEM(11, "<- Back to Main Page",          GOSSIP_SENDER_MAIN, 666);
  41.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, _creature->GetGUID());
  42.     }
  43.  
  44. public:
  45.     custom_npc_doctor() : CreatureScript("custom_npc_doctor") { }
  46.  
  47.     bool OnGossipHello(Player *player, Creature *_creature)
  48.     {
  49.         if(player->isInCombat())
  50.         {
  51.             player->CLOSE_GOSSIP_MENU();
  52.             _creature->MonsterWhisper("You are in combat. Come back later!", player->GetGUID());
  53.             return true;
  54.         }
  55.  
  56.         SendMainMenu(player, _creature);
  57.         return true;
  58.     }
  59.  
  60.     bool OnGossipSelect(Player *player, Creature *_creature, uint32 sender, uint32 action)
  61.     {
  62.         player->PlayerTalkClass->ClearMenus();
  63.  
  64.         if(player->isInCombat())
  65.         {
  66.             player->CLOSE_GOSSIP_MENU();
  67.             _creature->MonsterWhisper("You are in combat. Come back later!", player->GetGUID());
  68.             return true;
  69.         }
  70.  
  71.         if(sender != GOSSIP_SENDER_MAIN)
  72.             return true;
  73.  
  74.         switch(action)
  75.         {
  76.         /****************************************************************************************
  77.          *  MAINS                                                                               *
  78.          ****************************************************************************************/
  79.         case 101: //Restore Health
  80.             player->SetHealth(player->GetMaxHealth());
  81.             player->CastSpell(player, 61456, false);
  82.             _creature->MonsterWhisper("Your Health has been restored.", player->GetGUID());
  83.             break;
  84.         case 102: //Restore Mana
  85.             player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  86.             player->CastSpell(player, 61456, false);
  87.             _creature->MonsterWhisper("Your Mana has been restored.", player->GetGUID());
  88.             break;
  89.         case 103: //Remove Cooldown
  90.             player->RemoveAllSpellCooldown();
  91.             player->CastSpell(player, 75459, false);
  92.             _creature->MonsterWhisper("Your cooldowns have been removed.", player->GetGUID());
  93.             break;
  94.         case 104: //Remove Exhaustion
  95.             player->RemoveAurasDueToSpell(57723);
  96.             player->CastSpell(player, 61456, false);
  97.             _creature->MonsterWhisper("Exhaustion has been removed.", player->GetGUID());
  98.             break;
  99.         case 105: //Remove Sated
  100.             player->RemoveAurasDueToSpell(57724);
  101.             player->CastSpell(player, 61456, false);          
  102.             _creature->MonsterWhisper("Sated has been removed.", player->GetGUID());
  103.             break;
  104.  
  105.         /****************************************************************************************
  106.          *  BUFFS                                                                               *
  107.          ****************************************************************************************/
  108.         case 200:
  109.             //SendSubMenu(player, _creature);
  110.             break;
  111.         case 201: // Arcane Intellect
  112.             _creature->CastSpell(player, 42995, false);
  113.             break;
  114.         case 202: // Mark of the Wild
  115.             _creature->CastSpell(player, 48469, false);
  116.             break;
  117.         case 203: // Thorns
  118.             _creature->CastSpell(player, 53307, false);
  119.             break;
  120.         case 204: // Greater Blessing of Sanctuary
  121.             _creature->CastSpell(player, 25899, false);
  122.             break;
  123.         case 205: // Greater Blessing of Might
  124.             _creature->CastSpell(player, 48934, false);
  125.             break;
  126.         case 206: // Greater Blessing of Kings
  127.             _creature->CastSpell(player, 25898, false);
  128.             break;
  129.         case 207: // Greater Blessing of Wisdom
  130.             _creature->CastSpell(player, 48938, false);
  131.             break;
  132.         case 208: // Divine Spirit
  133.             _creature->CastSpell(player, 48073, false);
  134.             break;
  135.         case 209: // Power Word: Fortitude
  136.             _creature->CastSpell(player, 48169, false);
  137.             break;
  138.         case 210: // Shadow Protection
  139.             _creature->CastSpell(player, 48161, false);
  140.             break;
  141.  
  142.         /****************************************************************************************
  143.          *  MAIN MENU                                                                           *
  144.          ****************************************************************************************/
  145.         case 666:
  146.             SendMainMenu(player, _creature);
  147.             break;
  148.         default:
  149.             player->CLOSE_GOSSIP_MENU();
  150.             return true;
  151.         }
  152.  
  153.         if(action >= 100 && action < 200)
  154.             SendMainMenu(player, _creature);
  155.  
  156.         if(action >= 200 && action < 300)
  157.             SendSubMenu(player, _creature);
  158.  
  159.         return true;
  160.     }
  161. };
  162.  
  163. void AddSC_custom_npc_doctor()
  164. {
  165.     new custom_npc_doctor();
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement