aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/wotlk_classic/2024_01_10_00_world_2024_01_09_04_world.sql1
-rw-r--r--src/server/game/Entities/Conversation/Conversation.cpp14
-rw-r--r--src/server/game/Globals/ConversationDataStore.cpp5
-rw-r--r--src/server/game/Globals/ConversationDataStore.h12
4 files changed, 25 insertions, 7 deletions
diff --git a/sql/updates/world/wotlk_classic/2024_01_10_00_world_2024_01_09_04_world.sql b/sql/updates/world/wotlk_classic/2024_01_10_00_world_2024_01_09_04_world.sql
new file mode 100644
index 00000000000..bab5177967b
--- /dev/null
+++ b/sql/updates/world/wotlk_classic/2024_01_10_00_world_2024_01_09_04_world.sql
@@ -0,0 +1 @@
+ALTER TABLE `conversation_template` ADD COLUMN `Flags` tinyint NOT NULL DEFAULT 0 AFTER `TextureKitId`;
diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp
index 03ba8b2ab4a..c6c74a483d1 100644
--- a/src/server/game/Entities/Conversation/Conversation.cpp
+++ b/src/server/game/Entities/Conversation/Conversation.cpp
@@ -217,13 +217,17 @@ void Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry,
bool Conversation::Start()
{
- for (UF::ConversationLine const& line : *m_conversationData->Lines)
+ ConversationTemplate const* conversationTemplate = sConversationDataStore->GetConversationTemplate(GetEntry()); // never null, already checked in ::Create / ::CreateConversation
+ if (!conversationTemplate->Flags.HasFlag(ConversationFlags::AllowWithoutSpawnedActor))
{
- UF::ConversationActor const* actor = line.ActorIndex < m_conversationData->Actors.size() ? &m_conversationData->Actors[line.ActorIndex] : nullptr;
- if (!actor || (!actor->CreatureID && actor->ActorGUID.IsEmpty()))
+ for (UF::ConversationLine const& line : *m_conversationData->Lines)
{
- TC_LOG_ERROR("entities.conversation", "Failed to create conversation (Id: {}) due to missing actor (Idx: {}).", GetEntry(), line.ActorIndex);
- return false;
+ UF::ConversationActor const* actor = line.ActorIndex < m_conversationData->Actors.size() ? &m_conversationData->Actors[line.ActorIndex] : nullptr;
+ if (!actor || (!actor->CreatureID && actor->ActorGUID.IsEmpty()))
+ {
+ TC_LOG_ERROR("entities.conversation", "Failed to create conversation (Id: {}) due to missing actor (Idx: {}).", GetEntry(), line.ActorIndex);
+ return false;
+ }
}
}
diff --git a/src/server/game/Globals/ConversationDataStore.cpp b/src/server/game/Globals/ConversationDataStore.cpp
index f133f97eddd..4a96244cf39 100644
--- a/src/server/game/Globals/ConversationDataStore.cpp
+++ b/src/server/game/Globals/ConversationDataStore.cpp
@@ -212,7 +212,7 @@ void ConversationDataStore::LoadConversationTemplates()
return lineId;
};
- if (QueryResult templates = WorldDatabase.Query("SELECT Id, FirstLineId, TextureKitId, ScriptName FROM conversation_template"))
+ if (QueryResult templates = WorldDatabase.Query("SELECT Id, FirstLineId, TextureKitId, Flags, ScriptName FROM conversation_template"))
{
uint32 oldMSTime = getMSTime();
@@ -224,7 +224,8 @@ void ConversationDataStore::LoadConversationTemplates()
conversationTemplate.Id = fields[0].GetUInt32();
conversationTemplate.FirstLineId = fields[1].GetUInt32();
conversationTemplate.TextureKitId = fields[2].GetUInt32();
- conversationTemplate.ScriptId = sObjectMgr->GetScriptId(fields[3].GetString());
+ conversationTemplate.Flags = (ConversationFlags)fields[3].GetUInt8();
+ conversationTemplate.ScriptId = sObjectMgr->GetScriptId(fields[4].GetString());
conversationTemplate.Actors = std::move(actorsByConversation[conversationTemplate.Id]);
diff --git a/src/server/game/Globals/ConversationDataStore.h b/src/server/game/Globals/ConversationDataStore.h
index ed8bec144f3..228e8be1e5b 100644
--- a/src/server/game/Globals/ConversationDataStore.h
+++ b/src/server/game/Globals/ConversationDataStore.h
@@ -19,6 +19,7 @@
#define ConversationDataStore_h__
#include "Define.h"
+#include "EnumFlag.h"
#include "ObjectGuid.h"
#include <variant>
#include <vector>
@@ -74,11 +75,22 @@ struct ConversationLineTemplate
uint8 ChatType;
};
+enum class ConversationFlags : uint8
+{
+ None = 0x00,
+ MultipleConversationType = 0x01, // NYI purpose unknown
+ IsTalkingHeadConversation = 0x02, // implicitly implemented when conversation_actors.ActivePlayerObject == 0 && conversation_actors.NoActorObject == 0 && conversation_actors.ConversationActorGuid == 0
+ AllowWithoutSpawnedActor = 0x04,
+};
+
+DEFINE_ENUM_FLAG(ConversationFlags);
+
struct ConversationTemplate
{
uint32 Id;
uint32 FirstLineId; // Link to ConversationLine.db2
uint32 TextureKitId; // Background texture
+ EnumFlag<ConversationFlags> Flags = ConversationFlags::None;
std::vector<ConversationActorTemplate> Actors;
std::vector<ConversationLineTemplate const*> Lines;