diff options
-rw-r--r-- | sql/updates/world/master/2017_07_27_00_world.sql | 1 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/GossipDef.cpp | 16 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/GossipDef.h | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Northrend/zone_storm_peaks.cpp | 9 | ||||
-rw-r--r-- | src/server/scripts/Northrend/zone_wintergrasp.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/World/npc_professions.cpp | 12 | ||||
-rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 36 |
8 files changed, 26 insertions, 57 deletions
diff --git a/sql/updates/world/master/2017_07_27_00_world.sql b/sql/updates/world/master/2017_07_27_00_world.sql new file mode 100644 index 00000000000..1537f6e5592 --- /dev/null +++ b/sql/updates/world/master/2017_07_27_00_world.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='' WHERE `ScriptName`='npc_pet_trainer'; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 8848fb5aa44..aaa273573f3 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -41,27 +41,27 @@ GossipMenu::~GossipMenu() ClearMenu(); } -void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/) +uint32 GossipMenu::AddMenuItem(int32 optionIndex, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/) { ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS); // Find a free new id - script case - if (menuItemId == -1) + if (optionIndex == -1) { - menuItemId = 0; + optionIndex = 0; if (!_menuItems.empty()) { for (GossipMenuItemContainer::const_iterator itr = _menuItems.begin(); itr != _menuItems.end(); ++itr) { - if (int32(itr->first) > menuItemId) + if (int32(itr->first) > optionIndex) break; - menuItemId = itr->first + 1; + optionIndex = itr->first + 1; } } } - GossipMenuItem& menuItem = _menuItems[menuItemId]; + GossipMenuItem& menuItem = _menuItems[optionIndex]; menuItem.MenuItemIcon = icon; menuItem.Message = message; @@ -70,6 +70,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me menuItem.OptionType = action; menuItem.BoxMessage = boxMessage; menuItem.BoxMoney = boxMoney; + return optionIndex; } /** @@ -131,7 +132,8 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui } /// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro. - AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); + uint32 optionIndex = AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); + AddGossipMenuItemData(optionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.TrainerId); } } diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 0916c88083a..5b1db6e8227 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -167,7 +167,7 @@ class TC_GAME_API GossipMenu GossipMenu(); ~GossipMenu(); - void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false); + uint32 AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false); void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action); void SetMenuId(uint32 menu_id) { _menuId = menu_id; } diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 57ad947e1ef..d4e9f23482e 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -132,11 +132,11 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPackets::NPC::TrainerBuySpel if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if (_player->GetCurrentTrainerId() != packet.TrainerID) + if (_player->GetCurrentTrainerId() != uint32(packet.TrainerID)) return; Trainer::Trainer const* trainer = sObjectMgr->GetTrainer(packet.TrainerID); - if (!npc) + if (!trainer) return; trainer->TeachSpell(npc, _player, packet.SpellID); diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 2c26c7b242d..2f68b9bef51 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -119,7 +119,8 @@ public: enum RoxiRamrocket { SPELL_MECHANO_HOG = 60866, - SPELL_MEKGINEERS_CHOPPER = 60867 + SPELL_MEKGINEERS_CHOPPER = 60867, + TRAINER_ID_ROXI_RAMROCKET = 102, }; class npc_roxi_ramrocket : public CreatureScript @@ -134,11 +135,11 @@ public: player->PrepareQuestMenu(creature->GetGUID()); //Trainer Menu - if ( creature->IsTrainer() ) + if (creature->IsTrainer()) AddGossipItemFor(player, GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); //Vendor Menu - if ( creature->IsVendor() ) + if (creature->IsVendor()) if (player->HasSpell(SPELL_MECHANO_HOG) || player->HasSpell(SPELL_MEKGINEERS_CHOPPER)) AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); @@ -152,7 +153,7 @@ public: switch (action) { case GOSSIP_ACTION_TRAIN: - player->GetSession()->SendTrainerList(creature->GetGUID()); + player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_ROXI_RAMROCKET); break; case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index b06ab39d9f6..d31344add7b 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -396,10 +396,7 @@ class npc_wg_quest_giver : public CreatureScript return true; if (creature->IsVendor()) - { AddGossipItemFor(player, Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR); - player->PlayerTalkClass->GetGossipMenu().AddGossipMenuItemData(0, 0, 0); - } /// @todo: move this to conditions or something else diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 04ce1037cfe..26e4e6de928 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -190,6 +190,7 @@ enum SpecializationTrainers N_TRAINER_TRANSMUTE = 22427, // Zarevhi N_TRAINER_ELIXIR = 19052, // Lorokeem N_TRAINER_POTION = 17909, // Lauranna Thar'well + TRAINER_ID_ALCHEMY = 122, /* Blacksmithing */ N_TRAINER_SMITHOMNI1 = 11145, // Myolor Sunderfury @@ -201,6 +202,7 @@ enum SpecializationTrainers N_TRAINER_HAMMER = 11191, // Lilith the Lithe N_TRAINER_AXE = 11192, // Kilram N_TRAINER_SWORD = 11193, // Seril Scourgebane + TRAINER_ID_BLACKSMITHING = 80, /* Leatherworking */ N_TRAINER_DRAGON1 = 7866, // Peter Galen @@ -209,11 +211,13 @@ enum SpecializationTrainers N_TRAINER_ELEMENTAL2 = 7869, // Brumn Winterhoof N_TRAINER_TRIBAL1 = 7870, // Caryssia Moonhunter N_TRAINER_TRIBAL2 = 7871, // Se'Jib + TRAINER_ID_LEATHERWORKING = 103, /* Tailoring */ N_TRAINER_SPELLFIRE = 22213, // Gidge Spellweaver N_TRAINER_MOONCLOTH = 22208, // Nasmara Moonsong N_TRAINER_SHADOWEAVE = 22212, // Andrion Darkspinner + TRAINER_ID_TAILORING = 117, }; /*### @@ -485,7 +489,7 @@ public: player->GetSession()->SendListInventory(creature->GetGUID()); break; case GOSSIP_ACTION_TRAIN: - player->GetSession()->SendTrainerList(creature->GetGUID()); + player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_ALCHEMY); break; //Learn Alchemy case GOSSIP_ACTION_INFO_DEF + 1: @@ -673,7 +677,7 @@ public: player->GetSession()->SendListInventory(creature->GetGUID()); break; case GOSSIP_ACTION_TRAIN: - player->GetSession()->SendTrainerList(creature->GetGUID()); + player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_BLACKSMITHING); break; //Learn Armor/Weapon case GOSSIP_ACTION_INFO_DEF + 1: @@ -983,7 +987,7 @@ public: player->GetSession()->SendListInventory(creature->GetGUID()); break; case GOSSIP_ACTION_TRAIN: - player->GetSession()->SendTrainerList(creature->GetGUID()); + player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_LEATHERWORKING); break; //Unlearn Leather case GOSSIP_ACTION_INFO_DEF + 1: @@ -1113,7 +1117,7 @@ public: player->GetSession()->SendListInventory(creature->GetGUID()); break; case GOSSIP_ACTION_TRAIN: - player->GetSession()->SendTrainerList(creature->GetGUID()); + player->GetSession()->SendTrainerList(creature->GetGUID(), TRAINER_ID_TAILORING); break; //Learn Tailor case GOSSIP_ACTION_INFO_DEF + 1: diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index dbbfd8a1f01..2974bddd85d 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1733,41 +1733,6 @@ class npc_wormhole : public CreatureScript }; /*###### -## npc_pet_trainer -######*/ - -enum PetTrainer -{ - MENU_ID_PET_UNLEARN = 6520, - OPTION_ID_PLEASE_DO = 0 -}; - -class npc_pet_trainer : public CreatureScript -{ -public: - npc_pet_trainer() : CreatureScript("npc_pet_trainer") { } - - struct npc_pet_trainerAI : public ScriptedAI - { - npc_pet_trainerAI(Creature* creature) : ScriptedAI(creature) { } - - void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override - { - if (menuId == MENU_ID_PET_UNLEARN && gossipListId == OPTION_ID_PLEASE_DO) - { - player->ResetPetTalents(); - CloseGossipMenuFor(player); - } - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_pet_trainerAI(creature); - } -}; - -/*###### ## npc_experience ######*/ @@ -2553,7 +2518,6 @@ void AddSC_npcs_special() new npc_brewfest_reveler(); new npc_training_dummy(); new npc_wormhole(); - new npc_pet_trainer(); new npc_experience(); new npc_firework(); new npc_spring_rabbit(); |