aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp9
-rw-r--r--src/server/game/Conditions/ConditionMgr.h3
-rw-r--r--src/server/game/Entities/Conversation/Conversation.cpp4
-rw-r--r--src/server/game/Globals/ConversationDataStore.cpp5
-rw-r--r--src/server/game/Globals/ConversationDataStore.h1
5 files changed, 21 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 88f0336ce4e..9a8abba5482 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -20,6 +20,7 @@
#include "AreaTrigger.h"
#include "AreaTriggerDataStore.h"
#include "Containers.h"
+#include "ConversationDataStore.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "GameEventMgr.h"
@@ -79,6 +80,7 @@ char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX]
"Phase",
"Graveyard",
"AreaTrigger",
+ "ConversationLine"
};
ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[CONDITION_MAX] =
@@ -1915,6 +1917,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) const
return false;
}
break;
+ case CONDITION_SOURCE_TYPE_CONVERSATION_LINE:
+ if (!sConversationDataStore->GetConversationLineTemplate(cond->SourceEntry))
+ {
+ TC_LOG_ERROR("sql.sql", "%s does not exist in `conversation_line_template`, ignoring.", cond->ToString().c_str());
+ return false;
+ }
+ break;
default:
TC_LOG_ERROR("sql.sql", "%s Invalid ConditionSourceType in `condition` table, ignoring.", cond->ToString().c_str());
return false;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 5cfb0cfb3e9..3ce9b8564e2 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -169,7 +169,8 @@ enum ConditionSourceType
CONDITION_SOURCE_TYPE_PHASE = 26,
CONDITION_SOURCE_TYPE_GRAVEYARD = 27,
CONDITION_SOURCE_TYPE_AREATRIGGER = 28,
- CONDITION_SOURCE_TYPE_MAX = 29 // MAX
+ CONDITION_SOURCE_TYPE_CONVERSATION_LINE = 29,
+ CONDITION_SOURCE_TYPE_MAX = 30 // MAX
};
enum RelationType
diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp
index 2d8a0621d31..75d7d2b8ab2 100644
--- a/src/server/game/Entities/Conversation/Conversation.cpp
+++ b/src/server/game/Entities/Conversation/Conversation.cpp
@@ -16,6 +16,7 @@
*/
#include "Conversation.h"
+#include "ConditionMgr.h"
#include "ConversationDataStore.h"
#include "Creature.h"
#include "IteratorPair.h"
@@ -152,6 +153,9 @@ bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry,
std::vector<UF::ConversationLine> lines;
for (ConversationLineTemplate const* line : conversationTemplate->Lines)
{
+ if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_CONVERSATION_LINE, line->Id, creator))
+ continue;
+
actorIndices.insert(line->ActorIdx);
lines.emplace_back();
UF::ConversationLine& lineField = lines.back();
diff --git a/src/server/game/Globals/ConversationDataStore.cpp b/src/server/game/Globals/ConversationDataStore.cpp
index 61bcfc212bf..60b709fe23b 100644
--- a/src/server/game/Globals/ConversationDataStore.cpp
+++ b/src/server/game/Globals/ConversationDataStore.cpp
@@ -184,6 +184,11 @@ ConversationTemplate const* ConversationDataStore::GetConversationTemplate(uint3
return Trinity::Containers::MapGetValuePtr(_conversationTemplateStore, conversationId);
}
+ConversationLineTemplate const* ConversationDataStore::GetConversationLineTemplate(uint32 conversationLineId) const
+{
+ return Trinity::Containers::MapGetValuePtr(_conversationLineTemplateStore, conversationLineId);
+}
+
ConversationDataStore* ConversationDataStore::Instance()
{
static ConversationDataStore instance;
diff --git a/src/server/game/Globals/ConversationDataStore.h b/src/server/game/Globals/ConversationDataStore.h
index 257e76c6a31..41931758dae 100644
--- a/src/server/game/Globals/ConversationDataStore.h
+++ b/src/server/game/Globals/ConversationDataStore.h
@@ -67,6 +67,7 @@ public:
void LoadConversationTemplates();
ConversationTemplate const* GetConversationTemplate(uint32 conversationId) const;
+ ConversationLineTemplate const* GetConversationLineTemplate(uint32 conversationLineId) const;
static ConversationDataStore* Instance();
};