From 6d9ce8e8baa100ecc7650d0ae56037c131bab2e0 Mon Sep 17 00:00:00 2001 From: ModoX Date: Tue, 12 Oct 2021 00:16:20 +0200 Subject: Core/PacketIO: Implemented CMSG_CONVERSATION_LINE_STARTED (#27036) * Added OnConversationLineStarted hook to ConversationScripts * Added example for Defender of Azeroth conversation --- src/server/game/Scripting/ScriptMgr.cpp | 9 +++++++++ src/server/game/Scripting/ScriptMgr.h | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'src/server/game/Scripting') diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index a74251922c3..fc7ac25b3da 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -2171,6 +2171,15 @@ void ScriptMgr::OnConversationCreate(Conversation* conversation, Unit* creator) tmpscript->OnConversationCreate(conversation, creator); } +void ScriptMgr::OnConversationLineStarted(Conversation* conversation, uint32 lineId, Player* sender) +{ + ASSERT(conversation); + ASSERT(sender); + + GET_SCRIPT(ConversationScript, conversation->GetScriptId(), tmpscript); + tmpscript->OnConversationLineStarted(conversation, lineId, sender); +} + // Scene void ScriptMgr::OnSceneStart(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate) { diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index bd3e383572c..9b4bd01e2b6 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -828,6 +828,9 @@ class TC_GAME_API ConversationScript : public ScriptObject // Called when Conversation is created but not added to Map yet. virtual void OnConversationCreate(Conversation* /*conversation*/, Unit* /*creator*/) { } + + // Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid + virtual void OnConversationLineStarted(Conversation* /*conversation*/, uint32 /*lineId*/, Player* /*sender*/) { } }; class TC_GAME_API SceneScript : public ScriptObject @@ -1132,6 +1135,7 @@ class TC_GAME_API ScriptMgr public: /* ConversationScript */ void OnConversationCreate(Conversation* conversation, Unit* creator); + void OnConversationLineStarted(Conversation* conversation, uint32 lineId, Player* sender); public: /* SceneScript */ -- cgit v1.2.3