mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Conditions: Added conversation line source type (#27167)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
void LoadConversationTemplates();
|
||||
|
||||
ConversationTemplate const* GetConversationTemplate(uint32 conversationId) const;
|
||||
ConversationLineTemplate const* GetConversationLineTemplate(uint32 conversationLineId) const;
|
||||
|
||||
static ConversationDataStore* Instance();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user