Advertisement
julienanid

Tools NPC

Sep 16th, 2013
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.34 KB | None | 0 0
  1.     /*
  2.     <--------------------------------------------------------------------------->
  3.      - Developer(s): Mthsena
  4.      - Edited by: Synth
  5.      - Complete: %100
  6.      - ScriptName: 'Tools_NPC'
  7.      - Comment: Tested.
  8.      - Shared for: Emudevs !
  9.     <--------------------------------------------------------------------------->
  10.     */
  11.  
  12. #include "ScriptPCH.h"
  13.  
  14. class Tools_NPC : public CreatureScript
  15. {
  16. public:
  17.     Tools_NPC() : CreatureScript("Tools_NPC") { }
  18.  
  19.     bool OnGossipHello(Player *player, Creature *creature)
  20.     {
  21.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1);
  22.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2);
  23.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3);
  24.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4);
  25.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5);
  26.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6);
  27.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others", GOSSIP_SENDER_MAIN, 7);
  28.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Nevermind", GOSSIP_SENDER_MAIN, 8);
  29.         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  30.         return true;
  31.     }
  32.     bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action)
  33.     {
  34.         player->PlayerTalkClass->ClearMenus();
  35.         switch(action)
  36.         {
  37.         case 1: // Restore HP and MP
  38.             if(player->IsInCombat())
  39.             {
  40.                 creature->MonsterWhisper("You're in combat!", player->GetGUID(), false);
  41.                 player->CLOSE_GOSSIP_MENU();
  42.                 return false;
  43.             }
  44.             else if(player->getPowerType() == POWER_MANA)
  45.                 player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
  46.  
  47.             player->SetHealth(player->GetMaxHealth());
  48.             player->CLOSE_GOSSIP_MENU();
  49.             break;
  50.         case 2: // Reset Instances
  51.             for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
  52.             {
  53.                 Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
  54.                 for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
  55.                 {
  56.                     player->UnbindInstance(itr, Difficulty(i));
  57.                 }
  58.             }
  59.             player->CLOSE_GOSSIP_MENU();
  60.             break;
  61.         case 3: // Reset Cooldowns
  62.             if(player->IsInCombat())
  63.             {
  64.                 creature->MonsterWhisper("You're in combat!", player->GetGUID(), false);
  65.                 player->CLOSE_GOSSIP_MENU();
  66.                 return false;
  67.             }
  68.  
  69.             player->RemoveAllSpellCooldown();
  70.             player->CLOSE_GOSSIP_MENU();
  71.             break;
  72.         case 4: // Reset Combat
  73.             player->CombatStop();
  74.             player->CLOSE_GOSSIP_MENU();
  75.             break;
  76.         case 5: // Remove Sickness
  77.             if(player->HasAura(15007))
  78.                 player->RemoveAura(15007);
  79.  
  80.             player->CLOSE_GOSSIP_MENU();
  81.             break;
  82.         case 6: // Repair Items
  83.             player->DurabilityRepairAll(false, 0, false);
  84.             player->CLOSE_GOSSIP_MENU();
  85.             break;
  86.         case 7: // Others
  87.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Talents", GOSSIP_SENDER_MAIN, 71);
  88.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Spells", GOSSIP_SENDER_MAIN, 72);
  89.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "<-Back", GOSSIP_SENDER_MAIN, 73);
  90.             player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  91.             break;
  92.         case 8:
  93.             player->CLOSE_GOSSIP_MENU();
  94.             break;
  95.         case 71: // Reset Talents
  96.             player->resetTalents(true);
  97.             player->SendTalentsInfoData(false);
  98.             player->CLOSE_GOSSIP_MENU();
  99.             break;
  100.         case 72: // Reset Spells
  101.             player->resetSpells();
  102.             player->CLOSE_GOSSIP_MENU();
  103.             break;
  104.         case 73: // ...Back
  105.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1);
  106.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2);
  107.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3);
  108.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4);
  109.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5);
  110.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6);
  111.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others", GOSSIP_SENDER_MAIN, 7);
  112.             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Nevermind", GOSSIP_SENDER_MAIN, 8);
  113.             player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  114.             break;
  115.         }
  116.         return true;
  117.     }
  118. };
  119.  
  120. void AddSC_Tools_NPC()
  121. {
  122.     new Tools_NPC();
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement