From cdfba27105c6005a1050b9660ac5cb662c281597 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 8 Mar 2021 14:28:45 -0500 Subject: [PATCH] Core/SAI: Don't require BaseObject when creating conversation from smart scripts Port From (https://github.com/TrinityCore/TrinityCore/commit/c019d4f10c47612aea49a8b081f367df00ca7c97) --- Source/Game/AI/SmartScripts/SmartScript.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 7f55df0d5..a326f41b3 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -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() { 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() { 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"); } }