Advertisement
Guest User

C++ Doctor Made by Wolf Officious

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