Created
February 24, 2014 19:46
-
-
Save Demonid/9195583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ScriptPCH.h" | |
enum NpcAtions { | |
NPC_RESET_NORMALS = 100, | |
NPC_RESET_HERO = 200 | |
}; | |
class npc_reset_instance : public CreatureScript | |
{ | |
public: | |
npc_reset_instance() : CreatureScript("npc_reset_instance"){} | |
bool OnGossipHello(Player* player, Creature* pCreature) | |
{ | |
//player->PlayerTalkClass->ClearMenus(); | |
//player->PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, 1, "Reiniciar Saves Dificultad Normal", 0, 0, "", 0); | |
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface\\icons\\Spell_Holy_DevineAegis:35|t|r Reiniciar Saves Dificultad Normal.", GOSSIP_SENDER_MAIN, NPC_RESET_NORMALS); | |
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); | |
return true; | |
} | |
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*Sender*/, uint32 Action) | |
{ | |
player->PlayerTalkClass->ClearMenus(); | |
if (Action == NPC_RESET_NORMALS) | |
{ | |
for (uint8 i = 0; i < 2 /* Difficulty */; i++) | |
{ | |
Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); | |
for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end(); ++itr) | |
player->UnbindInstance(itr, Difficulty(i)); | |
} | |
ChatHandler(player->GetSession()).PSendSysMessage("instances reset"); | |
player->PlayerTalkClass->SendCloseGossip(); | |
} | |
return true; | |
} | |
}; | |
void AddSC_npc_reset_instance() | |
{ | |
new npc_reset_instance(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment