diff options
| author | ModoX <moardox@gmail.com> | 2021-10-12 00:16:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-12 00:16:20 +0200 |
| commit | 6d9ce8e8baa100ecc7650d0ae56037c131bab2e0 (patch) | |
| tree | 911d162cb936f3e7bc7c79dfe79b7f6002aee8a7 /src/server/scripts/World | |
| parent | 9b036b8fe0c443acd882de9faf615abe89dad691 (diff) | |
Core/PacketIO: Implemented CMSG_CONVERSATION_LINE_STARTED (#27036)
* Added OnConversationLineStarted hook to ConversationScripts
* Added example for Defender of Azeroth conversation
Diffstat (limited to 'src/server/scripts/World')
| -rw-r--r-- | src/server/scripts/World/conversation_scripts.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/server/scripts/World/conversation_scripts.cpp b/src/server/scripts/World/conversation_scripts.cpp index 9d237f0502f..6d5de609e63 100644 --- a/src/server/scripts/World/conversation_scripts.cpp +++ b/src/server/scripts/World/conversation_scripts.cpp @@ -15,6 +15,41 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "ScriptMgr.h" +#include "Conversation.h" +#include "ObjectAccessor.h" +#include "Player.h" + +class conversation_allied_race_dk_defender_of_azeroth : public ConversationScript +{ +public: + enum DefenderOfAzerothIds : uint32 + { + NPC_TALK_TO_YOUR_COMMANDER_CREDIT = 161709, + NPC_LISTEN_TO_YOUR_COMMANDER_CREDIT = 163027, + + CONVERSATION_LINE_PLAYER = 32926 + }; + + conversation_allied_race_dk_defender_of_azeroth() : ConversationScript("conversation_allied_race_dk_defender_of_azeroth") { } + + void OnConversationCreate(Conversation* conversation, Unit* creator) override + { + conversation->AddActor(ObjectGuid::Create<HighGuid::Player>(0xFFFFFFFFFFFFFFFF), 1); + if (Player* player = creator->ToPlayer()) + player->KilledMonsterCredit(NPC_TALK_TO_YOUR_COMMANDER_CREDIT); + } + + void OnConversationLineStarted(Conversation* /*conversation*/, uint32 lineId, Player* sender) override + { + if (lineId != CONVERSATION_LINE_PLAYER) + return; + + sender->KilledMonsterCredit(NPC_LISTEN_TO_YOUR_COMMANDER_CREDIT); + } +}; + void AddSC_conversation_scripts() { + new conversation_allied_race_dk_defender_of_azeroth(); } |
