Core/Conditions: Added conversation line source type

Port From (https://github.com/TrinityCore/TrinityCore/commit/03c0f787a1390eb50789f5bda104bbe40dda3c77)
This commit is contained in:
hondacrx
2021-11-03 11:12:40 -04:00
parent e255a0b3e5
commit 46e896cbc6
4 changed files with 16 additions and 0 deletions
@@ -103,6 +103,7 @@ namespace Framework.Constants
Phase = 26,
Graveyard = 27,
AreaTrigger = 28,
ConversationLine = 29,
Max
}
@@ -1104,6 +1104,13 @@ namespace Game
return false;
}
break;
case ConditionSourceType.ConversationLine:
if (Global.ConversationDataStorage.GetConversationLineTemplate((uint)cond.SourceEntry) == null)
{
Log.outError(LogFilter.Sql, $"{cond} does not exist in `conversation_line_template`, ignoring.");
return false;
}
break;
default:
Log.outError(LogFilter.Sql, $"{cond.ToString()} Invalid ConditionSourceType in `condition` table, ignoring.");
return false;
@@ -192,6 +192,11 @@ namespace Game.DataStorage
return _conversationTemplateStorage.LookupByKey(conversationId);
}
public ConversationLineTemplate GetConversationLineTemplate(uint conversationLineId)
{
return _conversationLineTemplateStorage.LookupByKey(conversationLineId);
}
Dictionary<uint, ConversationTemplate> _conversationTemplateStorage = new();
Dictionary<uint, ConversationLineTemplate> _conversationLineTemplateStorage = new();
}
+3
View File
@@ -164,6 +164,9 @@ namespace Game.Entities
List<ConversationLine> lines = new();
foreach (ConversationLineTemplate line in conversationTemplate.Lines)
{
if (!Global.ConditionMgr.IsObjectMeetingNotGroupedConditions(ConditionSourceType.ConversationLine, line.Id, creator))
continue;
actorIndices.Add(line.ActorIdx);
ConversationLine lineField = new();