Core/SAI: Don't require BaseObject when creating conversation from smart scripts

Port From (https://github.com/TrinityCore/TrinityCore/commit/c019d4f10c47612aea49a8b081f367df00ca7c97)
This commit is contained in:
hondacrx
2021-03-08 14:28:45 -05:00
parent 5eea1fec98
commit cdfba27105
+8 -10
View File
@@ -2332,18 +2332,16 @@ namespace Game.AI
case SmartActions.CreateConversation:
{
WorldObject baseObject = GetBaseObject();
if (baseObject != null)
foreach (WorldObject target in targets)
{
foreach (WorldObject target in targets)
Player playerTarget = target.ToPlayer();
if (playerTarget != null)
{
Player playerTarget = target.ToPlayer();
if (playerTarget != null)
{
Conversation conversation = Conversation.CreateConversation(e.Action.conversation.id, playerTarget,
playerTarget, new List<ObjectGuid>() { playerTarget.GetGUID() }, null);
if (!conversation)
Log.outWarn(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CREATE_CONVERSATION: id {e.Action.conversation.id}, baseObject {baseObject.GetName()}, target {playerTarget.GetName()} - failed to create");
}
Conversation conversation = Conversation.CreateConversation(e.Action.conversation.id, playerTarget,
playerTarget, new List<ObjectGuid>() { playerTarget.GetGUID() }, null);
if (!conversation)
Log.outWarn(LogFilter.ScriptsAi, $"SmartScript.ProcessAction: SMART_ACTION_CREATE_CONVERSATION: id {e.Action.conversation.id}, baseObject {baseObject?.GetName()}, target {playerTarget.GetName()} - failed to create");
}
}