aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.h
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-12-28 23:25:10 +0100
committerOvahlord <dreadkiller@gmx.de>2024-12-29 12:16:46 +0100
commit1f81c961f24337abdc8de25bd23d9834d0c7392b (patch)
tree46b4699d0b3ffbc4b197913064659abd978d1ed3 /src/server/game/Scripting/ScriptMgr.h
parent9b49b9009d010b56b0289e8122bedceb172e4948 (diff)
Core/AI: Implemented conversation ai (#30538)
(cherry picked from commit 309ba22a15e5e0b4321b99f7157ccb18e0adc8dd) # Conflicts: # src/server/scripts/BrokenIsles/zone_mardum.cpp # src/server/scripts/DragonIsles/AberrusTheShadowedCrucible/aberrus_the_shadowed_crucible.cpp # src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp # src/server/scripts/KulTiras/WaycrestManor/waycrest_manor.cpp # src/server/scripts/KulTiras/zone_boralus.cpp # src/server/scripts/Shadowlands/SanctumOfDomination/boss_sylvanas_windrunner.cpp # src/server/scripts/Shadowlands/SepulcherOfTheFirstOnes/boss_anduin_wrynn.cpp # src/server/scripts/Zandalar/KingsRest/kings_rest.cpp
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.h')
-rw-r--r--src/server/game/Scripting/ScriptMgr.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 31a5842a383..d7746b01e04 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -38,6 +38,7 @@ class BattlegroundMap;
class BattlegroundScript;
class Channel;
class Conversation;
+class ConversationAI;
class Creature;
class CreatureAI;
class DynamicObject;
@@ -911,17 +912,8 @@ class TC_GAME_API ConversationScript : public ScriptObject
~ConversationScript();
- // 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);
+ // Called when a ConversationAI object is needed for the conversation.
+ virtual ConversationAI* GetAI(Conversation* conversation) const;
};
class TC_GAME_API SceneScript : public ScriptObject
@@ -1279,10 +1271,8 @@ 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);
+ bool CanCreateConversationAI(uint32 scriptId) const;
+ ConversationAI* GetConversationAI(Conversation* conversation);
public: /* SceneScript */
@@ -1405,6 +1395,15 @@ class GenericAreaTriggerEntityScript : public AreaTriggerEntityScript
};
#define RegisterAreaTriggerAI(ai_name) new GenericAreaTriggerEntityScript<ai_name>(#ai_name)
+template <class AI>
+class GenericConversationScript : public ConversationScript
+{
+public:
+ GenericConversationScript(char const* name) : ConversationScript(name) {}
+ ConversationAI* GetAI(Conversation* conversation) const override { return new AI(conversation); }
+};
+#define RegisterConversationAI(ai_name) new GenericConversationScript<ai_name>(#ai_name)
+
template<class Script>
class GenericBattlegroundMapScript : public BattlegroundMapScript
{