Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- <--------------------------------------------------------------------------->
- - Developer(s): Mthsena
- - Edited by: Synth
- - Complete: %100
- - ScriptName: 'Tools_NPC'
- - Comment: Tested.
- - Shared for: Emudevs !
- <--------------------------------------------------------------------------->
- */
- #include "ScriptPCH.h"
- class Tools_NPC : public CreatureScript
- {
- public:
- Tools_NPC() : CreatureScript("Tools_NPC") { }
- bool OnGossipHello(Player *player, Creature *creature)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others", GOSSIP_SENDER_MAIN, 7);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Nevermind", GOSSIP_SENDER_MAIN, 8);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch(action)
- {
- case 1: // Restore HP and MP
- if(player->IsInCombat())
- {
- creature->Whisper("You're in combat!", LANG_UNIVERSAL, player->GetGUID(), false);
- player->CLOSE_GOSSIP_MENU();
- return false;
- }
- else if(player->getPowerType() == POWER_MANA)
- player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));
- player->SetHealth(player->GetMaxHealth());
- player->CLOSE_GOSSIP_MENU();
- break;
- case 2: // Reset Instances
- for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
- {
- Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
- for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
- {
- player->UnbindInstance(itr, Difficulty(i));
- }
- }
- player->CLOSE_GOSSIP_MENU();
- break;
- case 3: // Reset Cooldowns
- if(player->IsInCombat())
- {
- creature->Whisper("You're in combat!", LANG_UNIVERSAL, player->GetGUID(), false);
- player->CLOSE_GOSSIP_MENU();
- return false;
- }
- player->RemoveAllSpellCooldown();
- player->CLOSE_GOSSIP_MENU();
- break;
- case 4: // Reset Combat
- player->CombatStop();
- player->CLOSE_GOSSIP_MENU();
- break;
- case 5: // Remove Sickness
- if(player->HasAura(15007))
- player->RemoveAura(15007);
- player->CLOSE_GOSSIP_MENU();
- break;
- case 6: // Repair Items
- player->DurabilityRepairAll(false, 0, false);
- player->CLOSE_GOSSIP_MENU();
- break;
- case 7: // Others
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Talents", GOSSIP_SENDER_MAIN, 71);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Spells", GOSSIP_SENDER_MAIN, 72);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "<-Back", GOSSIP_SENDER_MAIN, 73);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- break;
- case 8:
- player->CLOSE_GOSSIP_MENU();
- break;
- case 71: // Reset Talents
- player->ResetTalents(true);
- player->SendTalentsInfoData(false);
- player->CLOSE_GOSSIP_MENU();
- break;
- case 72: // Reset Spells
- player->ResetSpells();
- player->CLOSE_GOSSIP_MENU();
- break;
- case 73: // ...Back
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others", GOSSIP_SENDER_MAIN, 7);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Nevermind", GOSSIP_SENDER_MAIN, 8);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- break;
- }
- return true;
- }
- };
- void AddSC_Tools_NPC()
- {
- new Tools_NPC();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement