diff options
-rw-r--r-- | sql/FULL/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/7909_world_scriptname.sql | 1 | ||||
-rw-r--r-- | src/scripts/world/npcs_special.cpp | 56 |
3 files changed, 58 insertions, 0 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 33fc086dd79..d0e6c84d65c 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -161,6 +161,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_highlord_darion_mograine' WHERE UPDATE `creature_template` SET `ScriptName`='npc_the_lich_king_tirion_dawn' WHERE `entry` IN (29183,29175); UPDATE `creature_template` SET `ScriptName`='npc_shadowfiend' WHERE `entry` = 19668; UPDATE `creature_template` SET `ScriptName`='npc_wormhole' WHERE `entry`='35646'; +UPDATE `creature_template` SET `ScriptName`='npc_pet_trainer' WHERE `entry` IN (10090,3698,17484,4320,3545,16712,3622,16675,3620,10086,2879,3306,543,2878,3688,10089,16271,10088,3624); /* */ /* ZONE */ diff --git a/sql/updates/7909_world_scriptname.sql b/sql/updates/7909_world_scriptname.sql new file mode 100644 index 00000000000..824c090800e --- /dev/null +++ b/sql/updates/7909_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_pet_trainer' WHERE `entry` IN (10090,3698,17484,4320,3545,16712,3622,16675,3620,10086,2879,3306,543,2878,3688,10089,16271,10088,3624); diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 0410de688e8..3ab437c0503 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -2062,6 +2062,56 @@ bool GossipSelect_npc_wormhole(Player* pPlayer, Creature* pCreature, uint32 uiSe return true; } +enum ePetTrainer +{ + TEXT_ISHUNTER = 5838, + TEXT_NOTHUNTER = 5839, + TEXT_PETINFO = 13474, + TEXT_CONFIRM = 7722 +}; + +#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." + +bool GossipHello_npc_pet_trainer(Player* pPlayer, Creature* pCreature) +{ + if (pPlayer->getClass() == CLASS_HUNTER) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->GetPet() && pPlayer->GetPet()->getPetType() == HUNTER_PET) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, pCreature->GetGUID()); + return true; + } + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_NOTHUNTER, pCreature->GetGUID()); + return true; +} + +bool GossipSelect_npc_pet_trainer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 3: + { + pPlayer->ResetPetTalents(); + pPlayer->CLOSE_GOSSIP_MENU(); + } + break; + } + return true; +} + void AddSC_npcs_special() { Script *newscript; @@ -2194,5 +2244,11 @@ void AddSC_npcs_special() newscript->pGossipHello = &GossipHello_npc_wormhole; newscript->pGossipSelect = &GossipSelect_npc_wormhole; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_pet_trainer"; + newscript->pGossipHello = &GossipHello_npc_pet_trainer; + newscript->pGossipSelect = &GossipSelect_npc_pet_trainer; + newscript->RegisterSelf(); } |