diff --git a/BloodMoneyDuel.cpp b/BloodMoneyDuel.cpp new file mode 100644 index 0000000..51b890b --- /dev/null +++ b/BloodMoneyDuel.cpp @@ -0,0 +1,435 @@ +// Blood Money Duels +// Original code by Parranoia from AC-web +// Updated by Faiver from Emudevs +// Edited by Rochet2 +// Original thread: http://www.ac-web.org/forums/showthread.php?156980-C-Blood-Money-Duels + +// Set USE_TOKEN to 1 if you want to have it use tokens in place of gold +#define USE_TOKEN 0 +#define TOKEN_ID 200000 + +#include "ScriptPCH.h" + +class BloodMoney +{ +public: + // Read write lock and guards + typedef boost::shared_mutex LockType; + typedef boost::shared_lock ReadGuard; // Lock for read access: ReadGuard guard(_lock); + typedef boost::unique_lock WriteGuard; // Lock for write access: WriteGuard guard(_lock); + typedef boost::upgrade_lock RWRead; // Lock for read access before writing: RWRead read(_lock); + typedef boost::upgrade_to_unique_lock RWWrite; // Lock for write access before writing: RWWrite write(read); + + // Data definitions + struct MoneyInfo + { + MoneyInfo() : challenger(0), amount(0), accepted(false) { } + uint32 challenger; + uint32 amount; + bool accepted; + }; + typedef std::list MoneyList; + typedef std::unordered_map MoneyListMap; + + // Returns a copy or empty list + MoneyList GetMoneyList(uint32 targetGUID) + { + ReadGuard guard(_lock); + MoneyListMap::const_iterator it = _listMap.find(targetGUID); + if (it != _listMap.end()) + return it->second; + return MoneyList(); + } + + // Finds a challenge and removes it, then returns the challenge amount. Otherwise returns 0 and does nothing + uint32 GetAndRemoveChallenge(uint32 targetGUID, uint32 challengerGUID) + { + RWRead read(_lock); + MoneyListMap::iterator it = _listMap.find(targetGUID); + if (it == _listMap.end()) + return 0; + + MoneyList& list = it->second; + for (MoneyList::iterator itr = list.begin(); itr != list.end(); ++itr) + { + if (itr->challenger != challengerGUID) + continue; + if (!itr->accepted) + return 0; + + uint32 amount = itr->amount; + + RWWrite write(read); + list.erase(itr); + if (list.empty()) + _listMap.erase(targetGUID); + + return amount; + } + return 0; + } + + bool IsChallenged(uint32 targetGUID) + { + ReadGuard guard(_lock); + return _listMap.find(targetGUID) != _listMap.end(); + } + + bool HasChallenger(uint32 targetGUID, uint32 challengerGUID) + { + ReadGuard guard(_lock); + MoneyListMap::const_iterator it = _listMap.find(targetGUID); + if (it == _listMap.end()) + return false; + + const MoneyList& list = it->second; + for (MoneyList::const_iterator itr = list.begin(); itr != list.end(); ++itr) + if (itr->challenger == challengerGUID) + return true; + + return false; + } + + bool AddChallenger(uint32 targetGUID, uint32 challengerGUID, uint32 amount) + { + MoneyInfo moneyInfo; + moneyInfo.challenger = challengerGUID; + moneyInfo.amount = amount; + moneyInfo.accepted = false; + + RWRead read(_lock); + + if (HasChallenger(targetGUID, challengerGUID)) + return false; + + if (HasChallenger(challengerGUID, targetGUID)) + return false; + + RWWrite write(read); + _listMap[targetGUID].push_back(moneyInfo); + return true; + } + + bool RemoveChallenger(uint32 targetGUID, uint32 challengerGUID) + { + RWRead read(_lock); + MoneyListMap::iterator it = _listMap.find(targetGUID); + if (it == _listMap.end()) + return false; + + MoneyList &list = it->second; + for (MoneyList::iterator it = list.begin(); it != list.end(); ++it) + { + if (it->challenger != challengerGUID) + continue; + + RWWrite write(read); + list.erase(it); + if (list.empty()) + _listMap.erase(targetGUID); + return true; + } + return false; + } + + bool AcceptChallenge(uint32 targetGUID, uint32 challengerGUID) + { + RWRead read(_lock); + MoneyListMap::iterator it = _listMap.find(targetGUID); + if (it == _listMap.end()) + return false; + + MoneyList &list = it->second; + for (MoneyList::iterator itr = list.begin(); itr != list.end(); ++itr) + { + if (itr->challenger != challengerGUID) + continue; + + // Already accepted, internal error + if (itr->accepted) + return false; + + RWWrite write(read); + itr->accepted = true; + return true; + } + return false; + } + + // Used to lock for using GetMap access + LockType& GetLock() + { + return _lock; + } + + // Access map directly, remember to use lock to guard the read and write + MoneyListMap& GetMap() + { + return _listMap; + } + +private: + MoneyListMap _listMap; + LockType _lock; +}; + +static BloodMoney bloodMoney; + +class npc_blood_money : public CreatureScript +{ +public: + npc_blood_money() : CreatureScript("npc_blood_money") { } + + enum Sender + { + SENDER_CLOSE, + SENDER_CHALLENGE, + SENDER_ACCEPT, + SENDER_DECLINE, + }; + + bool OnGossipHello(Player* player, Creature* creature) override + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Desafía a un Jugador", SENDER_CHALLENGE, 0); + if (bloodMoney.IsChallenged(player->GetGUIDLow())) + { + BloodMoney::MoneyList list = bloodMoney.GetMoneyList(player->GetGUIDLow()); + for (BloodMoney::MoneyList::const_iterator it = list.begin(); it != list.end(); ++it) + { + // Skip accepted entries + if (it->accepted) + continue; + + if (Player* plr = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, it->challenger))) + { +#if(USE_TOKEN == 1) + char msg[100]; + sprintf(msg, "Accept %s's Challenge of %u tokens", plr->GetName().c_str(), it->amount); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, SENDER_ACCEPT, it->challenger); + sprintf(msg, "Decline %s's Challenge of %u tokens", plr->GetName().c_str(), it->amount); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, SENDER_DECLINE, it->challenger); +#else + char msg[100]; + sprintf(msg, "Accept %s's Challenge of %ug", plr->GetName().c_str(), it->amount); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, SENDER_ACCEPT, it->challenger); + sprintf(msg, "Decline %s's Challenge of %ug", plr->GetName().c_str(), it->amount); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, msg, SENDER_DECLINE, it->challenger); +#endif + } + } + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Salir", SENDER_CLOSE, 0); + 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 (sender) + { + case SENDER_ACCEPT: + if (bloodMoney.AcceptChallenge(player->GetGUIDLow(), action)) + { + player->GetSession()->SendNotification("Has aceptado el desafio"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + } + else + { + player->GetSession()->SendNotification("Error interno, inténtelo de nuevo"); + } + break; + case SENDER_DECLINE: + if (bloodMoney.RemoveChallenger(player->GetGUIDLow(), action)) + { + player->GetSession()->SendNotification("Has rechazado el desafio"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + } + break; + case SENDER_CHALLENGE: +#if(USE_TOKEN == 1) + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "5 Distintivos Supremos", GOSSIP_SENDER_MAIN, 5, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "10 Distintivos Supremos", GOSSIP_SENDER_MAIN, 10, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "15 Distintivos Supremos", GOSSIP_SENDER_MAIN, 15, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "25 Distintivos Supremos", GOSSIP_SENDER_MAIN, 25, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "50 Distintivos Supremos", GOSSIP_SENDER_MAIN, 50, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "100 Distintivos Supremoss", GOSSIP_SENDER_MAIN, 100, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "150 Distintivos Supremoss", GOSSIP_SENDER_MAIN, 150, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "200 Distintivos Supremos", GOSSIP_SENDER_MAIN, 200, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "250 Distintivos Supremos", GOSSIP_SENDER_MAIN, 250, "", 0, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "500 Distintivos Supremos", GOSSIP_SENDER_MAIN, 500, "", 0, true); +#else + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 5 Monedas de Oro", GOSSIP_SENDER_MAIN, 5, "", 5 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 10 Monedas de Oro", GOSSIP_SENDER_MAIN, 10, "", 10 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 15 Monedas de Oro", GOSSIP_SENDER_MAIN, 15, "", 15 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 25 Monedas de Orog", GOSSIP_SENDER_MAIN, 25, "", 25 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 50 Monedas de Oro", GOSSIP_SENDER_MAIN, 50, "", 50 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 100 Monedas de Oro", GOSSIP_SENDER_MAIN, 100, "", 100 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 200 Monedas de Oro", GOSSIP_SENDER_MAIN, 200, "", 200 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 500 Monedas de Orog", GOSSIP_SENDER_MAIN, 500, "", 500 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 1000 Monedas de Oro", GOSSIP_SENDER_MAIN, 1000, "", 1000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 2000 Monedas de Oro", GOSSIP_SENDER_MAIN, 2000, "", 2000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 5000 Monedas de Oro", GOSSIP_SENDER_MAIN, 5000, "", 5000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 10000 Monedas de Oro", GOSSIP_SENDER_MAIN, 10000, "", 10000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 20000 Monedas de Oro", GOSSIP_SENDER_MAIN, 20000, "", 20000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 50000 Monedas de Oro", GOSSIP_SENDER_MAIN, 50000, "", 50000 * GOLD, true); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Apostar 100000 Monedas de Oro", GOSSIP_SENDER_MAIN, 100000, "", 100000 * GOLD, true); +#endif + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + return true; + + default: + player->CLOSE_GOSSIP_MENU(); + return true; + } + + OnGossipHello(player, creature); + return true; + } + + bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) + { + player->PlayerTalkClass->ClearMenus(); + + std::string targetName(code); + if (player->GetName() == targetName) + { + player->GetSession()->SendNotification("No tienes lo nesesario para aceptar el Desafio"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + Player* target = sObjectAccessor->FindPlayerByName(targetName); + if (!target) + { + player->GetSession()->SendNotification("El jugador seleccionado no se encuentra conectado en estos momentos"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + if (player->GetGUID() == target->GetGUID()) + { + player->GetSession()->SendNotification("No tienes lo nesesario para aceptar el Desafio"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + if (target->GetZoneId() != player->GetZoneId()) + { + player->GetSession()->SendNotification("%s Ese jugador no esta en la Zona", target->GetName().c_str()); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + +#if (USE_TOKEN == 1) + if (!player->HasItemCount(TOKEN_ID, action)) + { + player->GetSession()->SendNotification("No tiene suficientes Distintivos Supremos para Solicitar la Apuesta"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + if (!target->HasItemCount(TOKEN_ID, action)) + { + player->GetSession()->SendNotification("%s No tienes suficientes Distintivos Supremos para Solicitar la Apuesta", target->GetName().c_str()); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } +#else + if (target->GetMoney() < action * GOLD) + { + player->GetSession()->SendNotification("%s No tiene suficiente dinero", target->GetName().c_str()); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + if (player->GetMoney() < action * GOLD) + { + player->GetSession()->SendNotification("No tiene suficiente dinero"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } +#endif + + if (!bloodMoney.AddChallenger(target->GetGUIDLow(), player->GetGUIDLow(), action)) + { + player->GetSession()->SendNotification("No puedes retar a un jugador con el que ya solicitaste el Duelo Apostador"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } + + player->GetSession()->SendNotification("Apuesta Solicitada"); + OnGossipSelect(player, creature, SENDER_CHALLENGE, GOSSIP_ACTION_INFO_DEF); + return true; + } +}; + +class BloodMoneyReward : public PlayerScript +{ +public: + BloodMoneyReward() : PlayerScript("BloodMoneyReward") { } + + void OnDuelEnd(Player* winner, Player* loser, DuelCompleteType type) + { + if (type != DUEL_WON) + return; + + // Loser challenged winner + uint32 amount = bloodMoney.GetAndRemoveChallenge(winner->GetGUIDLow(), loser->GetGUIDLow()); + + // Winner challenged loser + if (!amount) + amount = bloodMoney.GetAndRemoveChallenge(loser->GetGUIDLow(), winner->GetGUIDLow()); + + // No challenges + if (!amount) + return; + +#if (USE_TOKEN == 1) + if (!winner->HasItemCount(TOKEN_ID, amount)) + { + winner->AddAura(15007, winner); // Apply Rez sickness for possible cheating + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFUsted ha ganadola Enfermedad de Dolencia de Resurreccion por tratar de abusar del sistema."); + ChatHandler(loser->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFTu oponente trató de hacer trampa. No te preocupes que no te pierdes ningún Distintivo por esta apuesta."); + } + else if (!loser->HasItemCount(TOKEN_ID, amount)) + { + loser->AddAura(15007, loser); // Apply Rez sickness for possible cheating + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFUsted ha ganadola Enfermedad de Dolencia de Resurreccion por tratar de abusar del sistema."); + ChatHandler(loser->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFTu oponente trató de hacer trampa. No te preocupes que no te pierdes ningún Distintivo por esta apuesta."); + } + else + { + winner->AddItem(TOKEN_ID, amount); + loser->DestroyItemCount(TOKEN_ID, amount, true); + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFFelicitaciones por ganar aqui le entrego %u Distintivos Supremos!", amount); + } +#else + int32 money = amount * GOLD; + if (winner->GetMoney() < money) + { + winner->AddAura(15007, winner); // Apply Rez sickness for possible cheating + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFUsted ha ganadola Enfermedad de Dolencia de Resurreccion por tratar de abusar del sistema."); + ChatHandler(loser->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFTu oponente trató de hacer trampa. No te preocupes que no te pierdes ningúna moneda de oro por esta apuesta."); + } + else if (loser->GetMoney() < money) + { + loser->AddAura(15007, loser); // Apply Rez sickness for possible cheating + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFTu oponente trató de hacer trampa. El no tenía suficiente dinero para pagar la apuesta."); + ChatHandler(loser->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFUsted ha ganado la enfermadad Dolencia Resurrección tratando de abusar del sistema."); + } + else + { + winner->ModifyMoney(money); + loser->ModifyMoney(-money); + ChatHandler(winner->GetSession()).PSendSysMessage("|cff800C0C[Duelo Apostador] |cffFFFFFFFelicitaciones por ganar %u Monedas de Oro!", amount); + } +#endif + } +}; + +void AddSC_npc_blood_money() +{ + new BloodMoneyReward(); + new npc_blood_money(); +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..e516c8a --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# TrinityCore-335a +TrinityCore Release 335a + +FixCore es una empresa de desarrollo con especialidad en el juego world of warcraft. @FixStore - @FixDevs - @FixCMS son propiedad de @FixCore. + +El 80% de los trabajos que realiza @FixCore y sus demás subempresas son de manera gratuita sin embargo el 20% de los demás trabajos suelen ser de cobro debido a que se pudo haber requerido de algún pago extra para algún template, linea etc.. No acepte cosas de cobro que estén a nombre de @FixCore sin que usted esté seguro de que sea de manera legal ** En caso de tener dudas, inquietudes o desea contactarnos puede enviarnos un E-Mail ** fixcore2@gmail.com + +--- + +FixCore is a development company specializing in the game world of warcraft. @FixStore - @FixDevs - @FixCMS Are owned by @FixCore. + +80% of the work done @FixCore and other sub-companies are free however 20% of other jobs usually collection because it could have required some extra payment for a template, line etc .. Do not accept things that are a collection @FixCore name without you sure it legally ** If you have questions, concerns or want to contact you can send an E-Mail ** fixcore2@gmail.com diff --git a/Trainer.cpp b/Trainer.cpp new file mode 100644 index 0000000..d27ec99 --- /dev/null +++ b/Trainer.cpp @@ -0,0 +1,48 @@ +#include "ScriptPCH.h" + +class npc_morphs_fix : public CreatureScript +{ +public: + npc_morphs_fix() : CreatureScript("npc_morphs_fix") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(8, "Morphs Part 1", GOSSIP_SENDER_MAIN, 4); + pPlayer->ADD_GOSSIP_ITEM(8, "Morphs Part 2", GOSSIP_SENDER_MAIN, 5); + pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!pPlayer) + return true; + + switch (uiAction) + { + { + case 4: + pPlayer->CastSpell(pPlayer, 190000, true, NULL, NULL, pPlayer->GetGUID()); + break; + + case 5: + pPlayer->CastSpell(pPlayer, 190001, true, NULL, NULL, pPlayer->GetGUID()); + break; + + + + + } + } + return true; + } + +}; + +void AddSC_npc_morphs_fix() +{ + new npc_morphs_fix(); +} \ No newline at end of file diff --git a/VisualWeapon.cpp b/VisualWeapon.cpp new file mode 100644 index 0000000..2ed6e75 --- /dev/null +++ b/VisualWeapon.cpp @@ -0,0 +1,162 @@ +#include "ScriptPCH.h" + +using namespace std; + +#define DEFAULT_MESSAGE 907 + +struct VisualData +{ + uint32 Menu; + uint32 Submenu; + uint32 Icon; + uint32 Id; + string Name; +}; + +VisualData vData[] = +{ + { 1, 0, GOSSIP_ICON_BATTLE, 3789, "Rabiar" }, + { 1, 0, GOSSIP_ICON_BATTLE, 3854, "Poder con hechizos" }, + { 1, 0, GOSSIP_ICON_BATTLE, 3273, "Verdugo Deathfrost" }, + { 1, 0, GOSSIP_ICON_BATTLE, 3225, "verdugo" }, + { 1, 0, GOSSIP_ICON_BATTLE, 3870, "El drenaje de la sangre"}, + { 1, 0, GOSSIP_ICON_BATTLE, 1899, "Arma profano"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2674, "Erupción de hechizo"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2675, "Batalla"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2671, "Arcane y fuego el poder con hechizos"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2672, "La sombra y el poder con hechizos de Escarcha"}, + { 1, 0, GOSSIP_ICON_BATTLE, 3365, "Runa de Swordshattering"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2673, "Mangosta"}, + { 1, 0, GOSSIP_ICON_BATTLE, 2343, "el poder con hechizos"}, + { 1, 2, GOSSIP_ICON_TALK, 0, "Siguiente.." }, + + { 2, 0, GOSSIP_ICON_BATTLE, 425, "Negro Templo Maniquí"}, + { 2, 0, GOSSIP_ICON_BATTLE, 3855, "Spell Power III"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1894, "Icy Weapon"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1103, "agilidad"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1898, "Lifestealing"}, + { 2, 0, GOSSIP_ICON_BATTLE, 3345, "Vida terrestre I"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1743, "MHTest02"}, + { 2, 0, GOSSIP_ICON_BATTLE, 3093, "poder de ataque contra muertos vivientes y demonios"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1900, "Crusader"}, + { 2, 0, GOSSIP_ICON_BATTLE, 3846, "Spell Power II"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1606, "Poder de Ataque"}, + { 2, 0, GOSSIP_ICON_BATTLE, 283, "Windfury I"}, + { 2, 0, GOSSIP_ICON_BATTLE, 1, "Muerdepiedras III"}, + { 2, 3, GOSSIP_ICON_TALK, 0, "Siguiente .."}, + { 2, 1, GOSSIP_ICON_TALK, 0, "..Atras"}, + + { 3, 0, GOSSIP_ICON_BATTLE, 3265, "Bienaventurados Arma Coating"}, + { 3, 0, GOSSIP_ICON_BATTLE, 2, "Estigma de Escarcha I"}, + { 3, 0, GOSSIP_ICON_BATTLE, 3, "Lengua de Fuego III"}, + { 3, 0, GOSSIP_ICON_BATTLE, 3266, "Justos Arma Coating"}, + { 3, 0, GOSSIP_ICON_BATTLE, 1903, "Espíritu"}, + { 3, 0, GOSSIP_ICON_BATTLE, 13, "afilado"}, + { 3, 0, GOSSIP_ICON_BATTLE, 26, "Frost Petróleo"}, + { 3, 0, GOSSIP_ICON_BATTLE, 7, "Veneno mortal"}, + { 3, 0, GOSSIP_ICON_BATTLE, 803, "Fiery Weapon"}, + { 3, 0, GOSSIP_ICON_BATTLE, 1896, "El daño Weapon"}, + { 3, 0, GOSSIP_ICON_BATTLE, 2666, "Intelecto"}, + { 3, 0, GOSSIP_ICON_BATTLE, 25, "La sombra del aceite"}, + { 3, 2, GOSSIP_ICON_TALK, 0, "..Atras"}, +}; + +class NPC_VisualWeapon : public CreatureScript +{ +public: + NPC_VisualWeapon() : CreatureScript("NPC_VisualWeapon") { } + + bool MainHand; + + void SetVisual(Player* player, uint32 visual) + { + uint8 slot = MainHand ? EQUIPMENT_SLOT_MAINHAND : EQUIPMENT_SLOT_OFFHAND; + + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); + + if (!item) + { + ChatHandler(player->GetSession()).PSendSysMessage("No hay armaduras disponibles para cambiar el Visual."); + return; + } + + const ItemTemplate* itemTemplate = item->GetTemplate(); + + if (itemTemplate->SubClass == ITEM_SUBCLASS_ARMOR_SHIELD || + itemTemplate->SubClass == ITEM_SUBCLASS_ARMOR_BUCKLER || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_SPEAR || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_BOW || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_GUN || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_obsolete || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_EXOTIC || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_EXOTIC2 || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_MISC || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_THROWN || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_CROSSBOW || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_WAND || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE || + itemTemplate->SubClass == ITEM_SUBCLASS_WEAPON_obsolete) + return; + + player->SetUInt16Value(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + (item->GetSlot() * 2), 0, visual); + } + + void GetMenu(Player* player, Creature* creature, uint32 menuId) + { + for (uint8 i = 0; i < (sizeof(vData) / sizeof(*vData)); i++) + { + if (vData[i].Menu == menuId) + player->ADD_GOSSIP_ITEM(vData[i].Icon, vData[i].Name, GOSSIP_SENDER_MAIN, i); + } + + player->SEND_GOSSIP_MENU(DEFAULT_MESSAGE, creature->GetGUID()); + } + + bool OnGossipHello(Player* player, Creature* creature) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/inv_misc_tournaments_symbol_draenei:30|t Una Mano", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/inv_misc_tournaments_symbol_draenei:30|t Mano Izquierda", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface/ICONS/INV_Misc_Coin_05:30|t Salir", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + player->SEND_GOSSIP_MENU(DEFAULT_MESSAGE, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); + + switch (action) + { + case GOSSIP_ACTION_INFO_DEF + 1: + MainHand = true; + GetMenu(player, creature, 1); + return false; + + case GOSSIP_ACTION_INFO_DEF + 2: + MainHand = false; + GetMenu(player, creature, 1); + return false; + + case GOSSIP_ACTION_INFO_DEF + 3: + player->CLOSE_GOSSIP_MENU(); + return false; + } + + uint32 menuData = vData[action].Submenu; + + if (menuData == 0) + { + SetVisual(player, vData[action].Id); + menuData = vData[action].Menu; + } + + GetMenu(player, creature, menuData); + return true; + } +}; + +void AddSC_NPC_VisualWeapon() +{ + new NPC_VisualWeapon; +} diff --git a/characternuevoannounce.cpp b/characternuevoannounce.cpp new file mode 100644 index 0000000..fcfaaf8 --- /dev/null +++ b/characternuevoannounce.cpp @@ -0,0 +1,32 @@ +//CastleDEV +#include "ScriptPCH.h" + +class announce_login : public PlayerScript +{ +public: + announce_login() : PlayerScript("announce_login") {} + + void OnLogin(Player* player, bool /*loginFirst*/) + { + std::string msg; + + if(player->GetTotalPlayedTime() < 5) + { + msg += "|cff54b5ffWelcome to our new character called|r "; + msg += player->GetName(); + msg += "|cff54b5ff!|r"; + sWorld->SendServerMessage(SERVER_MSG_STRING, msg.c_str(), 0); + player->CastSpell(player, 55420); + return; + } + else + { + } + } + +}; + +void AddSC_announce_login() +{ + new announce_login; +} \ No newline at end of file diff --git a/chat_censure.cpp b/chat_censure.cpp new file mode 100644 index 0000000..d6e4856 --- /dev/null +++ b/chat_censure.cpp @@ -0,0 +1,103 @@ +#include "ScriptPCH.h" +#include "Channel.h" +#include "Language.h" +#include + +class System_Censure : public PlayerScript +{ +public: + System_Censure() : PlayerScript("System_Censure") {} + + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg) + { + CheckMessage(player, msg, lang, NULL, NULL, NULL, NULL); + } + + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) + { + CheckMessage(player, msg, lang, receiver, NULL, NULL, NULL); + } + + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Group* group) + { + CheckMessage(player, msg, lang, NULL, group, NULL, NULL); + } + + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Guild* guild) + { + CheckMessage(player, msg, lang, NULL, NULL, guild, NULL); + } + + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Channel* channel) + { + CheckMessage(player, msg, lang, NULL, NULL, NULL, channel); + } + +void CheckMessage(Player* player, std::string& msg, uint32 lang, Player* /*receiver*/, Group* /*group*/, Guild* /*guild*/, Channel* channel) +{ + if (player->IsGameMaster() || lang == LANG_ADDON) + return; + + //transform to lowercase (for simpler checking) + std::string lower = msg; + std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); + + const uint8 cheksSize = 18; + std::string checks[cheksSize]; + checks[0] ="http://"; + checks[1] =".com"; + checks[2] =".net"; + checks[3] =".org"; + checks[4] =".ru"; + checks[5] ="rondor"; + checks[6] ="www."; + checks[7] ="xxx"; + checks[8] = "verga"; + checks[9] = "server"; + checks[10] = "servidor"; + checks[11] = ".la"; + checks[12] = "chupamela"; + checks[13] = "mamamela"; + checks[14] = "server"; + checks[15] = ".info"; + checks[16] = ".tk"; + checks[17] = ".ml"; + checks[18] = "puto"; + checks[19] = "marico"; + checks[20] = "noob"; + checks[21] = "pendejo"; + checks[22] = "deathforce"; + checks[23] = "death"; + checks[24] = "force"; + checks[25] = "dencel"; + checks[26] = "servegame"; + checks[27] = ".biz"; + checks[28] = ".no-ip"; + + for (int i = 0; i < cheksSize; ++i) + if (lower.find(checks[i]) != std::string::npos) + { + msg = "No se tolera el Spam!"; + msg = lang == LANG_GM_SILENCE; + ChatHandler(player->GetSession()).PSendSysMessage("|TInterface/ICONS/achievement_leader_sylvanas:20|tNo se tolera el Spam!"); + std::string plr = player->GetName(); + std::string gender = player->getGender() == GENDER_FEMALE ? "esta" : "esta"; + bool ingroup = player->GetGroup(); + std::string tag_colour = "7bbef7"; + std::string plr_colour = "ff0000"; + std::string boss_colour = "18be00"; + std::ostringstream stream; + stream << "|CFF" << tag_colour << + "[Anuncio de Spam]|r:|cff" << plr_colour << " " << plr << + (ingroup ? " el " : " ") << gender << (ingroup ? " Spameando " : " Spameando ") << "!"; + sWorld->SendGMText(LANG_GM_BROADCAST, stream.str().c_str()); + return; + } + + } + }; + +void AddSC_System_Censure() +{ + new System_Censure(); +} diff --git a/clear_combat_bug.cpp b/clear_combat_bug.cpp new file mode 100644 index 0000000..5177cf2 --- /dev/null +++ b/clear_combat_bug.cpp @@ -0,0 +1,43 @@ +#include "ScriptPCH.h" + + class clear_combat : public CreatureScript + { + public: + clear_combat() : CreatureScript("clear_combat") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { +pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/inv_fabric_spellfire:30|t Limpiar mi combate", GOSSIP_SENDER_MAIN, 0); +pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID()); +return true; + } + + bool OnGossipSelect(Player * Player, Creature * Creature, uint32 /*uiSender*/, uint32 uiAction) + { +if(!Player) + return true; + +switch(uiAction) +{ + case 0: if(!Player->duel) // Comprueba si un jugador está en un duelo o no.// Checks if a player is in a duel or not. + { + Player->ClearInCombat(); + ChatHandler(Player->GetSession()).SendSysMessage("Tu combate esta limpio!"); + } + else + { + ChatHandler(Player->GetSession()).SendSysMessage("Estas en un duelo, no puede usar esto!"); + Player->PlayerTalkClass->SendCloseGossip(); + }; +} +return true; + } + +}; + +void AddSC_clear_combat() +{ + new clear_combat(); +} \ No newline at end of file diff --git a/donation_npc.cpp b/donation_npc.cpp new file mode 100644 index 0000000..507b91d --- /dev/null +++ b/donation_npc.cpp @@ -0,0 +1,369 @@ +///////////////////////////////////////////////////////////////////////////// +// ____ __ __ __ ___ // +// / __ )____ _/ /_/ /_/ /__ / | ________ ____ ____ ______ // +// / __ / __ `/ __/ __/ / _ \/ /| | / ___/ _ \/ __ \/ __ `/ ___/ // +// / /_/ / /_/ / /_/ /_/ / __/ ___ |/ / / __/ / / / /_/ (__ ) // +// /_____/\__,_/\__/\__/_/\___/_/ |_/_/ \___/_/ /_/\__,_/____/ // +// Developed by Natureknight for BattleArenas.no-ip.org // +// Copyright (C) 2015 Natureknight/JessiqueBA // +// battlearenas.no-ip.org // +///////////////////////////////////////////////////////////////////////////// + +#include "ScriptPCH.h" + +// IMPORTANT: Write your definitions here: + +std::string website = "fusioncms_new"; // FusionCMS database name + +// Those are already in the item_template (db) so dont need to touch them: +const uint32 DONOR_TOKEN = 49927; // Define the donor token Item ID +const uint32 ONE_CHARACTER_VIP = 4992700; // Define one-character vip Item ID + +// DONATION POINTS PRICES: +const uint32 accVipPrice = 30; // VIP account price (in donation points) +const uint32 charVipPrice = 7; // Character VIP price (in donation points) +const uint32 titlePrice = 1; // Donation title price (in donation points) + +// VOTE POINTS PRICES: +const uint32 arenaPtsPrice = 50; // Price for 1000 arena points (in vote points) +const uint32 honorPtsPrice = 30; // Price for 2000 honor points (in vote points) + +class Donation_NPC_AT : public CreatureScript +{ +public: + Donation_NPC_AT() : CreatureScript("Donation_NPC_AT"){} + + uint32 SelectDPoints(Player* pPlayer) + { + QueryResult select = LoginDatabase.PQuery("SELECT dp FROM %s.account_data WHERE id = '%u'", website.c_str(), pPlayer->GetSession()->GetAccountId()); + + if (!select) // Just in case, but should not happen + { + pPlayer->CLOSE_GOSSIP_MENU(); + return 0; + } + + Field* fields = select->Fetch(); + uint32 dp = fields[0].GetUInt32(); + + return dp; + } + + uint32 SelectVPoints(Player* pPlayer) + { + QueryResult select = LoginDatabase.PQuery("SELECT vp FROM %s.account_data WHERE id = '%u'", website.c_str(), pPlayer->GetSession()->GetAccountId()); + + if (!select) // Just in case, but should not happen + { + pPlayer->CLOSE_GOSSIP_MENU(); + return 0; + } + + Field* fields = select->Fetch(); + uint32 vp = fields[0].GetUInt32(); + + return vp; + } + + void RewardTitle(Player* pPlayer, uint32 entry) + { + if (pPlayer->HasTitle(sCharTitlesStore.LookupEntry(entry))) + { + pPlayer->GetSession()->SendAreaTriggerMessage("You already have this title."); + pPlayer->CLOSE_GOSSIP_MENU(); + } + else + { + LoginDatabase.PExecute("UPDATE %s.account_data SET dp = '%u' -%u WHERE id = '%u'", website.c_str(), SelectDPoints(pPlayer), titlePrice, pPlayer->GetSession()->GetAccountId()); + pPlayer->GetSession()->SendAreaTriggerMessage("Successfully earned this title! Thanks for the support!"); + pPlayer->SetTitle(sCharTitlesStore.LookupEntry(entry)); + pPlayer->SaveToDB(); + } + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + std::stringstream purchaseHonor; + std::stringstream purchaseArena; + std::stringstream points; + std::stringstream purchaseTitle; + + // TODO: Prevent exploiting the FusionCMS donate points + if (pPlayer->GetSession()->GetSecurity() < 5 && SelectDPoints(pPlayer) > 50) + { + pPlayer->GetSession()->SendAreaTriggerMessage("You have large amount of Donation points: %u. This is probably a website related problem, please " + "immediately contact the administrator via ticket about this issue.", SelectDPoints(pPlayer)); + pPlayer->CLOSE_GOSSIP_MENU(); + return false; + } + + // Purchase VIP Account + if (SelectDPoints(pPlayer) < accVipPrice) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Purchase VIP Account (|cff980000Locked|r / Click for Information)", GOSSIP_SENDER_MAIN, 1); + else if (SelectDPoints(pPlayer) >= 30) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Purchase VIP Account (|cff009900Unlocked|r / Click to use)", GOSSIP_SENDER_MAIN, 2); + + // Purchase VIP only for current char + if (SelectDPoints(pPlayer) < charVipPrice) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "VIP only for current character (|cff980000Locked|r / Click for Information)", GOSSIP_SENDER_MAIN, 3); + else if (SelectDPoints(pPlayer) >= 7) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "VIP only for current character (|cff009900Unlocked|r / Click to use)", GOSSIP_SENDER_MAIN, 4); + + // Allow players to get honor points by using their voting points + if (SelectVPoints(pPlayer) < honorPtsPrice) + { + purchaseHonor << "Purchase 2k Honor Points (|cff980000Locked|r / Min " << honorPtsPrice << " VP needed)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseHonor.str().c_str(), GOSSIP_SENDER_MAIN, 999); + } + else if (SelectVPoints(pPlayer) >= honorPtsPrice) + { + purchaseHonor << "Purchase 2k Honor Points (|cff009900Unlocked|r / Click to use)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseHonor.str().c_str(), GOSSIP_SENDER_MAIN, 5); + } + + // Allow player to get arena points by using their voting points + if (SelectVPoints(pPlayer) < arenaPtsPrice) + { + purchaseArena << "Purchase 1k Arena Points (|cff980000Locked|r / Min " << arenaPtsPrice << " VP needed)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseArena.str().c_str(), GOSSIP_SENDER_MAIN, 999); + } + else if (SelectVPoints(pPlayer) >= arenaPtsPrice) + { + purchaseArena << "Purchase 1k Arena Points (|cff009900Unlocked|r / Click to use)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseArena.str().c_str(), GOSSIP_SENDER_MAIN, 6); + } + + + // Allow player to get arena points by using their voting points + if (SelectDPoints(pPlayer) < titlePrice) + { + purchaseTitle << "Purchase Character Title (|cff980000Locked|r / Min " << titlePrice << " DP needed)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseTitle.str().c_str(), GOSSIP_SENDER_MAIN, 7); + } + else if (SelectDPoints(pPlayer) >= titlePrice) + { + purchaseTitle << "Purchase Character Title (|cff009900Unlocked|r / Click to use)"; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, purchaseTitle.str().c_str(), GOSSIP_SENDER_MAIN, 7); + } + + // Show Donate and Voting Points when GossipHello + points << "My Donation Points amount: " << SelectDPoints(pPlayer); + points << "\n" << "My Voting Points amount: " << SelectVPoints(pPlayer); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, points.str().c_str(), GOSSIP_SENDER_MAIN, 100); // No action here, just to show points + pPlayer->SEND_GOSSIP_MENU(60031, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 sender, uint32 uiAction) + { + pPlayer->PlayerTalkClass->ClearMenus(); + + if (sender != GOSSIP_SENDER_MAIN) + return false; + + uint32 dp = SelectDPoints(pPlayer); + uint32 vp = SelectVPoints(pPlayer); + + switch (uiAction) + { + case 1: // Vip account - locked + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Back to Main Menu", GOSSIP_SENDER_MAIN, 1000); + pPlayer->SEND_GOSSIP_MENU(60032, pCreature->GetGUID()); + break; + + case 2: // Vip account - unlocked + if (pPlayer->GetSession()->GetSecurity() >= 1 || pPlayer->HasItemCount(ONE_CHARACTER_VIP, 1)) + { + pPlayer->GetSession()->SendAreaTriggerMessage("You're already VIP or GM."); + pPlayer->CLOSE_GOSSIP_MENU(); + } + else + { + LoginDatabase.PExecute("UPDATE %s.account_data SET dp = '%u' -%u WHERE id = '%u'", website.c_str(), dp, accVipPrice, pPlayer->GetSession()->GetAccountId()); + LoginDatabase.PExecute("INSERT INTO `account_access` (`id`, `gmlevel`, `RealmID`) VALUES (%u, 1, -1);", pPlayer->GetSession()->GetAccountId()); + pPlayer->GetSession()->SendAreaTriggerMessage("Successfully upgraded your account to VIP. Close the game and login again for changes to take effect! Thanks for the support!"); + pPlayer->SaveToDB(); + pPlayer->CLOSE_GOSSIP_MENU(); + } + break; + + case 3: // VIP only character - locked + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Back to Main Menu", GOSSIP_SENDER_MAIN, 1000); + pPlayer->SEND_GOSSIP_MENU(60033, pCreature->GetGUID()); + break; + + case 4: // VIP only character - unlocked + if (pPlayer->GetSession()->GetSecurity() >= 1 || pPlayer->HasItemCount(ONE_CHARACTER_VIP, 1)) + { + pPlayer->GetSession()->SendAreaTriggerMessage("You're already VIP or GM."); + pPlayer->CLOSE_GOSSIP_MENU(); + } + else + { + LoginDatabase.PExecute("UPDATE %s.account_data SET dp = '%u' -%u WHERE id = '%u'", website.c_str(), dp, charVipPrice, pPlayer->GetSession()->GetAccountId()); + pPlayer->GetSession()->SendAreaTriggerMessage("Successfully upgraded this character to VIP! Thanks for the support!"); + pPlayer->AddItem(ONE_CHARACTER_VIP, 1); + pPlayer->SaveToDB(); + pPlayer->CLOSE_GOSSIP_MENU(); + } + break; + + case 5: // Honor Points - 2000 + LoginDatabase.PExecute("UPDATE %s.account_data SET vp = '%u' -%u WHERE id = '%u'", website.c_str(), vp, honorPtsPrice, pPlayer->GetSession()->GetAccountId()); + pPlayer->GetSession()->SendAreaTriggerMessage("Successfully earned 2000 Honor Points. Thanks for the support!"); + pPlayer->ModifyHonorPoints(2000); + pPlayer->SaveToDB(); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 6: // Arena Points - 1000 + LoginDatabase.PExecute("UPDATE %s.account_data SET vp = '%u' -%u WHERE id = '%u'", website.c_str(), vp, arenaPtsPrice, pPlayer->GetSession()->GetAccountId()); + pPlayer->GetSession()->SendAreaTriggerMessage("Successfully earned 1000 Arena Points. Thanks for the support!"); + pPlayer->ModifyArenaPoints(1000); + pPlayer->SaveToDB(); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 7: // Donation titles + if (dp >= titlePrice) + { + pPlayer->ADD_GOSSIP_ITEM(4, "Conqueror (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 8); + pPlayer->ADD_GOSSIP_ITEM(4, "Justicar (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 9); + pPlayer->ADD_GOSSIP_ITEM(4, "Battlemaster (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 10); + pPlayer->ADD_GOSSIP_ITEM(4, "Scarab Lord (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 11); + pPlayer->ADD_GOSSIP_ITEM(4, "Brewmaster (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 12); + pPlayer->ADD_GOSSIP_ITEM(4, "The Love Fool (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 13); + pPlayer->ADD_GOSSIP_ITEM(4, "Matron (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 14); + pPlayer->ADD_GOSSIP_ITEM(4, "Patron (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 15); + pPlayer->ADD_GOSSIP_ITEM(4, "The Hallowed (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 16); + pPlayer->ADD_GOSSIP_ITEM(4, "Merrymaker (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 17); + pPlayer->ADD_GOSSIP_ITEM(4, "The Noble (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 18); + pPlayer->ADD_GOSSIP_ITEM(4, "The Pilgrim (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 19); + pPlayer->ADD_GOSSIP_ITEM(4, "Flame Keeper (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 20); + pPlayer->ADD_GOSSIP_ITEM(4, "Flame Warden (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 21); + pPlayer->ADD_GOSSIP_ITEM(4, "Elder (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 22); + pPlayer->ADD_GOSSIP_ITEM(4, "Jenkins (|cff009900Unlocked|r)", GOSSIP_SENDER_MAIN, 23); + pPlayer->ADD_GOSSIP_ITEM(4, "Back to Main Page", GOSSIP_SENDER_MAIN, 1000); + pPlayer->SEND_GOSSIP_MENU(60013, pCreature->GetGUID()); + } + else if (dp < titlePrice) + { + pPlayer->ADD_GOSSIP_ITEM(4, "Conqueror (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Justicar (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Battlemaster (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Scarab Lord (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Brewmaster (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "The Love Fool (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Matron (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Patron (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "The Hallowed (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Merrymaker (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "The Noble (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "The Pilgrim (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Flame Keeper (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Flame Warden (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Elder (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Jenkins (|cff980000Locked|r)", GOSSIP_SENDER_MAIN, 999); + pPlayer->ADD_GOSSIP_ITEM(4, "Back to Main Page", GOSSIP_SENDER_MAIN, 1000); + pPlayer->SEND_GOSSIP_MENU(60013, pCreature->GetGUID()); + } + break; + + case 8: // Conqueror + RewardTitle(pPlayer, 47); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 9: // Justicar + RewardTitle(pPlayer, 48); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 10: // Battlemaster + RewardTitle(pPlayer, 72); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 11: // Scarab Lord + RewardTitle(pPlayer, 46); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 12: // Brewmaster + RewardTitle(pPlayer, 133); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 13: // the Love Fool + RewardTitle(pPlayer, 135); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 14: // Matron + RewardTitle(pPlayer, 137); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 15: // Patron + RewardTitle(pPlayer, 138); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 16: // The Hallowed + RewardTitle(pPlayer, 124); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 17: // Merrymaker + RewardTitle(pPlayer, 134); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 18: // The Noble + RewardTitle(pPlayer, 155); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 19: // The Pilgrim + RewardTitle(pPlayer, 168); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 20: // Flame Keeper + RewardTitle(pPlayer, 76); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 21: // Flame Warden + RewardTitle(pPlayer, 75); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 22: // Elder + RewardTitle(pPlayer, 74); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 23: // Jenkins + RewardTitle(pPlayer, 143); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case 999: // Not enought points + pPlayer->GetSession()->SendAreaTriggerMessage("Not enought points."); + OnGossipHello(pPlayer, pCreature); + break; + + case 1000: // Back to main menu + OnGossipHello(pPlayer, pCreature); + break; + } + return true; + } +}; + +void AddSC_Donation_NPC() +{ + new Donation_NPC_AT(); +} \ No newline at end of file diff --git a/duel_reset.cpp b/duel_reset.cpp new file mode 100644 index 0000000..6b43217 --- /dev/null +++ b/duel_reset.cpp @@ -0,0 +1,24 @@ +#include "ScriptPCH.h" + +class Duel_Reset : public PlayerScript +{ + public: + Duel_Reset() : PlayerScript("Duel_Reset"){} + + void OnDuelEnd(Player* pWinner, Player* pLoser, DuelCompleteType /*type*/) + { + pWinner->SetHealth(pWinner->GetMaxHealth()); + if ( pWinner->getPowerType() == POWER_MANA ) + pWinner->SetPower(POWER_MANA, pWinner->GetMaxPower(POWER_MANA)); + pWinner->GetSession()->SendNotification("|cff00ff00|TInterface\\icons\\inv_bannerpvp_02:18|t Ganas el duelo! tus cds han sido restablecidos |cff00ff00|TInterface\\icons\\inv_bannerpvp_01:18|t"); + pLoser->SetHealth(pLoser->GetMaxHealth()); + if ( pLoser->getPowerType() == POWER_MANA ) + pLoser->SetPower(POWER_MANA, pLoser->GetMaxPower(POWER_MANA)); + pLoser->GetSession()->SendNotification("|cff00ff00|TInterface\\icons\\inv_bannerpvp_01:18|t Perdiste el duelo! tus cds han sido restablecidos |cff00ff00|TInterface\\icons\\inv_bannerpvp_02:18|t"); + } +}; + +void AddSC_Duel_Reset() +{ + new Duel_Reset(); +} \ No newline at end of file diff --git a/guild_house.cpp b/guild_house.cpp new file mode 100644 index 0000000..975c30e --- /dev/null +++ b/guild_house.cpp @@ -0,0 +1,741 @@ +#include "ScriptPCH.h" +#include +#include "GuildMgr.h" +#include "ObjectMgr.h" + +const uint32 GUILD_TOKEN = 37711; +bool requiresGUpdate = true; +std::vector GuildHouses; +char string[200]; + +enum Objects +{ + OBJECT_TABLE = 180698, + OBJECT_TORCH = 187988, + OBJECT_MAILBOX = 142094, + OBJECT_CRATE = 183992, + OBJECT_A_FLAG = 187342, + OBJECT_H_FLAG = 192688, + OBJECT_CHAIR = 10201, + OBJECT_FIREPIT = 1967, + OBJECT_GUILDVAULT = 187390, + OBJECT_BARBER_CHAIR = 191817, + OBJECT_CRANBERRY_BUSH = 195199, +}; + +void SpawnObject(Player * pPlayer, uint32 objectId) +{ + const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); + + float x = float(pPlayer->GetPositionX()); + float y = float(pPlayer->GetPositionY()); + float z = float(pPlayer->GetPositionZ()); + float o = float(pPlayer->GetOrientation()); + Map* map = pPlayer->GetMap(); + + GameObject* object = new GameObject; + uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + if (!object->Create(guidLow, objectInfo->entry, map, pPlayer->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + { + delete object; + return; + } + + object->SetRespawnTime(1); + object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), pPlayer->GetPhaseMaskForSpawn()); + + if (!object->LoadGameObjectFromDB(guidLow, map)) + { + delete object; + return; + } + + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); + WorldDatabase.PExecute("INSERT INTO guildhouse_objects VALUES('%u', '%u')", pPlayer->GetGuildId(), guidLow); +} + +uint32 getGuildAreaId(Player * pPlayer) +{ + QueryResult Result = WorldDatabase.PQuery("SELECT area FROM guildhouses WHERE guildId='%u'", pPlayer->GetGuildId()); + if(Result) + { + Field * pField = Result->Fetch(); + return pField[0].GetUInt32(); + } + + return -1; + +} + +bool isInGuildArea(Player * pPlayer) +{ + for(int i = 0; i < 21; i++) + { + if(pPlayer->GetAreaId() == getGuildAreaId(pPlayer)) + return true; + } + return false; +} + +bool isGuildHouseOwner(Player * pPlayer) +{ + if(GuildHouses.empty() || requiresGUpdate == true) + { + if(requiresGUpdate == true) + { + GuildHouses.clear(); + requiresGUpdate = false; + } + QueryResult Result = WorldDatabase.PQuery("SELECT guildId FROM guildhouses WHERE guildId != '0'"); + if(Result) + { + Field * pFields = Result->Fetch(); + int i = 0; + do + { + GuildHouses.push_back(pFields[0].GetUInt64()); + i++; + }while(Result->NextRow()); + + return isGuildHouseOwner(pPlayer); + } + else + { + return false; + } + } + else + { + for(std::vector::iterator itr = GuildHouses.begin(); itr != GuildHouses.end(); itr++) + { + if(*itr != pPlayer->GetGuildId()) + continue; + else + return true; + } + return false; + } +} + +bool isPlayerGuildLeader(Player *player) +{ + return (player->GetRank() == 0) && (player->GetGuildId() != 0); +} + +bool GuildOwnsHouse(Player * pPlayer) +{ + QueryResult pResult = WorldDatabase.PQuery("SELECT * FROM guildhouses WHERE guildId='%u'", pPlayer->GetGuildId()); + if(!pResult) + return false; + else + return true; +} + +void CleanUpObjects(Player * pPlayer, uint32 guildId) +{ + QueryResult ObjectSpawns = WorldDatabase.PQuery("SELECT `guid` FROM `guildhouse_objects` WHERE `guildId` = '%u'", guildId); + if(ObjectSpawns) + { + do + { + Field * pField = ObjectSpawns->Fetch(); + uint32 Object_GUID = pField[0].GetUInt32(); + GameObject* object = NULL; + ChatHandler handler = ChatHandler(pPlayer->GetSession()); + + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(Object_GUID)) + object = handler.GetObjectGlobalyWithGuidOrNearWithDbGuid(Object_GUID, gameObjectData->id); + + if (!object) + continue; + + object->SetRespawnTime(0); + object->Delete(); + object->DeleteFromDB(); + WorldDatabase.PExecute("DELETE FROM `guildhouse_objects` WHERE guid='%u'", Object_GUID); + }while(ObjectSpawns->NextRow()); + } +} + +void SellGuildHouse(Player * pPlayer, Creature * pCreature) +{ + if(isInGuildArea(pPlayer)) + { + WorldDatabase.PExecute("UPDATE `guildhouses` SET `guildId`='0' WHERE `guildId`='%u'", pPlayer->GetGuildId()); + CleanUpObjects(pPlayer, pPlayer->GetGuildId()); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha vendido con éxito su casa hermandad!", pPlayer->GetName()); + pPlayer->PlayerTalkClass->SendCloseGossip(); + requiresGUpdate = true; + pPlayer->TeleportTo(530, -1861.239990f, 5437.810059f, -10.463400f, 1.353830f); // generally the mall + } + else + { + pPlayer->GetSession()->SendNotification("Usted no debe estar en su casa hermandad para venderlo!"); + } +} + +void PurchaseGuildHouse(Player * pPlayer, Creature * pCreature, uint32 &Id) +{ + if(pPlayer->HasItemCount(GUILD_TOKEN, 1)) + { + WorldDatabase.PExecute("UPDATE `guildhouses` SET `guildId`='%u' WHERE `id`='%u'", pPlayer->GetGuildId(), Id); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Felicitaciones por la compra de su nueva casa hermandad!", pPlayer->GetName()); + + pPlayer->DestroyItemCount(GUILD_TOKEN, 1, true); + requiresGUpdate = true; + } + else + { + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Necesitas un token guild para comprar una casa", pPlayer->GetName()); + + } + pPlayer->PlayerTalkClass->SendCloseGossip(); +} + +void TeleportToHouse(Player * pPlayer) +{ + if (pPlayer->IsInCombat()); + QueryResult result = WorldDatabase.PQuery("SELECT `x`, `y`, `z`, `map` FROM `guildhouses` WHERE `guildId` = '%u'", pPlayer->GetGuildId()); + if (result) + { + Field *fields = result->Fetch(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + uint32 map = fields[3].GetUInt32(); + pPlayer->TeleportTo(map, x, y, z, pPlayer->GetOrientation()); + } +} + +class GuildHouse_NPC : public CreatureScript +{ + public: + GuildHouse_NPC() : CreatureScript("GuildHouse"){} + + + void ShowHouseListings(Player * pPlayer, Creature * pCreature, unsigned int start = 0) + { + pPlayer->PlayerTalkClass->ClearMenus(); + + QueryResult pResult = WorldDatabase.PQuery("SELECT id, comment FROM guildhouses WHERE guildId='0'"); + uint32 houses = pResult->GetRowCount(); + int offset = 0; + Field * pField = pResult->Fetch(); + bool ranOnce = false; + for(unsigned int i = start; i < houses; i++) + { + if(start != 0 && ranOnce == false) + { + for(int x = 0; x < start; x++) + { + pResult->NextRow(); + } + ranOnce = true; + } + + if(offset != 10) + { + pPlayer->ADD_GOSSIP_ITEM(6, pField[1].GetString(), GOSSIP_SENDER_MAIN, pField[0].GetUInt32()); + offset++; + pResult->NextRow(); + } + else + { + if((startid + 12) > houses) + { + pPlayer->ADD_GOSSIP_ITEM(7, "----------TENEBROUS----------", GOSSIP_SENDER_MAIN, 41); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(7, "Siguiente", GOSSIP_SENDER_MAIN, 4353); + startid = start + offset; + i = houses +10; + } + } + } + pPlayer->PlayerTalkClass->SendGossipMenu(2, pCreature->GetGUID()); + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + startid = 0; + + if(pPlayer->GetGuildId() == 0) + { + pPlayer->GetSession()->SendNotification("Debe estar en una casa!"); + return false; + } + else if (!GuildOwnsHouse(pPlayer) && !isPlayerGuildLeader(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Su Guild no posee una casa!"); + return false; + } + pPlayer->ADD_GOSSIP_ITEM(4, " Tenebrous Wow:", GOSSIP_SENDER_MAIN, 41); + pPlayer->ADD_GOSSIP_ITEM(4, "----------------------------------------------", GOSSIP_SENDER_MAIN, 41); + if(isPlayerGuildLeader(pPlayer)) + { + if(!GuildOwnsHouse(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(6, "Comprar una Casa del Gremio", GOSSIP_SENDER_MAIN, 38); + else + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(6, "Venta Casa del Gremio", GOSSIP_SENDER_MAIN, 39, "¿Seguro que quiere vender su casa gremial?", 0, false); + } + if(GuildOwnsHouse(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(7, "|cff00ff00|TInterface\\icons\\inv_shirt_guildtabard:18|t Ir a casa de la guild|r", GOSSIP_SENDER_MAIN, 40); + + pPlayer->PlayerTalkClass->SendGossipMenu(2, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + pPlayer->PlayerTalkClass->ClearMenus(); + + switch(uiAction) + { + case 38: + ShowHouseListings(pPlayer, pCreature); + break; + case 39: + SellGuildHouse(pPlayer, pCreature); + pPlayer->PlayerTalkClass->SendCloseGossip(); + break; + case 40: + TeleportToHouse(pPlayer); + pPlayer->GetSession()->SendNotification("|cff00ff00|TInterface\\icons\\achievement_arena_3v3_6:18|t ¡Bienvenido a la casa de tu guild! |cff00ff00|TInterface\\icons\\achievement_arena_3v3_6:18|t"); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("|cff00ff00|TInterface\\icons\\achievement_arena_3v3_6:18|t ¡Bienvenido a la casa de tu guild! |cff00ff00|TInterface\\icons\\achievement_arena_3v3_6:18|t", pPlayer->GetName()); + break; + case 41: + OnGossipHello(pPlayer, pCreature); + break; + case 4353: + ShowHouseListings(pPlayer, pCreature, startid); + break; + default: + if(uiAction < 38 && uiAction > 0) + PurchaseGuildHouse(pPlayer, pCreature, uiAction); + break; + } + return true; + } + + private: + uint32 startid; +}; + + +class Table_Token : public ItemScript +{ + public: + Table_Token() : ItemScript("Table Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_TABLE); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + return true; + } +}; + +class Torch_Token : public ItemScript +{ + public: + Torch_Token() : ItemScript("Torch Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_TORCH); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Mailbox_Token : public ItemScript +{ + public: + Mailbox_Token() : ItemScript("Mailbox Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_MAILBOX); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Crate_Token : public ItemScript +{ + public: + Crate_Token() : ItemScript("Crate Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_CRATE); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class A_Flag_Token : public ItemScript +{ + public: + A_Flag_Token() : ItemScript("A_Flag Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_A_FLAG); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class H_Flag_Token : public ItemScript +{ + public: + H_Flag_Token() : ItemScript("H_Flag Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + + SpawnObject(pPlayer, OBJECT_H_FLAG); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Chair_Token : public ItemScript +{ + public: + Chair_Token() : ItemScript("Chair Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_CHAIR); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Firepit_Token : public ItemScript +{ + public: + Firepit_Token() : ItemScript("Firepit Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_FIREPIT); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Vault_Token : public ItemScript +{ + public: + Vault_Token() : ItemScript("Vault Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_GUILDVAULT); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Barber_Token : public ItemScript +{ + public: + Barber_Token() : ItemScript("Barber Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + } + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_BARBER_CHAIR); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +class Cranberry_Token : public ItemScript +{ + public: + Cranberry_Token() : ItemScript("Cranberry Token"){} + + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + if(!pPlayer) + return false; + + if(!pItem) + return false; + + if(!isPlayerGuildLeader(pPlayer) || !isGuildHouseOwner(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Debe poseer una casa de guild a utilizar este elemento!"); + return false; + }; + + if(!isInGuildArea(pPlayer)) + { + pPlayer->GetSession()->SendNotification("Usted no está en su área de la casa!"); + return false; + } + + SpawnObject(pPlayer, OBJECT_CRANBERRY_BUSH); + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); + + return true; + } +}; + +//token vendor + +class Guild_Token_Vendor : public CreatureScript +{ + public: + Guild_Token_Vendor() : CreatureScript("Token Vendor"){} + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + if(!isPlayerGuildLeader(pPlayer)) + { + pPlayer->GetSession()->SendNotification("You must be a guildmaster!"); + pPlayer->PlayerTalkClass->SendCloseGossip(); + return false; + } + if(isGuildHouseOwner(pPlayer)) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(4, "I would like to purchase Object Tokens!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->ADD_GOSSIP_ITEM(3, "Nevermind.", GOSSIP_SENDER_MAIN, 2); + pPlayer->PlayerTalkClass->SendGossipMenu(2, pCreature->GetGUID()); + //return true; + } + else + { + pPlayer->GetSession()->SendNotification("Recuerda que debes tener la casa gremio!"); + return false; + } + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->GetSession()->SendListInventory(pCreature->GetGUID()); + break; + case 2: + pPlayer->PlayerTalkClass->SendCloseGossip(); + break; + } + return true; + } +}; + + +void AddSC_GuildHouse() +{ + new GuildHouse_NPC(); + new Table_Token(); + new Torch_Token(); + new Mailbox_Token(); + new Crate_Token(); + new A_Flag_Token(); + new H_Flag_Token(); + new Chair_Token(); + new Firepit_Token(); + new Vault_Token(); + new Barber_Token(); + new Guild_Token_Vendor(); + new Cranberry_Token(); +} \ No newline at end of file diff --git a/guild_start.cpp b/guild_start.cpp new file mode 100644 index 0000000..7f4e8bd --- /dev/null +++ b/guild_start.cpp @@ -0,0 +1,31 @@ +#include "ScriptMgr.h" +#include "Player.h" +#include "GuildMgr.h" +#include "Config.h" +/* +#define GUILD_ID_ALLIANCE 45 //Guild ID +#define GUILD_ID_HORDE 46 //Guild ID +*/ +class gon_playerscripts : public PlayerScript +{ + public: + gon_playerscripts() : PlayerScript("gon_playerscripts") { } + + void OnLogin(Player* player, bool firstLogin) + { + if (firstLogin) + { + uint32 GUILD_ID_ALLIANCE = sConfigMgr->GetIntDefault("StartGuild.Alliance", 0); + uint32 GUILD_ID_HORDE = sConfigMgr->GetIntDefault("StartGuild.Horde", 0); + Guild* guild = sGuildMgr->GetGuildById(player->GetTeam() == ALLIANCE ? GUILD_ID_ALLIANCE : GUILD_ID_HORDE); + + if (guild) + guild->AddMember(player->GetGUID()); + } + } +}; + +void AddSC_gon_playerscripts() +{ + new gon_playerscripts(); +} \ No newline at end of file diff --git a/honor-gurubashi.cpp b/honor-gurubashi.cpp new file mode 100644 index 0000000..46407d0 --- /dev/null +++ b/honor-gurubashi.cpp @@ -0,0 +1,28 @@ +#include "ScriptPCH.h" + +class gurubashipvp : public PlayerScript +{ +public: + gurubashipvp() : PlayerScript("gurubashipvp") { } + + void OnPvPKill(Player *pKiller, Player *pVictim) { + int reward = 20; // = 50 Puntos de Honor + int pvparea = 2177; //Area ID of the place both characters must be to be eligible for reward + int area1 = pKiller->GetAreaId(); + int area2 = pVictim->GetAreaId(); + if(area1 == area2) { + int area = area; + if(area == pvparea) { + if(pKiller->GetTeam() != pVictim->GetTeam()) { + int honor = pKiller->GetHonorPoints(); + pKiller->ModifyHonorPoints(honor + reward); + } + } + } + } +}; + +void AddSC_gurubashipvp() +{ + new gurubashipvp; +} \ No newline at end of file diff --git a/instance_reset.cpp b/instance_reset.cpp new file mode 100644 index 0000000..a4bbebb --- /dev/null +++ b/instance_reset.cpp @@ -0,0 +1,81 @@ +/* FixCore - 2016 - Todos los derechos reservados */ + +#include "ScriptPCH.h" + +class npc_instances_reset_fixcore : public CreatureScript +{ + public: + npc_instances_reset_fixcore() : CreatureScript("npc_instances_reset_fixcore") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(4, "Reiniciar instancias", GOSSIP_SENDER_MAIN, 22); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!pPlayer) + return true; + + switch (uiAction) + { + { + case 22: + if (!*args) + return false; + + Player* player = handler->getSelectedPlayer(); + if (!player) + player = handler->GetSession()->GetPlayer(); + + char* map = strtok((char*)args, " "); + char* pDiff = strtok(NULL, " "); + int8 diff = -1; + if (pDiff) + diff = atoi(pDiff); + uint16 counter = 0; + uint16 MapId = 0; + + if (strcmp(map, "all") != 0) + { + MapId = uint16(atoi(map)); + if (!MapId) + return false; + } + + 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();) + { + InstanceSave* save = itr->second.save; + if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) + { + std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); + handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); + player->UnbindInstance(itr, Difficulty(i)); + counter++; + } + else + ++itr; + } + } + handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBOUND, counter); + + return true; + break; + return true; + } + } + } + +}; + +void AddSC_npc_instances_reset_fixcore() +{ + new npc_instances_reset_fixcore(); +} diff --git a/item_res_group_v2.cpp b/item_res_group_v2.cpp new file mode 100644 index 0000000..d41638a --- /dev/null +++ b/item_res_group_v2.cpp @@ -0,0 +1,108 @@ + /*---------------------------------------------*\ + | Coded By Obitus | + | April 02, 2016 | + | Tested on TrinityCore 3.3.5 | + | Added distance check (Thanks to Phil) | + | This is the 2nd version - without gossip | + \*---------------------------------------------*/ + +//I was insipired by http://www.wowhead.com/spell=83968/mass-resurrection + +/* +-- Execute this query in WORLD DATABASE +INSERT INTO `item_template` (`entry`, `class`, `SoundOverrideSubclass`, `name`, `displayid`, `Quality`, `Flags`, `FlagsExtra`, `BuyCount`, `BuyPrice`, `SellPrice`, `AllowableClass`, `AllowableRace`, `RequiredLevel`, `maxcount`, `stackable`, `delay`, `spellid_1`, `spellcooldown_1`, `spellcategorycooldown_1`, `spellcooldown_2`, `spellcategorycooldown_2`, `spellcooldown_3`, `spellcategorycooldown_3`, `spellcooldown_4`, `spellcategorycooldown_4`, `spellcooldown_5`, `spellcategorycooldown_5`, `description`, `RequiredDisenchantSkill`, `ScriptName`) +VALUES (192000, 15, -1, 'Mass Resurrection', 67105, 7, 0, 0, 1, 228800000, 34, -1, -1, 28, 1, 1, 1000, 14093, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, '|cffffffff100 yd range\r\n|cffffd400Brings all dead party and raid members back to life with 35% health and 35% mana. Cannot be cast in combat or while in a battleground or arena.\r\nYou can use this item once every 15 minutes.', -1, 'item_res_group'); + +*/ + + +#include "ScriptMgr.h" +#include "Player.h" +#include "Group.h" +#include "ObjectAccessor.h" +#include "ScriptedGossip.h" +#include "WorldSession.h" + +class item_res_group : public ItemScript +{ +public: + item_res_group() : ItemScript("item_res_group") { } + + bool DistanceIsValid(Position* playerWhoUsesTheItem, Position* deadPlayersInGroup) + { + if (std::abs(deadPlayersInGroup->GetPositionX() - playerWhoUsesTheItem->GetPositionX()) <= 91.44) //91.44 meters = 100 yards + return true; + return false; + } + + bool OnUse(Player* playerWhoUsesTheItem, Item* item, SpellCastTargets const& /*targets*/) + { + Group* group = playerWhoUsesTheItem->GetGroup(); + Group::MemberSlotList const &members = group->GetMemberSlots(); + + if (playerWhoUsesTheItem->HasAura(38910)) //Fel Weakness + { + playerWhoUsesTheItem->GetSession()->SendNotification("Usted debe esperar 15 minutos para usar este objeto otra vez"); + return false; + } + + if (!playerWhoUsesTheItem->GetGroup()) + { + playerWhoUsesTheItem->GetSession()->SendNotification("Usted no está en un grupo!"); + return false; + } + /* //What if the leader is dead? + if (playerWhoUsesTheItem->GetGroup()->GetLeaderGUID() != playerWhoUsesTheItem->GetGUID()) + { + playerWhoUsesTheItem->GetSession()->SendNotification("You are not the group leader!"); + return false; + } + */ + if (playerWhoUsesTheItem->InBattleground()) + { + playerWhoUsesTheItem->GetSession()->SendNotification("Usted no puede usar este objeto en un campo de batalla!"); + return false; + } + + if (playerWhoUsesTheItem->InArena()) + { + playerWhoUsesTheItem->GetSession()->SendNotification("Usted no puede usar este objeto en una Arena!"); + return false; + } + + if (playerWhoUsesTheItem->IsInCombat()) + { + playerWhoUsesTheItem->GetSession()->SendNotification("Usted no puede usar este objeto en combate!"); + return false; + } + + else + { + for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr) + { + Group::MemberSlot const &slot = *itr; + Player* deadPlayersInGroup = ObjectAccessor::FindPlayer((*itr).guid); + + //skip if player/s is/are offline //--This check is mandatory. the server will crash without it + if (!deadPlayersInGroup || deadPlayersInGroup->GetSession()->PlayerDisconnected()) + { + playerWhoUsesTheItem->CLOSE_GOSSIP_MENU(); + } + + if (deadPlayersInGroup && deadPlayersInGroup->GetSession() && deadPlayersInGroup->isDead() && playerWhoUsesTheItem->GetSession() && DistanceIsValid(playerWhoUsesTheItem, deadPlayersInGroup)) + { + deadPlayersInGroup->ResurrectPlayer(0.35f, false); //35% hp and mana, don't apply Resurrection Sickness + deadPlayersInGroup->CastSpell(deadPlayersInGroup, 48171, true); //Visual Spell Resurrect (priest) + deadPlayersInGroup->DurabilityRepairAll(0, 0, false); //Repair All - upon resurrection + playerWhoUsesTheItem->CastSpell(playerWhoUsesTheItem, 38910, true); //Fel Weakness //Cast a debuff on player To prevent the item being used over and over again + } + } + } + return true; + } +}; + +void AddSC_item_res_group() +{ + new item_res_group; +} diff --git a/itemlevel.cpp b/itemlevel.cpp new file mode 100644 index 0000000..1050f0b --- /dev/null +++ b/itemlevel.cpp @@ -0,0 +1,58 @@ +/* + _______ _ ______ + |__ __| | | | ____| + | | __ _ ___| |_ _ _| |__ _ __ ___ _ _ + | |/ _` / __| __| | | | __| | '_ ` _ \| | | | + | | (_| \__ \ |_| |_| | |____| | | | | | |_| | + |_|\__,_|___/\__|\__, |______|_| |_| |_|\__,_| + __/ | + |___/ + +Script Made By Sinistah +Special Thanks To LilleCarl For The Code Snippet + +Legend +------ +item_id = the item id of the item ur using. +max_lvl = the max lvl the script will allow players to use the item. +lvl = how many levels the item will grant upon used +*/ +#include "ScriptMgr.h" +#include "Player.h" +#include "WorldSession.h" + +enum +{ + item_id = 90001, + max_lvl = 80, + lvl = 1 +}; + +class item_level : public ItemScript +{ +public: + item_level() : ItemScript("item_level") { } + + bool OnUse(Player* player, Item* item, const SpellCastTargets &) + { + if(player->IsInCombat() || player->IsInFlight() || player->InBattleground() || player->InArena()) + { + player->GetSession()->SendNotification("No puedes usar Piedra de la Verguenza!"); + return false; + } + if(player->getLevel() == max_lvl) + { + player->GetSession()->SendNotification("Estas en el maximo nivel."); + return false; + } + player->SetLevel(player->getLevel() == max_lvl ? max_lvl : player->getLevel() + lvl); + player->DestroyItemCount(item_id, 1, true); + player->GetSession()->SendNotification("Usaste una Piedra de la Verguenza."); + return true; + } +}; + +void AddSC_item_level() +{ + new item_level(); +} diff --git a/kill_shop.cpp b/kill_shop.cpp new file mode 100644 index 0000000..b74c075 --- /dev/null +++ b/kill_shop.cpp @@ -0,0 +1,70 @@ +/* +INSERT INTO `creature_template` (`entry`,`difficulty_entry_1`,`difficulty_entry_2`,`difficulty_entry_3`,`KillCredit1`,`KillCredit2`,`modelid1`,`modelid2`,`modelid3`,`modelid4`,`name`,`subname`,`IconName`,`gossip_menu_id`,`minlevel`,`maxlevel`,`exp`,`faction`,`npcflag`,`speed_walk`,`speed_run`,`scale`,`rank`,`mindmg`,`maxdmg`,`dmgschool`,`attackpower`,`dmg_multiplier`,`baseattacktime`,`rangeattacktime`,`unit_class`,`unit_flags`,`unit_flags2`,`dynamicflags`,`family`,`trainer_type`,`trainer_spell`,`trainer_class`,`trainer_race`,`minrangedmg`,`maxrangedmg`,`rangedattackpower`,`type`,`type_flags`,`lootid`,`pickpocketloot`,`skinloot`,`resistance1`,`resistance2`,`resistance3`,`resistance4`,`resistance5`,`resistance6`,`spell1`,`spell2`,`spell3`,`spell4`,`spell5`,`spell6`,`spell7`,`spell8`,`PetSpellDataId`,`VehicleId`,`mingold`,`maxgold`,`AIName`,`MovementType`,`InhabitType`,`HoverHeight`,`Health_mod`,`Mana_mod`,`Armor_mod`,`RacialLeader`,`questItem1`,`questItem2`,`questItem3`,`questItem4`,`questItem5`,`questItem6`,`movementId`,`RegenHealth`,`mechanic_immune_mask`,`flags_extra`,`ScriptName`,`VerifiedBuild`) VALUES (151516, 0, 0, 0, 0, 0, 23445, 0, 0, 0, 'Name', 'Subname', '', 0, 80, 80, 0, 35, 129, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2000, 2000, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'hk_kills_shop', 1); +*/ + +class honorable_kills_shop : public CreatureScript +{ +public: + honorable_kills_shop() : CreatureScript("hk_kills_shop") { } + + bool OnGossipHello(Player* player, Creature* creature) + { + player->ADD_GOSSIP_ITEM(4, "[Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything!]", GOSSIP_SENDER_MAIN, 1001); + player->ADD_GOSSIP_ITEM(4, "[5k kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1002); + player->ADD_GOSSIP_ITEM(4, "[1k kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1003); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender*/, uint32 action) + { + char allow[500]; //have enough kills, can view shop + sprintf(allow, "You have enough kills, therefore you may view my goods."); + char deny[500]; //does not have enough kills, may not view shop + sprintf(deny, "I'm sorry, %s, but you do not have enough Lifetime Kills, therefore I cannot allow you to view my goods.", player->GetSession()->GetPlayerName().c_str()); + player->PlayerTalkClass->ClearMenus(); + switch (action) + { + ///////////START ACTIONS////////////////// + + + case 1002: + if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= 5000) //more or equal kills (5000) acá el honor + { + player->GetSession()->SendListInventory(pCreature->GetGUID(), 1); + pCreature->Whisper(allow, LANG_UNIVERSAL, player, true); + player->CLOSE_GOSSIP_MENU(); + } + else + { + pCreature->Whisper(deny, LANG_UNIVERSAL, player, true); + player->CLOSE_GOSSIP_MENU(); + } + break; + + case 1001: + player->CLOSE_GOSSIP_MENU(); + break; + + case 1003: + if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= 1000) //more or equal kills (1000) + { + player->GetSession()->SendListInventory(pCreature->GetGUID(), 2); + pCreature->Whisper(allow, LANG_UNIVERSAL, player, true); + player->CLOSE_GOSSIP_MENU(); + } + else + { + pCreature->Whisper(deny, LANG_UNIVERSAL, player, true); + player->CLOSE_GOSSIP_MENU(); + } + break; + } + return true; + } +}; + +void AddSC_Honorable_Kills_Shopz() +{ + new honorable_kills_shop(); +} \ No newline at end of file diff --git a/learn_max_talent_rank.cpp b/learn_max_talent_rank.cpp new file mode 100644 index 0000000..8ffad8b --- /dev/null +++ b/learn_max_talent_rank.cpp @@ -0,0 +1,94 @@ + /*------------------------------------------------------------| + | Coded By Obitus | + | March 18th, 2016 | + | Tested on the latest TrinityCore 3.3.5 | + | What it does? | + | Players will automatically learn the highest talent rank | + | Improved the code - Thanks to Phil | + |-------------------------------------------------------------| + */ + +#include "Player.h" +#include "ScriptMgr.h" + +class learn_max_talent_rank : public PlayerScript +{ +public: + learn_max_talent_rank() : PlayerScript("learn_max_talent_rank") { } + + + // Called when a player's free talent points change (right before the change is applied) + void OnFreeTalentPointsChanged(Player* player, uint32 points) + { + uint32 Talent_First_Rank[] = + { + 19386, //Wyvern Sting + 53301, //Explosive Shot + 19306, //Counter Attack + 19434, //Aimed Shot + 3674, //Black Arrow + + 55050, //Heart Strike + 49143, //Frost Strike + 49184, //Howling Blast + 55090, //Scourge Strike + 49158, //Corpse Explosion + + 12294, //Mortal Strike + 20243, //Devastate + + 20925, //Holy Shield + 31935, //Avenger's Shield + 20473, //Holy Shock + + 11366, //Pyroblast + 11426, //Ice Barrier + 44457, //Living Bomb + 31661, //Dragon's Breath + 11113, //Blast Wave + 44425, //Arcane Barrage + + 17877, //Shadowburn + 30283, //Shadowfury + 30108, //Unstable Affliction + 50796, //Chaos Bolt + 48181, //Haunt + 18220, //Dark Pact + + 16511, //Hemorrhage + 1329, //Mutilate + + 34914, //Vampiric Touch + 47540, //Penance + 724, //Lightwell + 19236, //Desperate Prayer + 34861, //Circle of Healing + 15407, //Mind Flay + + 61295, //Riptide + 974, //Earth Shield + 30706, //Totem of Wrath + 51490, //Thunderstorm + + 50516, //Typhoon + 48505, //Starfall + 48438, //Wild Growth + 5570, //Insect Swarm + 33876, //Mangle (Cat) + 33878 //Mangle (Bear) + + }; + + for (uint32 i = 0; i < sizeof(Talent_First_Rank) / sizeof(uint32); i++) + if (player->HasSpell(Talent_First_Rank[i])) + player->LearnSpellHighestRank(Talent_First_Rank[i]); + + if (player->HasSpell(20911)) //Blessing of Sanctuary + player->LearnSpell(25899, false); //Greater Blessing of Sanctuary + } +}; + +void AddSC_learn_max_talent_rank() +{ + new learn_max_talent_rank; +} \ No newline at end of file diff --git a/login_announce.cpp b/login_announce.cpp new file mode 100644 index 0000000..ebfb7e5 --- /dev/null +++ b/login_announce.cpp @@ -0,0 +1,19 @@ +#include "ScriptPCH.h" + +class login_announce : public PlayerScript +{ +public: + login_announce() : PlayerScript("login_announce") { } + + void OnLogin(Player* player, bool /*loginFirst*/) + { + if (player || player->GetSession()) + { + player->GetSession()->SendNotification("|cff00ff00|TInterface\\icons\\inv_staff_104:25|t |cff00ff00%s|r Bienvenido a TenebrousWoW! |cff00ff00|TInterface\\icons\\inv_staff_104:25|t", player->GetName()); + } + } +}; +void AddSC_login_announce() +{ + new login_announce; +} \ No newline at end of file diff --git a/login_boa.cpp b/login_boa.cpp new file mode 100644 index 0000000..3290099 --- /dev/null +++ b/login_boa.cpp @@ -0,0 +1,129 @@ +#include "Player.h" +#include "Chat.h" +#define Welcome_Name "Your Servername" + +class Player_Boa : public PlayerScript +{ + +public: + Player_Boa() : PlayerScript("Player_Boa") { } + + void OnLogin(Player* player, bool firstLogin) override + { + if (!firstLogin) // Run script only on first login + return; + std::ostringstream ss; + ss << "|cffFF0000["<GetName() << " to the server! "; + sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str()); + uint32 shoulders = 0, chest = 0, ring = 0, trinkett = 0, weapon = 0, weapon2 = 0; + + ring = 50255; + switch (player->getClass()) + { + case CLASS_WARRIOR: + //Warrior + shoulders = 42949; + chest = 48685; + trinkett = 42991; + weapon = 42945; + break; + case CLASS_PALADIN: + //Paladin + shoulders = 42949; + chest = 48685; + trinkett = 42991; + weapon = 42945; + break; + case CLASS_HUNTER: + //Hunter + shoulders = 42950; + chest = 48677; + trinkett = 42991; + weapon = 42943; + weapon2 = 42946; + break; + case CLASS_ROGUE: + //Rogue + shoulders = 42952; + chest = 48689; + trinkett = 42991; + weapon = 42944; + weapon2 = 42944; + break; + case CLASS_PRIEST: + //Priest + shoulders = 42985; + chest = 48691; + trinkett = 42992; + weapon = 42947; + break; + case CLASS_DEATH_KNIGHT: + //Death Knight + shoulders = 42949; + chest = 48685; + trinkett = 42991; + weapon = 42945; + break; + case CLASS_SHAMAN: + //Shaman + shoulders = 42951; + chest = 48683; + trinkett = 42992; + weapon = 42948; + break; + case CLASS_MAGE: + //Mage + shoulders = 42985; + chest = 48691; + trinkett = 42992; + weapon = 42947; + break; + case CLASS_WARLOCK: + //Warlock + shoulders = 42985; + chest = 48691; + trinkett = 42992; + weapon = 42947; + break; + case CLASS_DRUID: + //Druid + shoulders = 42984; + chest = 48687; + trinkett = 42992; + weapon = 42948; + break; + default: + return; + } + switch(player->getClass()) + { + case CLASS_HUNTER: + player->AddItem(shoulders, 1); + player->AddItem(trinkett, 2); + player->AddItem(ring, 1); + player->AddItem(chest, 1); + player->AddItem(weapon, 1); + player->AddItem(weapon2, 1); + break; + case CLASS_ROGUE: + player->AddItem(shoulders, 1); + player->AddItem(trinkett, 2); + player->AddItem(ring, 1); + player->AddItem(chest, 1); + player->AddItem(weapon, 1); + player->AddItem(weapon2, 1); + break; + default: + player->AddItem(shoulders, 1); + player->AddItem(trinkett, 2); + player->AddItem(ring, 1); + player->AddItem(chest, 1); + player->AddItem(weapon, 1); + } + } +}; + +void AddSC_Player_Boa() +{ + new Player_Boa(); +} \ No newline at end of file diff --git a/login_reset.cpp b/login_reset.cpp new file mode 100644 index 0000000..4232d21 --- /dev/null +++ b/login_reset.cpp @@ -0,0 +1,28 @@ +//script made by SymbolixDEV +class login_script : public PlayerScript +{ +public: + login_script() : PlayerScript("login_script") { } + + void OnLogin(Player* player, bool) + { + std::string msg; + if (player->GetSession()->GetSecurity() != SEC_PLAYER) + msg = "[GM]:"; + else + msg = "[PLAYER]:"; + msg += player->GetName()+" has logged in!"; + sWorld->SendGlobalText(msg.c_str(), NULL); + player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA)); // set max mana + player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY)); //set max rogue/druid enery go on login! + player->SetPower(POWER_RAGE, player->GetMaxPower(POWER_RAGE)); //set max warrior rage on login! + player->SetPower(POWER_RUNIC_POWER, player->GetMaxPower(POWER_RUNIC_POWER)); //set max runic power on Death Knight on login! + player->SetFullHealth(); // set max health on login on game ! + player->GetSpellHistory()->ResetAllCooldowns(); //reset cooldowns on login! + } +}; + +void AddSC_login_script() +{ + new login_script(); +} \ No newline at end of file diff --git a/monturas.cpp b/monturas.cpp new file mode 100644 index 0000000..f635387 --- /dev/null +++ b/monturas.cpp @@ -0,0 +1,193 @@ +#include "ScriptPCH.h" + +class npc_monturas_km : public CreatureScript +{ + public: + npc_monturas_km() : CreatureScript("npc_monturas_km") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t White Polar Bear (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 39); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Sable de Hielo (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 40); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Gran Oso de Batalla (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 41); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Corcel Celestial (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 42); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Swift Magic Broom (500 PvP Tokens)", GOSSIP_SENDER_MAIN, 43); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Raven Lord (500 PVP Tokens)", GOSSIP_SENDER_MAIN, 44); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Amani War Bear (500 PvP Tokens)", GOSSIP_SENDER_MAIN, 45); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Wooly White Rhino (750 PvP Tokens)", GOSSIP_SENDER_MAIN, 46); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Magic Rooster Egg (750 PVP Tokens)", GOSSIP_SENDER_MAIN, 47); + pPlayer->ADD_GOSSIP_ITEM(7, "|TInterface/ICONS/achievement_reputation_kirintor:30|t Tallstrider Egg (750 PvP Tokens)", GOSSIP_SENDER_MAIN, 48); + pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!pPlayer) + return true; + + switch (uiAction) + { + { + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + pPlayer->AddItem(43962, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the White Polar Bear", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 40: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + pPlayer->AddItem(12302, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Ancient Frostsaber", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 41: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + pPlayer->AddItem(38576, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Big Battle Bear", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 42: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + pPlayer->AddItem(49290, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Celestial Steed", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 43: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + pPlayer->AddItem(33184, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Swift Magic Broom", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 44: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + pPlayer->AddItem(32768, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Raven Lord.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 45: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + pPlayer->AddItem(33809, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Amani War Bear", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 46: + if (pPlayer->HasItemCount(29434, 750, true)) + { + pPlayer->DestroyItemCount(29434, 750, true); + pPlayer->AddItem(54068, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Wooly White Rhino", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 47: + if (pPlayer->HasItemCount(29434, 750, true)) + { + pPlayer->DestroyItemCount(29434, 750, true); + pPlayer->AddItem(46778, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Magic Rooster Egg", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 48: + if (pPlayer->HasItemCount(29434, 750, true)) + { + pPlayer->DestroyItemCount(29434, 750, true); + pPlayer->AddItem(121777, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido the Tallstrider Egg", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + } + return true; + } + } + +}; + +void AddSC_npc_monturas_km() +{ + new npc_monturas_km(); +} \ No newline at end of file diff --git a/monturasenpjs.cpp b/monturasenpjs.cpp new file mode 100644 index 0000000..3a52041 --- /dev/null +++ b/monturasenpjs.cpp @@ -0,0 +1,54 @@ +#include + +class AccountMounts : public PlayerScript +{ + static const bool limitrace = false; // This set to true will only learn mounts from chars on the same team, do what you want. +public: + AccountMounts() : PlayerScript("AccountMounts") { } + + void OnLogin(Player* pPlayer, bool firstLogin) + { + std::vector Guids; + QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId()); + if (!result1) + return; + + do + { + Field* fields = result1->Fetch(); + + uint32 guid = fields[0].GetUInt32(); + uint32 race = fields[1].GetUInt8(); + + if ((Player::TeamForRace(race) == Player::TeamForRace(pPlayer->getRace())) || !limitrace) + Guids.push_back(result1->Fetch()[0].GetUInt32()); + + } while (result1->NextRow()); + + std::vector Spells; + + for (auto& i : Guids) + { + QueryResult result2 = CharacterDatabase.PQuery("SELECT spell FROM character_spell WHERE guid = %u", i); + if (!result2) + continue; + + do + { + Spells.push_back(result2->Fetch()[0].GetUInt32()); + } while (result2->NextRow()); + } + + for (auto& i : Spells) + { + auto sSpell = sSpellStore.LookupEntry(i); + if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED) + pPlayer->LearnSpell(sSpell->Id, false); + } + } +}; + +void AddSC_accontmounts() +{ + new AccountMounts; +} \ No newline at end of file diff --git a/morphs.cpp b/morphs.cpp new file mode 100644 index 0000000..1ed598c --- /dev/null +++ b/morphs.cpp @@ -0,0 +1,340 @@ +#include "ScriptPCH.h" + +class npc_morphs_km : public CreatureScript +{ + public: + npc_morphs_km() : CreatureScript("npc_morphs_km") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Blood Elf Female (3 Tokens)", GOSSIP_SENDER_MAIN, 4); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Blood Elf Male (3 Tokens)", GOSSIP_SENDER_MAIN, 5); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Gnome Female (3 Tokens)", GOSSIP_SENDER_MAIN, 6); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Gnome Male (3 Tokens)", GOSSIP_SENDER_MAIN, 7); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Human Female (3 Tokens)", GOSSIP_SENDER_MAIN, 8); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Human Male (3 Tokens)", GOSSIP_SENDER_MAIN, 9); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Tauren Female (3 Tokens)", GOSSIP_SENDER_MAIN, 10); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Tauren Male (3 Tokens)", GOSSIP_SENDER_MAIN, 11); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Undead Pirate (5 Tokens)", GOSSIP_SENDER_MAIN, 12); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Etherial (5 Tokens)", GOSSIP_SENDER_MAIN, 13); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Mad Scientist (5 Tokens)", GOSSIP_SENDER_MAIN, 14); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Tatooed Man (5 Tokens)", GOSSIP_SENDER_MAIN, 15); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Necromancer (5 Tokens)", GOSSIP_SENDER_MAIN, 16); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Skeletal Mago (5 Tokens)", GOSSIP_SENDER_MAIN, 17); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Frost Troll (5 Tokens)", GOSSIP_SENDER_MAIN, 18); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Blood Elf Demon Girl (5 Tokens)", GOSSIP_SENDER_MAIN, 19); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Human 19 Twink (5 Tokens)", GOSSIP_SENDER_MAIN, 20); + pPlayer->ADD_GOSSIP_ITEM(8, "|TInterface/ICONS/achievement_boss_anomalus:30|t Undead 19 Twink (5 Tokens)", GOSSIP_SENDER_MAIN, 21); + pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!pPlayer) + return true; + + switch (uiAction) + { + { + case 4: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20370); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Female Blood Elf.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 5: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20369); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Male Blood Elf.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 6: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20320); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Gnome Female.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 7: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20580); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Gnome Male.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 8: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(19724); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Human Female.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 9: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(19723); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Human Male.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 10: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20584); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Tauren Female.", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 11: + if (pPlayer->HasItemCount(29434, 3, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(20319); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Tauren Male", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 12: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 3, true); + pPlayer->SetDisplayId(25042); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Undead Pirate", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 13: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(24942); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Etherial", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 14: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(23875); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Mad Scientist", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 15: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(22634); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Tattooed Man", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 16: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(24793); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Necromancer", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 17: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(24495); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.7f); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Skeletal Mage", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 18: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(24938); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Frost Troll", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 19: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(24930); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en BELF Demon Girl", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 20: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(29796); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Human 19 Twink", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 21: + if (pPlayer->HasItemCount(29434, 5, true)) + { + pPlayer->DestroyItemCount(29434, 5, true); + pPlayer->SetDisplayId(29795); + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted ha sido transformado en Undead 19 Twink", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + } + return true; + } + } + +}; + +void AddSC_npc_morphs_km() +{ + new npc_morphs_km(); +} \ No newline at end of file diff --git a/npc_beastmaster.cpp b/npc_beastmaster.cpp new file mode 100644 index 0000000..282c4b2 --- /dev/null +++ b/npc_beastmaster.cpp @@ -0,0 +1,1622 @@ +#include "ScriptPCH.h" +#include "Pet.h" + +class Npc_Beastmaster : public CreatureScript +{ +public: + Npc_Beastmaster() : CreatureScript("Npc_Beastmaster") { } + + void CreatePet(Player *player, Creature * m_creature, uint32 entry) { + + if(player->getClass() != CLASS_HUNTER) { + ChatHandler(player->GetSession()).PSendSysMessage("Tu no eres cazador!."); + player->PlayerTalkClass->SendCloseGossip(); + return; + } + + if(player->GetPet()) { + ChatHandler(player->GetSession()).PSendSysMessage("Primero debes dejar tu mascota!."); + player->PlayerTalkClass->SendCloseGossip(); + return; + } + + Creature *creatureTarget = m_creature->SummonCreature(entry, player->GetPositionX(), player->GetPositionY()+2, player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 500); + if(!creatureTarget) return; + + Pet* pet = player->CreateTamedPetFrom(creatureTarget, 0); + if(!pet) return; + + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view + + pet->SetPower(POWER_HAPPINESS, 1048000); + + pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction()); + + pet->SetUInt32Value(UNIT_FIELD_LEVEL, player->getLevel() - 1); + pet->GetMap()->AddToMap(pet->ToCreature()); + + pet->SetUInt32Value(UNIT_FIELD_LEVEL, player->getLevel()); + + pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true); + if(!pet->InitStatsForLevel(player->getLevel())) + + pet->UpdateAllStats(); + + player->SetMinion(pet, true); + + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + pet->InitTalentForLevel(); + player->PetSpellInitialize(); + + player->PlayerTalkClass->SendCloseGossip(); + ChatHandler(player->GetSession()).PSendSysMessage("|TInterface/ICONS/inv_misc_pet_04:18|t Pet obtenida!."); + } + + + bool OnGossipHello(Player *player, Creature * m_creature) + { + + if(player->getClass() != CLASS_HUNTER) + { + ChatHandler(player->GetSession()).PSendSysMessage("Debes ser cazador."); + return true; + } + player->ADD_GOSSIP_ITEM(7, "Obtener una nueva mascota.", GOSSIP_SENDER_MAIN, 1000); + if (player->CanTameExoticPets()) + { + player->ADD_GOSSIP_ITEM(7, "Obtener una nueva mascota exótica.", GOSSIP_SENDER_MAIN, 50); + } + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); + switch (action) + { + + case 100: + player->ADD_GOSSIP_ITEM(7, "Obtener una nueva mascota.", GOSSIP_SENDER_MAIN, 1000); + if (player->CanTameExoticPets()) + { + player->ADD_GOSSIP_ITEM(7, "Obtener una nueva mascota exótica.", GOSSIP_SENDER_MAIN, 50); + } + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1000: // Submenu + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(5, "[Siguiente Página] ->", GOSSIP_SENDER_MAIN, 10000); + player->ADD_GOSSIP_ITEM(4, "Domar Bat!", GOSSIP_SENDER_MAIN, 1001); + player->ADD_GOSSIP_ITEM(4, "Domar Bear!", GOSSIP_SENDER_MAIN, 1002); + player->ADD_GOSSIP_ITEM(4, "Domar Bird of Prey!", GOSSIP_SENDER_MAIN, 1003); + player->ADD_GOSSIP_ITEM(4, "Domar Boar!", GOSSIP_SENDER_MAIN, 1004); + player->ADD_GOSSIP_ITEM(4, "Domar Carrion Bird!", GOSSIP_SENDER_MAIN, 1005); + player->ADD_GOSSIP_ITEM(4, "Domar Cat!", GOSSIP_SENDER_MAIN, 1006); + player->ADD_GOSSIP_ITEM(4, "Domar Crab!", GOSSIP_SENDER_MAIN, 1007); + player->ADD_GOSSIP_ITEM(4, "Domar Crocolisk!", GOSSIP_SENDER_MAIN, 1008); + player->ADD_GOSSIP_ITEM(4, "Domar Dragonhawk!", GOSSIP_SENDER_MAIN, 1009); + player->ADD_GOSSIP_ITEM(4, "Domar Gorilla!", GOSSIP_SENDER_MAIN, 1010); + player->ADD_GOSSIP_ITEM(4, "Domar Hyena!", GOSSIP_SENDER_MAIN, 1011); + player->ADD_GOSSIP_ITEM(4, "Domar Moth!", GOSSIP_SENDER_MAIN, 1012); + player->ADD_GOSSIP_ITEM(4, "Domar Nether Ray!", GOSSIP_SENDER_MAIN, 1013); + player->ADD_GOSSIP_ITEM(4, "Domar Raptor!", GOSSIP_SENDER_MAIN, 1014); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 10000: // Submenu + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(5, "<- [Menú anterior]", GOSSIP_SENDER_MAIN, 1000); + player->ADD_GOSSIP_ITEM(4, "Domar Ravager!", GOSSIP_SENDER_MAIN, 1015); + player->ADD_GOSSIP_ITEM(4, "Domar Scorpid!", GOSSIP_SENDER_MAIN, 1016); + player->ADD_GOSSIP_ITEM(4, "Domar Serpent!", GOSSIP_SENDER_MAIN, 1017); + player->ADD_GOSSIP_ITEM(4, "Domar Spider!", GOSSIP_SENDER_MAIN, 1018); + player->ADD_GOSSIP_ITEM(4, "Domar Sporebat!", GOSSIP_SENDER_MAIN, 1019); + player->ADD_GOSSIP_ITEM(4, "Domar Tallstrider!", GOSSIP_SENDER_MAIN, 1020); + player->ADD_GOSSIP_ITEM(4, "Domar Turtle!", GOSSIP_SENDER_MAIN, 1021); + player->ADD_GOSSIP_ITEM(4, "Domar Warpstalker!", GOSSIP_SENDER_MAIN, 1022); + player->ADD_GOSSIP_ITEM(4, "Domar Windserpent!", GOSSIP_SENDER_MAIN, 1023); + player->ADD_GOSSIP_ITEM(4, "Domar Wolf!", GOSSIP_SENDER_MAIN, 1024); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1001: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Brown Bat", GOSSIP_SENDER_MAIN, 1); + player->ADD_GOSSIP_ITEM(6, "Red Bat", GOSSIP_SENDER_MAIN, 2); + player->ADD_GOSSIP_ITEM(6, "Tan Bat", GOSSIP_SENDER_MAIN, 283); + player->ADD_GOSSIP_ITEM(6, "White Bat", GOSSIP_SENDER_MAIN, 4); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1002: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Bear", GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM(6, "Brown Bear", GOSSIP_SENDER_MAIN, 9); + player->ADD_GOSSIP_ITEM(6, "Dark Brown Bear", GOSSIP_SENDER_MAIN, 10); + player->ADD_GOSSIP_ITEM(6, "Grey Bear", GOSSIP_SENDER_MAIN, 11); + player->ADD_GOSSIP_ITEM(6, "White Bear", GOSSIP_SENDER_MAIN, 12); + player->ADD_GOSSIP_ITEM(6, "Diseased Black Bear", GOSSIP_SENDER_MAIN, 13); + player->ADD_GOSSIP_ITEM(6, "Diseased Brown Bear", GOSSIP_SENDER_MAIN, 284); + player->ADD_GOSSIP_ITEM(6, "Diseased Dark Brown Bear", GOSSIP_SENDER_MAIN, 282); + player->ADD_GOSSIP_ITEM(6, "Diseased White Bear", GOSSIP_SENDER_MAIN, 17); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1003: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Owl", GOSSIP_SENDER_MAIN, 18); + player->ADD_GOSSIP_ITEM(6, "Brown Owl", GOSSIP_SENDER_MAIN, 19); + player->ADD_GOSSIP_ITEM(6, "Dark Brown Owl", GOSSIP_SENDER_MAIN, 20); + player->ADD_GOSSIP_ITEM(6, "Green Owl", GOSSIP_SENDER_MAIN, 21); + player->ADD_GOSSIP_ITEM(6, "Grey Owl", GOSSIP_SENDER_MAIN, 22); + player->ADD_GOSSIP_ITEM(6, "Red/Purple Owl", GOSSIP_SENDER_MAIN, 23); + player->ADD_GOSSIP_ITEM(6, "Red Owl", GOSSIP_SENDER_MAIN, 24); + player->ADD_GOSSIP_ITEM(6, "White Owl", GOSSIP_SENDER_MAIN, 25); + player->ADD_GOSSIP_ITEM(4, "[Siguiente Página] ->", GOSSIP_SENDER_MAIN, 10003); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 10003: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "<- [Previous Page]", GOSSIP_SENDER_MAIN, 1003); + player->ADD_GOSSIP_ITEM(6, "Bald Eagle", GOSSIP_SENDER_MAIN, 29); + player->ADD_GOSSIP_ITEM(6, "Brown Eagle", GOSSIP_SENDER_MAIN, 30); + player->ADD_GOSSIP_ITEM(6, "White Eagle", GOSSIP_SENDER_MAIN, 32); + player->ADD_GOSSIP_ITEM(6, "Black Hawk", GOSSIP_SENDER_MAIN, 33); + player->ADD_GOSSIP_ITEM(6, "Brown Hawk", GOSSIP_SENDER_MAIN, 34); + player->ADD_GOSSIP_ITEM(6, "Blue Parrot", GOSSIP_SENDER_MAIN, 35); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1004: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Boar", GOSSIP_SENDER_MAIN, 37); + player->ADD_GOSSIP_ITEM(6, "Brown Boar", GOSSIP_SENDER_MAIN, 38); + player->ADD_GOSSIP_ITEM(6, "Grey Boar", GOSSIP_SENDER_MAIN, 39); + player->ADD_GOSSIP_ITEM(6, "Red Boar", GOSSIP_SENDER_MAIN, 40); + player->ADD_GOSSIP_ITEM(6, "Undead Boar", GOSSIP_SENDER_MAIN, 41); + player->ADD_GOSSIP_ITEM(6, "Yellow Boar", GOSSIP_SENDER_MAIN, 42); + player->ADD_GOSSIP_ITEM(6, "Armored Black Boar", GOSSIP_SENDER_MAIN, 43); + player->ADD_GOSSIP_ITEM(6, "Armored Brown Boar", GOSSIP_SENDER_MAIN, 44); + player->ADD_GOSSIP_ITEM(6, "Armored Ghostly Boar", GOSSIP_SENDER_MAIN, 45); + player->ADD_GOSSIP_ITEM(6, "Armored Grey Boar", GOSSIP_SENDER_MAIN, 46); + player->ADD_GOSSIP_ITEM(6, "Black/Green Felboar", GOSSIP_SENDER_MAIN, 47); + player->ADD_GOSSIP_ITEM(6, "Blue/White Felboar", GOSSIP_SENDER_MAIN, 48); + player->ADD_GOSSIP_ITEM(6, "Grey/Orange Felboar", GOSSIP_SENDER_MAIN, 49); + player->ADD_GOSSIP_ITEM(6, "Red/Black Felboar", GOSSIP_SENDER_MAIN, 51); + player->ADD_GOSSIP_ITEM(6, "Yellow/Black Felboar", GOSSIP_SENDER_MAIN, 52); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1005: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Vulture", GOSSIP_SENDER_MAIN, 53); + player->ADD_GOSSIP_ITEM(6, "Brown Vulture", GOSSIP_SENDER_MAIN, 54); + player->ADD_GOSSIP_ITEM(6, "Red Vulture", GOSSIP_SENDER_MAIN, 55); + player->ADD_GOSSIP_ITEM(6, "Black Vulture", GOSSIP_SENDER_MAIN, 56); + player->ADD_GOSSIP_ITEM(6, "White Vulture", GOSSIP_SENDER_MAIN, 57); + player->ADD_GOSSIP_ITEM(6, "Ghostly Blue Two-Headed Vulture", GOSSIP_SENDER_MAIN, 58); + player->ADD_GOSSIP_ITEM(6, "Blue Two-Headed Vulture", GOSSIP_SENDER_MAIN, 59); + player->ADD_GOSSIP_ITEM(6, "Green Two-Headed Vulture", GOSSIP_SENDER_MAIN, 60); + player->ADD_GOSSIP_ITEM(6, "White Two-Headed Vulture", GOSSIP_SENDER_MAIN, 5); + player->ADD_GOSSIP_ITEM(6, "Red Two-Headed Vulture", GOSSIP_SENDER_MAIN, 61); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1006: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "[Siguiente Página] ->", GOSSIP_SENDER_MAIN, 10006); + player->ADD_GOSSIP_ITEM(6, "Black Cat", GOSSIP_SENDER_MAIN, 62); + player->ADD_GOSSIP_ITEM(6, "Black Spotted Cat", GOSSIP_SENDER_MAIN, 63); + player->ADD_GOSSIP_ITEM(6, "Black Striped Cat", GOSSIP_SENDER_MAIN, 64); + player->ADD_GOSSIP_ITEM(6, "Brown Cat", GOSSIP_SENDER_MAIN, 65); + player->ADD_GOSSIP_ITEM(6, "Dark Striped Cat", GOSSIP_SENDER_MAIN, 66); + player->ADD_GOSSIP_ITEM(6, "Orange Spotted Cat", GOSSIP_SENDER_MAIN, 67); + player->ADD_GOSSIP_ITEM(6, "Orange Striped Cat", GOSSIP_SENDER_MAIN, 68); + player->ADD_GOSSIP_ITEM(6, "Ghost Cat", GOSSIP_SENDER_MAIN, 69); + player->ADD_GOSSIP_ITEM(6, "White Cat", GOSSIP_SENDER_MAIN, 70); + player->ADD_GOSSIP_ITEM(6, "White Spotted Cat", GOSSIP_SENDER_MAIN, 71); + player->ADD_GOSSIP_ITEM(6, "White Stripped Cat", GOSSIP_SENDER_MAIN, 72); + player->ADD_GOSSIP_ITEM(6, "Aqua Sabercat", GOSSIP_SENDER_MAIN, 73); + player->ADD_GOSSIP_ITEM(6, "White Stripped Saber Cat", GOSSIP_SENDER_MAIN, 74); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 10006: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "<- [Previous Page]", GOSSIP_SENDER_MAIN, 1006); + player->ADD_GOSSIP_ITEM(6, "Dark Striped Sabercat", GOSSIP_SENDER_MAIN, 75); + player->ADD_GOSSIP_ITEM(6, "Lavender Sabercat", GOSSIP_SENDER_MAIN, 76); + player->ADD_GOSSIP_ITEM(6, "Orange Spotted Sabercat", GOSSIP_SENDER_MAIN, 77); + player->ADD_GOSSIP_ITEM(6, "Oranged Striped Sabercat", GOSSIP_SENDER_MAIN, 78); + player->ADD_GOSSIP_ITEM(6, "Brown Lynx", GOSSIP_SENDER_MAIN, 79); + player->ADD_GOSSIP_ITEM(6, "Red Lynx", GOSSIP_SENDER_MAIN, 80); + player->ADD_GOSSIP_ITEM(6, "Black Lion", GOSSIP_SENDER_MAIN, 81); + player->ADD_GOSSIP_ITEM(6, "Gold Lion", GOSSIP_SENDER_MAIN, 82); + player->ADD_GOSSIP_ITEM(6, "Lioness", GOSSIP_SENDER_MAIN, 83); + player->ADD_GOSSIP_ITEM(6, "White Lion", GOSSIP_SENDER_MAIN, 84); + player->ADD_GOSSIP_ITEM(6, "Hunched Black Gem Cat", GOSSIP_SENDER_MAIN, 85); + player->ADD_GOSSIP_ITEM(6, "Hunched Black Spotted Cat", GOSSIP_SENDER_MAIN, 86); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1007: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Crab", GOSSIP_SENDER_MAIN, 87); + player->ADD_GOSSIP_ITEM(6, "Bronze Crab", GOSSIP_SENDER_MAIN, 88); + player->ADD_GOSSIP_ITEM(6, "Red Crab", GOSSIP_SENDER_MAIN, 89); + player->ADD_GOSSIP_ITEM(6, "White Crab", GOSSIP_SENDER_MAIN, 90); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1008: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Green Crocolisk", GOSSIP_SENDER_MAIN, 91); + player->ADD_GOSSIP_ITEM(6, "Grey Crocolisk", GOSSIP_SENDER_MAIN, 92); + player->ADD_GOSSIP_ITEM(6, "White Crocolisk", GOSSIP_SENDER_MAIN, 93); + player->ADD_GOSSIP_ITEM(6, "Yellow Crocolisk", GOSSIP_SENDER_MAIN, 94); + player->ADD_GOSSIP_ITEM(6, "Ghostly Hydra", GOSSIP_SENDER_MAIN, 96); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1009: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Dragonhawk", GOSSIP_SENDER_MAIN, 97); + player->ADD_GOSSIP_ITEM(6, "Orange/Red Dragonhawk", GOSSIP_SENDER_MAIN, 98); + player->ADD_GOSSIP_ITEM(6, "Orange Dragonhawk", GOSSIP_SENDER_MAIN, 99); + player->ADD_GOSSIP_ITEM(6, "Red Dragonhawk", GOSSIP_SENDER_MAIN, 101); + player->ADD_GOSSIP_ITEM(6, "Violet Dragonhawk", GOSSIP_SENDER_MAIN, 102); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1010: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Gorilla", GOSSIP_SENDER_MAIN, 103); + player->ADD_GOSSIP_ITEM(6, "Dark Grey Gorilla", GOSSIP_SENDER_MAIN, 104); + player->ADD_GOSSIP_ITEM(6, "Grey Gorilla", GOSSIP_SENDER_MAIN, 105); + player->ADD_GOSSIP_ITEM(6, "Red Gorilla", GOSSIP_SENDER_MAIN, 106); + player->ADD_GOSSIP_ITEM(6, "White Gorilla", GOSSIP_SENDER_MAIN, 107); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1011: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Brown Hyena", GOSSIP_SENDER_MAIN, 108); + player->ADD_GOSSIP_ITEM(6, "Grey Hyena", GOSSIP_SENDER_MAIN, 109); + player->ADD_GOSSIP_ITEM(6, "Orange Hyena", GOSSIP_SENDER_MAIN, 110); + player->ADD_GOSSIP_ITEM(6, "Purple Hyena", GOSSIP_SENDER_MAIN, 111); + player->ADD_GOSSIP_ITEM(6, "Yellow Hyena", GOSSIP_SENDER_MAIN, 112); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1012: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Beige Moth", GOSSIP_SENDER_MAIN, 114); + player->ADD_GOSSIP_ITEM(6, "Blue/Yellow Moth", GOSSIP_SENDER_MAIN, 115); + player->ADD_GOSSIP_ITEM(6, "Blue Moth", GOSSIP_SENDER_MAIN, 116); + player->ADD_GOSSIP_ITEM(6, "Green Moth", GOSSIP_SENDER_MAIN, 117); + player->ADD_GOSSIP_ITEM(6, "Tan Moth", GOSSIP_SENDER_MAIN, 118); + player->ADD_GOSSIP_ITEM(6, "White Moth", GOSSIP_SENDER_MAIN, 119); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1013: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Nether Ray", GOSSIP_SENDER_MAIN, 120); + player->ADD_GOSSIP_ITEM(6, "Gold Nether Ray", GOSSIP_SENDER_MAIN, 121); + player->ADD_GOSSIP_ITEM(6, "Green Nether Ray", GOSSIP_SENDER_MAIN, 122); + player->ADD_GOSSIP_ITEM(6, "Purple Nether Ray", GOSSIP_SENDER_MAIN, 123); + player->ADD_GOSSIP_ITEM(6, "Red Nether Ray", GOSSIP_SENDER_MAIN, 124); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1014: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Raptor", GOSSIP_SENDER_MAIN, 125); + player->ADD_GOSSIP_ITEM(6, "Blue Raptor", GOSSIP_SENDER_MAIN, 126); + player->ADD_GOSSIP_ITEM(6, "Green Raptor", GOSSIP_SENDER_MAIN, 127); + player->ADD_GOSSIP_ITEM(6, "Grey Raptor", GOSSIP_SENDER_MAIN, 128); + player->ADD_GOSSIP_ITEM(6, "Orange Raptor", GOSSIP_SENDER_MAIN, 129); + player->ADD_GOSSIP_ITEM(6, "Purple Raptor", GOSSIP_SENDER_MAIN, 130); + player->ADD_GOSSIP_ITEM(6, "Red Raptor", GOSSIP_SENDER_MAIN, 131); + player->ADD_GOSSIP_ITEM(6, "Yellow Raptor", GOSSIP_SENDER_MAIN, 132); + player->ADD_GOSSIP_ITEM(6, "Spiked Black Raptor", GOSSIP_SENDER_MAIN, 133); + player->ADD_GOSSIP_ITEM(6, "Spiked Blue Raptor", GOSSIP_SENDER_MAIN, 134); + player->ADD_GOSSIP_ITEM(6, "Spiked Brown Raptor", GOSSIP_SENDER_MAIN, 135); + player->ADD_GOSSIP_ITEM(6, "Spiked Green Raptor", GOSSIP_SENDER_MAIN, 136); + player->ADD_GOSSIP_ITEM(6, "Spiked Red Raptor", GOSSIP_SENDER_MAIN, 137); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1015: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Spiked Orange", GOSSIP_SENDER_MAIN, 138); + player->ADD_GOSSIP_ITEM(6, "Green/Purple Ravager", GOSSIP_SENDER_MAIN, 141); + player->ADD_GOSSIP_ITEM(6, "Green Ravager", GOSSIP_SENDER_MAIN, 142); + player->ADD_GOSSIP_ITEM(6, "Orange/Black Ravager", GOSSIP_SENDER_MAIN, 143); + player->ADD_GOSSIP_ITEM(6, "Orange/Purple Ravager", GOSSIP_SENDER_MAIN, 144); + player->ADD_GOSSIP_ITEM(6, "Orange Ravager", GOSSIP_SENDER_MAIN, 146); + player->ADD_GOSSIP_ITEM(6, "Red/Black Ravager", GOSSIP_SENDER_MAIN, 147); + player->ADD_GOSSIP_ITEM(6, "Spiked Dark Green Ravager", GOSSIP_SENDER_MAIN, 281); + player->ADD_GOSSIP_ITEM(6, "Spiked Purple Ravager", GOSSIP_SENDER_MAIN, 151); + player->ADD_GOSSIP_ITEM(6, "Spiked Red Ravager", GOSSIP_SENDER_MAIN, 152); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1016: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Scorpid", GOSSIP_SENDER_MAIN, 153); + player->ADD_GOSSIP_ITEM(6, "Bronze Scorpid", GOSSIP_SENDER_MAIN, 154); + player->ADD_GOSSIP_ITEM(6, "Brown Scorpid", GOSSIP_SENDER_MAIN, 155); + player->ADD_GOSSIP_ITEM(6, "Pink Scorpid", GOSSIP_SENDER_MAIN, 156); + player->ADD_GOSSIP_ITEM(6, "Red Scorpid", GOSSIP_SENDER_MAIN, 157); + player->ADD_GOSSIP_ITEM(6, "Yellow Scorpid", GOSSIP_SENDER_MAIN, 158); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1017: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Serpent", GOSSIP_SENDER_MAIN, 159); + player->ADD_GOSSIP_ITEM(6, "Teal Serpent", GOSSIP_SENDER_MAIN, 160); + player->ADD_GOSSIP_ITEM(6, "Brown Serpent", GOSSIP_SENDER_MAIN, 161); + player->ADD_GOSSIP_ITEM(6, "Purple Serpent", GOSSIP_SENDER_MAIN, 163); + player->ADD_GOSSIP_ITEM(6, "White Serpent", GOSSIP_SENDER_MAIN, 165); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1018: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "[Siguiente Página] ->", GOSSIP_SENDER_MAIN, 10018); + player->ADD_GOSSIP_ITEM(6, "Black Widow Spider", GOSSIP_SENDER_MAIN, 166); + player->ADD_GOSSIP_ITEM(6, "Crystal Spider", GOSSIP_SENDER_MAIN, 167); + player->ADD_GOSSIP_ITEM(6, "Green Spider", GOSSIP_SENDER_MAIN, 168); + player->ADD_GOSSIP_ITEM(6, "Grey Spider", GOSSIP_SENDER_MAIN, 169); + player->ADD_GOSSIP_ITEM(6, "Jungle Spider", GOSSIP_SENDER_MAIN, 170); + player->ADD_GOSSIP_ITEM(6, "Olive Spider", GOSSIP_SENDER_MAIN, 171); + player->ADD_GOSSIP_ITEM(6, "Purple Spider", GOSSIP_SENDER_MAIN, 172); + player->ADD_GOSSIP_ITEM(6, "Red Spider", GOSSIP_SENDER_MAIN, 173); + player->ADD_GOSSIP_ITEM(6, "Tan Spider", GOSSIP_SENDER_MAIN, 174); + player->ADD_GOSSIP_ITEM(6, "Spiked Orange/Black Spider", GOSSIP_SENDER_MAIN, 175); + player->ADD_GOSSIP_ITEM(6, "Spiked Red/Black Spider", GOSSIP_SENDER_MAIN, 176); + player->ADD_GOSSIP_ITEM(6, "Spiked Red/Yellow Spider", GOSSIP_SENDER_MAIN, 177); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 10018: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "<- [Previous Page]", GOSSIP_SENDER_MAIN, 1018); + player->ADD_GOSSIP_ITEM(6, "Light Grey Bone Spider", GOSSIP_SENDER_MAIN, 178); + player->ADD_GOSSIP_ITEM(6, "Green Tarantula", GOSSIP_SENDER_MAIN, 179); + player->ADD_GOSSIP_ITEM(6, "Grey Tarantula", GOSSIP_SENDER_MAIN, 180); + player->ADD_GOSSIP_ITEM(6, "Lava Tarantula", GOSSIP_SENDER_MAIN, 181); + player->ADD_GOSSIP_ITEM(6, "Orange Tarantula", GOSSIP_SENDER_MAIN, 182); + player->ADD_GOSSIP_ITEM(6, "Red Tarantula", GOSSIP_SENDER_MAIN, 183); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1019: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Sporebat", GOSSIP_SENDER_MAIN, 184); + player->ADD_GOSSIP_ITEM(6, "Brown Sporebat", GOSSIP_SENDER_MAIN, 185); + player->ADD_GOSSIP_ITEM(6, "Green Sporebat", GOSSIP_SENDER_MAIN, 186); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1020: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Brown Tallstrider", GOSSIP_SENDER_MAIN, 187); + player->ADD_GOSSIP_ITEM(6, "Grey Tallstrider", GOSSIP_SENDER_MAIN, 188); + player->ADD_GOSSIP_ITEM(6, "Pink Tallstrider", GOSSIP_SENDER_MAIN, 189); + player->ADD_GOSSIP_ITEM(6, "Purple Tallstrider", GOSSIP_SENDER_MAIN, 190); + player->ADD_GOSSIP_ITEM(6, "Turquoise Tallstrider", GOSSIP_SENDER_MAIN, 191); + player->ADD_GOSSIP_ITEM(6, "White Tallstrider", GOSSIP_SENDER_MAIN, 192); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1021: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Turtle", GOSSIP_SENDER_MAIN, 193); + player->ADD_GOSSIP_ITEM(6, "Green Turtle", GOSSIP_SENDER_MAIN, 194); + player->ADD_GOSSIP_ITEM(6, "Grey Turtle", GOSSIP_SENDER_MAIN, 195); + player->ADD_GOSSIP_ITEM(6, "Orange Turtle", GOSSIP_SENDER_MAIN, 196); + player->ADD_GOSSIP_ITEM(6, "White Turtle", GOSSIP_SENDER_MAIN, 197); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1022: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Warpstalker", GOSSIP_SENDER_MAIN, 198); + player->ADD_GOSSIP_ITEM(6, "Blue/Green Warpstalker", GOSSIP_SENDER_MAIN, 199); + player->ADD_GOSSIP_ITEM(6, "Green Warpstalker", GOSSIP_SENDER_MAIN, 200); + player->ADD_GOSSIP_ITEM(6, "Red Warpstalker", GOSSIP_SENDER_MAIN, 201); + player->ADD_GOSSIP_ITEM(6, "White Warpstaler", GOSSIP_SENDER_MAIN, 202); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1023: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Windserpent", GOSSIP_SENDER_MAIN, 203); + player->ADD_GOSSIP_ITEM(6, "Green Windserpent", GOSSIP_SENDER_MAIN, 204); + player->ADD_GOSSIP_ITEM(6, "Orange Windserpent", GOSSIP_SENDER_MAIN, 205); + player->ADD_GOSSIP_ITEM(6, "Red Windserpent", GOSSIP_SENDER_MAIN, 206); + player->ADD_GOSSIP_ITEM(6, "White Windserpent", GOSSIP_SENDER_MAIN, 207); + player->ADD_GOSSIP_ITEM(6, "Yellow Windserpent", GOSSIP_SENDER_MAIN, 208); + player->ADD_GOSSIP_ITEM(6, "Spiked Blue Windserpent", GOSSIP_SENDER_MAIN, 209); + player->ADD_GOSSIP_ITEM(6, "Spiked Green Windserpent", GOSSIP_SENDER_MAIN, 210); + player->ADD_GOSSIP_ITEM(6, "Spiked Grey Windserpent", GOSSIP_SENDER_MAIN, 211); + player->ADD_GOSSIP_ITEM(6, "Spiked Red Windserpent", GOSSIP_SENDER_MAIN, 212); + player->ADD_GOSSIP_ITEM(6, "Spiked White Windserpent", GOSSIP_SENDER_MAIN, 213); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1024: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "[Siguiente Página] ->", GOSSIP_SENDER_MAIN, 10024); + player->ADD_GOSSIP_ITEM(6, "Black Wolf", GOSSIP_SENDER_MAIN, 214); + player->ADD_GOSSIP_ITEM(6, "Diseased Wolf", GOSSIP_SENDER_MAIN, 215); + player->ADD_GOSSIP_ITEM(6, "Ghost Wolf", GOSSIP_SENDER_MAIN, 216); + player->ADD_GOSSIP_ITEM(6, "Grey Wolf", GOSSIP_SENDER_MAIN, 217); + player->ADD_GOSSIP_ITEM(6, "Tan Wolf", GOSSIP_SENDER_MAIN, 218); + player->ADD_GOSSIP_ITEM(6, "White Wolf", GOSSIP_SENDER_MAIN, 219); + player->ADD_GOSSIP_ITEM(6, "Bicolour Worg", GOSSIP_SENDER_MAIN, 220); + player->ADD_GOSSIP_ITEM(6, "Black Worg", GOSSIP_SENDER_MAIN, 221); + player->ADD_GOSSIP_ITEM(6, "Brown Worg", GOSSIP_SENDER_MAIN, 222); + player->ADD_GOSSIP_ITEM(6, "Dark Grey Worg", GOSSIP_SENDER_MAIN, 223); + player->ADD_GOSSIP_ITEM(6, "Grey Worg", GOSSIP_SENDER_MAIN, 224); + player->ADD_GOSSIP_ITEM(6, "Red Worg", GOSSIP_SENDER_MAIN, 225); + player->ADD_GOSSIP_ITEM(6, "White Worg", GOSSIP_SENDER_MAIN, 226); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 10024: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(4, "<- [Previous Page]", GOSSIP_SENDER_MAIN, 1024); + player->ADD_GOSSIP_ITEM(6, "Black Saber Worg", GOSSIP_SENDER_MAIN, 227); + player->ADD_GOSSIP_ITEM(6, "Brown Saber Worg", GOSSIP_SENDER_MAIN, 228); + player->ADD_GOSSIP_ITEM(6, "Grey Saber Worg", GOSSIP_SENDER_MAIN, 229); + player->ADD_GOSSIP_ITEM(6, "White Saber Worg", GOSSIP_SENDER_MAIN, 230); + player->ADD_GOSSIP_ITEM(6, "Saddled Black Saber Worg", GOSSIP_SENDER_MAIN, 231); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + + case 50: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Chimaera", GOSSIP_SENDER_MAIN, 1025); + player->ADD_GOSSIP_ITEM(6, "Core Hound", GOSSIP_SENDER_MAIN, 1026); + player->ADD_GOSSIP_ITEM(6, "Devilsaur", GOSSIP_SENDER_MAIN, 1027); + player->ADD_GOSSIP_ITEM(6, "Rhino", GOSSIP_SENDER_MAIN, 1028); + player->ADD_GOSSIP_ITEM(6, "Silithid", GOSSIP_SENDER_MAIN, 1029); + player->ADD_GOSSIP_ITEM(6, "Worm", GOSSIP_SENDER_MAIN, 1030); + player->ADD_GOSSIP_ITEM(6, "Spirit Beast", GOSSIP_SENDER_MAIN, 1031); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1025: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Beige Chimaera", GOSSIP_SENDER_MAIN, 232); + player->ADD_GOSSIP_ITEM(6, "Green Chimaera", GOSSIP_SENDER_MAIN, 234); + player->ADD_GOSSIP_ITEM(6, "White Chimaera", GOSSIP_SENDER_MAIN, 235); + player->ADD_GOSSIP_ITEM(6, "Armored Green Chimaera", GOSSIP_SENDER_MAIN, 236); + player->ADD_GOSSIP_ITEM(6, "Armored Purple Chimaera", GOSSIP_SENDER_MAIN,237); + player->ADD_GOSSIP_ITEM(6, "Armored White Chimaera", GOSSIP_SENDER_MAIN, 238); + player->ADD_GOSSIP_ITEM(6, "Armored Yellow Chimaera", GOSSIP_SENDER_MAIN, 239); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1026: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Green Corehound", GOSSIP_SENDER_MAIN, 240); + player->ADD_GOSSIP_ITEM(6, "Grey Corehound", GOSSIP_SENDER_MAIN, 242); + player->ADD_GOSSIP_ITEM(6, "Red Corehound", GOSSIP_SENDER_MAIN, 243); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1027: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Black Devilsaur", GOSSIP_SENDER_MAIN, 244); + player->ADD_GOSSIP_ITEM(6, "Green Devilsaur", GOSSIP_SENDER_MAIN, 245); + player->ADD_GOSSIP_ITEM(6, "Red Devilsaur", GOSSIP_SENDER_MAIN, 246); + player->ADD_GOSSIP_ITEM(6, "White Devilsaur", GOSSIP_SENDER_MAIN, 247); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1028: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue Rhino", GOSSIP_SENDER_MAIN, 248); + player->ADD_GOSSIP_ITEM(6, "Brown Rhino", GOSSIP_SENDER_MAIN, 249); + player->ADD_GOSSIP_ITEM(6, "Grey Rhino", GOSSIP_SENDER_MAIN, 250); + player->ADD_GOSSIP_ITEM(6, "White Rhino", GOSSIP_SENDER_MAIN, 251); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1029: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Green Silithid", GOSSIP_SENDER_MAIN, 252); + player->ADD_GOSSIP_ITEM(6, "Purple Silithid", GOSSIP_SENDER_MAIN, 253); + player->ADD_GOSSIP_ITEM(6, "Tan Silithid", GOSSIP_SENDER_MAIN, 254); + player->ADD_GOSSIP_ITEM(6, "Yellow Silithid", GOSSIP_SENDER_MAIN, 255); + player->ADD_GOSSIP_ITEM(6, "Blue Silithid Colossi", GOSSIP_SENDER_MAIN, 256); + player->ADD_GOSSIP_ITEM(6, "Orange Silithid Colossi", GOSSIP_SENDER_MAIN, 257); + player->ADD_GOSSIP_ITEM(6, "Pink Silithid Colossi", GOSSIP_SENDER_MAIN, 258); + player->ADD_GOSSIP_ITEM(6, "Brown Ant Silithid", GOSSIP_SENDER_MAIN, 260); + player->ADD_GOSSIP_ITEM(6, "Green Ant Silithid", GOSSIP_SENDER_MAIN, 261); + player->ADD_GOSSIP_ITEM(6, "Purple Ant Silithid", GOSSIP_SENDER_MAIN, 262); + player->ADD_GOSSIP_ITEM(6, "Tan Ant Silithid", GOSSIP_SENDER_MAIN, 263); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1030: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Blue/Black Worm", GOSSIP_SENDER_MAIN, 275); + player->ADD_GOSSIP_ITEM(6, "Brown Worm", GOSSIP_SENDER_MAIN, 264); + player->ADD_GOSSIP_ITEM(6, "Green Worm", GOSSIP_SENDER_MAIN, 265); + player->ADD_GOSSIP_ITEM(6, "Grey Worm", GOSSIP_SENDER_MAIN, 266); + player->ADD_GOSSIP_ITEM(6, "White Worm", GOSSIP_SENDER_MAIN, 267); + player->ADD_GOSSIP_ITEM(6, "Yellow Worm", GOSSIP_SENDER_MAIN, 268); + player->ADD_GOSSIP_ITEM(6, "Black Jormungar", GOSSIP_SENDER_MAIN, 269); + player->ADD_GOSSIP_ITEM(6, "Blue Jormungar", GOSSIP_SENDER_MAIN, 270); + player->ADD_GOSSIP_ITEM(6, "Ghost Jormungar", GOSSIP_SENDER_MAIN, 271); + player->ADD_GOSSIP_ITEM(6, "Green Jormungar", GOSSIP_SENDER_MAIN, 272); + player->ADD_GOSSIP_ITEM(6, "Purple Jormungar", GOSSIP_SENDER_MAIN, 273); + player->ADD_GOSSIP_ITEM(6, "White Jormungar", GOSSIP_SENDER_MAIN, 274); + player->SEND_GOSSIP_MENU(1, m_creature->GetGUID()); + break; + + case 1031: + player->ADD_GOSSIP_ITEM(4, "<- [Menú Principal]", GOSSIP_SENDER_MAIN, 100); + player->ADD_GOSSIP_ITEM(6, "Spectral Bear", GOSSIP_SENDER_MAIN, 277); + player->ADD_GOSSIP_ITEM(6, "Spectral Saber Tiger", GOSSIP_SENDER_MAIN, 278); + player->ADD_GOSSIP_ITEM(6, "Spirit Leapard ", GOSSIP_SENDER_MAIN, 279); + player->ADD_GOSSIP_ITEM(6, "Lightning Saber Worg ", GOSSIP_SENDER_MAIN, 280); + + case GOSSIP_OPTION_STABLEPET: + player->GetSession()->SendStablePet(m_creature->GetGUID()); + break; + case GOSSIP_OPTION_VENDOR: + player->GetSession()->SendListInventory(m_creature->GetGUID()); + break; + + case 1: //Brown Bat + CreatePet(player, m_creature, 1513); + break; + + case 2: //Red Bat + CreatePet(player, m_creature, 1554); + break; + + case 283: //Tan Bat + CreatePet(player, m_creature, 4861); + break; + + case 4: //White Bat + CreatePet(player, m_creature, 10357); + break; + + case 8: //Black Bear + CreatePet(player, m_creature, 1186); + break; + + case 9: //Brown Bear + CreatePet(player, m_creature, 17345); + break; + + case 10: //Dark Brown Bear + CreatePet(player, m_creature, 17348); + break; + + case 11: //Grey Bear + CreatePet(player, m_creature, 2354); + break; + + case 12: //White bear + CreatePet(player, m_creature, 1130); + break; + + case 13: //diseased black bear + CreatePet(player, m_creature, 1815); + break; + + case 284: //diseased brown bear + CreatePet(player, m_creature, 14280); + break; + + case 282: //diseased dark brown bear + CreatePet(player, m_creature, 17661); + break; + + case 16: //diseased white bear + CreatePet(player, m_creature, 26643); + break; + + case 18: //black owl + CreatePet(player, m_creature, 17053); + break; + + case 19: //brown owl + CreatePet(player, m_creature, 17034); + break; + + case 21: //green owl + CreatePet(player, m_creature, 27244); + break; + + case 22: //grey owl + CreatePet(player, m_creature, 7079); + break; + + case 23: //redpurple owl + CreatePet(player, m_creature, 21084); + break; + + case 24: //red owl + CreatePet(player, m_creature, 23051); + break; + + case 25: //white owl + CreatePet(player, m_creature, 14343); + break; + + case 20: //dark brown owl + CreatePet(player, m_creature, 19429); + break; + + case 29: //bold eagle + CreatePet(player, m_creature, 26369); + break; + + case 30: //brown eagle + CreatePet(player, m_creature, 28004); + break; + + case 32: //white eagle + CreatePet(player, m_creature, 29044); + break; + + case 33: //black hawk + CreatePet(player, m_creature, 23945); + break; + + case 34: //brown hawk + CreatePet(player, m_creature, 24747); + break; + + case 35: //blue parrot + CreatePet(player, m_creature, 32481); + break; + + case 37: //black boar + CreatePet(player, m_creature, 119); + break; + + case 38: //brown boar + CreatePet(player, m_creature, 345); + break; + + case 39: //grey boar + CreatePet(player, m_creature, 3098); + break; + + case 40: //red boar + CreatePet(player, m_creature, 547); + break; + + case 41: //undead boar + CreatePet(player, m_creature, 16117); + break; + + case 42: //yellow boar + CreatePet(player, m_creature, 2966); + break; + + case 43: //armored black boar + CreatePet(player, m_creature, 4512); + break; + + case 44: //armored brown boar + CreatePet(player, m_creature, 4511); + break; + + case 45: //armored brown ghost boar + CreatePet(player, m_creature, 6021); + break; + + case 46: //armored grey boar + CreatePet(player, m_creature, 4514); + break; + + case 47: //black felboar + CreatePet(player, m_creature, 21878); + break; + + case 48: //blue felboar + CreatePet(player, m_creature, 22180); + break; + + case 49: //orange felboar + CreatePet(player, m_creature, 16863); + break; + + case 51: //red felboar + CreatePet(player, m_creature, 16880); + break; + + case 52: //yellow felboar + CreatePet(player, m_creature, 21195); + break; + + case 53: //blue vulture + CreatePet(player, m_creature, 7376); + break; + + case 54: //brown vulture + CreatePet(player, m_creature, 1109); + break; + + case 55: //red vulture + CreatePet(player, m_creature, 5429); + break; + + case 56: //black vulture + CreatePet(player, m_creature, 2829); + break; + + case 57: //white vulture + CreatePet(player, m_creature, 2931); + break; + + case 58: //ghost blue two headed vulture + CreatePet(player, m_creature, 21470); + break; + + case 59: //blue two headed vulture + CreatePet(player, m_creature, 18707); + break; + + case 60: //green two headed vulture + CreatePet(player, m_creature, 5983); + break; + + case 5: //white two headed vulture + CreatePet(player, m_creature, 21515); + break; + + case 61: //red two headed vulture + CreatePet(player, m_creature, 16973); + break; + + case 62: //black cat + CreatePet(player, m_creature, 977); + break; + + case 63: //black spotted cat + CreatePet(player, m_creature, 18982); + break; + + case 64: //black striped cat + CreatePet(player, m_creature, 21723); + break; + + case 65: //brown cat + CreatePet(player, m_creature, 24064); + break; + + case 66: //dark striped cat + CreatePet(player, m_creature, 17023); + break; + + case 67: //orange spotted cat + CreatePet(player, m_creature, 2731); + break; + + case 68: //orange striped cat + CreatePet(player, m_creature, 682); + break; + + case 69: //ghost cat + CreatePet(player, m_creature, 3619); + break; + + case 70: //white cat + CreatePet(player, m_creature, 7430); + break; + + case 71: //white spotted cat + CreatePet(player, m_creature, 29327); + break; + + case 72: //white striped cat + CreatePet(player, m_creature, 21724); + break; + + case 73: //aqua sabar cat + CreatePet(player, m_creature, 10200); + break; + + case 75: //dark striped saber cat + CreatePet(player, m_creature, 2175); + break; + + case 76: //lavender saber cat + CreatePet(player, m_creature, 7434); + break; + + case 77: //orange spotted saber cat + CreatePet(player, m_creature, 28001); + break; + + case 78: //orange striped saber cat + CreatePet(player, m_creature, 28297); + break; + + case 74: //white striped saber cat + CreatePet(player, m_creature, 7431); + break; + + case 79: //brown lynx + CreatePet(player, m_creature, 16348); + break; + + case 80: //red lynx + CreatePet(player, m_creature, 15651); + break; + + case 81: //black lion + CreatePet(player, m_creature, 28097); + break; + + case 82: //gold lion + CreatePet(player, m_creature, 5807); + break; + + case 83: //lioness + CreatePet(player, m_creature, 14222); + break; + + case 84: //white lion + CreatePet(player, m_creature, 3475); + break; + + case 85: //black gem cat + CreatePet(player, m_creature, 28115); + break; + + case 86: //black spotted cat + CreatePet(player, m_creature, 28404); + break; + + case 87: //blue crab + CreatePet(player, m_creature, 26521); + break; + + case 88: //bronze crab + CreatePet(player, m_creature, 830); + break; + + case 89: //red crab + CreatePet(player, m_creature, 23929); + break; + + case 90: //white crab + CreatePet(player, m_creature, 24478); + break; + + case 91: //green crocolisk + CreatePet(player, m_creature, 4344); + break; + + case 92: //grey crocolisk + CreatePet(player, m_creature, 17952); + break; + + case 93: //white crocolisk + CreatePet(player, m_creature, 20773); + break; + + case 94: //yellow crocolisk + CreatePet(player, m_creature, 1693); + break; + + case 96: //ghost hydra + CreatePet(player, m_creature, 29033); + break; + + case 97: //blue dragonhawk + CreatePet(player, m_creature, 25867); + break; + + case 98: //orange red dragonhawk + CreatePet(player, m_creature, 15650); + break; + + case 99: //orange dragonhawk + CreatePet(player, m_creature, 15649); + break; + + case 101: //red dragon hawk + CreatePet(player, m_creature, 18155); + break; + + case 102: //violet dragonhawk + CreatePet(player, m_creature, 20502); + break; + + case 103: //black gorilla + CreatePet(player, m_creature, 28096); + break; + + case 104: //dark grey gorilla + CreatePet(player, m_creature, 1559); + break; + + case 105: //grey gorilla + CreatePet(player, m_creature, 28098); + break; + + case 106: //red gorilla + CreatePet(player, m_creature, 9622); + break; + + case 107: //white gorilla + CreatePet(player, m_creature, 6585); + break; + + case 108: //brown hyena + CreatePet(player, m_creature, 4690); + break; + + case 109: //grey hyena + CreatePet(player, m_creature, 5985); + break; + + case 110: //orange hyena + CreatePet(player, m_creature, 4534); + break; + + case 111: //purple hyena + CreatePet(player, m_creature, 5427); + break; + + case 112: //yellow hyena + CreatePet(player, m_creature, 12418); + break; + + case 114: //beige moth + CreatePet(player, m_creature, 18468); + break; + + case 115: //blue yellow moth + CreatePet(player, m_creature, 18438); + break; + + case 116: //blue moth + CreatePet(player, m_creature, 20611); + break; + + case 117: //green moth + CreatePet(player, m_creature, 18437); + break; + + case 118: //tan moth + CreatePet(player, m_creature, 25464); + break; + + case 119: //white moth + CreatePet(player, m_creature, 25498); + break; + + case 120: //blue nether ray + CreatePet(player, m_creature, 18131); + break; + + case 121: //gold nether ray + CreatePet(player, m_creature, 22181); + break; + + case 122: //green nether ray + CreatePet(player, m_creature, 20196); + break; + + case 123: //purple nether ray + CreatePet(player, m_creature, 18880); + break; + + case 124: //red nether ray + CreatePet(player, m_creature, 21901); + break; + + case 125: //black raptor + CreatePet(player, m_creature, 23873); + break; + + case 126: //blue raptor + CreatePet(player, m_creature, 730); + break; + + case 127: //green raptor + CreatePet(player, m_creature, 6581); + break; + + case 128: //grey raptor + CreatePet(player, m_creature, 29334); + break; + + case 129: //orange raptor + CreatePet(player, m_creature, 1019); + break; + + case 130: //purple raptor + CreatePet(player, m_creature, 3632); + break; + + case 131: //red raptor + CreatePet(player, m_creature, 3123); + break; + + case 132: //yellow raptor + CreatePet(player, m_creature, 2561); + break; + + case 133: //black spiked raptor + CreatePet(player, m_creature, 20729); + break; + + case 134: //blue spiked raptor + CreatePet(player, m_creature, 29698); + break; + + case 135: //brown spiked raptor + CreatePet(player, m_creature, 20634); + break; + + case 136: //green spiked raptor + CreatePet(player, m_creature, 21124); + break; + + case 137: //red spiked raptor + CreatePet(player, m_creature, 20751); + break; + + case 138: //spiked orange ravager + CreatePet(player, m_creature, 17199); + break; + + case 141: //green purple ravager + CreatePet(player, m_creature, 19189); + break; + + case 142: //green ravager + CreatePet(player, m_creature, 24922); + break; + + case 143: //orange black ravager + CreatePet(player, m_creature, 16932); + break; + + case 144: //orange purple ravager + CreatePet(player, m_creature, 21423); + break; + + case 146: //orange ravager + CreatePet(player, m_creature, 17199); + break; + + case 147: //red black ravager + CreatePet(player, m_creature, 19350); + break; + + case 281: //spiked green ravager + CreatePet(player, m_creature, 16934); + break; + + case 151: //spiked purple ravager + CreatePet(player, m_creature, 19349); + break; + + case 152: //spiked red ravager + CreatePet(player, m_creature, 16933); + break; + + case 153: //black scorpid + CreatePet(player, m_creature, 7022); + break; + + case 154: //bronze scorpid + CreatePet(player, m_creature, 9691); + break; + + case 155: //brown scorpid + CreatePet(player, m_creature, 15336); + break; + + case 156: //pink scorpid + CreatePet(player, m_creature, 15240); + break; + + case 157: //red scorpid + CreatePet(player, m_creature, 15196); + break; + + case 158: //yellow scorpid + CreatePet(player, m_creature, 11736); + break; + + case 159: //blue serpent + CreatePet(player, m_creature, 5048); + break; + + case 160: //teal serpent + CreatePet(player, m_creature, 5225); + break; + + case 161: //brown serpent + CreatePet(player, m_creature, 28011); + break; + + case 163: //purple serpent + CreatePet(player, m_creature, 5755); + break; + + case 165: //white serpent + CreatePet(player, m_creature, 7268); + break; + + case 166: //black widow spider + CreatePet(player, m_creature, 1505); + break; + + case 167: //crystal spider + CreatePet(player, m_creature, 10596); + break; + + case 168: //green spider + CreatePet(player, m_creature, 4379); + break; + + case 169: //grey spider + CreatePet(player, m_creature, 217); + break; + + case 170: //jungle spider + CreatePet(player, m_creature, 15976); + break; + + case 171: //olive spider + CreatePet(player, m_creature, 22044); + break; + + case 172: //purple spider + CreatePet(player, m_creature, 29461); + break; + + case 173: //red spider + CreatePet(player, m_creature, 20682); + break; + + case 174: //tan spider + CreatePet(player, m_creature, 22132); + break; + + case 175: //spiked orange spider + CreatePet(player, m_creature, 28342); + break; + + case 176: //spiked red black spider + CreatePet(player, m_creature, 17683); + break; + + case 177: //spiked red yellow spider + CreatePet(player, m_creature, 17522); + break; + + case 178: //light grey bone spider + CreatePet(player, m_creature, 32475); + break; + + case 179: //green tarantula + CreatePet(player, m_creature, 1986); + break; + + case 180: //grey tarantula + CreatePet(player, m_creature, 14266); + break; + + case 181: //lava tarantula + CreatePet(player, m_creature, 5857); + break; + + case 182: //orange tarantula + CreatePet(player, m_creature, 442); + break; + + case 183: //red tarantula + CreatePet(player, m_creature, 11738); + break; + + case 184: //blue sporebat + CreatePet(player, m_creature, 18128); + break; + + case 185: //brown sporebat + CreatePet(player, m_creature, 18280); + break; + + case 186: //green sporebat + CreatePet(player, m_creature, 18129); + break; + + case 187: //brown tallstrider + CreatePet(player, m_creature, 2955); + break; + + case 188: //grey tallstrider + CreatePet(player, m_creature, 2956); + break; + + case 189: //pink tallstrider + CreatePet(player, m_creature, 3068); + break; + + case 190: //purple tallstrider + CreatePet(player, m_creature, 22807); + break; + + case 191: //turquoise tallstrider + CreatePet(player, m_creature, 2172); + break; + + case 192: //white tallstrider + CreatePet(player, m_creature, 3246); + break; + + case 193: //blue turtle + CreatePet(player, m_creature, 3653); + break; + + case 194: //green turtle + CreatePet(player, m_creature, 4824); + break; + + case 195: //grey turtle + CreatePet(player, m_creature, 4397); + break; + + case 196: //orange turtle + CreatePet(player, m_creature, 22885); + break; + + case 197: //white turtle + CreatePet(player, m_creature, 25482); + break; + + case 198: //black warp stalker + CreatePet(player, m_creature, 23163); + break; + + case 199: //blue green warp stalker + CreatePet(player, m_creature, 18884); + break; + + case 200: //green warp stalker + CreatePet(player, m_creature, 20906); + break; + + case 201: //red warp stalker + CreatePet(player, m_creature, 22255); + break; + + case 202: //white warp stalker + CreatePet(player, m_creature, 23219); + break; + + case 203: //black windserpent + CreatePet(player, m_creature, 5056); + break; + + case 204: //green windserpent + CreatePet(player, m_creature, 5756); + break; + + case 205: //orange wind serpent + CreatePet(player, m_creature, 5307); + break; + + case 206: //red wind serpent + CreatePet(player, m_creature, 5708); + break; + + case 207: //white wind serpent + CreatePet(player, m_creature, 26806); + break; + + case 208: //yellow wind serpent + CreatePet(player, m_creature, 8336); + break; + + case 209: //spiked blue wind serpent + CreatePet(player, m_creature, 26446); + break; + + case 210: //spiked green wind serpent + CreatePet(player, m_creature, 21123); + break; + + case 211: //spiked grey wind serpent + CreatePet(player, m_creature, 20673); + break; + + case 212: //spiked red wind serpent + CreatePet(player, m_creature, 20749); + break; + + case 213: //spiked white wind serpent + CreatePet(player, m_creature, 28477); + break; + + case 214: //black wolf + CreatePet(player, m_creature, 20330); + break; + + case 215: //diseased black wolf + CreatePet(player, m_creature, 1817); + break; + + case 216: //ghost wolf + CreatePet(player, m_creature, 26111); + break; + + case 217: //grey wolf + CreatePet(player, m_creature, 1508); + break; + + case 218: //tan wolf + CreatePet(player, m_creature, 2958); + break; + + case 219: //white wolf + CreatePet(player, m_creature, 29993); + break; + + case 220: //bicolor worg + CreatePet(player, m_creature, 10220); + break; + + case 221: //black worg + CreatePet(player, m_creature, 10221); + break; + + case 222: //brown worg + CreatePet(player, m_creature, 19458); + break; + + case 223: //dark grey worg + CreatePet(player, m_creature, 8211); + break; + + case 224: //grey worg + CreatePet(player, m_creature, 118); + break; + + case 225: //red worg + CreatePet(player, m_creature, 2753); + break; + + case 226: //white worg + CreatePet(player, m_creature, 521); + break; + + case 227: //black saber worg + CreatePet(player, m_creature, 24475); + break; + + case 228: //brown saber worg + CreatePet(player, m_creature, 24516); + break; + + case 229: //grey saber worg + CreatePet(player, m_creature, 24517); + break; + + case 230: //white saber worg + CreatePet(player, m_creature, 24677); + break; + + case 231: //saddled black worg + CreatePet(player, m_creature, 17669); + break; + + case 232: //beige chimeara + CreatePet(player, m_creature, 8764); + break; + + case 234: //green chimeara + CreatePet(player, m_creature, 8660); + break; + + case 235: //white chimeara + CreatePet(player, m_creature, 24673); + break; + + case 236: //armored green chimeara + CreatePet(player, m_creature, 21789); + break; + + case 237: //armored purple chimeara + CreatePet(player, m_creature, 20932); + break; + + case 238: //armored white chimeara + CreatePet(player, m_creature, 11497); + break; + + case 239: //armored yellow chimeara + CreatePet(player, m_creature, 21033); + break; + + case 240: //green corehound + CreatePet(player, m_creature, 21102); + break; + + case 242: //grey corehound + CreatePet(player, m_creature, 17447); + break; + + case 243: //red corehound + CreatePet(player, m_creature, 11671); + break; + + case 244: //black devilsaur + CreatePet(player, m_creature, 6499); + break; + + case 245: //green devilsaur + CreatePet(player, m_creature, 32485); + break; + + case 246: //red devilsaur + CreatePet(player, m_creature, 6584); + break; + + case 247: //white devilsaur + CreatePet(player, m_creature, 6498); + break; + + case 248: //blue rhino + CreatePet(player, m_creature, 29838); + break; + + case 249: //brown rhino + CreatePet(player, m_creature, 25488); + break; + + case 250: //grey rhino + CreatePet(player, m_creature, 28288); + break; + + case 251: //white rhino + CreatePet(player, m_creature, 32361); + break; + + case 252: //green silithid + CreatePet(player, m_creature, 15622); + break; + + case 253: //purple silithid + CreatePet(player, m_creature, 14473); + break; + + case 254: //tan silithid + CreatePet(player, m_creature, 15230); + break; + + case 255: //yellow silithid + CreatePet(player, m_creature, 15323); + break; + + case 256: //blue giant silithid + CreatePet(player, m_creature, 15543); + break; + + case 257: //orange giant silithid + CreatePet(player, m_creature, 15511); + break; + + case 258: //pink giant silithid + CreatePet(player, m_creature, 15544); + break; + + case 260: //brown ant silithid + CreatePet(player, m_creature, 11725); + break; + + case 261: //green ant silithid + CreatePet(player, m_creature, 15229); + break; + + case 262: //purple ant silithid + CreatePet(player, m_creature, 11733); + break; + + case 263: //tan ant silithid + CreatePet(player, m_creature, 15300); + break; + + case 275: //blue worm + CreatePet(player, m_creature, 11789); + break; + + case 264: //brown worm + CreatePet(player, m_creature, 21381); + break; + + case 265: //green worm + CreatePet(player, m_creature, 11788); + break; + + case 266: //grey worm + CreatePet(player, m_creature, 11741); + break; + + case 267: //white worm + CreatePet(player, m_creature, 5226); + break; + + case 268: //yellow worm + CreatePet(player, m_creature, 14477); + break; + + case 269: //black jormungar + CreatePet(player, m_creature, 26360); + break; + + case 270: //blue jormungar + CreatePet(player, m_creature, 30291); + break; + + case 271: //ghost jormungar + CreatePet(player, m_creature, 30423); + break; + + case 272: //green jormungar + CreatePet(player, m_creature, 26358); + break; + + case 273: //purple jormungar + CreatePet(player, m_creature, 25454); + break; + + case 274: //white jormungar + CreatePet(player, m_creature, 26359); + break; + + case 277: //spectral bear + CreatePet(player, m_creature, 38453); + break; + + case 278: //spectral tiger + CreatePet(player, m_creature, 33776); + break; + + case 279: //spirit leopard + CreatePet(player, m_creature, 32517); + break; + + case 280: //lighting worg + CreatePet(player, m_creature, 35189); + break; + + + } + return true; + } +}; + +void AddSC_Npc_Beastmaster() +{ + new Npc_Beastmaster(); +} diff --git a/npc_enchant.cpp b/npc_enchant.cpp new file mode 100644 index 0000000..ffeafc1 --- /dev/null +++ b/npc_enchant.cpp @@ -0,0 +1,974 @@ +#include "ScriptPCH.h" + +enum Enchants +{ + ENCHANT_WEP_BLADE_WARD = 3869, + ENCHANT_WEP_BLOOD_DRAINING = 3870, + ENCHANT_WEP_BERSERKING = 3789, + + ENCHANT_WEP_ACCURACY = 3788, + ENCHANT_WEP_AGILITY_1H = 1103, + ENCHANT_WEP_AGILITY_2H = 2670, + ENCHANT_WEP_SPIRIT = 3844, + ENCHANT_WEP_BATTLEMASTER = 2675, + ENCHANT_WEP_BLACK_MAGIC = 3790, + ENCHANT_WEP_ICEBREAKER = 3239, + ENCHANT_WEP_LIFEWARD = 3241, + ENCHANT_WEP_MIGHTY_SPELL_POWER = 3834, // One-hand + ENCHANT_WEP_GREATER_SPELL_POWER = 3854, // Two-hand (staff) + ENCHANT_WEP_MONGOOSE = 2673, + ENCHANT_WEP_EXECUTIONER = 3225, + ENCHANT_WEP_POTENCY = 3833, + ENCHANT_WEP_TITANGUARD = 3851, + ENCHANT_WEP_MASSACRE = 3827, + + ENCHANT_WEP_CINDERGLACIER = 3369, + ENCHANT_WEP_LICHBANE = 3366, + ENCHANT_WEP_RAZORICE = 3370, + ENCHANT_WEP_SPELLBREAKING = 3595, + ENCHANT_WEP_SPELLSHATTERING = 3367, + ENCHANT_WEP_SWORDBREAKING = 3594, + ENCHANT_WEP_SWORDSHATTERING = 3365, + ENCHANT_WEP_FALLEN_CRUSADER = 3368, + ENCHANT_WEP_NERUBIAN_CARAPACE = 3883, + ENCHANT_WEP_STONESKIN_GARGOYLE = 3847, + + ENCHANT_WEP_TITANIUM_CHAIN = 3731, + + ENCHANT_SHIELD_DEFENSE = 1952, + ENCHANT_SHIELD_INTELLECT = 1128, + ENCHANT_SHIELD_MAJOR_STAMINA = 1071, + ENCHANT_SHIELD_RESILIENCE = 3229, + + ENCHANT_SHIELD_TITANIUM_PLATING = 3849, + ENCHANT_SHIELD_TITANIUM_SPIKE = 3748, + + ENCHANT_HEAD_BLISSFUL_MENDING = 3819, + ENCHANT_HEAD_BURNING_MYSTERIES = 3820, + ENCHANT_HEAD_DOMINANCE = 3796, + ENCHANT_HEAD_SAVAGE_GLADIATOR = 3842, + ENCHANT_HEAD_STALWART_PROTECTOR = 3818, + ENCHANT_HEAD_TORMENT = 3817, + ENCHANT_HEAD_TRIUMPH = 3795, + + ENCHANT_SHOULDER_MASTERS_AXE = 3835, + ENCHANT_SHOULDER_MASTERS_CRAG = 3836, + ENCHANT_SHOULDER_MASTERS_PINNACLE = 3837, + ENCHANT_SHOULDER_MASTERS_STORM = 3838, + ENCHANT_SHOULDER_GREATER_AXE = 3808, + ENCHANT_SHOULDER_GREATER_CRAG = 3809, + ENCHANT_SHOULDER_GREATER_GLADIATOR = 3852, + ENCHANT_SHOULDER_GREATER_PINNACLE = 3811, + ENCHANT_SHOULDER_GREATER_STORM = 3810, + ENCHANT_SHOULDER_DOMINANCE = 3794, + ENCHANT_SHOULDER_TRIUMPH = 3793, + + ENCHANT_CLOAK_DARKGLOW_EMBROIDERY = 3728, + ENCHANT_CLOAK_SWORDGUARD_EMBROIDERY = 3730, + ENCHANT_CLOAK_LIGHTWEAVE_EMBROIDERY = 3722, + ENCHANT_CLOAK_FLEXWEAVE_UNDERLAY = 3605, + ENCHANT_CLOAK_SPRINGY_ARACHNOWEAVE = 3859, + ENCHANT_CLOAK_WISDOM = 3296, + ENCHANT_CLOAK_TITANWEAVE = 1951, + ENCHANT_CLOAK_SPELL_PIERCING = 3243, + ENCHANT_CLOAK_SHADOW_ARMOR = 3256, + ENCHANT_CLOAK_MIGHTY_ARMOR = 3294, + ENCHANT_CLOAK_MAJOR_AGILITY = 1099, + ENCHANT_CLOAK_GREATER_SPEED = 3831, + + ENCHANT_CHEST_EXCEPTIONAL_MANA = 3233, + ENCHANT_CHEST_GREATER_MANA_RESTO = 3533, + ENCHANT_CHEST_EXCEPTIONAL_RESILIENCE= 3245, + ENCHANT_CHEST_SUPER_HEALTH = 3297, + ENCHANT_CHEST_ALL_STATS = 3832, + + ENCHANT_BRACER_GREATER_ASSAULT = 3845, + ENCHANT_BRACER_EXCEPTIONAL_INTELLECT= 3458, + ENCHANT_BRACER_MAJOR_SPIRIT = 1147, + ENCHANT_BRACER_EXPERTISE = 3231, + ENCHANT_BRACER_GREATER_STATS = 2661, + ENCHANT_BRACER_SUPERIOR_SPELLPOWER = 2332, + ENCHANT_BRACER_MAJOR_STAMINA = 3850, + + ENCHANT_BRACER_FUR_LINING_AP = 3756, + ENCHANT_BRACER_FUR_LINING_STAMINA = 3757, + ENCHANT_BRACER_FUR_LINING_SP = 3758, + ENCHANT_BRACER_ARCANE_RESIST = 3763, + ENCHANT_BRACER_NATURE_RESIST = 3762, + ENCHANT_BRACER_SHADOW_RESIST = 3761, + ENCHANT_BRACER_FROST_RESIST = 3760, + ENCHANT_BRACER_FIRE_RESIST = 3759, + + ENCHANT_BRACER_SOCKET_BRACER = 3717, + + ENCHANT_GLOVES_CRUSHER = 1603, + // EXTREMELY ugly hack for duplicate enchants + ENCHANT_GLOVES_EXPERTISE = -3231, + ENCHANT_GLOVES_PRECISION = 3234, + ENCHANT_GLOVES_GREATER_ASSAULT = 1603, + ENCHANT_GLOVES_MAJOR_AGILITY = 1097, + ENCHANT_GLOVES_EXCEPTIONAL_SPELLPOWER = 2330, + ENCHANT_GLOVES_ARMSMAN = 3253, + + ENCHANT_GLOVES_SOCKET_GLOVES = 3723, + + ENCHANT_GLOVES_PYROROCKET = 3603, + ENCHANT_GLOVES_HYPERSPEED_ACCELERATORS = 3604, + + ENCHANT_BELT_ETERNAL_BELT_BUCKLE = 3729, + ENCHANT_BELT_FRAG_BELT = 3601, + + ENCHANT_LEGS_FROSTHIDE_ARMOR = 3822, + ENCHANT_LEGS_ICESCALE_ARMOR = 3823, + ENCHANT_LEGS_EARTHEN_ARMOR = 3853, + ENCHANT_LEGS_SAPPHIRE_SPELLTHREAD = 3873, + ENCHANT_LEGS_BRILLIANT_SPELLTHREAD = 3872, + + ENCHANT_BOOTS_TUSKARRS_VITALITY = 3232, + ENCHANT_BOOTS_ICEWALKER = 2599, + ENCHANT_BOOTS_GREATER_ASSAULT = 1597, + ENCHANT_BOOTS_GREATER_SPIRIT = 528, + ENCHANT_BOOTS_GREATER_FORTITUDE = 3259, + ENCHANT_BOOTS_SUPERIOR_AGILITY = 983, + ENCHANT_BOOTS_NITRO_BOOSTS = 3606, + + ENCHANT_RING_STAMINA = 3791, + ENCHANT_RING_GREATER_SPELLPOWER = 3840, + ENCHANT_RING_ASSAULT = 3839, + + ENCHANT_RANGED_HEARTSEEKER_SCOPE = 3608, + ENCHANT_RANGED_SUN_SCOPE = 3607 +}; + +Item* PlayerAddItem(Player* player, uint32 item_id) +{ + uint8 count = 1; + uint32 noSpaceForCount = 0; + ItemPosCountVec dest; + + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, + dest, item_id, count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) + count -= noSpaceForCount; + + Item* item = player->StoreNewItem(dest, item_id, true, + Item::GenerateItemRandomPropertyId(item_id)); + + if (noSpaceForCount > 0) + { + player->GetSession()->SendNotification("Por favor, hacer espacio en su " + "inventario."); + return NULL; + } + return item; +} + +void EnchantWithItem(Player* player, uint32 item_id, Item* target) +{ + Item* item = PlayerAddItem(player, item_id); + SpellCastTargets* targets = new SpellCastTargets(); + targets->SetItemTarget(target); + player->CastItemUseSpell(item, *targets, 1, 0); +} + +void EnchantWithSpell(Player* player, uint32 spell_id, Item* item) +{ + SpellCastTargets* targets = new SpellCastTargets(); + targets->SetItemTarget(item); + player->CastSpell(*targets, sSpellMgr->GetSpellInfo(spell_id), + NULL, TRIGGERED_IGNORE_POWER_AND_REAGENT_COST); +} + +void Enchant(Player* player, Creature* creature, Item* item, uint32 enchantid) +{ + if (!item) + { + player->GetSession()->SendNotification("Primero equipa el item."); + return; + } + + uint32 item_id = 0; + switch (enchantid) + { + case ENCHANT_WEP_GREATER_SPELL_POWER: + case ENCHANT_WEP_AGILITY_2H: + case ENCHANT_WEP_MASSACRE: + if (item->GetTemplate()->InventoryType != INVTYPE_2HWEAPON) + { + ChatHandler(player->GetSession()).PSendSysMessage("Esta no es un arma de 2 Manos"); + return; + } + break; + case ENCHANT_SHIELD_DEFENSE: + case ENCHANT_SHIELD_INTELLECT: + case ENCHANT_SHIELD_MAJOR_STAMINA: + case ENCHANT_SHIELD_RESILIENCE: + case ENCHANT_SHIELD_TITANIUM_PLATING: + case ENCHANT_SHIELD_TITANIUM_SPIKE: + if (item->GetTemplate()->InventoryType != INVTYPE_SHIELD) + { + ChatHandler(player->GetSession()).PSendSysMessage("Eso no es un escudo"); + return; + } + break; + case ENCHANT_RANGED_HEARTSEEKER_SCOPE: + case ENCHANT_RANGED_SUN_SCOPE: + if (item->GetTemplate()->InventoryType != INVTYPE_RANGED && + item->GetTemplate()->InventoryType != INVTYPE_RANGEDRIGHT) + { + ChatHandler(player->GetSession()).PSendSysMessage("Eso no es un arma a distancia"); + return; + } + break; + default: + break; + } + + player->ApplyEnchantment(item, PERM_ENCHANTMENT_SLOT, false); + item->ClearEnchantment(PERM_ENCHANTMENT_SLOT); + item->SetEnchantment(PERM_ENCHANTMENT_SLOT, enchantid, 0, 0); + player->ApplyEnchantment(item, PERM_ENCHANTMENT_SLOT, true); + + switch (enchantid) + { + case ENCHANT_BELT_ETERNAL_BELT_BUCKLE: + EnchantWithItem(player, 41611, item); + break; + case ENCHANT_BRACER_SOCKET_BRACER: + PlayerAddItem(player, 5956); // Blacksmith hammer + EnchantWithSpell(player, 55628, item); + player->DestroyItemCount(5956, -1, true, false); + break; + case ENCHANT_GLOVES_SOCKET_GLOVES: + PlayerAddItem(player, 5956); // Blacksmith hammer + EnchantWithSpell(player, 55641, item); + player->DestroyItemCount(5956, -1, true, false); + break; + } + + const char* item_name = item->GetTemplate()->Name1.c_str(); + player->GetSession()->SendNotification("|cff00ff00|TInterface\\icons\\inv_weapon_bow_55:20|t %s |cff00ff00|TInterface\\icons\\inv_weapon_bow_55:20|t ¡ITEM ENCANTADO!", item->GetTemplate()->Name1.c_str()); +} + +class npc_enchantment : public CreatureScript +{ + public: + npc_enchantment() : CreatureScript("npc_enchantment") { } + int selected_enchant; + + bool OnGossipHello(Player* player, Creature* creature) + { + ShowMainMenu(player, creature); + return true; + } + + void ShowMainMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Weapon_ShortBlade_02:30|t|r Encantar Arma", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Weapon_Staff_109:30|t|r Encantar Arma 2M", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Weapon_ShortBlade_02:30|t|r Encantar Arma a Distancia", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\Ability_Warrior_ShieldWall:30|t|r Encantar Escudo", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Head_Gnome_01:30|t|r Encantar Casco", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_SHOULDER_97:30|t|r Encantar Hombros", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\Item_icecrowncloak:30|t|r Encantar Capa", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Desecrated_ClothChest:30|t|r Encantar Pecho", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Desecrated_MailBracer:30|t|r Encantar Muneca", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Desecrated_PlateGloves:30|t|r Encantar Guantes", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Belt_28:30|t|r Encantar Cintura", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Desecrated_ClothPants:30|t|r Encantar Piernas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\INV_Misc_Desecrated_LeatherBoots:30|t|r Encantar Botas", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + if (player->HasSkill(SKILL_ENCHANTING) && player->GetSkillValue(SKILL_ENCHANTING) >= 450) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|cff00ff00|TInterface\\icons\\inv_jewelry_ring_11:30|t|rEncantar Anillos", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void Show1HWeaponMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + if (player->getClass() == CLASS_DEATH_KNIGHT) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Cinderglacier", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_CINDERGLACIER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Aterraexánime", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_LICHBANE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Cuchilla de hielo", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_RAZORICE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Ruptura de hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_SPELLBREAKING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Interruptor espada", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_SWORDBREAKING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de cruzado caído", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_FALLEN_CRUSADER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Nerubian Caparazón", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_NERUBIAN_CARAPACE); + } + if (player->HasSkill(SKILL_ENCHANTING) && player->GetSkillValue(SKILL_ENCHANTING) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Hoja Ward", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BLADE_WARD); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "El drenaje de la sangre", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BLOOD_DRAINING); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Precision -- 25 Hit + 25 Crit", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_ACCURACY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Negro mágico -- 250 Spell Haste Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BLACK_MAGIC); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Batalla -- La probabilidad de sanar en hit", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BATTLEMASTER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Berserking -- 400 Attack Power Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BERSERKING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Agilidad excepcional - 26 Agilidad", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_AGILITY_1H); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Espíritu Excepcional - 45 Espíritu", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_SPIRIT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Verdugo - 120 Brazo Pen Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_EXECUTIONER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Icebreaker - daño de Fuego en la exitosa", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_ICEBREAKER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Resguardo de vida - La probabilidad de sanar en hit", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_LIFEWARD); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Poder con hechizos Mighty - 63 poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_MIGHTY_SPELL_POWER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mangosta - 120 Agilidad Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_MONGOOSE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Potencia Superior - 65 poder de ataque", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_POTENCY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Titanguard - 50 Stamina", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_TITANGUARD); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Titanio Arma Cadena - Menos Desarmar Tiempo", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_TITANIUM_CHAIN); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void Show2HWeaponMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + if (player->getClass() == CLASS_DEATH_KNIGHT) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Cinderglacier", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_CINDERGLACIER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de aterraexánime", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_LICHBANE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de cuchilla de hielo", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_RAZORICE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Hechizo destrozando", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_SPELLSHATTERING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de Espada demoledora", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_SWORDSHATTERING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de cruzado caído", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_FALLEN_CRUSADER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Runa de la gárgola piel de piedra", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_STONESKIN_GARGOYLE); + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Rabiar - Ataque 400 Poder Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_BERSERKING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Verdugo - 120 Brazo Pen Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_EXECUTIONER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor poder con hechizos - 81 poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_GREATER_SPELL_POWER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor agilidad - 35 Agilidad", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_AGILITY_2H); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Masacre - 110 poder de ataque", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_MASSACRE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mangosta - 120 Agilidad Proc", GOSSIP_SENDER_MAIN, + ENCHANT_WEP_MONGOOSE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowShieldMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Defensa - 20 Defensa", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_DEFENSE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Gran Intelecto - 25 Intelecto", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_INTELLECT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor Resistencia - 18 Stamina", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_MAJOR_STAMINA); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Resiliencia - 12 Resiliencia", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_RESILIENCE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Titanio Revestimiento - 36 Bloquear", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_TITANIUM_PLATING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Titanio Punta de escudo - 81 Block + 50% menos Desarmar", GOSSIP_SENDER_MAIN, + ENCHANT_SHIELD_TITANIUM_SPIKE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowHeadMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de Mending dichoso - 30 poder con hechizos + 10 Mp5", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_BLISSFUL_MENDING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de Quemar Misterios - 25 Resistencia al Fuego + 30 Stam", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_BURNING_MYSTERIES); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de Dominación - 30 poder con hechizos 20 + Critico", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_DOMINANCE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de El Gladiador indómito - 30 Resistencia + 25 Resil", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_SAVAGE_GLADIATOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de El Protector Stalwart - 37 Resistencia + Defensa", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_STALWART_PROTECTOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de Tormento - 29 poder con hechizos + 20 Resil", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_TORMENT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Arcano de Triumph - 50 Poder de Ataque + 20 Resil", GOSSIP_SENDER_MAIN, + ENCHANT_HEAD_TRIUMPH); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowShouldersMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + if (player->HasSkill(SKILL_INSCRIPTION) && player->GetSkillValue(SKILL_INSCRIPTION) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del Maestro de la Axe", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_MASTERS_AXE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del Maestro de la Crag", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_MASTERS_CRAG); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del Maestro de pináculo", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_MASTERS_PINNACLE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del Maestro de la tormenta", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_MASTERS_STORM); + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del hacha - 40 Poder de Ataque + 15 Crit", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_GREATER_AXE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción de la Peña - 24 poder con hechizos + 8 Mp5", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_GREATER_CRAG); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del pináculo - 30 Resistencia + 15 Resil", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_GREATER_PINNACLE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción del Gladiador - 20 de Dodge + 15 Defensa", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_GREATER_GLADIATOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción de la tormenta - 24 poder con hechizos 15 + Crit", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_GREATER_STORM); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción de Dominación - 23 poder con hechizos + 15", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_DOMINANCE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Inscripción de triunfo - 40 poder de ataque + 15 Resil", GOSSIP_SENDER_MAIN, + ENCHANT_SHOULDER_TRIUMPH); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowCloakMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Elástico Arachne Weave", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_SPRINGY_ARACHNOWEAVE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Base de tejido flexible", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_FLEXWEAVE_UNDERLAY); + } + if (player->getClass() == CLASS_ROGUE) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Shadow Armor", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_SHADOW_ARMOR); + if (player->HasSkill(SKILL_TAILORING) && player->GetSkillValue(SKILL_TAILORING) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Darkglow bordado", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_DARKGLOW_EMBROIDERY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "bordado de tejido de luz", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_LIGHTWEAVE_EMBROIDERY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "bordado de guardia de espada", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_SWORDGUARD_EMBROIDERY); + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Sabiduría - 10 Espíritu + 2% a reducir la amenaza", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_WISDOM); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Titanweave - 16 Defensa", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_TITANWEAVE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Hechizo Piercing - 35 Mágicas Pen", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_SPELL_PIERCING); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Armor Mighty - 225 Armor", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_MIGHTY_ARMOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor agilidad - 22 Agilidad", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_MAJOR_AGILITY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor velocidad - 23 Haste", GOSSIP_SENDER_MAIN, + ENCHANT_CLOAK_GREATER_SPEED); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowChestMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mana Excepcional - 150 Mana", GOSSIP_SENDER_MAIN, + ENCHANT_CHEST_EXCEPTIONAL_MANA); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Maná superior Restauración - 10 Mp5", GOSSIP_SENDER_MAIN, + ENCHANT_CHEST_GREATER_MANA_RESTO); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Resiliencia Excepcional - 20 Resiliencia", GOSSIP_SENDER_MAIN, + ENCHANT_CHEST_EXCEPTIONAL_RESILIENCE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Súper Salud - 225 Salud", GOSSIP_SENDER_MAIN, + ENCHANT_CHEST_SUPER_HEALTH); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "10 de todas las estadísticas", GOSSIP_SENDER_MAIN, + ENCHANT_CHEST_ALL_STATS); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowBracerMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Gran Asalto - 50 poder de ataque", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_GREATER_ASSAULT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "El intelecto excepcional - 16 Intelecto", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_EXCEPTIONAL_INTELLECT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor Espíritu - 18 Espíritu", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_MAJOR_SPIRIT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Experiencia - 15 Especialización", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_EXPERTISE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayores Stats - 6 TODAS LAS ESTADÍSTICAS", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_GREATER_STATS); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Poder con hechizos superior - 30 poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_SUPERIOR_SPELLPOWER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor Resistencia - 40 Stamina", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_MAJOR_STAMINA); + if (player->HasSkill(SKILL_LEATHERWORKING) && player->GetSkillValue(SKILL_LEATHERWORKING) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Poder de Ataque", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_FUR_LINING_AP); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Aguante", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_FUR_LINING_STAMINA); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_FUR_LINING_SP); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Resistir Arcano", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_ARCANE_RESIST); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Naturaleza Resist", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_NATURE_RESIST); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Shadow Resista", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_SHADOW_RESIST); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Helada Resist", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_FROST_RESIST); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Piel Forro: Resistencia al Fuego", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_FIRE_RESIST); + } + if (player->HasSkill(SKILL_BLACKSMITHING) && player->GetSkillValue(SKILL_BLACKSMITHING) >= 450) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Socket brazales", GOSSIP_SENDER_MAIN, + ENCHANT_BRACER_SOCKET_BRACER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowGlovesMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Soldado - 2% Amenaza 10 Parry", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_ARMSMAN); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Poder con hechizos excepcional - 23 poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_EXCEPTIONAL_SPELLPOWER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Experiencia - 15 Especialización", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_EXPERTISE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Gran Asalto - 44 poder de ataque", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_CRUSHER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor agilidad - 20 Agilidad", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_MAJOR_AGILITY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Precisión - 20 Hit Rating", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_PRECISION); + if (player->HasSkill(SKILL_BLACKSMITHING) && player->GetSkillValue(SKILL_BLACKSMITHING) >= 450) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Guantes Socket", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_SOCKET_GLOVES); + if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) >= 450) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mano-Mounted Pyro Rocket", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_PYROROCKET); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Aceleradores de hipervelocidad", GOSSIP_SENDER_MAIN, + ENCHANT_GLOVES_HYPERSPEED_ACCELERATORS); + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowBeltMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Eterno hebilla de cinturón", GOSSIP_SENDER_MAIN, + ENCHANT_BELT_ETERNAL_BELT_BUCKLE); + if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) >= 450) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Frag Cinturón", GOSSIP_SENDER_MAIN, + ENCHANT_BELT_FRAG_BELT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowLegsMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Armadura para pierna de pellejo de escarcha - 55 Stam 22 Agil", GOSSIP_SENDER_MAIN, + ENCHANT_LEGS_FROSTHIDE_ARMOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Icescale Armadura para pierna - 75 AP 22 Crit", GOSSIP_SENDER_MAIN, + ENCHANT_LEGS_ICESCALE_ARMOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Earthen Armadura para pierna - 40 Resil 28 Stam", GOSSIP_SENDER_MAIN, + ENCHANT_LEGS_EARTHEN_ARMOR); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Sapphire hilo de hechizo - 50 SP 30 Stam", GOSSIP_SENDER_MAIN, + ENCHANT_LEGS_SAPPHIRE_SPELLTHREAD); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Brillante hilo de hechizo - 50 SP 22 Espíritu", GOSSIP_SENDER_MAIN, + ENCHANT_LEGS_BRILLIANT_SPELLTHREAD); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowBootsMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Icewalker - 12 Hit + 12 Crit", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_ICEWALKER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Gran Asalto - 32 Assult", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_GREATER_ASSAULT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor Fortaleza - 22 stamins", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_GREATER_FORTITUDE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Gran Espíritu - 18 Espíritu", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_GREATER_SPIRIT); + if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) >= 450) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Aumenta Nitro", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_NITRO_BOOSTS); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Agilidad Superior - 16 Agilidad", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_SUPERIOR_AGILITY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Vitalidad de Tuskarr - 15 Stam + velocidad Aumentar", GOSSIP_SENDER_MAIN, + ENCHANT_BOOTS_TUSKARRS_VITALITY); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowRingsMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Asalto", GOSSIP_SENDER_MAIN, + ENCHANT_RING_ASSAULT); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Mayor poder con hechizos", GOSSIP_SENDER_MAIN, + ENCHANT_RING_GREATER_SPELLPOWER); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Aguante", GOSSIP_SENDER_MAIN, + ENCHANT_RING_STAMINA); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + void ShowRangedMenu(Player* player, Creature* creature) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Buscacorazones Alcance", GOSSIP_SENDER_MAIN, + ENCHANT_RANGED_HEARTSEEKER_SCOPE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Sun Alcance", GOSSIP_SENDER_MAIN, + ENCHANT_RANGED_SUN_SCOPE); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Atras", GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) + { + int slot = -1; + bool check_adjacent_slot = true; + switch (action) + { + case -1: // Back + ShowMainMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + Show1HWeaponMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + Show2HWeaponMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + ShowShieldMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 4: + ShowHeadMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 5: + ShowShouldersMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + ShowCloakMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 7: + ShowChestMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 8: + ShowBracerMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 9: + ShowGlovesMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 10: + ShowBeltMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 11: + ShowLegsMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 12: + ShowBootsMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 13: + ShowRangedMenu(player, creature); + break; + case GOSSIP_ACTION_INFO_DEF + 14: + ShowRingsMenu(player, creature); + break; + + // 1H weapons + case ENCHANT_WEP_BLADE_WARD: + case ENCHANT_WEP_BLOOD_DRAINING: + case ENCHANT_WEP_AGILITY_1H: + case ENCHANT_WEP_SPIRIT: + case ENCHANT_WEP_BERSERKING: + case ENCHANT_WEP_ACCURACY: + case ENCHANT_WEP_BLACK_MAGIC: + case ENCHANT_WEP_BATTLEMASTER: + case ENCHANT_WEP_ICEBREAKER: + case ENCHANT_WEP_LIFEWARD: + case ENCHANT_WEP_TITANGUARD: + case ENCHANT_WEP_POTENCY: + case ENCHANT_WEP_MONGOOSE: + case ENCHANT_WEP_MIGHTY_SPELL_POWER: + case ENCHANT_WEP_EXECUTIONER: + case ENCHANT_WEP_TITANIUM_CHAIN: + + // 2H weapons + // case ENCHANT_WEP_BERSERKING: + // case ENCHANT_WEP_MONGOOSE: + // case ENCHANT_WEP_EXECUTIONER: + // case ENCHANT_WEP_TITANIUM_CHAIN: + case ENCHANT_WEP_GREATER_SPELL_POWER: + case ENCHANT_WEP_AGILITY_2H: + case ENCHANT_WEP_MASSACRE: + + // Runeforging + case ENCHANT_WEP_CINDERGLACIER: + case ENCHANT_WEP_LICHBANE: + case ENCHANT_WEP_RAZORICE: + case ENCHANT_WEP_SPELLBREAKING: + case ENCHANT_WEP_SPELLSHATTERING: + case ENCHANT_WEP_SWORDBREAKING: + case ENCHANT_WEP_SWORDSHATTERING: + case ENCHANT_WEP_FALLEN_CRUSADER: + case ENCHANT_WEP_NERUBIAN_CARAPACE: + case ENCHANT_WEP_STONESKIN_GARGOYLE: + slot = EQUIPMENT_SLOT_MAINHAND; + break; + + // Shields + case ENCHANT_SHIELD_DEFENSE: + case ENCHANT_SHIELD_INTELLECT: + case ENCHANT_SHIELD_RESILIENCE: + case ENCHANT_SHIELD_TITANIUM_PLATING: + case ENCHANT_SHIELD_MAJOR_STAMINA: + case ENCHANT_SHIELD_TITANIUM_SPIKE: + slot = EQUIPMENT_SLOT_OFFHAND; + break; + + // Head + case ENCHANT_HEAD_BLISSFUL_MENDING: + case ENCHANT_HEAD_BURNING_MYSTERIES: + case ENCHANT_HEAD_DOMINANCE: + case ENCHANT_HEAD_SAVAGE_GLADIATOR: + case ENCHANT_HEAD_STALWART_PROTECTOR: + case ENCHANT_HEAD_TORMENT: + case ENCHANT_HEAD_TRIUMPH: + slot = EQUIPMENT_SLOT_HEAD; + break; + + // Shoulders + case ENCHANT_SHOULDER_MASTERS_AXE: + case ENCHANT_SHOULDER_MASTERS_CRAG: + case ENCHANT_SHOULDER_MASTERS_PINNACLE: + case ENCHANT_SHOULDER_MASTERS_STORM: + case ENCHANT_SHOULDER_GREATER_AXE: + case ENCHANT_SHOULDER_GREATER_CRAG: + case ENCHANT_SHOULDER_GREATER_GLADIATOR: + case ENCHANT_SHOULDER_GREATER_PINNACLE: + case ENCHANT_SHOULDER_GREATER_STORM: + case ENCHANT_SHOULDER_DOMINANCE: + case ENCHANT_SHOULDER_TRIUMPH: + slot = EQUIPMENT_SLOT_SHOULDERS; + break; + + // Cloak + case ENCHANT_CLOAK_DARKGLOW_EMBROIDERY: + case ENCHANT_CLOAK_SWORDGUARD_EMBROIDERY: + case ENCHANT_CLOAK_FLEXWEAVE_UNDERLAY: + case ENCHANT_CLOAK_LIGHTWEAVE_EMBROIDERY: + case ENCHANT_CLOAK_SPRINGY_ARACHNOWEAVE: + case ENCHANT_CLOAK_WISDOM: + case ENCHANT_CLOAK_TITANWEAVE: + case ENCHANT_CLOAK_SPELL_PIERCING: + case ENCHANT_CLOAK_SHADOW_ARMOR: + case ENCHANT_CLOAK_MIGHTY_ARMOR: + case ENCHANT_CLOAK_MAJOR_AGILITY: + case ENCHANT_CLOAK_GREATER_SPEED: + slot = EQUIPMENT_SLOT_BACK; + break; + + // Chest + case ENCHANT_CHEST_EXCEPTIONAL_MANA: + case ENCHANT_CHEST_GREATER_MANA_RESTO: + case ENCHANT_CHEST_EXCEPTIONAL_RESILIENCE: + case ENCHANT_CHEST_SUPER_HEALTH: + case ENCHANT_CHEST_ALL_STATS: + slot = EQUIPMENT_SLOT_CHEST; + break; + + // Bracers + case ENCHANT_BRACER_GREATER_ASSAULT: + case ENCHANT_BRACER_EXCEPTIONAL_INTELLECT: + case ENCHANT_BRACER_MAJOR_SPIRIT: + case ENCHANT_BRACER_EXPERTISE: + case ENCHANT_BRACER_GREATER_STATS: + case ENCHANT_BRACER_SUPERIOR_SPELLPOWER: + case ENCHANT_BRACER_MAJOR_STAMINA: + case ENCHANT_BRACER_FUR_LINING_AP: + case ENCHANT_BRACER_FUR_LINING_STAMINA: + case ENCHANT_BRACER_FUR_LINING_SP: + case ENCHANT_BRACER_ARCANE_RESIST: + case ENCHANT_BRACER_NATURE_RESIST: + case ENCHANT_BRACER_SHADOW_RESIST: + case ENCHANT_BRACER_FROST_RESIST: + case ENCHANT_BRACER_FIRE_RESIST: + case ENCHANT_BRACER_SOCKET_BRACER: + slot = EQUIPMENT_SLOT_WRISTS; + break; + + // Gloves + case ENCHANT_GLOVES_EXPERTISE: + case ENCHANT_GLOVES_PRECISION: + case ENCHANT_GLOVES_GREATER_ASSAULT: + case ENCHANT_GLOVES_MAJOR_AGILITY: + case ENCHANT_GLOVES_EXCEPTIONAL_SPELLPOWER: + case ENCHANT_GLOVES_ARMSMAN: + case ENCHANT_GLOVES_SOCKET_GLOVES: + case ENCHANT_GLOVES_PYROROCKET: + case ENCHANT_GLOVES_HYPERSPEED_ACCELERATORS: + slot = EQUIPMENT_SLOT_HANDS; + break; + + // Belt + case ENCHANT_BELT_ETERNAL_BELT_BUCKLE: + case ENCHANT_BELT_FRAG_BELT: + slot = EQUIPMENT_SLOT_WAIST; + break; + + // Legs + case ENCHANT_LEGS_FROSTHIDE_ARMOR: + case ENCHANT_LEGS_ICESCALE_ARMOR: + case ENCHANT_LEGS_EARTHEN_ARMOR: + case ENCHANT_LEGS_SAPPHIRE_SPELLTHREAD : + case ENCHANT_LEGS_BRILLIANT_SPELLTHREAD: + slot = EQUIPMENT_SLOT_LEGS; + break; + + // Boots + case ENCHANT_BOOTS_TUSKARRS_VITALITY: + case ENCHANT_BOOTS_ICEWALKER: + case ENCHANT_BOOTS_GREATER_ASSAULT: + case ENCHANT_BOOTS_GREATER_SPIRIT: + case ENCHANT_BOOTS_GREATER_FORTITUDE: + case ENCHANT_BOOTS_SUPERIOR_AGILITY: + case ENCHANT_BOOTS_NITRO_BOOSTS: + slot = EQUIPMENT_SLOT_FEET; + break; + + // Rings + case ENCHANT_RING_STAMINA: + case ENCHANT_RING_GREATER_SPELLPOWER: + case ENCHANT_RING_ASSAULT: + slot = EQUIPMENT_SLOT_FINGER1; + break; + + // Ranged weapon + case ENCHANT_RANGED_HEARTSEEKER_SCOPE: + case ENCHANT_RANGED_SUN_SCOPE: + slot = EQUIPMENT_SLOT_RANGED; + break; + + // Main hand + case GOSSIP_ACTION_INFO_DEF + 20: + slot = EQUIPMENT_SLOT_MAINHAND; + action = selected_enchant; + check_adjacent_slot = false; + break; + + // Off hand + case GOSSIP_ACTION_INFO_DEF + 21: + slot = EQUIPMENT_SLOT_OFFHAND; + action = selected_enchant; + check_adjacent_slot = false; + break; + + default: + player->CLOSE_GOSSIP_MENU(); + break; + } + if (slot > -1) + { + // allows for a maximum of 2 duplicates, and the + // convenience of using enchant ids as gossip + // userdata + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); + if (!item && slot == INVTYPE_RANGEDRIGHT) + item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, + INVTYPE_RANGEDRIGHT); + if (item && check_adjacent_slot && + item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT) != 0) + { + switch (slot) + { + case EQUIPMENT_SLOT_MAINHAND: + { + Item* offhand = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + if (offhand) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + item->GetTemplate()->Name1.c_str(), + GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + 20); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + offhand->GetTemplate()->Name1.c_str(), + GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + 21); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + "Back", + GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + selected_enchant = action; + return true; + } + break; + } + case EQUIPMENT_SLOT_FINGER1: + { + Item* ring2 = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FINGER2); + if (ring2) + { + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + item->GetTemplate()->Name1.c_str(), + GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + 20); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + ring2->GetTemplate()->Name1.c_str(), + GOSSIP_SENDER_MAIN, + GOSSIP_ACTION_INFO_DEF + 21); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, + "Back", + GOSSIP_SENDER_MAIN, -1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + selected_enchant = action; + return true; + } + break; + } + default: + break; + } + } + Enchant(player, creature, item, action); + ShowMainMenu(player, creature); + } + return true; + } +}; + +void AddSC_npc_enchantment() +{ + new npc_enchantment(); +} \ No newline at end of file diff --git a/npc_profesiones.cpp b/npc_profesiones.cpp new file mode 100644 index 0000000..d86c862 --- /dev/null +++ b/npc_profesiones.cpp @@ -0,0 +1,292 @@ +/*Fixed By DevKM*/ +#include "Language.h" + +class Professions_NPC : public CreatureScript +{ +public: + Professions_NPC () : CreatureScript("Professions_NPC") { } + + uint32 PlayerMaxLevel() const + { + return sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); + } + + bool PlayerHasItemOrSpell(Player* player, uint32 itemId, uint32 spellId) + { + return player->HasItemCount(itemId, 1, true) || player->HasSpell(spellId); + } + + bool PlayerAlreadyHasTwoProfessions(Player* player) + { + uint32 skillCount = 0; + + if (player->HasSkill(SKILL_MINING)) + skillCount++; + if (player->HasSkill(SKILL_SKINNING)) + skillCount++; + if (player->HasSkill(SKILL_HERBALISM)) + skillCount++; + + if (skillCount >= 2) + return true; + + for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) + { + SkillLineEntry const *SkillInfo = sSkillLineStore.LookupEntry(i); + if (!SkillInfo) + continue; + + if (SkillInfo->categoryId == SKILL_CATEGORY_SECONDARY) + continue; + + if ((SkillInfo->categoryId != SKILL_CATEGORY_PROFESSION) || !SkillInfo->canLink) + continue; + + uint32 skillID = SkillInfo->id; + if (player->HasSkill(skillID)) + skillCount++; + + if (skillCount >= 2) + return true; + } + + return false; + } + + bool LearnAllRecipesInProfession(Player* player, SkillType skill) + { + char* skill_name; + + SkillLineEntry const* SkillInfo = sSkillLineStore.LookupEntry(skill); + skill_name = SkillInfo->name[ChatHandler(player->GetSession()).GetSessionDbcLocale()]; + + if (!SkillInfo) + return false; + + LearnSkillRecipesHelper(player, SkillInfo->id); + + player->SetSkill(SkillInfo->id, player->GetSkillStep(SkillInfo->id), 450, 450); + ChatHandler(player->GetSession()).PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, skill_name); + + return true; + } + + void LearnSkillRecipesHelper(Player* player, uint32 skill_id) + { + uint32 classmask = player->getClassMask(); + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) + continue; + + if (skillLine->skillId != skill_id) + continue; + + if (skillLine->forward_spellid) + continue; + + if (skillLine->racemask != 0) + continue; + + if (skillLine->classmask && (skillLine->classmask & classmask) == 0) + continue; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(skillLine->spellId); + if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false)) + continue; + + player->LearnSpell(skillLine->spellId, false); + } + } + + bool IsSecondarySkill(SkillType skill) + { + return skill == SKILL_COOKING || skill == SKILL_FIRST_AID; + } + + void CompleteLearnProfession(Player* player, Creature* creature, SkillType skill) + { + if (PlayerAlreadyHasTwoProfessions(player) && !IsSecondarySkill(skill)) + player->GetSession()->SendNotification("|TInterface/ICONS/achievement_profession_chefhat:18|t Ya aprendiste 2 profesiones |TInterface/ICONS/achievement_profession_fishing_findfish:18|t"); + else + { + if (!LearnAllRecipesInProfession(player, skill)) + ChatHandler(player->GetSession()).PSendSysMessage("ERROR!", player->GetName()); + + } + } + + bool OnGossipHello(Player* player, Creature* creature) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Alquimia", GOSSIP_SENDER_MAIN, 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Herreria", GOSSIP_SENDER_MAIN, 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Peleteteria", GOSSIP_SENDER_MAIN, 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Sastreria", GOSSIP_SENDER_MAIN, 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Ingenieria", GOSSIP_SENDER_MAIN, 5); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Encantamiento", GOSSIP_SENDER_MAIN, 6); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Joyeria", GOSSIP_SENDER_MAIN, 7); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Inscripcion", GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Herboristería", GOSSIP_SENDER_MAIN, 11); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Peleteria", GOSSIP_SENDER_MAIN, 12); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Mineria", GOSSIP_SENDER_MAIN, 13); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Cocina", GOSSIP_SENDER_MAIN, 9); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "|TInterface/ICONS/spell_holy_prayerofshadowprotection:30|t Primeros Auxilios", GOSSIP_SENDER_MAIN, 10); + player->SEND_GOSSIP_MENU(907, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 /* sender */, uint32 actions) + { + player->PlayerTalkClass->ClearMenus(); + + switch (actions) + { + case 196: + + + player->SEND_GOSSIP_MENU(907, creature->GetGUID()); + break; + case 1: + if(player->HasSkill(SKILL_ALCHEMY)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_ALCHEMY); + player->CLOSE_GOSSIP_MENU(); + break; + case 2: + if(player->HasSkill(SKILL_BLACKSMITHING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_BLACKSMITHING); + player->CLOSE_GOSSIP_MENU(); + break; + case 3: + if(player->HasSkill(SKILL_LEATHERWORKING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_LEATHERWORKING); + player->CLOSE_GOSSIP_MENU(); + break; + case 4: + if(player->HasSkill(SKILL_TAILORING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_TAILORING); + player->PlayerTalkClass->SendCloseGossip(); + break; + case 5: + if(player->HasSkill(SKILL_ENGINEERING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_ENGINEERING); + player->CLOSE_GOSSIP_MENU(); + break; + + case 6: + if(player->HasSkill(SKILL_ENCHANTING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_ENCHANTING); + player->CLOSE_GOSSIP_MENU(); + break; + case 7: + if(player->HasSkill(SKILL_JEWELCRAFTING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_JEWELCRAFTING); + player->CLOSE_GOSSIP_MENU(); + break; + case 8: + if(player->HasSkill(SKILL_INSCRIPTION)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_INSCRIPTION); + player->CLOSE_GOSSIP_MENU(); + break; + case 9: + if(player->HasSkill(SKILL_COOKING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_COOKING); + player->CLOSE_GOSSIP_MENU(); + break; + case 10: + if(player->HasSkill(SKILL_FIRST_AID)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_FIRST_AID); + player->CLOSE_GOSSIP_MENU();; + break; + case 11: + if(player->HasSkill(SKILL_HERBALISM)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_HERBALISM); + player->CLOSE_GOSSIP_MENU(); + break; + case 12: + if(player->HasSkill(SKILL_SKINNING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_SKINNING); + player->CLOSE_GOSSIP_MENU(); + break; + case 13: + if(player->HasSkill(SKILL_MINING)) + { + player->CLOSE_GOSSIP_MENU(); + return false; + } + + CompleteLearnProfession(player, creature, SKILL_MINING); + player->CLOSE_GOSSIP_MENU(); + break; + } + return true; + } +}; + +void AddSC_Professions_NPC() +{ + new Professions_NPC(); +} + + diff --git a/npc_top10_arena.cpp b/npc_top10_arena.cpp new file mode 100644 index 0000000..1b90dc4 --- /dev/null +++ b/npc_top10_arena.cpp @@ -0,0 +1,362 @@ + +#include "ScriptPCH.h" +#include +#include +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "World.h" + +enum enus +{ + ARENA_MAX_RESULTS = 10, + ARENA_1V1_LADDER = GOSSIP_ACTION_INFO_DEF + 1, + ARENA_2V2_LADDER = GOSSIP_ACTION_INFO_DEF + 2, + ARENA_3V3_LADDER = GOSSIP_ACTION_INFO_DEF + 3, + ARENA_5V5_LADDER = GOSSIP_ACTION_INFO_DEF + 4, + ARENA_GOODBYE = GOSSIP_ACTION_INFO_DEF + 5, + ARENA_START_TEAM_LOOKUP = GOSSIP_ACTION_INFO_DEF + 6, + ARENA_HELP = GOSSIP_ACTION_INFO_DEF + 9999, +}; + +class arena_top_teams : public CreatureScript +{ + private: + uint32 optionToTeamType(uint32 option) + { + uint32 teamType; + switch(option) + { + case ARENA_1V1_LADDER: + teamType = 1; + break; + case ARENA_2V2_LADDER: + teamType = 2; + break; + + case ARENA_3V3_LADDER: + teamType = 3; + break; + + case ARENA_5V5_LADDER: + teamType = 5; + break; + } + return teamType; + } + + uint32 teamTypeToOption(uint32 teamType) + { + uint32 option; + switch(teamType) + { + + case 1: + option = ARENA_1V1_LADDER; + break; + + case 2: + option = ARENA_2V2_LADDER; + break; + + case 3: + option = ARENA_3V3_LADDER; + break; + + case 5: + option = ARENA_5V5_LADDER; + break; + } + return option; + } + + std::string raceToString(uint8 race) + { + std::string race_s = "Desconocido"; + switch (race) + { + case RACE_HUMAN: + race_s = "Humano"; + break; + + case RACE_ORC: + race_s = "Orco"; + break; + + case RACE_DWARF: + race_s = "Enano"; + break; + + case RACE_NIGHTELF: + race_s = "Elfo de la Noche"; + break; + + case RACE_UNDEAD_PLAYER: + race_s = "Muerto Viviente"; + break; + + case RACE_TAUREN: + race_s = "Tauren"; + break; + + case RACE_GNOME: + race_s = "Gnomo"; + break; + + case RACE_TROLL: + race_s = "Troll"; + break; + + case RACE_BLOODELF: + race_s = "Elfo de Sangre"; + break; + + case RACE_DRAENEI: + race_s = "Draenei"; + break; + } + return race_s; + } + + std::string classToString(uint8 Class) + { + std::string Class_s = "Desconocido"; + switch (Class) + { + case CLASS_WARRIOR: + Class_s = "Guerrero"; + break; + + case CLASS_PALADIN: + Class_s = "Paladin"; + break; + + case CLASS_HUNTER: + Class_s = "Cazador"; + break; + + case CLASS_ROGUE: + Class_s = "Picaro"; + break; + + case CLASS_PRIEST: + Class_s = "Sacerdote"; + break; + + case CLASS_DEATH_KNIGHT: + Class_s = "Caballero de la Muerte"; + break; + + case CLASS_SHAMAN: + Class_s = "Chaman"; + break; + + case CLASS_MAGE: + Class_s = "Mago"; + break; + + case CLASS_WARLOCK: + Class_s = "Brujo"; + break; + + case CLASS_DRUID: + Class_s = "Druida"; + break; + } + return Class_s; + } + + + std::string getWinPercent(uint32 wins, uint32 losses) + { + uint32 totalGames = wins + losses; + if (totalGames == 0) + return "0%"; + + std::stringstream buf; + uint32 percentage = (wins * 100) / totalGames; + buf << percentage << "%"; + return buf.str(); + } + + public: + arena_top_teams() : CreatureScript("arena_top_teams"){} + + bool OnGossipHello(Player *player, Creature *creature) + { + player->ADD_GOSSIP_ITEM(4,"|cff00ff00|TInterface\\icons\\spell_chargepositive:26|t|r ¿Como Funciona este npc?", GOSSIP_SENDER_MAIN, ARENA_HELP); + player->ADD_GOSSIP_ITEM(4, "|cff00ff00|TInterface\\icons\\Ability_Warrior_WeaponMastery:26|t|r Top 10: 1v1 Arena", GOSSIP_SENDER_MAIN, ARENA_1V1_LADDER); + player->ADD_GOSSIP_ITEM(4,"|cff00ff00|TInterface\\icons\\Achievement_Arena_2v2_7:26|t|r Top 10: 2v2 Arena", GOSSIP_SENDER_MAIN, ARENA_2V2_LADDER); + player->ADD_GOSSIP_ITEM(4,"|cff00ff00|TInterface\\icons\\Achievement_Arena_3v3_7:26|t|r Top 10: 3v3 Arena", GOSSIP_SENDER_MAIN, ARENA_3V3_LADDER); + player->ADD_GOSSIP_ITEM(4,"|cff00ff00|TInterface\\icons\\Achievement_Arena_5v5_7:26|t|r Top 10: 5v5 Arena", GOSSIP_SENDER_MAIN, ARENA_5V5_LADDER); + player->ADD_GOSSIP_ITEM(4,"|cff00ff00|TInterface\\icons\\spell_chargenegative:26|t|r Salir", GOSSIP_SENDER_MAIN, ARENA_GOODBYE); + player->SEND_GOSSIP_MENU(90085, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + { + player->PlayerTalkClass->ClearMenus(); + switch(uiAction) + { + case ARENA_GOODBYE: + { + player->PlayerTalkClass->SendCloseGossip(); + break; + } + + case ARENA_HELP: + { + ChatHandler(player->GetSession()).PSendSysMessage("|cffff6060[INFO]:|r Este npc crea una lista con los mejores players del server, un top 10 de ellos."); + break; + } + + case ARENA_1V1_LADDER: + case ARENA_2V2_LADDER: + case ARENA_5V5_LADDER: + case ARENA_3V3_LADDER: + { + uint32 teamType = optionToTeamType(uiAction); + QueryResult result = CharacterDatabase.PQuery("SELECT arenaTeamId, name, rating FROM arena_team WHERE type = '%u' ORDER BY rating DESC LIMIT %u;", teamType, ARENA_MAX_RESULTS); + + if(!result) + { + player->ADD_GOSSIP_ITEM(7, "No...", GOSSIP_SENDER_MAIN, ARENA_GOODBYE); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + } + else + { + std::string name; + uint32 teamId, rating, rank = 1; + player->ADD_GOSSIP_ITEM(0,"Top Arena Lista de Gladiadores:", GOSSIP_SENDER_MAIN, ARENA_GOODBYE); + do + { + Field *fields = result->Fetch(); + teamId = fields[0].GetUInt32(); + name = fields[1].GetString(); + rating = fields[2].GetUInt32(); + + std::stringstream buffer; + buffer << rank << ". " << name; + buffer << ": " << "|cFF1E90FF" << rating << "|r" << " rating!"; + player->ADD_GOSSIP_ITEM(4, buffer.str(), GOSSIP_SENDER_MAIN, ARENA_START_TEAM_LOOKUP + teamId); + + rank++; + } + while(result->NextRow()); + player->ADD_GOSSIP_ITEM(7, "Adios...", GOSSIP_SENDER_MAIN, ARENA_GOODBYE); + player->SEND_GOSSIP_MENU(90086, creature->GetGUID()); + } + break; + } + + default: + { + if (uiAction > ARENA_START_TEAM_LOOKUP) + { + uint32 teamId = uiAction - ARENA_START_TEAM_LOOKUP; + QueryResult result = CharacterDatabase.PQuery("SELECT name, rating, seasonWins, seasonGames - seasonWins, weekWins, weekGames - weekWins, rank, captainGuid , type FROM arena_team WHERE arenaTeamId = '%u'", teamId); + + if(!result) + { + player->GetSession()->SendNotification("Team de arena no funciona!..."); + player->PlayerTalkClass->SendCloseGossip(); + return true; + } + + Field *fields = result->Fetch(); + std::string name = fields[0].GetString(); + uint32 rating = fields[1].GetUInt32(); + uint32 seasonWins = fields[2].GetUInt32(); + uint32 seasonLosses = fields[3].GetUInt32(); + uint32 weekWins = fields[4].GetUInt32(); + uint32 weekLosses = fields[5].GetUInt32(); + uint32 rank = fields[6].GetUInt32(); + uint32 captainGuid = fields[7].GetUInt32(); + uint32 type = fields[8].GetUInt32(); + uint32 parentOption = teamTypeToOption(type); + + std::string seasonWinPercentage = getWinPercent(seasonWins, seasonLosses); + std::string weekWinPercentage = getWinPercent(weekWins, weekLosses); + + std::stringstream buf; + buf << "Nombre: " << "|cFF1E90FF" << name << "|r"; + player->ADD_GOSSIP_ITEM(7, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + buf.str(""); + + buf << "Rating: " << "|cFF1E90FF" << rating << "|r" << " (Rank: " << "|cFF1E90FF" << rank << "|r" << ", Type: " << "|cFF1E90FF" << type << "v" << type << "|r"")"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + buf.str(""); + + buf << "Total semana: " << "|cFF1E90FF" << weekWins << "-" << weekLosses << "|r"" (" << "|cFF1E90FF" << weekWinPercentage << "|r" << "win)"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + buf.str(""); + + buf << "Total Season: " << "|cFF1E90FF" << seasonWins << "-" << seasonLosses << "|r" << " (" << "|cFF1E90FF" << seasonWinPercentage << "|r" << " win)"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + + QueryResult members = CharacterDatabase.PQuery("SELECT a.guid, a.personalRating, a.weekWins, a.weekGames - a.weekWins, a.seasonWins, a.seasonGames - a.seasonWins, c.name, c.race, c.class, c.level FROM arena_team_member a LEFT JOIN characters c ON c.guid = a.guid WHERE arenaTeamId = '%u' ORDER BY a.guid = '%u' DESC, a.seasonGames DESC, c.name ASC", teamId, captainGuid); + if(!members) + { + player->ADD_GOSSIP_ITEM(7, "En los miembros del equipo encontrado...?", GOSSIP_SENDER_MAIN, parentOption); + } + else + { + uint32 memberPos = 1; + uint32 memberCount = members->GetRowCount(); + uint32 guid, personalRating, level; + std::string name, race, Class; + + buf.str(""); + buf << " --- " << memberCount << " team" << ((memberCount == 1) ? " member" : " members") << " found" << " ---"; + player->ADD_GOSSIP_ITEM(0, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + do + { + fields = members->Fetch(); + guid = fields[0].GetUInt32(); + personalRating = fields[1].GetUInt32(); + weekWins= fields[2].GetUInt32(); + weekLosses = fields[3].GetUInt32(); + seasonWins = fields[4].GetUInt32(); + seasonLosses = fields[5].GetUInt32(); + name = fields[6].GetString(); + race = raceToString(fields[7].GetUInt8()); + Class = classToString(fields[8].GetUInt8()); + level = fields[9].GetUInt32(); + + seasonWinPercentage = getWinPercent(seasonWins, seasonLosses); + weekWinPercentage = getWinPercent(weekWins, weekLosses); + + buf.str(""); + buf << memberPos << ". "; + if (guid == captainGuid) + buf << "Capitán del equipo "; + + + buf << race << " " << Class << ", " << "|cFF1E90FF" << personalRating << "|r" << " rating personal!"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + buf.str(""); + + buf << "Semana: " << "|cFF1E90FF" << weekWins << "-" << weekLosses << "|r" << " (" << "|cFF1E90FF" << weekWinPercentage << "|r" << " win), " << "|cFF1E90FF" << (weekWins + weekLosses) << "|r" << " played!"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + buf.str(""); + + buf << "Season: " << "|cFF1E90FF" << seasonWins << "-" << seasonLosses << "|r" << " (" << "|cFF1E90FF" << seasonWinPercentage << "|r" << " win), " << "|cFF1E90FF" << (seasonWins + seasonLosses) << "|r" << " played!"; + player->ADD_GOSSIP_ITEM(4, buf.str(), GOSSIP_SENDER_MAIN, parentOption); + memberPos++; + } + while(members->NextRow()); + } + player->SEND_GOSSIP_MENU(90087, creature->GetGUID()); + } + } + } + return true; + } +}; + +void AddSC_arena_top_teams() +{ + new arena_top_teams(); +} \ No newline at end of file diff --git a/phase_duels.cpp b/phase_duels.cpp new file mode 100644 index 0000000..91bb288 --- /dev/null +++ b/phase_duels.cpp @@ -0,0 +1,85 @@ +class PhasedDueling : public PlayerScript +{ +public: + PhasedDueling(): PlayerScript("PhasedDueling") {} + + void OnDuelStart(Player* firstplayer, Player* secondplayer) override + { + Map* map = firstplayer->GetMap(); + if (map->IsDungeon()) + return; + + // Duel flag is used as duel center point + GameObject* go = map->GetGameObject(ObjectGuid(firstplayer->GetUInt64Value(PLAYER_DUEL_ARBITER))); + if (!go) + return; + + // Get players from 100 yard radius ( duel radius is 40-50 yd ) + std::list playerList; + Trinity::AnyPlayerInObjectRangeCheck checker(go, 100.0f); + Trinity::PlayerListSearcher searcher(go, playerList, checker); + go->VisitNearbyWorldObject(100.0f, searcher); + + // insert players' phases to used phases, ignore GMs + uint32 usedPhases = 0; + if (!playerList.empty()) + for (std::list::const_iterator it = playerList.begin(); it != playerList.end(); ++it) + if (!(*it)->IsGameMaster()) + usedPhases |= (*it)->GetPhaseMask(); + + // loop all unique phases + for (uint32 phase = 2; phase <= ULONG_MAX / 2; phase *= 2) + { + // If phase in use, skip + if (usedPhases & phase) + continue; + + // Phase players & pets, dont update visibility yet + firstplayer->SetPhaseMask(phase, false); + secondplayer->SetPhaseMask(phase, false); + // Phase duel flag + go->SetPhaseMask(phase, true); + // Update visibility here so pets will be phased and wont despawn + firstplayer->UpdateObjectVisibility(); + secondplayer->UpdateObjectVisibility(); + return; + } + + // Couldnt find free unique phase + firstplayer->GetSession()->SendNotification("There are no free phases"); + secondplayer->GetSession()->SendNotification("There are no free phases"); + } + + // Restore phases + void OnDuelEnd(Player* firstplayer, Player* secondplayer, DuelCompleteType type) override + { + // Phase players, dont update visibility yet + firstplayer->SetPhaseMask(GetNormalPhase(firstplayer), false); + secondplayer->SetPhaseMask(GetNormalPhase(secondplayer), false); + // Update visibility here so pets will be phased and wont despawn + firstplayer->UpdateObjectVisibility(); + secondplayer->UpdateObjectVisibility(); + } + + // Attempt in storing the player phase with spell phases included. + uint32 GetNormalPhase(Player* player) const + { + if (player->IsGameMaster()) + return uint32(PHASEMASK_ANYWHERE); + + // GetPhaseMaskForSpawn copypaste + uint32 phase = PHASEMASK_NORMAL; + Player::AuraEffectList const& phases = player->GetAuraEffectsByType(SPELL_AURA_PHASE); + if (!phases.empty()) + phase = phases.front()->GetMiscValue(); + if (uint32 n_phase = phase & ~PHASEMASK_NORMAL) + return n_phase; + + return PHASEMASK_NORMAL; + } +}; + +void AddSC_PhasedDueling() +{ + new PhasedDueling(); +} \ No newline at end of file diff --git a/prizelevel.cpp b/prizelevel.cpp new file mode 100644 index 0000000..d7bf09b --- /dev/null +++ b/prizelevel.cpp @@ -0,0 +1,88 @@ +#include "ScriptMgr.h" +#include "Player.h" +#include "WorldSession.h" +class custom_CongratsOnLevel : public PlayerScript +{ +public: + custom_CongratsOnLevel() : PlayerScript("custom_CongratsOnLevel") { } + + void OnLevelChanged(Player* player, uint8 newLevel) + { + uint32 money, item, spell; + + switch(++newLevel) + { + case 10: + money = 10; // 1 de oro + item = 4500; // Mochila de viajero + //item3 = 29434; + spell = 26035; // celebra los buenos tiempos + break; + case 15: + money = 20; + item = 90001; //moneda de nivel + spell = 53758; //Frasco de Sangre piedra + break; + case 20: + money = 50; // 2 de oro + item = 43599; //Gran Oso de Blizzard + spell = 24705; //bendicion del hombre de mimbre + break; + case 30: + money = 30; // 3 de oro + item = 52002; // anillo de pirata aterrador + //item2 = 50255; + spell = 24425; //Espiritu zandalar + break; + case 40: + money = 40; + item = 41426; //obsequi envuelto en magia + //item2 = 50255; + spell = 35076; //bendicion de adal + break; + case 50: + money = 50; + item = 52002; //cartera de biene utiles + //item2 = 50255; + spell = 53758; // frasco de sangre piedra + break; + case 60: + money = 5000; + item = 29434; //distintivo de justicia + //item2 = 50255; + spell = 16609; //bendicion del jefe de guerra + break; + case 70: + money = 5000; + item = 45624;//emblema de conquista + //item2 = 50255; + spell = 26393; //bendicion de elune + break; + case 80: + money = 5000; + item = 90001; + //item2 = 50255; + spell = 33053; //Bendicion de don pellisco + break; + default: + return; + } + + std::ostringstream ss; + ss << "|cffFF0000[Rhonin WoW]|r Felicidades " << player->GetName() << " por alcanzar el nivel " << (uint32)newLevel; + sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str()); + + std::ostringstream ss2; + ss2 << "Por su esfuerzo y dedicación le recompensaron con " << money << " oro y un objeto especial!"; + player->GetSession()->SendNotification(ss2.str().c_str()); + + player->ModifyMoney(money*GOLD); + player->AddItem(item, 1); + player->CastSpell(player, spell, false); + } +}; + +void AddSC_custom_CongratsOnLevel() +{ + new custom_CongratsOnLevel(); +} diff --git a/removeore.cpp b/removeore.cpp new file mode 100644 index 0000000..0f4f310 --- /dev/null +++ b/removeore.cpp @@ -0,0 +1,100 @@ +#include "ScriptMgr.h" +#include "Player.h" +#include "Chat.h" +#define FFA_ENTER_MSG "|cffff6060[InMoral JcJ]:|r Esto es una |cFFFF4500zona JcJ|r, recuerda que cuando mueres |cFFFF4500pierdes 5 de oro|r pero ganaras |cFFFF4500 5 de oro|r por muerte!" +#define KILL_MSG "|cff00ff00|TInterface\\PvPRankBadges/PvPRank06:24|t|r Bien hecho usted ha ganado 5 de oro por esta |cFFFF4500Muerte|r!" +#define KILL_FFA_MSG "|cffff6060[InMoral JcJ]:|r Bien hecho ganaste 5 de oro por esta muerte! |cFFFF4500Muerte|r!" +#define LOST_GOLD_MSG "|cffff6060[InMoral JcJ]:|r Lo siento |cFFFF4500perdiste|r 5 de oro" +#define ERR_TOO_MUCH_MONEY "|cffff6060[InMoral JcJ]: Superaste la cantidad maxima de oro!|r" + +enum Rewards +{ + NORMAL_REWARD = 50000, + FFA_REWARD = 50000, + FFA_LOST = 50000 +}; + +class GoldOnKill : public PlayerScript +{ +public: + GoldOnKill() : PlayerScript("GoldOnKill") {} + + void OnUpdateZone(Player* player, uint32 zone, uint32 area) + { + if(player->pvpInfo.IsInFFAPvPArea) //gets updated by UpdatePvPState + { + ChatHandler handler(player->GetSession()); + handler.PSendSysMessage(FFA_ENTER_MSG); + } + } + void OnPVPKill(Player* killer, Player* victim) + { + ChatHandler kHandler(killer->GetSession()); + ChatHandler vHandler(victim->GetSession()); + + if(killer->GetGUID() == victim->GetGUID()) + { + return; + } + else + { + if(killer->pvpInfo.IsInFFAPvPArea && victim->pvpInfo.IsInFFAPvPArea) //gets updated by UpdatePvPState + { + if(killer->GetMoney() + FFA_REWARD < MAX_MONEY_AMOUNT) + { + killer->SetMoney(killer->GetMoney() + FFA_REWARD); + kHandler.PSendSysMessage(KILL_FFA_MSG); + killer->CastSpell(killer, 23505, true); + //killer->CastSpell(killer, 33053, true); //bendicion de don pellisco + //killer->CastSpell(killer, 35076, true); //bendicion de adal + //killer->CastSpell(killer, 26393, true); //bendicion de elune + //killer->CastSpell(killer, 26035, true); //celebra los buenos tiempos + //killer->CastSpell(killer, 22888, true); //berrido de convocacion + //killer->CastSpell(killer, 24425, true); //espiritu zandalar + //killer->CastSpell(killer, 24705, true); //hombre de minbre + killer->ModifyArenaPoints(1); + } + else + kHandler.PSendSysMessage(ERR_TOO_MUCH_MONEY); + if(victim->GetMoney() - FFA_LOST > 0) + { + if(victim->GetMoney() != 0){ + victim->SetMoney(victim->GetMoney() - FFA_LOST); + } + vHandler.PSendSysMessage(LOST_GOLD_MSG); + } + } + else + { + if(killer->GetMoney() + NORMAL_REWARD < MAX_MONEY_AMOUNT) + { + killer->SetMoney(killer->GetMoney() + NORMAL_REWARD); + kHandler.PSendSysMessage(KILL_MSG); + killer->CastSpell(killer, 23505, true); + //killer->CastSpell(killer, 33053, true); + //killer->CastSpell(killer, 35076, true); + //killer->CastSpell(killer, 26393, true); + //killer->CastSpell(killer, 26035, true); + //killer->CastSpell(killer, 22888, true); + //killer->CastSpell(killer, 24425, true); + //killer->CastSpell(killer, 24705, true); + killer->ModifyArenaPoints(1); + } + else + kHandler.PSendSysMessage(ERR_TOO_MUCH_MONEY); + if (victim->GetMoney() - FFA_LOST > 0) + { + if (victim->GetMoney() != 0){ + victim->SetMoney(victim->GetMoney() - FFA_LOST); + } + vHandler.PSendSysMessage(LOST_GOLD_MSG); + } + } + } + } +}; + +void AddSC_GoldOnKill() +{ + new GoldOnKill(); +} diff --git a/subir_skills.cpp b/subir_skills.cpp new file mode 100644 index 0000000..a5b1e4f --- /dev/null +++ b/subir_skills.cpp @@ -0,0 +1,38 @@ +/* +Creado por Sakuranobushi +Publicación original en Reign of Ysera de proyecto Oscuridad +Liberado para http://overwow.com +Por favor, mantener los creditos en caso de ser utilizado +*/ + + +#include "ScriptPCH.h" + + +class npc_skills : public CreatureScript +{ +public: + npc_skills() : CreatureScript("npc_skills") { } + + + bool OnGossipHello(Player* player, Creature* creature) + { + { + player->PrepareQuestMenu(creature->GetGUID()); + player->SendPreparedQuest(creature->GetGUID()); + } + player->ADD_GOSSIP_ITEM(TRAINER_ICON, "Quiero subir mis habilidades", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + return true; + } + + + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) + { + player->UpdateSkillsToMaxSkillsForLevel(); + player->SaveToDB(); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + player->PlayerTalkClass->SendCloseGossip(); + } +}; +void AddSC_npc_skills(){ new npc_skills();} \ No newline at end of file diff --git a/talent_chooser.cpp b/talent_chooser.cpp new file mode 100644 index 0000000..b503503 --- /dev/null +++ b/talent_chooser.cpp @@ -0,0 +1,581 @@ +#include "ScriptPCH.h" + +class Talent_Chooser : public CreatureScript +{ +public: + Talent_Chooser() : CreatureScript("Talent_Chooser") { } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + switch (pPlayer->getClass()) + { + case CLASS_PALADIN: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_auraoflight:30|t|cff660099Retribution|r\n|cffbc0000Passives:\nSheath of Light.|r\n|cff0A7600Actives:\nCrusader Strike and Repentance", GOSSIP_SENDER_MAIN, 0); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_holybolt:30|t|cff660099Holy|r\n|cffbc0000Passives:\nJudgements of the Pure, Light's Grace.|r\n|cff0A7600Actives:\nCleanse, Aura Mastery, Holy Guidance, and Concentration Aura.", GOSSIP_SENDER_MAIN, 1); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_devotionaura:30|t|cff660099Protection|r\n|cffbc0000Passives:\nSpiritual Attunement.\n|cff0A7600Actives:\nBlessing of Sanctuary, Holy Shield, and Consecration.", GOSSIP_SENDER_MAIN, 2); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_MAGE: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_magicalsentry:30|t|cff660099Arcane|r\n|cffbc0000Passives:\nMissle Barrage.|r\n|cff0A7600Actives:\nInvisibility and Slow.", GOSSIP_SENDER_MAIN, 3); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_fire_flamebolt:30|t|cff660099Fire|r\n|cffbc0000Passives:\nBlazing Speed.|r\n|cff0A7600Actives:\nDragon's Breath, and Scorch.", GOSSIP_SENDER_MAIN, 4); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_frost_frostbolt02:30|t|cff660099Frost|r\n|cffbc0000Passives:\nShatter.|r\n|cff0A7600Actives:\nIce Barrier and Ice Lance.", GOSSIP_SENDER_MAIN, 5); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_WARRIOR: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_rogue_eviscerate:30|t|cff660099Arms|r\n|cffbc0000Passives:\nTaste for Blood, Second Wind, Improved Overpower, Sudden Death. \n|cff0A7600Actives:\nIntervene", GOSSIP_SENDER_MAIN, 6); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_warrior_innerrage:30|t|cff660099Fury|r\n|cffbc0000Passives:\nBloodsurge.|r\n|cff0A7600Actives:\nBloodthirst, and Slam.", GOSSIP_SENDER_MAIN, 7); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_warrior_defensivestance:30|t|cff660099Protection|r\n|cffbc0000Passives:\nShield Mastery.|r\n|cff0A7600Actives:\nConcussion Blow, Last Stand, and Spell Reflection.", GOSSIP_SENDER_MAIN, 8); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_PRIEST: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_guardianspirit:30|t|cff660099Holy|r\n|cffbc0000Passives:\nEmpowered Renew, Spiritual Healing and Surge of Light.|r\n|cff0A7600Actives:\nDesperate Prayer and Holy Nova.", GOSSIP_SENDER_MAIN, 9); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_holy_wordfortitude:30|t|cff660099Discipline|r\n|cffbc0000Passives:\nMeditation, Soul Warding, Grace, Impowered Power Word: Shield and Rapture.|r\n|cff0A7600Actives:\nPain Surpression.", GOSSIP_SENDER_MAIN, 10); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_shadow_shadowwordpain:30|t|cff660099Shadow|r\n|cffbc0000Passive:\nFocused Mind and Shadow Weaving.|r\n|cff0A7600Actives:\nMind Flay and Vampiric Touch.", GOSSIP_SENDER_MAIN, 11); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_HUNTER: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_marksmanship:30|t|cff660099Marksmanship|r\n|cff0A7600Actives:\nSilencing Shot, Chimera Shot.|r", GOSSIP_SENDER_MAIN, 12); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_hunter_swiftstrike.:30|t|cff660099Survival|r\n|cffbc0000Passives:\nExpose Weakness, and Master Tactician.|r\n|cff0A7600Actives:\nScatter Shot, Deterrence.|r", GOSSIP_SENDER_MAIN, 13); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_hunter_beasttaming:30|t|cff660099Beastmaster|r\n|cffbc0000Passives:\nUnleashed Fury, Bestial Discipline, Ferocity, Kindred Spirits and Beast Mastery.|r\n|cff0A7600Actives:\nMaster's Call and Intimidation.|r", GOSSIP_SENDER_MAIN, 14); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_ROGUE: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_stealth:30|t|cff660099Subtlety|r\n|cffbc0000Passives:\nSlaughter from the Shadows and Elusiveness.|r\n|cff0A7600Actives:\nHemorrhage.", GOSSIP_SENDER_MAIN, 15); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_rogue_eviscerate:30|t|cff660099Assassination|r\n|cffbc0000Passives:\nOverkill, Seal Fate, Deadly Brew, and Improved Poisons.|r\n|cff0A7600Actives:\nCold Blood.", GOSSIP_SENDER_MAIN, 16); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_backstab:30|t|cff660099Combat|r\n|cffbc0000Passives:\nUnfair Advantage, and Improved Sprint.|r\n|cff0A7600Actives:\nAdrenaline Rush", GOSSIP_SENDER_MAIN, 17); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_SHAMAN: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_nature_magicimmunity:30|t|cff660099Restoration|r\n|cffbc0000Passives:\nNature's Guardian, and Purification and Healing Focus.|r\n|cff0A7600Actives:\nEarth Shield and Cleanse Spirit.", GOSSIP_SENDER_MAIN, 18); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_nature_lightningshield:30|t|cff660099Enhancement|r\n|cffbc0000Passives:\nDual Wield, Flurry, Mental Quickness, and Improved Stormstrike.|r\n|cff0A7600Actives:\nStormstrike, Lava Lash.", GOSSIP_SENDER_MAIN, 19); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_nature_lightning:30|t|cff660099Elemental|r\n|cffbc0000Passives:\nLightning Mastery, Eye of the Storm, and Storm Earth and Fire. \n|cff0A7600Actives:\nElemental Mastery.", GOSSIP_SENDER_MAIN, 20); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_WARLOCK: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_shadow_deathcoil:30|t|cff660099Affliciton|r\n|cffbc0000Passives:\nFel Concentration.|r\n|cff0A7600Actives:\nHaunt.", GOSSIP_SENDER_MAIN, 21); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_shadow_gathershadows:30|t|cff660099Demonology|r\n|cffbc0000Passives:\nMaster Summoner.|r\n|cff0A7600Actives:\nSoul Link and Fel Domination.|r", GOSSIP_SENDER_MAIN, 22); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_shadow_rainoffire:30|t|cff660099Destruction|r\n|cffbc0000Passives:\nBackdraft and Intensity.|r\n|cff0A7600Actives:\nConflagrate and Incinterate.|r", GOSSIP_SENDER_MAIN, 23); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + case CLASS_DRUID: + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_druid_catform:30|t|cff660099Feral|r\n|cffbc0000Passives:\nPredatory Strikes, Nurturing Instinct Shredding Attacks, and Feral Swiftness.|r\n|cff0A7600Actives:\nFeral Charge - Cat, Mangle - Cat and Shred.", GOSSIP_SENDER_MAIN, 24); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\ability_racial_bearform:30|t|cff660099Guardian|r\n|cffbc0000Passives:\nNatural Reaction and Protector of the Pack.|r\n|cff0A7600Actives:\nMangle - Bear and Dire Bear Form.", GOSSIP_SENDER_MAIN, 27); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_nature_starfall:30|t|cff660099Balance|r\n|cffbc0000Passives:\nDreamstate and Owlkin Frenzy.|r\n|cff0A7600Actives:\nMoonkin Form and Insect Swarm.", GOSSIP_SENDER_MAIN, 25); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface\\icons\\spell_nature_healingtouch:30|t|cff660099Restoration|r\n|cffbc0000Passives:\nIntensity and Gift of the Nature.|r\n|cff0A7600Actives:\nSwiftmend and Barkskin.", GOSSIP_SENDER_MAIN, 26); + pPlayer->PlayerTalkClass->SendGossipMenu(161666, pCreature->GetGUID()); + break; + } + return true; + } + + bool OnGossipSelect(Player * player, Creature * creature, uint32 sender, uint32 uiAction) + { + if (sender == GOSSIP_SENDER_MAIN) + { + player->PlayerTalkClass->ClearMenus(); + switch (uiAction) + { + // Paladin + case 0: //Retrubition + player->RemoveSpell(19746, false); //Concentration Aura + player->RemoveSpell(31821, false); //Aura Mastery + player->RemoveSpell(4987, false); //Cleanse + player->RemoveSpell(20911, false); //Blessing of Sanctuary + player->RemoveSpell(20925, false); //Holy Shield + player->RemoveSpell(26573, false); //Consecration + player->RemoveSpell(20127, false); //Redoubt + player->RemoveSpell(31785, false); //Spiritual Attunement + player->RemoveSpell(53671, false); //Judgements of the Pure + player->RemoveSpell(31833, false); //Light's Grace + player->RemoveSpell(31837, false); //Holy Guidance + player->LearnSpell(20066, false); //Repentance + player->LearnSpell(35395, false); //Crusader Strike + player->LearnSpell(53501, false); //Sheath of Light 1/3 + break; + case 1: //Holy + player->RemoveSpell(20066, false); //Repentance + player->RemoveSpell(35395, false); //Crusader Strike + player->RemoveSpell(53501, false); //Sheath of Light 1/3 + player->RemoveSpell(20911, false); //Blessing of Sanctuary + player->RemoveSpell(20925, false); //Holy Shield + player->RemoveSpell(26573, false); //Consecration + player->RemoveSpell(20127, false); //Redoubt + player->RemoveSpell(31785, false); //Spiritual Attunement + player->LearnSpell(31840, false); //Holy Guidance + player->LearnSpell(19746, false); //Concentration Aura + player->LearnSpell(31821, false); //Aura Mastery + player->LearnSpell(4987, false); //Cleanse + player->LearnSpell(54155, false); //Judgements of the Pure + player->LearnSpell(31836, false); //Light's Grace + break; + case 2: //Protection + player->RemoveSpell(35395, false); //Crusader Strike + player->RemoveSpell(53671, false); //Judgements of the Pure + player->RemoveSpell(31833, false); //Light's Grace + player->RemoveSpell(20066, false); //Repentance + player->RemoveSpell(53501, false); //Sheath of Light 1/3 + player->RemoveSpell(4987, false); //Cleanse + player->RemoveSpell(31821, false); //Aura Mastery + player->RemoveSpell(19746, false); //Concentration Aura + player->RemoveSpell(31837, false); //Holy Guidance + player->LearnSpell(20911, false); //Blessing of Sanctuary + player->LearnSpell(20925, false); //Holy Shield + player->LearnSpell(26573, false); //Consecration + player->LearnSpell(20135, false); //Redoubt + player->LearnSpell(33776, false); //Spiritual Attunement + break; + + // Mage + case 3: // Arcane + player->RemoveSpell(11426, false); //Ice Barrier + player->RemoveSpell(11170, false); //Shatter + player->RemoveSpell(31661, false); //Dragon's Breath + player->RemoveSpell(31641, false); //Blazing Speed + player->RemoveSpell(2948, false); //Scorch + player->RemoveSpell(30455, false); //Ice Lance + player->LearnSpell(66, false); //Invisibility + player->LearnSpell(54489, false); //Missle Barrage + player->LearnSpell(31589, false); //Slow + break; + case 4: // Fire + player->RemoveSpell(11426, false); //Ice Barrier + player->RemoveSpell(11170, false); //Shatter + player->RemoveSpell(44404, false); //Missle Barrage + player->RemoveSpell(31589, false); //Slow + player->RemoveSpell(30455, false); //Ice Lance + player->RemoveSpell(66, false); //Invisibility + player->LearnSpell(31661, false); //Dragon's Breath + player->LearnSpell(31642, false); //Blazing Speed + player->LearnSpell(2948, false); //Scorch + break; + case 5: // Frost + player->RemoveSpell(44404, false); //Missle Barrage + player->RemoveSpell(31589, false); //Slow + player->RemoveSpell(31661, false); //Dragon's Breath + player->RemoveSpell(31641, false); //Blazing Speed + player->RemoveSpell(2948, false); //Scorch + player->RemoveSpell(66, false); //Invisibility + player->LearnSpell(30455, false); //Ice Lance + player->LearnSpell(11426, false); //Ice Barrier + player->LearnSpell(12983, false); //Shatter + break; + + // Warrior + case 6: // Arms + player->LearnSpell(57499, false); //Warbringer + player->RemoveSpell(23881, false); //Bloodthirst + player->RemoveSpell(1464, false); //Slam + player->RemoveSpell(12975, false); //Last Stand + player->RemoveSpell(23920, false); //Spell Reflection + player->RemoveSpell(29598, false); //Shield Mastery + player->RemoveSpell(12809, false); //Concussion Blow + player->RemoveSpell(46913, false); //Bloodsurge + player->RemoveSpell(12292, false); //Death Wish + player->LearnSpell(56638, false); //Taste For Blood + player->LearnSpell(29838, false); //Second Wind + player->LearnSpell(12963, false); //Improved Overpower + player->LearnSpell(29724, false); //Sudden Death + player->LearnSpell(3411, false); //Intervene + break; + case 7: // Fury + player->LearnSpell(57499, false); //Warbringer + player->RemoveSpell(56636, false); //Taste For Blood + player->RemoveSpell(12975, false); //Last Stand + player->RemoveSpell(29834, false); //Second Wind + player->RemoveSpell(29723, false); //Sudden Death + player->RemoveSpell(3411, false); //Intervene + player->RemoveSpell(23920, false); //Spell Reflection + player->RemoveSpell(29598, false); //Shield Mastery + player->RemoveSpell(12809, false); //Concussion Blow + player->RemoveSpell(12960, false); //Improved Overpower + player->LearnSpell(23881, false); //Bloodthirst + player->LearnSpell(1464, false); //Slam + player->LearnSpell(46915, false); //Bloodsurge + break; + case 8: // Protection + player->LearnSpell(57499, false); //Warbringer + player->RemoveSpell(56636, false); //Taste For Blood + player->RemoveSpell(23881, false); //Bloodthirst + player->RemoveSpell(12292, false); //Death Wish + player->RemoveSpell(1464, false); //Slam + player->RemoveSpell(46913, false); //Bloodsurge + player->RemoveSpell(29834, false); //Second Wind + player->RemoveSpell(29723, false); //Sudden Death + player->RemoveSpell(3411, false); //Intervene + player->RemoveSpell(12960, false); //Improved Overpower + player->LearnSpell(23920, false); //Spell Reflection + player->LearnSpell(29599, false); //Shield Mastery + player->LearnSpell(12809, false); //Concussion Blow + player->LearnSpell(12975, false); //Last Stand + break; + + // Priest + case 9: // Holy + player->RemoveSpell(14521, false); //Meditation + player->RemoveSpell(33206, false); //Pain Suppression + player->RemoveSpell(63574, false); //Soul Warding + player->RemoveSpell(47535, false); //Rapture + player->RemoveSpell(15407, false); //Mind Flay + player->RemoveSpell(34914, false); //Vampiric Touch + player->RemoveSpell(33213, false); //Focused Mind + player->RemoveSpell(15257, false); //Shadow Weaving + player->RemoveSpell(47516, false); //Grace + player->RemoveSpell(14748, false); //Improved Power Word Sheild + player->LearnSpell(63543, false); //Empowered Renew + player->LearnSpell(19236, false); //Desperate Prayer + player->LearnSpell(33154, false); //Surge of Light + player->LearnSpell(15237, false); //Holy Nova + player->LearnSpell(9472, false); //Flash Heal Rank 2 + player->LearnSpell(6075, false); //Renew Rank 3 + player->LearnSpell(2055, false); //Heal Rank 2 + player->LearnSpell(15356, false); //Spiritual Healing + break; + case 10: // Discipline + player->RemoveSpell(63534, false); //Empowered Renew + player->RemoveSpell(19236, false); //Desperate Prayer + player->RemoveSpell(33150, false); //Surge of Light + player->RemoveSpell(15237, false); //Holy Nova + player->RemoveSpell(15407, false); //Mind Flay + player->RemoveSpell(34914, false); //Vampiric Touch + player->RemoveSpell(33213, false); //Focused Mind + player->RemoveSpell(15257, false); //Shadow Weaving + player->RemoveSpell(14898, false); //Spiritual Healing + player->LearnSpell(47517, false); //Grace + player->LearnSpell(14769, false); //Improved Power Word Sheild + player->LearnSpell(14777, false); //Meditation + player->LearnSpell(33206, false); //Pain Suppression + player->LearnSpell(63574, false); //Soul Warding + player->LearnSpell(47537, false); //Rapture + player->LearnSpell(9472, false); //Flash Heal Rank 2 + player->LearnSpell(6075, false); //Renew Rank 3 + player->LearnSpell(2055, false); //Heal Rank 2 + break; + case 11: // Shadow + player->RemoveSpell(63534, false); //Empowered Renew + player->RemoveSpell(19236, false); //Desperate Prayer + player->RemoveSpell(33150, false); //Surge of Light + player->RemoveSpell(15237, false); //Holy Nova + player->RemoveSpell(14521, false); //Meditation + player->RemoveSpell(33206, false); //Pain Suppression + player->RemoveSpell(63574, false); //Soul Warding + player->RemoveSpell(47535, false); //Rapture + player->RemoveSpell(9472, false); //Flash Heal Rank 2 + player->RemoveSpell(6075, false); //Renew Rank 3 + player->RemoveSpell(2055, false); //Heal Rank 2 + player->RemoveSpell(14898, false); //Spiritual Healing + player->RemoveSpell(47516, false); //Grace + player->RemoveSpell(14748, false); //Improved Power Word Sheild + player->LearnSpell(15332, false); //Shadow Weaving + player->LearnSpell(33215, false); //Focused Mind + player->LearnSpell(15407, false); //Mind Flay + player->LearnSpell(34914, false); //Vampiric Touch + break; + + // Hunter + case 12: // Marksman + player->CastSpell(player, 36562, false); //Force Dismisses Pet. + player->RemoveSpell(53271, false); //Master's Call + player->RemoveSpell(19590, false); //Bestial Discipline + player->RemoveSpell(19616, false); //Unleashed Fury + player->RemoveSpell(19598, false); //Ferocity + player->RemoveSpell(56314, false); //Kindred Spirits + player->RemoveSpell(19503, false); //Scatter Shot + player->RemoveSpell(19263, false); //Deterrence + player->RemoveSpell(34500, false); //Expose Weakness + player->RemoveSpell(34506, false); //Master Tactician + player->RemoveSpell(19577, false); //Intimidation + player->RemoveSpell(53270, false); //Beast Mastery (Exotic Pets) + player->LearnSpell(34490, false); //Silencing Shot + player->LearnSpell(53209, false); //Chimera Shot + break; + case 13: // Survival + player->CastSpell(player, 36562, false); //Force Dismisses Pet. + player->RemoveSpell(53271, false); //Master's Call + player->RemoveSpell(19590, false); //Bestial Discipline + player->RemoveSpell(19616, false); //Unleashed Fury + player->RemoveSpell(19598, false); //Ferocity + player->RemoveSpell(56314, false); //Kindred Spirits + player->RemoveSpell(34490, false); //Silencing Shot + player->RemoveSpell(53209, false); //Chimera Shot + player->RemoveSpell(19577, false); //Intimidation + player->RemoveSpell(53270, false); //Beast Mastery (Exotic Pets) + player->LearnSpell(19503, false); //Scatter Shot + player->LearnSpell(19263, false); //Deterrence + player->LearnSpell(34503, false); //Expose Weakness + player->LearnSpell(34839, false); //Master Tactician + break; + case 14: // Beastmaster + player->CastSpell(player, 36562, false); //Force Dismisses Pet/ + player->RemoveSpell(34490, false); //Silencing Shot + player->RemoveSpell(53209, false); //Chimera Shot + player->RemoveSpell(19503, false); //Scatter Shot + player->RemoveSpell(19263, false); //Deterrence + player->RemoveSpell(34500, false); //Expose Weakness + player->RemoveSpell(34506, false); //Master Tactician + player->LearnSpell(19577, false); //Intimidation + player->LearnSpell(53271, false); //Master's Call + player->LearnSpell(19620, false); //Unleashed Fury + player->LearnSpell(19592, false); //Bestial Discipline + player->LearnSpell(19602, false); //Ferocity + player->LearnSpell(56318, false); //Kindred Spirits + player->LearnSpell(53270, false); //Beast Mastery (Exotic Pets) + break; + + // Rogue + case 15: //Sub + player->RemoveSpell(51672, false); // Unfair Advantage + player->RemoveSpell(58426, false); // Overkill + player->RemoveSpell(13743, false); // Improved Sprint + player->RemoveSpell(13750, false); // Adrenaline Rush + player->RemoveSpell(14177, false); // Cold Blood + player->RemoveSpell(14113, false); // Improved Poisons + player->RemoveSpell(14186, false); // Seal Fate + player->RemoveSpell(51625, false); // Deadly Brew + player->LearnSpell(51711, false); // Slaughter from the Shadows 4/5 + player->LearnSpell(14066, false); // Elusiveness + player->LearnSpell(16511, false); // Hemorrhage + break; + case 16: // Assassination + player->RemoveSpell(13750, false); // Adrenaline Rush + player->RemoveSpell(51672, false); // Unfair Advantage + player->RemoveSpell(13743, false); // Improved Sprint + player->RemoveSpell(13981, false); // Elusiveness + player->RemoveSpell(16511, false); // Hemorrhage + player->RemoveSpell(51708, false); // Slaughter from the Shadows + player->LearnSpell(14177, false); // Cold Blood + player->LearnSpell(58426, false); // Overkill + player->LearnSpell(14117, false); // Improved Poisons + player->LearnSpell(14195, false); // Seal Fate + player->LearnSpell(51626, false); // Deadly Brew + break; + case 17: // Combat + player->RemoveSpell(14177, false); // Cold Blood + player->RemoveSpell(58426, false); // Overkill + player->RemoveSpell(14113, false); // Improved Poisons + player->RemoveSpell(14186, false); // Seal Fate + player->RemoveSpell(51625, false); // Deadly Brew + player->RemoveSpell(13981, false); // Elusiveness + player->RemoveSpell(16511, false); // Hemorrhage + player->RemoveSpell(51708, false); // Slaughter from the Shadows + player->LearnSpell(13750, false); // Adrenaline Rush + player->LearnSpell(51674, false); // Unfair Advantage + player->LearnSpell(13875, false); // Improved Sprint + break; + + // Shaman + case 18: //Restoration + player->RemoveSpell(51483, false); // Storm, Earth and Fire + player->RemoveSpell(16166, false); // Elemental Mastery + player->RemoveSpell(29062, false); // Eye of the Storm + player->RemoveSpell(16578, false); // Lightning Mastery + player->RemoveSpell(30798, false); // Dual Wield + player->RemoveSpell(17364, false); // Stormstrike + player->RemoveSpell(51521, false); // Improved Stormstrike + player->RemoveSpell(30812, false); // Mental Quickness 1/3 + player->RemoveSpell(16256, false); // Flurry + player->RemoveSpell(60103, false); // Lava Lash + player->RemoveSpell(939, false); // Healing Wave Rank 5 + player->RemoveSpell(8008, false); // Lesser Healing Rank 2 + player->RemoveSpell(51490, false); // REMOVE Thunderstorm + player->RemoveSpell(51730, false); // REMOVE Earthliving + player->LearnSpell(939, false); // Healing Wave Rank 5 + player->LearnSpell(8008, false); // Lesser Healing Rank 2 + player->LearnSpell(30886, false); // Nature's Guardian + player->LearnSpell(51886, false); // Cleanse Spirit + player->LearnSpell(16232, false); // Healing Focus + player->LearnSpell(974, false); // Earth Shield + player->LearnSpell(16213, false); // Purification + break; + case 19: // Enhancement + player->RemoveSpell(16213, false); // Purification + player->RemoveSpell(30881, false); // Nature's Guardian + player->RemoveSpell(51886, false); // Cleanse Spirit + player->RemoveSpell(16181, false); // Healing Focus + player->RemoveSpell(974, false); // Earth Shield + player->RemoveSpell(16166, false); // Elemental Mastery + player->RemoveSpell(29062, false); // Eye of the Storm + player->RemoveSpell(51483, false); // Storm, Earth and Fire + player->RemoveSpell(16578, false); // Lightning Mastery + player->RemoveSpell(939, false); // Healing Wave Rank 5 + player->RemoveSpell(8008, false); // Lesser Healing Rank 2 + player->RemoveSpell(51490, false); // REMOVE Thunderstorm + player->RemoveSpell(51730, false); // REMOVE Earthliving + player->LearnSpell(16284, false); // Flurry + player->LearnSpell(60103, false); // Lava Lash + player->LearnSpell(30812, false); // Mental Quickness 1/3 + player->LearnSpell(51522, false); // Improved Stormstrike + player->LearnSpell(30798, false); // Dual Wield + player->LearnSpell(17364, false); // Stormstrike + break; + case 20: // Elemental + player->RemoveSpell(16213, false); // Purification + player->RemoveSpell(30798, false); // Dual Wield + player->RemoveSpell(17364, false); // Stormstrike + player->RemoveSpell(51521, false); // Improved Stormstrike + player->RemoveSpell(30812, false); // Mental Quickness 1/3 + player->RemoveSpell(30881, false); // Nature's Guardian + player->RemoveSpell(51886, false); // Cleanse Spirit + player->RemoveSpell(16181, false); // Healing Focus + player->RemoveSpell(974, false); // Earth Shield + player->RemoveSpell(16256, false); // Flurry + player->RemoveSpell(60103, false); // Lava Lash + player->RemoveSpell(51490, false); // REMOVE Thunderstorm + player->RemoveSpell(51730, false); // REMOVE Earthliving + player->RemoveSpell(939, false); // Healing Wave Rank 5 + player->RemoveSpell(8008, false); // Lesser Healing Rank 2 + player->LearnSpell(29065, false); // Eye of the Storm + player->LearnSpell(51486, false); // Storm, Earth and Fire + player->LearnSpell(16582, false); // Lightning Mastery + player->LearnSpell(16166, false); // Elemental Mastery + break; + + // Warlock + case 21: //Affliction + player->CastSpell(player, 36562, false); //Force Dismisses Pet + player->RemoveSpell(17962, false); // Conflagrate + player->RemoveSpell(47258, false); // Backdraft + player->RemoveSpell(29722, false); // Incinterate + player->RemoveSpell(59672, false); // Metamorphosis + player->RemoveSpell(19028, false); // Soul Link + player->RemoveSpell(18708, false); // Fel Domination + player->RemoveSpell(18709, false); // Master Summoner + player->RemoveSpell(18135, false); // Intensity + player->RemoveSpell(47241, false); // REMOVE META + player->LearnSpell(48181, false); // Haunt + player->LearnSpell(17785, false); // Fel Concentration + break; + case 22: // Demonology + player->CastSpell(player, 36562, false); //Force Dismisses Pet + player->RemoveSpell(48181, false); // Haunt + player->RemoveSpell(17783, false); // Fel Concentration + player->RemoveSpell(17962, false); // Conflagrate + player->RemoveSpell(47258, false); // Backdraft + player->RemoveSpell(29722, false); // Incinterate + player->RemoveSpell(18135, false); // Intensity + player->RemoveSpell(47241, false); // REMOVE META + player->LearnSpell(19028, false); // Soul Link + player->LearnSpell(18708, false); // Fel Domination + player->LearnSpell(18710, false); // Master Summoner + break; + case 23: //Destruction + player->CastSpell(player, 36562, false); //Force Dismisses Pet + player->RemoveSpell(48181, false); // Haunt + player->RemoveSpell(17783, false); // Fel Concentration + player->RemoveSpell(59672, false); // Metamorphosis + player->RemoveSpell(19028, false); // Soul Link + player->RemoveSpell(18708, false); // Fel Domination + player->RemoveSpell(18709, false); // Master Summoner + player->RemoveSpell(47241, false); // REMOVE META + player->LearnSpell(18136, false); // Intensity + player->LearnSpell(17962, false); // Conflagrate + player->LearnSpell(47260, false); // Backdraft + player->LearnSpell(29722, false); // Incinterate + break; + + // Druid + case 24: //Feral + player->LearnSpell(16979, false); // Feral Charge - Bear + player->RemoveSpell(18562, false); // Swiftmend + player->RemoveSpell(17106, false); // Intensity + player->RemoveSpell(22812, false); // Barkskin + player->RemoveSpell(24858, false); // Moonkin Form + player->RemoveSpell(33597, false); // Dreamstate + player->RemoveSpell(5570, false); // Insect Swarm + player->RemoveSpell(57878, false); // Natural Reaction + player->RemoveSpell(57873, false); // Protector of the Pack + player->RemoveSpell(9634, false); // Dire Bear Form + player->RemoveSpell(33878, false); // Mangle (Bear) + player->RemoveSpell(48389, false); // Owlkin Frenzy + player->RemoveSpell(17104, false); //Gift of the Nature + player->LearnSpell(8939, false); // Growth Rank 3 + player->LearnSpell(2090, false); // Rejuvenation Rank 4 + player->LearnSpell(5221, false); // Shred + player->LearnSpell(33876, false); // Mangle (Cat) + player->LearnSpell(16975, false); // Predatory Strikes + player->LearnSpell(49376, false); // Feral Charge - Cat + player->LearnSpell(24866, false); // Feral Swiftness + player->LearnSpell(33872, false); // Nurturing Instinct 1/2 + player->LearnSpell(16968, false); // Shredding Attacks + break; + case 25: // Balance + player->LearnSpell(16979, false); // Feral Charge - Bear + player->RemoveSpell(18562, false); // Swiftmend + player->RemoveSpell(17106, false); // Intensity + player->RemoveSpell(22812, false); // Barkskin + player->RemoveSpell(33876, false); // Mangle (Cat) + player->RemoveSpell(49376, false); // Feral Charge - Cat + player->RemoveSpell(17002, false); // Feral Swiftness + player->RemoveSpell(16972, false); // Predatory Strikes + player->RemoveSpell(33872, false); // Nurturing Instinct 1/2 + player->RemoveSpell(57878, false); // Natural Reaction + player->RemoveSpell(57873, false); // Protector of the Pack + player->RemoveSpell(9634, false); // Dire Bear Form + player->RemoveSpell(33878, false); // Mangle (Bear) + player->RemoveSpell(8939, false); // Growth Rank 3 + player->RemoveSpell(2090, false); // Rejuvenation Rank 4 + player->RemoveSpell(5221, false); // Shred + player->RemoveSpell(17104, false); //Gift of the Nature + player->RemoveSpell(16966, false); // Shredding Attacks + player->LearnSpell(48393, false); // Owlkin Frenzy + player->LearnSpell(24858, false); // Moonkin Form + player->LearnSpell(33956, false); // Dreamstate + player->LearnSpell(5570, false); // Insect Swarm + break; + case 26: //Restoration + player->LearnSpell(16979, false); // Feral Charge - Bear + player->RemoveSpell(33876, false); // Mangle (Cat) + player->RemoveSpell(16972, false); // Predatory Strikes + player->RemoveSpell(49376, false); // Feral Charge - Cat + player->RemoveSpell(17002, false); // Feral Swiftness + player->RemoveSpell(33872, false); // Nurturing Instinct 1/2 + player->RemoveSpell(24858, false); // Moonkin Form + player->RemoveSpell(33597, false); // Dreamstate + player->RemoveSpell(5570, false); // Insect Swarm + player->RemoveSpell(48389, false); // Owlkin Frenzy + player->RemoveSpell(57878, false); // Natural Reaction + player->RemoveSpell(57873, false); // Protector of the Pack + player->RemoveSpell(9634, false); // Dire Bear Form + player->RemoveSpell(5221, false); // Shred + player->RemoveSpell(33878, false); // Mangle (Bear) + player->RemoveSpell(16966, false); // Shredding Attacks + player->LearnSpell(18562, false); // Swiftmend + player->LearnSpell(17108, false); // Intensity + player->LearnSpell(22812, false); // Barkskin + player->LearnSpell(8939, false); // Growth Rank 3 + player->LearnSpell(2090, false); // Rejuvenation Rank 4 + player->LearnSpell(24949, false); //Gift of the Nature + break; + case 27: //Guardian + player->LearnSpell(16979, false); // Feral Charge - Bear + player->RemoveSpell(33876, false); // Mangle (Cat) + player->RemoveSpell(16972, false); // Predatory Strikes + player->RemoveSpell(49376, false); // Feral Charge - Cat + player->RemoveSpell(17002, false); // Feral Swiftness + player->RemoveSpell(33872, false); // Nurturing Instinct 1/2 + player->RemoveSpell(24858, false); // Moonkin Form + player->RemoveSpell(33597, false); // Dreamstate + player->RemoveSpell(5570, false); // Insect Swarm + player->RemoveSpell(48389, false); // Owlkin Frenzy + player->RemoveSpell(18562, false); // Swiftmend + player->RemoveSpell(17106, false); // Intensity + player->RemoveSpell(22812, false); // Barkskin + player->RemoveSpell(5221, false); // Shred + player->RemoveSpell(17104, false); //Gift of the Nature + player->RemoveSpell(16966, false); // Shredding Attacks + player->LearnSpell(8939, false); // Growth Rank 3 + player->LearnSpell(2090, false); // Rejuvenation Rank 4 + player->LearnSpell(57881, false); // Natural Reaction + player->LearnSpell(57877, false); // Protector of the Pack + player->LearnSpell(9634, false); // Dire Bear Form + player->LearnSpell(33878, false); // Mangle (Bear) + break; + } + player->CLOSE_GOSSIP_MENU(); + } + return true; + } +}; + +void AddSC_Talent_Chooser() { + new Talent_Chooser(); +} \ No newline at end of file diff --git a/titulos.cpp b/titulos.cpp new file mode 100644 index 0000000..7954cdb --- /dev/null +++ b/titulos.cpp @@ -0,0 +1,292 @@ +#include "ScriptPCH.h" + +class npc_titulos_km : public CreatureScript +{ + public: + npc_titulos_km() : CreatureScript("npc_titulos_km") + { + } + + bool OnGossipHello(Player * pPlayer, Creature * pCreature) + { + pPlayer->PlayerTalkClass->ClearMenus(); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Assasin (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 22); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Malefic (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 23); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Forsaken (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 24); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Crusader (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 25); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Starcaller (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 26); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t The Seeker (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 27); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Bane of the Fallen King (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 28); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t The Light of Dawn (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 29); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Elder (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 30); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Scarab LordThe Insane (250 PvP Tokens)", GOSSIP_SENDER_MAIN, 31); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Vanquisher (500 PvP Tokens)", GOSSIP_SENDER_MAIN, 32); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Hand of A'dal (500 PvP Tokens)", GOSSIP_SENDER_MAIN, 33); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Champion of the Naaru (500 PvP Tokens)", GOSSIP_SENDER_MAIN, 34); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t Death's Demise (750 PvP Tokens)", GOSSIP_SENDER_MAIN, 35); + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_boss_algalon_01:30|t The Insane (750 PvP Tokens)", GOSSIP_SENDER_MAIN, 36); + if (pPlayer->getFaction() == ALLIANCE) + { + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_dungeon_nexus70_normal:30|t of the Alliance (1000 PvP Tokens)", GOSSIP_SENDER_MAIN, 37); + } + if (pPlayer->getFaction() == HORDE) + { + pPlayer->ADD_GOSSIP_ITEM(4, "|TInterface/ICONS/achievement_dungeon_nexus70_normal:30|t of the Horde (1000 PvP Tokens)", GOSSIP_SENDER_MAIN, 38); + } + pPlayer->PlayerTalkClass->SendGossipMenu(9452, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player * pPlayer, Creature * pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (!pPlayer) + return true; + + switch (uiAction) + { + { + case 22: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(95); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Assasin!", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 23: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(90); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título the Malefic", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 24: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(119); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título the Forsaken", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 25: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(156); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Crusader", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 26: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(164); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Starcaller", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 27: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(81); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título the Seeker", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 28: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(174); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Bane of the Fallen King", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 29: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(173); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título the Light of Dawn", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 30: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(74); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Elder", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 31: + if (pPlayer->HasItemCount(29434, 250, true)) + { + pPlayer->DestroyItemCount(29434, 250, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(46); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Scarab Lord", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 32: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(163); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Vanquisher", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 33: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(64); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Hand of A'dal", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 34: + if (pPlayer->HasItemCount(29434, 500, true)) + { + pPlayer->DestroyItemCount(29434, 500, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(53); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Champion of the Naaru", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 35: + if (pPlayer->HasItemCount(29434, 750, true)) + { + pPlayer->DestroyItemCount(29434, 750, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(158); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título Death's Demise", pPlayer->GetGUID()); + } + else + { + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Usted no tiene la cantidad necesaria de PvP Tokens.", pPlayer->GetGUID()); + } + break; + + case 36: + if (pPlayer->HasItemCount(29434, 750, true)) + { + pPlayer->DestroyItemCount(29434, 750, true); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(145); + pPlayer->SetTitle(titleInfo, false); + pPlayer->CLOSE_GOSSIP_MENU(); + ChatHandler(pPlayer->GetSession()).PSendSysMessage("Se le ha añadido el título the Insane", pPlayer->GetGUID()); + } + + return true; + } + } + } + +}; + +void AddSC_npc_titulos_km() +{ + new npc_titulos_km(); +} \ No newline at end of file diff --git a/top_class_killers.cpp b/top_class_killers.cpp new file mode 100644 index 0000000..cd95622 --- /dev/null +++ b/top_class_killers.cpp @@ -0,0 +1,89 @@ +#include "ScriptPCH.h" + +/*Class E_Menu*/ +#define E_Warrior "|TInterface/ICONS/ability_warrior_battleshout:30|t Ver top 5 Guerrero Muertes" +#define E_Paladin "|TInterface/ICONS/ability_paladin_artofwar:30|t Ver top 5 Paladin Muertes" +#define E_Hunter "|TInterface/ICONS/ability_hunter_aimedshot:30|t Ver top 5 Cazador Muertes" +#define E_Rogue "|TInterface/ICONS/ability_rogue_ambush:30|t Ver top 5 Picaro Muertes" +#define E_Priest "|TInterface/ICONS/ability_warrior_battleshout:30|t Ver top 5 Sacerdote Muertes" +#define E_Shaman "|TInterface/ICONS/spell_holy_searinglightpriest:30|t Ver top 5 Chaman Muertes" +#define E_Mage "|TInterface/ICONS/ability_mage_arcanebarrage:30|t Ver top 5 Mago Muertes" +#define E_Warlock "|TInterface/ICONS/ability_warlock_improvedsoulleech:30|t Ver top 5 Brujo Muertes" +#define E_Druid "|TInterface/ICONS/ability_druid_forceofnature:30|t Ver top 5 Druida Muertes" +#define E_Death_knight "|TInterface/ICONS/spell_deathknight_bloodboil:30|t Ver top 5 Dk Muertes" +/*Top 5 Message*/ +#define M_Warrior "|TInterface/ICONS/ability_warrior_battleshout:20|t Este es el top 5 Guerrero Muertes" +#define M_Paladin "|TInterface/ICONS/ability_paladin_artofwar:20|t Este es el top 5 Paladin Muertes" +#define M_Hunter "|TInterface/ICONS/ability_hunter_aimedshot:20|t 24Este es el top 5 Cazador Muertes" +#define M_Rogue "|TInterface/ICONS/ability_rogue_ambush:20|t Este es el top 5 Picaro Muertes" +#define M_Priest "|TInterface/ICONS/ability_warrior_battleshout:20|t Este es el top 5 Sacerdote Muertes" +#define M_Shaman "|TInterface/ICONS/spell_holy_searinglightpriest:20|t Este es el top 5 Chaman Muertes" +#define M_Mage "|TInterface/ICONS/ability_mage_arcanebarrage:20|t Este es el top 5 Mago Muertes" +#define M_Warlock "|TInterface/ICONS/ability_warlock_improvedsoulleech:20|t Este es el top 5 Brujo Muertes" +#define M_Druid "|TInterface/ICONS/ability_druid_forceofnature:20|t Este es el top 5 Druida Muertes" +#define M_Death_knight "|TInterface/ICONS/spell_deathknight_bloodboil:20|t Este es el top 5 Dk Muertes" + +class Top5_Killers : public CreatureScript +{ +public: + Top5_Killers() : CreatureScript("Top5_Killers") { } + + bool OnGossipHello(Player* player, Creature* creature) + { + player->ADD_GOSSIP_ITEM(1, E_Warrior, GOSSIP_SENDER_MAIN, 1); + player->ADD_GOSSIP_ITEM(1, E_Paladin, GOSSIP_SENDER_MAIN, 2); + player->ADD_GOSSIP_ITEM(1, E_Hunter, GOSSIP_SENDER_MAIN, 3); + player->ADD_GOSSIP_ITEM(1, E_Rogue, GOSSIP_SENDER_MAIN, 4); + player->ADD_GOSSIP_ITEM(1, E_Priest, GOSSIP_SENDER_MAIN, 5); + player->ADD_GOSSIP_ITEM(1, E_Shaman, GOSSIP_SENDER_MAIN, 7); + player->ADD_GOSSIP_ITEM(1, E_Mage, GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM(1, E_Warlock, GOSSIP_SENDER_MAIN, 9); + player->ADD_GOSSIP_ITEM(1, E_Druid, GOSSIP_SENDER_MAIN, 11); + player->ADD_GOSSIP_ITEM(1, E_Death_knight, GOSSIP_SENDER_MAIN, 6); + player->SEND_GOSSIP_MENU(1, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); + if (sender != GOSSIP_SENDER_MAIN) + return true; // wrong sender, something fisy + + switch(action) + { + case 1: ChatHandler(player->GetSession()).PSendSysMessage(M_Warrior); break; + case 2: ChatHandler(player->GetSession()).PSendSysMessage(M_Paladin); break; + case 3: ChatHandler(player->GetSession()).PSendSysMessage(M_Hunter); break; + case 4: ChatHandler(player->GetSession()).PSendSysMessage(M_Rogue); break; + case 5: ChatHandler(player->GetSession()).PSendSysMessage(M_Priest); break; + case 6: ChatHandler(player->GetSession()).PSendSysMessage(M_Death_knight); break; + case 7: ChatHandler(player->GetSession()).PSendSysMessage(M_Shaman); break; + case 8: ChatHandler(player->GetSession()).PSendSysMessage(M_Mage); break; + case 9: ChatHandler(player->GetSession()).PSendSysMessage(M_Warlock); break; + case 11: ChatHandler(player->GetSession()).PSendSysMessage(M_Druid); break; + default: return true; // invalid class, something fishy + } + + QueryResult result = CharacterDatabase.PQuery("SELECT name, totalKills FROM characters WHERE class = %u ORDER BY totalKills DESC LIMIT 5", action); + if(result) + { + do + { + Field * fields = result->Fetch(); + std::string name = fields[0].GetString(); + uint32 totalKills = fields[1].GetUInt32(); + ChatHandler(player->GetSession()).PSendSysMessage("Nombre: %s, Total de muertes : %u", name.c_str(), totalKills); + } + while(result->NextRow()); + } + OnGossipHello(player, creature); // return to main menu + return true; + } +}; + + +void AddSC_Top5_Killers() +{ + new Top5_Killers(); +} \ No newline at end of file diff --git a/triqui.cpp b/triqui.cpp new file mode 100644 index 0000000..89eb2bf --- /dev/null +++ b/triqui.cpp @@ -0,0 +1,1686 @@ +/* +DATABASE + +https://github.com/FixCore/TrinityCore-335a/blob/Complements-TC/triqui.sql +*/ + +/* +* Copyright (C) 2008-2016 TrinityCore +* Copyright (C) 2006-2009 ScriptDev2 +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +/* ScriptData +Name: npc_tic-tac-toe_335 +Author: Morphau +Category: Custom Script +EndScriptData +*/ + +#include +#include +#include +#include + +#include "Chat.h" +#include "Player.h" +#include "Creature.h" +#include "ObjectGuid.h" +#include "Group.h" +#include "GossipDef.h" +#include "ScriptedGossip.h" +#include "ScriptMgr.h" +#include "Util.h" +#include "ScriptedCreature.h" + +using namespace std; + +std::vector Path_IconSelectGameType = +{ + "INV_Misc_Grouplooking", + "T_Roboticon" +}; + +std::vector Path_Icon = +{ + "INV_Misc_Toy_04", + "INV_Misc_Toy_02", + "INV_Jewelry_TrinketPVP_02", + "INV_Jewelry_TrinketPVP_01", + "INV_Misc_Tournaments_Banner_Orc", + "INV_Misc_Tournaments_Banner_Human", + "INV_Bannerpvp_01", + "INV_Bannerpvp_02", + "Achievement_Reputation_03", + "Achievement_Reputation_01", + "Ability_Mount_Cockatricemountelite_purple", + "Ability_Mount_Cockatricemountelite_blue", + "Ability_Mount_Rocketmount", + "Ability_Mount_Rocketmountblue", + "INV_Chest_Cloth_55", + "INV_Chest_Cloth_52", + "Achievement_Bg_Interruptx_Flagcapture_Attempts_1game", + "Achievement_Bg_Interruptx_Flagcapture_Attempts", + "INV_Drink_Waterskin_09", + "INV_Drink_Waterskin_01", + "INV_Jewelcrafting_Crimsoncrab", + "INV_Jewelcrafting_Azurecrab", + "INV_Jewelcrafting_Dragonseye05", + "INV_Jewelcrafting_Dragonseye04", + "INV_Misc_Bag_07_Red", + "INV_Misc_Bag_07_Blue", + "INV_Misc_Rabbit_2", + "INV_Misc_Rabbit", + "INV_Pet_Pinkmurlocegg", + "INV_Pet_Bluemurlocegg", + "INV_Misc_Questionmark" +}; + +std::string COLOR_WHITE = "|cffffffff"; +std::string COLOR_RED = "|cffFF0000"; +std::string COLOR_BLUE = "|cff6666FF"; +std::string COLOR_GREEN = "|cff00cc00"; + +std::string Grid_Letters = "ABC"; + +struct NpcTicTacToeInfo +{ + std::string namePlayer01; + ObjectGuid guidPlayer01; + std::string namePlayer02; + ObjectGuid guidPlayer02; + uint32 themeTypeSelected; + std::string messageGameTypeSelected; + uint32 gameTypeSelected; + ObjectGuid nextGuidPlayerMove; + uint32 nextIdPlayerMove; + uint32 gameStatus; + uint32 gameGrid[3][3]; + uint32 AIgameGrid[3][3]; + bool needRefreshGossipP1; + bool needRefreshGossipP2; + uint32 computerStateText; +}; + +// NpcTicTacToeData Map +std::map NpcTicTacToeData; + +enum EventsTicTactToe +{ + WAIT_HUMAN_PLAYER_01 = 1, + WAIT_HUMAN_PLAYER_02 = 2, + WAIT_COMPUTER_PLAYER_TEXT_01 = 3, + WAIT_COMPUTER_PLAYER_TEXT_02 = 4, + WAIT_COMPUTER_PLAYER_TEXT_03 = 5, + WAIT_COMPUTER_PLAYER_TEXT_04 = 6 +}; + +enum GossipMenuTicTacToe +{ + GOSSIP_MENU_TICTACTOE_WELCOME = 150150, + GOSSIP_MENU_TICTACTOE_EMPTY = 150151, + GOSSIP_MENU_TICTACTOE_INGAME = 150152, + GOSSIP_MENU_TICTACTOE_SETUP = 150153, +}; + +enum MoneyRewardTicTacToe +{ + MONEY_WIN_GAME_HUMAN = 1000000, + MONEY_LOOSE_GAME_HUMAN = 1000000, + MONEY_DRAW_GAME_HUMAN = 10000, + MONEY_WIN_GAME_NPC = 10000, + MONEY_LOOSE_GAME_NPC = 10000, + MONEY_DRAW_GAME_NPC = 10000, + MONEY_WIN_GAME_IA_NPC = 100000, + MONEY_LOOSE_GAME_IA_NPC = 100000, + MONEY_DRAW_GAME_IA_NPC = 100000 +}; + +class npc_tic_tac_toe : public CreatureScript +{ +public: + npc_tic_tac_toe() : CreatureScript("npc_tic_tac_toe") { } + + static NpcTicTacToeInfo const* GetNpcTitcTacToeData(ObjectGuid playerGuid) + { + std::map::const_iterator itr = NpcTicTacToeData.find(playerGuid); + if (itr != NpcTicTacToeData.end()) + return &(itr->second); + return NULL; + } + + static string GetIconePathBySize(string iconName, uint32 size) + { + std::string pathBuilded = ""; + + pathBuilded = "|TInterface\\icons\\" + iconName; + pathBuilded += ":"; + pathBuilded += std::to_string(size); + pathBuilded += ":"; + pathBuilded += std::to_string(size); + pathBuilded += "|t"; + + return pathBuilded; + } + + static string GetIconeNameByPlayerTheme(std::vector Path_Icon, uint32 playerId, uint32 themeId) + { + std::string iconName = ""; + + switch (playerId) + { + case 1: + iconName = Path_Icon[themeId * 2 - 2]; + break; + case 2: + iconName = Path_Icon[themeId * 2 - 1]; + break; + default: + iconName = Path_Icon[(Path_Icon.size() - 1)]; + break; + } + + return iconName; + } + + struct npc_tic_tac_toeAI : public ScriptedAI + { + npc_tic_tac_toeAI(Creature* creature) : ScriptedAI(creature) { } + + EventMap _events; + + void UpdateAI(uint32 diff) override + { + if (_events.Empty()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case WAIT_HUMAN_PLAYER_01: + case WAIT_COMPUTER_PLAYER_TEXT_04: + { + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.gameStatus >= 5 && i->second.needRefreshGossipP1 == true) + { + if (Player* playerFind01 = ObjectAccessor::FindConnectedPlayer(i->second.guidPlayer01)) + { + NpcTicTacToeData[i->second.guidPlayer01].needRefreshGossipP1 = false; + npc_tic_tac_toe::OnGossipSelectTicTacToeHuman(playerFind01, me, GOSSIP_SENDER_MAIN, (GOSSIP_ACTION_INFO_DEF + 60), NULL); + } + } + } + } + } break; + + case WAIT_HUMAN_PLAYER_02: + { + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.gameStatus >= 5 && i->second.needRefreshGossipP2 == true) + { + if (Player* playerFind02 = ObjectAccessor::FindConnectedPlayer(i->second.guidPlayer02)) + { + NpcTicTacToeData[i->second.guidPlayer01].needRefreshGossipP2 = false; + npc_tic_tac_toe::OnGossipSelectTicTacToeHuman(playerFind02, me, GOSSIP_SENDER_MAIN, (GOSSIP_ACTION_INFO_DEF + 60), NULL); + } + } + } + } + } break; + + case WAIT_COMPUTER_PLAYER_TEXT_01: + { + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.gameStatus >= 5 && i->second.computerStateText == 1) + { + if (Player* playerFind01 = ObjectAccessor::FindConnectedPlayer(i->second.guidPlayer01)) + { + me->Whisper("Let's me think about my move.", LANG_UNIVERSAL, playerFind01, true); + } + + NpcTicTacToeData[i->second.guidPlayer01].computerStateText = 2; + } + } + } + } break; + + case WAIT_COMPUTER_PLAYER_TEXT_02: + { + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.gameStatus >= 5 && i->second.computerStateText == 2) + { + if (Player* playerFind01 = ObjectAccessor::FindConnectedPlayer(i->second.guidPlayer01)) + { + me->Whisper("Let's see what i can play now.", LANG_UNIVERSAL, playerFind01, true); + } + + NpcTicTacToeData[i->second.guidPlayer01].computerStateText = 3; + } + } + } + } break; + + case WAIT_COMPUTER_PLAYER_TEXT_03: + { + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.gameStatus >= 5 && i->second.computerStateText == 3) + { + if (Player* playerFind01 = ObjectAccessor::FindConnectedPlayer(i->second.guidPlayer01)) + { + NpcTicTacToeData[i->second.guidPlayer01].computerStateText = 4; + npc_tic_tac_toe::OnGossipSelectTicTacToeCumputer(playerFind01, me, GOSSIP_SENDER_MAIN, 0, NULL); + } + } + } + } + } break; + } + } + + } + }; + + // Check if game win or draw (return true if) + static bool checkIfGameWinOrDraw(NpcTicTacToeInfo const* NpcTicTacToeGameExist) + { + if (!NpcTicTacToeGameExist) + return false; + + bool winnerFound = false; + bool gameDraw = true; + + // Check if winner + for (int i = 0; i < 3; i++){ + if ((NpcTicTacToeGameExist->gameGrid[i][0] != 0 && NpcTicTacToeGameExist->gameGrid[i][0] == NpcTicTacToeGameExist->gameGrid[i][1] && NpcTicTacToeGameExist->gameGrid[i][1] == NpcTicTacToeGameExist->gameGrid[i][2]) || + (NpcTicTacToeGameExist->gameGrid[0][i] != 0 && NpcTicTacToeGameExist->gameGrid[0][i] == NpcTicTacToeGameExist->gameGrid[1][i] && NpcTicTacToeGameExist->gameGrid[1][i] == NpcTicTacToeGameExist->gameGrid[2][i]) || + (NpcTicTacToeGameExist->gameGrid[0][0] != 0 && NpcTicTacToeGameExist->gameGrid[0][0] == NpcTicTacToeGameExist->gameGrid[1][1] && NpcTicTacToeGameExist->gameGrid[1][1] == NpcTicTacToeGameExist->gameGrid[2][2]) || + (NpcTicTacToeGameExist->gameGrid[0][2] != 0 && NpcTicTacToeGameExist->gameGrid[0][2] == NpcTicTacToeGameExist->gameGrid[1][1] && NpcTicTacToeGameExist->gameGrid[1][1] == NpcTicTacToeGameExist->gameGrid[2][0])) + { + winnerFound = true; + } + } + + // Check if game draw ? + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + if (NpcTicTacToeGameExist->gameGrid[i][j] != 1 && NpcTicTacToeGameExist->gameGrid[i][j] != 2) + { + gameDraw = false; + } + } + } + + // GAME END + if (winnerFound == true || gameDraw == true) + { + // Maj status only the first time + if (NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus < 20) + { + if (winnerFound == true) + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus = 20; + + if (winnerFound == false && gameDraw == true) + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus = 30; + } + + return true; + } + else + { + return false; + } + } + + // AI SOURCE IDEA + // http://code.runnable.com/Vnjjxm6IJit89Bpu/tic-tac-toe-unbeatable-ai-for-c%2B%2B + static char AIcheck_win(NpcTicTacToeInfo const* NpcTicTacToeGameExist) + { + // Check horizontal, vertical & diagonal through [0][0] + if (NpcTicTacToeGameExist->AIgameGrid[0][0] != 0 && (NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[0][1] && NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[0][2] || + NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[1][0] && NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[2][0] || + NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[1][1] && NpcTicTacToeGameExist->AIgameGrid[0][0] == NpcTicTacToeGameExist->AIgameGrid[2][2])) + + return NpcTicTacToeGameExist->AIgameGrid[0][0]; + + // Check horizontal, vertical & diagonal through [1][1] + if (NpcTicTacToeGameExist->AIgameGrid[1][1] != 0 && (NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[1][0] && NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[1][2] || + NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[0][1] && NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[2][1] || + NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[2][0] && NpcTicTacToeGameExist->AIgameGrid[1][1] == NpcTicTacToeGameExist->AIgameGrid[0][2])) + + return NpcTicTacToeGameExist->AIgameGrid[1][1]; + + // Check horizontal, vertical & diagonal through [2][2] + if (NpcTicTacToeGameExist->AIgameGrid[2][2] != 0 && (NpcTicTacToeGameExist->AIgameGrid[2][2] == NpcTicTacToeGameExist->AIgameGrid[0][2] && NpcTicTacToeGameExist->AIgameGrid[2][2] == NpcTicTacToeGameExist->AIgameGrid[1][2] || + NpcTicTacToeGameExist->AIgameGrid[2][2] == NpcTicTacToeGameExist->AIgameGrid[2][0] && NpcTicTacToeGameExist->AIgameGrid[2][2] == NpcTicTacToeGameExist->AIgameGrid[2][1])) + + return NpcTicTacToeGameExist->AIgameGrid[2][2]; + + return 0; + } + + static int AIpick_best_move(NpcTicTacToeInfo const* NpcTicTacToeGameExist, int player1, int player2) + { + int best_move_score = -9999; + int best_move_row = -9999; + int best_move_col = -9999; + int score_for_this_move = 0; + + for (int r = 0; r < 3; r++) { + for (int c = 0; c < 3; c++) { + if (NpcTicTacToeGameExist->AIgameGrid[r][c] == 0) { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[r][c] = player1; //Try test move. + score_for_this_move = -(AInegamax(NpcTicTacToeGameExist, player2, player1)); + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[r][c] = 0; //Put back test move. + if (score_for_this_move >= best_move_score) { + best_move_score = score_for_this_move; + best_move_row = r; + best_move_col = c; + } + } + } + } + + return (10 * best_move_row + best_move_col); + } + + static int AInegamax(NpcTicTacToeInfo const* NpcTicTacToeGameExist, int player1, int player2) + { + int best_move_score = -9999; + int score_for_this_move = 0; + + //If player 1 wins, then the score is high (good for player1) + if (AIcheck_win(NpcTicTacToeGameExist) == player1) + return 1000; + + //If player 2 loses, then the score is low (bad for player1) + else if (AIcheck_win(NpcTicTacToeGameExist) == player2) + return -1000; + + for (int r = 0; r < 3; r++) { + for (int c = 0; c < 3; c++) { + if (NpcTicTacToeGameExist->AIgameGrid[r][c] == 0) { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[r][c] = player1; //Try test move. + score_for_this_move = -(AInegamax(NpcTicTacToeGameExist, player2, player1)); + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[r][c] = 0; //Put back test move. + if (score_for_this_move >= best_move_score) { + best_move_score = score_for_this_move; + } + } + } + } + + if (best_move_score == -9999 || best_move_score == 0) + return 0; + else if (best_move_score < 0) + return best_move_score + 1; + //As the game goes longer, and the recursion goes deeper, the moves near the end are less favorable than in the beginning. + else if (best_move_score > 0) + return best_move_score - 1; + else + return 0; + } + + static bool OnGossipSelectTicTacToeCumputer(Player* player, Creature* creature, uint32 sender, uint32 action, NpcTicTacToeInfo const* NpcTicTacToeGameExistFound) + { + if (!player) + return false; + + if (!creature) + return false; + + player->PlayerTalkClass->ClearMenus(); + + NpcTicTacToeInfo const* NpcTicTacToeGameExist = NULL; + + if (!NpcTicTacToeGameExistFound) + { + // Found current game for this player + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == player->GetGUID() || i->second.guidPlayer02 == player->GetGUID()) + { + NpcTicTacToeGameExist = GetNpcTitcTacToeData(i->second.guidPlayer01); + if (NpcTicTacToeGameExist) + { + gameExistFound = true; + } + break; + } + } + } + + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + else + { + NpcTicTacToeGameExist = NpcTicTacToeGameExistFound; + } + + uint32 aiFoundI = -1; + uint32 aiFoundJ = -1; + + // Master AI + if (NpcTicTacToeGameExist->gameTypeSelected == 3) + { + // Copy information in board AI + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + if (NpcTicTacToeGameExist->gameGrid[i][j] == 1) + { + // board[i][j] = '1'; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[i][j] = 1; + } + else if (NpcTicTacToeGameExist->gameGrid[i][j] == 2) + { + // board[i][j] = '2'; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[i][j] = 2; + } + else if (NpcTicTacToeGameExist->gameGrid[i][j] == 0) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].AIgameGrid[i][j] = 0; + } + } + } + + int AImove = AIpick_best_move(NpcTicTacToeGameExist, 2, 1); + aiFoundI = AImove / 10; + aiFoundJ = AImove % 10; + } + else + { + // Random AI + std::vector listStringCellEmpty; + listStringCellEmpty.clear(); + + // Find cell empty + for (int i = 0; i < 3; i++){ + for (int j = 0; j < 3; j++){ + if (NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameGrid[i][j] == 0) + { + listStringCellEmpty.push_back(std::to_string(i) + std::to_string(j)); + } + } + } + + if (!listStringCellEmpty.empty()) + { + uint16 stringCellFoud = urand(0, listStringCellEmpty.size() - 1); + aiFoundI = atoi(listStringCellEmpty[stringCellFoud].substr(0, 1).c_str()); + aiFoundJ = atoi(listStringCellEmpty[stringCellFoud].substr(1, 1).c_str()); + } + } + + if (aiFoundI != -1 && aiFoundJ != -1) + { + std::string whisperMessage = "I think I just found my best move in '"; + whisperMessage += Grid_Letters[aiFoundI]; + whisperMessage += std::to_string(aiFoundJ + 1); + whisperMessage += "'."; + + creature->Whisper(whisperMessage, LANG_UNIVERSAL, player, true); + + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameGrid[aiFoundI][aiFoundJ] = NpcTicTacToeGameExist->nextIdPlayerMove; + + if (NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer02; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 2; + } + else + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer01; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 1; + } + + // Refresh only gossip for player01 + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP1 = true; + + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_COMPUTER_PLAYER_TEXT_04, 500); + return true; + } + else + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + + static bool OnGossipSelectTicTacToeHuman(Player* player, Creature* creature, uint32 sender, uint32 action, NpcTicTacToeInfo const* NpcTicTacToeGameExistFound) + { + if (!player) + return false; + + if (!creature) + return false; + + player->PlayerTalkClass->ClearMenus(); + + NpcTicTacToeInfo const* NpcTicTacToeGameExist = NULL; + Player* playerFind02 = nullptr; + Player* playerFind01 = nullptr; + std::string notificationMessage = ""; + std::string whisperMessage = ""; + + if (!NpcTicTacToeGameExistFound) + { + // Found current game for this player + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == player->GetGUID() || i->second.guidPlayer02 == player->GetGUID()) + { + NpcTicTacToeGameExist = GetNpcTitcTacToeData(i->second.guidPlayer01); + if (NpcTicTacToeGameExist) + { + gameExistFound = true; + } + break; + } + } + } + + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + else + { + NpcTicTacToeGameExist = NpcTicTacToeGameExistFound; + } + + // Game created (roll who start only the first time) + if (action == (GOSSIP_ACTION_INFO_DEF + 60) && NpcTicTacToeGameExist->gameStatus == 2) + { + // Send notification about game started + notificationMessage = "Game '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' started."; + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage.c_str()); + + // If player game send notification to second player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + // If current player isn't player02 + if (player->GetGUID() != NpcTicTacToeGameExist->guidPlayer02) + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + playerFind02->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + } + } + else + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + playerFind02->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + } + } + } + + notificationMessage = "After a roll, player '"; + + // Roll who start game + switch (urand(1, 2)) + { + case 1: + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer01; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 1; + notificationMessage += "" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r"; + break; + + case 2: + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer02; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 2; + notificationMessage += "" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r"; + break; + } + + notificationMessage += "' will start this new game in first."; + + // Send notification about roll result + player->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage.c_str()); + + // If player game send notification to second player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + // If current player isn't player02 + if (player->GetGUID() != NpcTicTacToeGameExist->guidPlayer02) + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + playerFind02->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + } + } + else + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + playerFind02->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + } + } + } + else + { + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1) + { + creature->Whisper("You are lucky at roll, wait see what you will do know.", LANG_UNIVERSAL, player, true); + } + else + { + creature->Whisper("I start win this game before he start, don't cry.", LANG_UNIVERSAL, player, true); + action = GOSSIP_ACTION_INFO_DEF + 76; + } + } + + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus = 5; + + // Refresh for player02 launch if find (so only human game) + if (playerFind02) + { + // If current player isn't player02 + if (player->GetGUID() != NpcTicTacToeGameExist->guidPlayer02) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP2 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_02, 500); + } + else + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP1 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_01, 500); + } + } + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "Game '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' started.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " 1 2 3", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 63); + + std::string path_icon_string_display = ""; + for (int i(0); i < 3; i++){ + path_icon_string_display = " "; + for (int j(0); j < 3; j++){ + path_icon_string_display += " " + npc_tic_tac_toe::GetIconePathBySize(npc_tic_tac_toe::GetIconeNameByPlayerTheme(Path_Icon, NpcTicTacToeGameExist->gameGrid[i][j], NpcTicTacToeGameExist->themeTypeSelected), 75); + } + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, path_icon_string_display, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 63); + } + + if (checkIfGameWinOrDraw(NpcTicTacToeGameExist) == false) + { + // Computer game + if (NpcTicTacToeGameExist->gameTypeSelected != 1 && NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + // Only if action launch by last player01 move + if (action == (GOSSIP_ACTION_INFO_DEF + 76)) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].computerStateText = 1; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_COMPUTER_PLAYER_TEXT_01, 1000); + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_COMPUTER_PLAYER_TEXT_02, 3000); + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_COMPUTER_PLAYER_TEXT_03, 5000); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "\nSecond player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' playing |TInterface\\icons\\Spell_Holy_Borrowedtime:45|t.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + // Next player move + else + { + // If current player talking is the next who should play + if (NpcTicTacToeGameExist->nextGuidPlayerMove == player->GetGUID()) + { + // Send notification message + if (action == (GOSSIP_ACTION_INFO_DEF + 63)) + { + notificationMessage = "\n\nYou need click on : Select cell for use your " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, NpcTicTacToeGameExist->nextIdPlayerMove, NpcTicTacToeGameExist->themeTypeSelected), 45) + "."; + player->GetSession()->SendNotification(notificationMessage.c_str()); + } + + // Send notification and gossip details for wrong cell + if (action == (GOSSIP_ACTION_INFO_DEF + 67)) + { + player->GetSession()->SendNotification("\nWrong cell number, you need use (A1,A2,A3,B1,B2,B3,C1,C2,C3)."); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "\nWrong cell number, you need use (A1,A2,A3,B1,B2,B3,C1,C2,C3).", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 63); + + } + else if (action == (GOSSIP_ACTION_INFO_DEF + 68)) + { + player->GetSession()->SendNotification("\nWrong cell number, this cell is already played."); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "\nWrong cell number, this cell is already played.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 63); + + } + + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "\nSelect cell for use your " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, NpcTicTacToeGameExist->nextIdPlayerMove, NpcTicTacToeGameExist->themeTypeSelected), 40) + ".", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 75, "Write a cell name (for exemple : a1)", 0, true); + } + else + { + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "\nFirst player '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' playing |TInterface\\icons\\Spell_Holy_Borrowedtime:45|t.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + else + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "\nSecond player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' playing |TInterface\\icons\\Spell_Holy_Borrowedtime:45|t.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + } + } + } + else + { + // Game win + if (NpcTicTacToeGameExist->gameStatus == 20 || NpcTicTacToeGameExist->gameStatus == 21) + { + // Gossip win message + if (NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "\nGame win by the first player '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + else + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "\nGame win by the second player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r'.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Erase this game ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + // REWARD GIVE only the first time + if (NpcTicTacToeGameExist->gameStatus == 20) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus = 21; + + // Game Type player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + // Player01 win (player02 loose) + if (NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + notificationMessage = "This game it's win by the first player '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'."; + + if (playerFind01 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + ChatHandler(playerFind01->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper("Good Game, you are better than this human ;) !", LANG_UNIVERSAL, playerFind01, true); + + // REWARD GIVE ? (human game - player01 WIN - player02 LOOSE) + // Give 100 PO to player01 + playerFind01->ModifyMoney(MONEY_WIN_GAME_HUMAN); + } + + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper("You can try to do your best in a next game !", LANG_UNIVERSAL, playerFind02, true); + + // REWARD GIVE ? (human game - player01 WIN - player02 LOOSE) + // Take 100 PO from player02 + if (playerFind02->GetMoney() >= MONEY_LOOSE_GAME_HUMAN) + playerFind02->ModifyMoney(-MONEY_LOOSE_GAME_HUMAN); + } + } + else + { + notificationMessage = "This game it's win by the second player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r'."; + + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper("Good Game, you are better than this human ;) !", LANG_UNIVERSAL, playerFind02, true); + + // REWARD GIVE ? (human game - player01 LOOSE - player02 WIN) + // Give 100 PO to player02 + playerFind02->ModifyMoney(MONEY_WIN_GAME_HUMAN); + } + + if (playerFind01 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + ChatHandler(playerFind01->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper("You can try to do your best in a next game !", LANG_UNIVERSAL, playerFind01, true); + + // REWARD GIVE ? (human game - player01 LOOSE - player02 WIN) + // Take 100 PO from player01 + if (playerFind01->GetMoney() >= MONEY_LOOSE_GAME_HUMAN) + playerFind01->ModifyMoney(-MONEY_LOOSE_GAME_HUMAN); + } + } + } + else if (NpcTicTacToeGameExist->gameTypeSelected == 2) + { + // Player01 win (computer loose) + if (NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + notificationMessage = "This game it's win by the first player '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'."; + whisperMessage = "Good Game, you are better than a NPC ;) !"; + + // REWARD GIVE ? (computer game - player01 WIN - computer LOOSE) + // Give 1 PO + player->ModifyMoney(MONEY_WIN_GAME_NPC); + } + else + { + notificationMessage = "This game it's win by the second player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'."; + whisperMessage = "You can try to do your best in a next game, I'm just a NPC ;) !"; + + // REWARD GIVE ? (computer game - player02 (computer) WIN - player01 LOOSE) + // Take 1 PO from player01 + if (player->GetMoney() >= MONEY_LOOSE_GAME_NPC) + player->ModifyMoney(-MONEY_LOOSE_GAME_NPC); + } + + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper(whisperMessage, LANG_UNIVERSAL, player, true); + } + else if (NpcTicTacToeGameExist->gameTypeSelected == 3) + { + // Player01 win (master computer loose) + if (NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + notificationMessage = "This game it's win by the first player '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'."; + whisperMessage = "Good Game, you are better than a master NPC ;) !"; + + // REWARD GIVE ? (master computer game - player01 WIN - master computer LOOSE) + // Give 10 PO + player->ModifyMoney(MONEY_WIN_GAME_IA_NPC); + } + else + { + notificationMessage = "This game it's win by the second player '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer01 + "|r'."; + whisperMessage = "You can try to do your best in a next game, I'm just a master NPC ;) !"; + + // REWARD GIVE ? (master computer game - player02 (master computer) WIN - player01 LOOSE) + // Take 10 PO from player01 + if (player->GetMoney() >= MONEY_LOOSE_GAME_IA_NPC) + player->ModifyMoney(-MONEY_LOOSE_GAME_IA_NPC); + } + + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage.c_str()); + creature->Whisper(whisperMessage, LANG_UNIVERSAL, player, true); + } + + // Launch gossip refresh only for human game player02 + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP2 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_02, 500); + } + + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP1 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_01, 500); + } + } + else + { + // Gossip draw message + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "\nThis game it's a draw, no winner.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Erase this game ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + // REWARD GIVE only the first time + if (NpcTicTacToeGameExist->gameStatus == 30) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameStatus = 31; + + // Game Type player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + // DRAW + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1 || NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + if (playerFind01 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + ChatHandler(playerFind01->GetSession()).PSendSysMessage("This game it's a draw."); + creature->Whisper("Good Game, but not enougth for one of you can win !", LANG_UNIVERSAL, playerFind01, true); + + // REWARD GIVE ? (human game - DRAW) + // Give 1 PO to player01 + playerFind01->ModifyMoney(MONEY_DRAW_GAME_HUMAN); + } + + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + ChatHandler(playerFind02->GetSession()).PSendSysMessage("This game it's a draw."); + creature->Whisper("Good Game, but not enougth for one of you can win !", LANG_UNIVERSAL, playerFind02, true); + + // REWARD GIVE ? (human game - DRAW) + // Give 1 PO to player02 + playerFind02->ModifyMoney(MONEY_DRAW_GAME_HUMAN); + } + } + } + else if (NpcTicTacToeGameExist->gameTypeSelected == 2) + { + // DRAW + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1 || NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + ChatHandler(player->GetSession()).PSendSysMessage("This game it's a draw."); + creature->Whisper("Good Game, you are a NPC ;) ?", LANG_UNIVERSAL, player, true); + + // REWARD GIVE ? (computer game - DRAW) + // Give 1 PO + player->ModifyMoney(MONEY_DRAW_GAME_NPC); + } + } + else if (NpcTicTacToeGameExist->gameTypeSelected == 3) + { + // DRAW + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1 || NpcTicTacToeGameExist->nextIdPlayerMove == 2) + { + ChatHandler(player->GetSession()).PSendSysMessage("This game it's a draw."); + creature->Whisper("Good Game, you are a master NPC ;) ?", LANG_UNIVERSAL, player, true); + + // REWARD GIVE ? (master computer game - DRAW) + // Give 10 PO + player->ModifyMoney(MONEY_DRAW_GAME_IA_NPC); + } + } + + // Launch gossip refresh only for human game player02 + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP2 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_02, 500); + } + + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP1 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_01, 500); + } + } + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_INGAME, creature->GetGUID()); + return true; + } + + bool OnGossipHello(Player* player, Creature* creature) override + { + if (!player) + return false; + + if (!creature) + return false; + + player->PlayerTalkClass->ClearMenus(); + + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == player->GetGUID() || i->second.guidPlayer02 == player->GetGUID()) + { + gameExistFound = true; + + // If theme already selected (only the player who start build the game can continue) + if (i->second.gameStatus == 1 && i->second.guidPlayer01 == player->GetGUID()) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "You are already in one game setup.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); + } + else if (i->second.gameStatus == 2 && i->second.guidPlayer01 == player->GetGUID()) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "You are already in one game created.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + } + else if (i->second.gameStatus < 2 && i->second.guidPlayer02 == player->GetGUID() && i->second.gameTypeSelected == 1) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "You are already in one game setup (create by '" + COLOR_RED + "" + i->second.namePlayer01 + "|r').\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + } + else if (i->second.gameStatus == 2 && i->second.guidPlayer02 == player->GetGUID() && i->second.gameTypeSelected == 1) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "You are already in one game created by '" + COLOR_RED + "" + i->second.namePlayer01 + "|r', join it ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + } + else if (i->second.gameStatus >= 5 && i->second.gameStatus < 20) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "You are already in an existing game '" + COLOR_RED + "" + i->second.namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + i->second.namePlayer02 + "|r', join it ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + else if (i->second.gameStatus >= 20) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "This game '" + COLOR_RED + "" + i->second.namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + i->second.namePlayer02 + "|r' it's already done.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Erase your existing game ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + break; + } + } + } + + // No game found for current player (as player01 or player02 + if (gameExistFound == false) + { + // If no game already started + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "No game already exist with you, for start new one you need first choose a theme.\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "\nShow rules", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_WELCOME, creature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) + { + if (!player) + return false; + + if (!creature) + return false; + + player->PlayerTalkClass->ClearMenus(); + + // Found current game for this player + NpcTicTacToeInfo const* NpcTicTacToeGameExist = NULL; + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == player->GetGUID() || i->second.guidPlayer02 == player->GetGUID()) + { + NpcTicTacToeGameExist = GetNpcTitcTacToeData(i->second.guidPlayer01); + if (NpcTicTacToeGameExist) + { + gameExistFound = true; + } + break; + } + } + } + + uint32 themeTypeSelected = 0; + + switch (action) + { + // Gossip Hello welcome + case GOSSIP_ACTION_INFO_DEF + 1: + { + OnGossipHello(player, creature); + return true; + } break; + + // Erase game + case GOSSIP_ACTION_INFO_DEF + 3: + { + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "You have an existing game '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r', do you want to erase it ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4, "Are you sure ?", 0, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_INGAME, creature->GetGUID()); + } break; + + // Erase game CONFIRM + case GOSSIP_ACTION_INFO_DEF + 4: + { + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + + std::string notificationMessage01 = "Game '" + NpcTicTacToeGameExist->namePlayer01 + "' Vs '" + NpcTicTacToeGameExist->namePlayer02 + "' deleted "; + std::string notificationMessage02 = "Game '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' deleted "; + + std::string notificationColor = (player->GetGUID() == NpcTicTacToeGameExist->guidPlayer01) ? "cffFF0000" : "cff6666FF"; + notificationMessage01 += "by '|" + notificationColor + player->GetName() + "|r'."; + notificationMessage02 += "by '|" + notificationColor + player->GetName() + "|r'."; + + player->GetSession()->SendNotification(notificationMessage01.c_str()); + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage02.c_str()); + + Player* playerFind02 = nullptr; + + // If player game send notification to second player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + // If player 01 talking, find player 02 + if (player->GetGUID() == NpcTicTacToeGameExist->guidPlayer01) + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + playerFind02->GetSession()->SendNotification(notificationMessage01.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage02.c_str()); + } + } + else if (player->GetGUID() == NpcTicTacToeGameExist->guidPlayer02) + { + if (playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer01)) + { + playerFind02->GetSession()->SendNotification(notificationMessage01.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage02.c_str()); + } + } + } + + NpcTicTacToeData.erase(NpcTicTacToeGameExist->guidPlayer01); + OnGossipHello(player, creature); + + if (playerFind02) + OnGossipHello(playerFind02, creature); + } break; + + // Rules and exemmple game win + case GOSSIP_ACTION_INFO_DEF + 10: + { + // Select a random theme and player win + uint32 themeExemple = urand(1, 8); + uint32 winPlayerExemple01 = urand(1, 2); + uint32 winPlayerExemple02 = (winPlayerExemple01 == 1) ? 2 : 1; + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Tic Tac Toe game rules : The player who succeeds in placing three of their marks in a " + COLOR_GREEN + "horizontal|r, " + COLOR_GREEN + "vertical|r, or " + COLOR_GREEN + "diagonal|r row wins the game. Lines are letters (ABC) and columns are numbers (123).\nThis is an exemple of game win by " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 45) + ":\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " 1 2 3", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + + switch (urand(0,2)) + { + case 0: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + break; + case 1: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + break; + case 2: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple02, themeExemple), 70) + " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, winPlayerExemple01, themeExemple), 70) + "", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + break; + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_EMPTY, creature->GetGUID()); + } break; + + // Choose theme + case GOSSIP_ACTION_INFO_DEF + 15: + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Select theme you want play with :\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); + + for (std::size_t i(1); i <= ((Path_Icon.size() - 1) / 2); ++i) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, " " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 1, i), 70) + " Vs " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 2, i), 70), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20 + i); + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_SETUP, creature->GetGUID()); + } break; + + // Theme selected, choose game type now + // Theme already selected before and save now + case GOSSIP_ACTION_INFO_DEF + 20: + case GOSSIP_ACTION_INFO_DEF + 21: + case GOSSIP_ACTION_INFO_DEF + 22: + case GOSSIP_ACTION_INFO_DEF + 23: + case GOSSIP_ACTION_INFO_DEF + 24: + case GOSSIP_ACTION_INFO_DEF + 25: + case GOSSIP_ACTION_INFO_DEF + 26: + case GOSSIP_ACTION_INFO_DEF + 27: + case GOSSIP_ACTION_INFO_DEF + 28: + case GOSSIP_ACTION_INFO_DEF + 29: + case GOSSIP_ACTION_INFO_DEF + 30: + case GOSSIP_ACTION_INFO_DEF + 31: + case GOSSIP_ACTION_INFO_DEF + 32: + case GOSSIP_ACTION_INFO_DEF + 33: + case GOSSIP_ACTION_INFO_DEF + 34: + case GOSSIP_ACTION_INFO_DEF + 35: + case GOSSIP_ACTION_INFO_DEF + 36: + { + // Check if not already in create game (check done in GossipHello) + // OK + + uint32 gossipActionthemeTypeSelected = 0; + + if (action != (GOSSIP_ACTION_INFO_DEF + 20)) + { + themeTypeSelected = action - GOSSIP_ACTION_INFO_DEF - 20; + gossipActionthemeTypeSelected = action - GOSSIP_ACTION_INFO_DEF; + + NpcTicTacToeData[player->GetGUID()].namePlayer01 = player->GetName().c_str(); + NpcTicTacToeData[player->GetGUID()].guidPlayer01 = player->GetGUID(); + NpcTicTacToeData[player->GetGUID()].themeTypeSelected = themeTypeSelected; + NpcTicTacToeData[player->GetGUID()].gameStatus = 1; + } + else + { + gossipActionthemeTypeSelected = 20; + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Theme " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 1, NpcTicTacToeData[player->GetGUID()].themeTypeSelected), 60) + " Vs " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 2, NpcTicTacToeData[player->GetGUID()].themeTypeSelected), 60) + " selected.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + gossipActionthemeTypeSelected); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nYou need now to select your adversary :\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + gossipActionthemeTypeSelected); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "|TInterface\\icons\\" + Path_IconSelectGameType[0] + ":45|t Take groupmate", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 51); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "|TInterface\\icons\\" + Path_IconSelectGameType[0] + ":45|t Take your target", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 52); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "|TInterface\\icons\\" + Path_IconSelectGameType[1] + ":45|t Take NPC (random move)", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 53); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "|TInterface\\icons\\" + Path_IconSelectGameType[1] + ":45|t Take NPC (AI)", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 54); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_SETUP, creature->GetGUID()); + } break; + + // Theme selected, game type selected + case GOSSIP_ACTION_INFO_DEF + 51: + case GOSSIP_ACTION_INFO_DEF + 52: + case GOSSIP_ACTION_INFO_DEF + 53: + case GOSSIP_ACTION_INFO_DEF + 54: + { + // Check if not already in create game (check done in GossipHello) + // OK + + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + + // Can be a player02 too in field + // string namePlayer01 = player->GetName().c_str(); + ObjectGuid guidPlayer01 = player->GetGUID(); + + string namePlayer02 = ""; + ObjectGuid guidPlayer02; + uint32 gameTypeSelected = 0; + string messageGameTypeSelected = ""; + + // Human game (with group mate) + if (action == GOSSIP_ACTION_INFO_DEF + 51) + { + // Check if player in group and if have only one mate + if (player->GetGroup() && player->GetGroup()->GetMembersCount() == 2) + { + // if (group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2) + for (GroupReference* groupRef = player->GetGroup()->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) + { + if (Player* member = groupRef->GetSource()) + { + if (member->IsInWorld() && member->GetGUID() != guidPlayer01) + { + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == member->GetGUID() || i->second.guidPlayer02 == member->GetGUID()) + { + gameExistFound = true; + } + } + } + + if (gameExistFound == false) + { + namePlayer02 = member->GetName().c_str(); + guidPlayer02 = member->GetGUID(); + } + else + { + std::string notificationMessage = "Your mate '" + member->GetName() + "' it's already in one game."; + player->GetSession()->SendNotification(notificationMessage.c_str()); + } + } + } + } + + if (namePlayer02 != "") + { + gameTypeSelected = 1; + messageGameTypeSelected = "Human adversary selected.\n"; + } + else + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + else + { + player->GetSession()->SendNotification("You need to be in a group (only with one mate)."); + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + // Human game (with target mate) + else if (action == GOSSIP_ACTION_INFO_DEF + 52) + { + Player* targetPlayer = ObjectAccessor::FindPlayer(player->GetTarget()); + if (targetPlayer && targetPlayer != player) + { + if (targetPlayer->IsInWorld()) + { + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == targetPlayer->GetGUID() || i->second.guidPlayer02 == targetPlayer->GetGUID()) + { + gameExistFound = true; + } + } + } + + if (gameExistFound == false) + { + namePlayer02 = targetPlayer->GetName().c_str(); + guidPlayer02 = targetPlayer->GetGUID(); + } + else + { + std::string notificationMessage = "Your target '" + targetPlayer->GetName() + "' it's already in one game."; + player->GetSession()->SendNotification(notificationMessage.c_str()); + } + } + + if (namePlayer02 != "") + { + gameTypeSelected = 1; + messageGameTypeSelected = "Human adversary selected.\n"; + } + else + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + else + { + player->GetSession()->SendNotification("You need to select a player."); + player->CLOSE_GOSSIP_MENU(); + return true; + } + } + // Computer game + else if (action == GOSSIP_ACTION_INFO_DEF + 53) + { + namePlayer02 = "NPC"; + // If none second player get same guid for the second computer player + guidPlayer02 = player->GetGUID(); + gameTypeSelected = 2; + messageGameTypeSelected = "NPC adversary (random move) selected.\n"; + } + // Master Computer game + else if (action == GOSSIP_ACTION_INFO_DEF + 54) + { + namePlayer02 = "MasterNPC"; + // If none second player get same guid for the second computer player + guidPlayer02 = player->GetGUID(); + gameTypeSelected = 3; + messageGameTypeSelected = "NPC adversary (AI) selected.\n"; + } + + NpcTicTacToeData[guidPlayer01].namePlayer01 = player->GetName().c_str(); + NpcTicTacToeData[guidPlayer01].guidPlayer01 = guidPlayer01; + NpcTicTacToeData[guidPlayer01].namePlayer02 = namePlayer02; + NpcTicTacToeData[guidPlayer01].guidPlayer02 = guidPlayer02; + NpcTicTacToeData[guidPlayer01].messageGameTypeSelected = messageGameTypeSelected; + NpcTicTacToeData[guidPlayer01].gameTypeSelected = gameTypeSelected; + NpcTicTacToeData[guidPlayer01].gameStatus = 2; + NpcTicTacToeData[guidPlayer01].needRefreshGossipP1 = false; + NpcTicTacToeData[guidPlayer01].needRefreshGossipP2 = false; + + // Init game grid default falue + for (int i(0); i < 3; i++){ + for (int j(0); j < 3; j++){ + NpcTicTacToeData[guidPlayer01].gameGrid[i][j] = 0; + } + } + + std::string notificationMessage = "Game '" + COLOR_RED + "" + NpcTicTacToeData[guidPlayer01].namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeData[guidPlayer01].namePlayer02 + "|r' created."; + ChatHandler(player->GetSession()).PSendSysMessage(notificationMessage.c_str()); + + OnGossipSelect(player, creature, GOSSIP_SENDER_MAIN, (GOSSIP_ACTION_INFO_DEF + 56)); + + // If player game send notification to second player + if (NpcTicTacToeGameExist->gameTypeSelected == 1) + { + if (Player* playerFind02 = ObjectAccessor::FindConnectedPlayer(NpcTicTacToeGameExist->guidPlayer02)) + { + playerFind02->GetSession()->SendNotification(notificationMessage.c_str()); + ChatHandler(playerFind02->GetSession()).PSendSysMessage(notificationMessage.c_str()); + + OnGossipSelect(playerFind02, creature, GOSSIP_SENDER_MAIN, (GOSSIP_ACTION_INFO_DEF + 56)); + } + } + } break; + + // Show game details for the two players + case GOSSIP_ACTION_INFO_DEF + 56: + { + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Theme " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 1, NpcTicTacToeGameExist->themeTypeSelected), 60) + " Vs " + GetIconePathBySize(GetIconeNameByPlayerTheme(Path_Icon, 2, NpcTicTacToeGameExist->themeTypeSelected), 60) + " selected.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, NpcTicTacToeGameExist->messageGameTypeSelected, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + + switch (NpcTicTacToeGameExist->gameTypeSelected) + { + case 1: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_GREEN + "win|r this game, you will have " + std::to_string(MONEY_WIN_GAME_HUMAN / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_RED + "loose|r this game, you will loose " + std::to_string(MONEY_LOOSE_GAME_HUMAN / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If game " + COLOR_WHITE + "draw|r, you will have " + std::to_string(MONEY_DRAW_GAME_HUMAN / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + break; + case 2: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_GREEN + "win|r this game, you will have " + std::to_string(MONEY_WIN_GAME_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_RED + "loose|r this game, you will loose " + std::to_string(MONEY_LOOSE_GAME_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If game " + COLOR_WHITE + "draw|r, you will have " + std::to_string(MONEY_DRAW_GAME_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + break; + case 3: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_GREEN + "win|r this game, you will have " + std::to_string(MONEY_WIN_GAME_IA_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If you " + COLOR_RED + "loose|r this game, you will loose " + std::to_string(MONEY_LOOSE_GAME_IA_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, "If game " + COLOR_WHITE + "draw|r, you will have " + std::to_string(MONEY_DRAW_GAME_IA_NPC / 10000) + " Gold.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 56); + break; + } + + // All player can't start this new game + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "\nGame '" + COLOR_RED + "" + NpcTicTacToeGameExist->namePlayer01 + "|r' Vs '" + COLOR_BLUE + "" + NpcTicTacToeGameExist->namePlayer02 + "|r' created, start this new game ?\n", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 60); + + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "\nMain menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(GOSSIP_MENU_TICTACTOE_INGAME, creature->GetGUID()); + } break; + + // Game started + case GOSSIP_ACTION_INFO_DEF + 60: + // Send notification rules + case GOSSIP_ACTION_INFO_DEF + 63: + // Wrong cell number + case GOSSIP_ACTION_INFO_DEF + 67: + // Wrong cell number : not empty + case GOSSIP_ACTION_INFO_DEF + 68: + // Select move for computer + case GOSSIP_ACTION_INFO_DEF + 76: + OnGossipSelectTicTacToeHuman(player, creature, GOSSIP_SENDER_MAIN, action, NpcTicTacToeGameExist); + break; + } + return true; + } + + // Called when a player select gossip with a code + bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) + { + if (!player) + return false; + + if (!creature) + return false; + + player->PlayerTalkClass->ClearMenus(); + + // Found current game for this player + NpcTicTacToeInfo const* NpcTicTacToeGameExist = NULL; + bool gameExistFound = false; + + if (!NpcTicTacToeData.empty()) + { + // Check for each information if player found as player 01 or 02 + for (std::map::const_iterator i = NpcTicTacToeData.begin(); i != NpcTicTacToeData.end(); ++i) + { + if (i->second.guidPlayer01 == player->GetGUID() || i->second.guidPlayer02 == player->GetGUID()) + { + NpcTicTacToeGameExist = GetNpcTitcTacToeData(i->second.guidPlayer01); + if (NpcTicTacToeGameExist) + { + gameExistFound = true; + } + break; + } + } + } + + // If no game found for current player + if (gameExistFound == false) + { + player->CLOSE_GOSSIP_MENU(); + return true; + } + + // Select move for player + if (action == GOSSIP_ACTION_INFO_DEF + 75) + { + // only 1 letter and 1 number need (2 characters) + if (strlen(code) == 2) + { + std::string codeString = std::string(code); + Utf8ToUpperOnlyLatin(codeString); + + // Check if letter and number given are correct + if (codeString.substr(0, 1).find_first_of("ABC") != std::string::npos && codeString.substr(1, 1).find_first_of("123") != std::string::npos) + { + // If cell empty + if (NpcTicTacToeGameExist->gameGrid[static_cast(Grid_Letters.find(codeString.substr(0, 1)))][atoi(codeString.substr(1, 1).c_str()) - 1] == 0) + { + // Set player id in cell choosen + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameGrid[static_cast(Grid_Letters.find(codeString.substr(0, 1)))][atoi(codeString.substr(1, 1).c_str()) - 1] = NpcTicTacToeGameExist->nextIdPlayerMove; + + // Set the next player move and refresh + if (NpcTicTacToeGameExist->nextIdPlayerMove == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer02; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 2; + + // Launch gossip refresh only for human game + if (NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameTypeSelected == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP2 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_02, 500); + + // Main game check + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 60)); + return true; + } + else + { + // Check if win (action for computer move) + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 76)); + return true; + } + } + else + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextGuidPlayerMove = NpcTicTacToeGameExist->guidPlayer01; + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].nextIdPlayerMove = 1; + + // Launch gossip refresh only for human game + if (NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].gameTypeSelected == 1) + { + NpcTicTacToeData[NpcTicTacToeGameExist->guidPlayer01].needRefreshGossipP1 = true; + ENSURE_AI(npc_tic_tac_toe::npc_tic_tac_toeAI, creature->AI())->_events.ScheduleEvent(WAIT_HUMAN_PLAYER_01, 500); + } + + // Main game check + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 60)); + return true; + } + } + else + { + // Send notification and gossip details for wrong cell (already play) + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 68)); + return true; + } + } + else + { + // Send notification and gossip details for wrong cell + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 67)); + return true; + } + } + else + { + // Send notification and gossip details for wrong cell + OnGossipSelect(player, creature, sender, (GOSSIP_ACTION_INFO_DEF + 67)); + return true; + } + } + + player->CLOSE_GOSSIP_MENU(); + return true; + } + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_tic_tac_toeAI(creature); + } + +}; + +void AddSC_npc_tic_tac_toe() +{ + new npc_tic_tac_toe(); +} diff --git a/vip_npc.cpp b/vip_npc.cpp new file mode 100644 index 0000000..698d3ad --- /dev/null +++ b/vip_npc.cpp @@ -0,0 +1,43 @@ +#include "ScriptPCH.h" + +class VIP_NPC : public CreatureScript +{ +public: + VIP_NPC() : CreatureScript("VIP_NPC") { } + + bool OnGossipHello(Player * player, Creature * pCreature) + { + if (player->GetSession()->GetSecurity() >= SEC_GAMEMASTER) + { + player->ADD_GOSSIP_ITEM(6, "Browse goods", GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR); + player->ADD_GOSSIP_ITEM(6, "Goodbye", GOSSIP_SENDER_MAIN, 1); + } + else + { + player->GetSession()->SendNotification("Only a VIP may speak to me. Donate or do something unique for the server to become a VIP!"); + player->CLOSE_GOSSIP_MENU(); + } + player->PlayerTalkClass->SendGossipMenu(9452, pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); + switch (action) + { + case GOSSIP_OPTION_VENDOR: + player->GetSession()->SendListInventory(m_creature->GetGUID()); + break; + case 1: + player->CLOSE_GOSSIP_MENU(); + break; + } + return true; + } +}; + +void AddSC_VIP_NPC() +{ + new VIP_NPC(); +} \ No newline at end of file