diff options
-rw-r--r-- | sql/updates/world/master/2017_02_12_04_world_2016_08_15_00_world.sql | 12 | ||||
-rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 69 |
2 files changed, 36 insertions, 45 deletions
diff --git a/sql/updates/world/master/2017_02_12_04_world_2016_08_15_00_world.sql b/sql/updates/world/master/2017_02_12_04_world_2016_08_15_00_world.sql new file mode 100644 index 00000000000..867d5b127a5 --- /dev/null +++ b/sql/updates/world/master/2017_02_12_04_world_2016_08_15_00_world.sql @@ -0,0 +1,12 @@ +-- Pet Trainer creature updates +UPDATE `creature_template` SET `gossip_menu_id`= 4783 WHERE `entry` IN (543, 3306, 3545, 3698, 4320, 16675, 40405); +UPDATE `creature_template` SET /*`exp`= 0, `npcflag`= 17, `trainer_type`= 3,*/ `flags_extra`= 2, `ScriptName`= 'npc_pet_trainer' WHERE `entry`= 40405; +UPDATE `gossip_menu_option` SET `option_icon`= 0 WHERE `menu_id`= 6520 AND `id`= 0; + +-- gossip menu conditions, hunter class (4) for Pet Trainer gossip window +DELETE FROM `conditions` WHERE `SourceGroup`= 4783; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(14,4783,5838,0,0,15,0,4,0,0,0,0,0,'','Show gossip menu 4783 text id 5838 if player is a Hunter.'), +(14,4783,5839,0,0,15,0,4,0,0,1,0,0,'','Show gossip menu 4783 text id 5839 if player is not a Hunter.'), +(15,4783, 0,0,0,15,0,4,0,0,0,0,0,'','Show gossip menu 4783 option id 0 if player is a Hunter.'), +(15,4783, 1,0,0,15,0,4,0,0,0,0,0,'','Show gossip menu 4783 option id 1 if player is a Hunter.'); diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 84026dd671a..badf474480c 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -16,30 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Npcs_Special -SD%Complete: 100 -SDComment: To be used for special NPCs that are located globally. -SDCategory: NPCs -EndScriptData -*/ - -/* ContentData -npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell -npc_lunaclaw_spirit 80% support for quests 6001/6002 (Body and Heart) -npc_chicken_cluck 100% support for quest 3861 (Cluck!) -npc_dancing_flames 100% midsummer event NPC -npc_guardian 100% guardianAI used to prevent players from accessing off-limits areas. Not in use by SD2 -npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 -npc_injured_patient 100% patients for triage-quests (6622 and 6624) -npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 and 6624 (Triage) -npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given -npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap -npc_shadowfiend 100% restore 5% of owner's mana when shadowfiend die from damage -npc_firework 100% NPC's summoned by rockets and rocket clusters, for making them cast visual -npc_train_wrecker 100% Wind-Up Train Wrecker that kills train set -EndContentData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" @@ -1800,51 +1776,54 @@ class npc_wormhole : public CreatureScript enum PetTrainer { - TEXT_ISHUNTER = 5838, - TEXT_NOTHUNTER = 5839, - TEXT_PETINFO = 13474, - TEXT_CONFIRM = 7722 + MENU_ID_PET_TRAINING = 4783, + MENU_ID_PET_UNLEARN = 6520, + NPC_TEXT_PET_FAMILIES = 13474, + NPC_TEXT_PET_TRAINING = 5838, + NPC_TEXT_UNLEARN = 7722, + OPTION_ID_HOW_DO_I_TRAIN = 0, + OPTION_ID_UNTRAIN_MY_PET = 1, + OPTION_ID_PLEASE_DO = 0, }; -#define GOSSIP_PET1 "How do I train my pet?" -#define GOSSIP_PET2 "I wish to untrain my pet." -#define GOSSIP_PET_CONFIRM "Yes, please do." - class npc_pet_trainer : public CreatureScript { public: npc_pet_trainer() : CreatureScript("npc_pet_trainer") { } - bool OnGossipHello(Player* player, Creature* creature) override + bool OnGossipHello(Player* player, Creature* creature) /*override*/ { + player->PlayerTalkClass->ClearMenus(); + if (creature->IsQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->getClass() == CLASS_HUNTER) + if (player->GetPet() && player->GetPet()->getPetType() == HUNTER_PET) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (player->GetPet() && player->GetPet()->getPetType() == HUNTER_PET) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - player->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, creature->GetGUID()); - return true; + player->ADD_GOSSIP_ITEM_DB(MENU_ID_PET_TRAINING, OPTION_ID_HOW_DO_I_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM_DB(MENU_ID_PET_TRAINING, OPTION_ID_UNTRAIN_MY_PET, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->SEND_GOSSIP_MENU(NPC_TEXT_PET_TRAINING, creature->GetGUID()); + } + else + { + player->ADD_GOSSIP_ITEM_DB(MENU_ID_PET_TRAINING, OPTION_ID_HOW_DO_I_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->SEND_GOSSIP_MENU(NPC_TEXT_PET_TRAINING, creature->GetGUID()); } - player->PlayerTalkClass->SendGossipMenu(TEXT_NOTHUNTER, creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) /*override*/ { player->PlayerTalkClass->ClearMenus(); switch (action) { case GOSSIP_ACTION_INFO_DEF + 1: - player->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, creature->GetGUID()); + player->SEND_GOSSIP_MENU(NPC_TEXT_PET_FAMILIES, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, creature->GetGUID()); + player->ADD_GOSSIP_ITEM_DB(MENU_ID_PET_UNLEARN, OPTION_ID_PLEASE_DO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->SEND_GOSSIP_MENU(NPC_TEXT_UNLEARN, creature->GetGUID()); } break; case GOSSIP_ACTION_INFO_DEF + 3: |