aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Conversation/Conversation.cpp3
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp24
-rw-r--r--src/server/game/Scripting/ScriptMgr.h8
3 files changed, 35 insertions, 0 deletions
diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp
index 2eb4f466eba..e3edba75986 100644
--- a/src/server/game/Entities/Conversation/Conversation.cpp
+++ b/src/server/game/Entities/Conversation/Conversation.cpp
@@ -64,6 +64,8 @@ void Conversation::RemoveFromWorld()
void Conversation::Update(uint32 diff)
{
+ sScriptMgr->OnConversationUpdate(this, diff);
+
if (GetDuration() > Milliseconds(diff))
{
_duration -= Milliseconds(diff);
@@ -239,6 +241,7 @@ bool Conversation::Start()
if (!GetMap()->AddToMap(this))
return false;
+ sScriptMgr->OnConversationStart(this);
return true;
}
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 78bd542fc1f..ea370b4efb4 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -2259,6 +2259,14 @@ void ScriptMgr::OnConversationCreate(Conversation* conversation, Unit* creator)
tmpscript->OnConversationCreate(conversation, creator);
}
+void ScriptMgr::OnConversationStart(Conversation* conversation)
+{
+ ASSERT(conversation);
+
+ GET_SCRIPT(ConversationScript, conversation->GetScriptId(), tmpscript);
+ tmpscript->OnConversationStart(conversation);
+}
+
void ScriptMgr::OnConversationLineStarted(Conversation* conversation, uint32 lineId, Player* sender)
{
ASSERT(conversation);
@@ -2268,6 +2276,14 @@ void ScriptMgr::OnConversationLineStarted(Conversation* conversation, uint32 lin
tmpscript->OnConversationLineStarted(conversation, lineId, sender);
}
+void ScriptMgr::OnConversationUpdate(Conversation* conversation, uint32 diff)
+{
+ ASSERT(conversation);
+
+ GET_SCRIPT(ConversationScript, conversation->GetScriptId(), tmpscript);
+ tmpscript->OnConversationUpdate(conversation, diff);
+}
+
// Scene
void ScriptMgr::OnSceneStart(Player* player, uint32 sceneInstanceID, SceneTemplate const* sceneTemplate)
{
@@ -3125,10 +3141,18 @@ void ConversationScript::OnConversationCreate(Conversation* /*conversation*/, Un
{
}
+void ConversationScript::OnConversationStart(Conversation* /*conversation*/ )
+{
+}
+
void ConversationScript::OnConversationLineStarted(Conversation* /*conversation*/, uint32 /*lineId*/, Player* /*sender*/)
{
}
+void ConversationScript::OnConversationUpdate(Conversation* /*conversation*/, uint32 /*diff*/)
+{
+}
+
SceneScript::SceneScript(char const* name)
: ScriptObject(name)
{
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 91d1b3902e8..631b5320cd6 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -923,8 +923,14 @@ 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 Conversation is started
+ virtual void OnConversationStart(Conversation* conversation);
+
// Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid
virtual void OnConversationLineStarted(Conversation* conversation, uint32 lineId, Player* sender);
+
+ // Called for each update tick
+ virtual void OnConversationUpdate(Conversation* conversation, uint32 diff);
};
class TC_GAME_API SceneScript : public ScriptObject
@@ -1269,7 +1275,9 @@ class TC_GAME_API ScriptMgr
public: /* ConversationScript */
void OnConversationCreate(Conversation* conversation, Unit* creator);
+ void OnConversationStart(Conversation* conversation);
void OnConversationLineStarted(Conversation* conversation, uint32 lineId, Player* sender);
+ void OnConversationUpdate(Conversation* conversation, uint32 diff);
public: /* SceneScript */