Core/SAI: Implemented action type SMART_ACTION_DESTROY_CONVERSATION

Port From (https://github.com/TrinityCore/TrinityCore/commit/e9e7059a23618e58e57dc3b24eb218505ca3f746)
This commit is contained in:
Hondacrx
2025-09-03 21:27:53 -04:00
parent f1f6c4055b
commit 9f05b762ad
3 changed files with 46 additions and 2 deletions
@@ -2708,6 +2708,28 @@ namespace Game.AI
}
break;
}
case SmartActions.DestroyConversation:
{
void work(Conversation conversation)
{
if (conversation.GetEntry() != e.Action.destroyConversation.id)
return;
if (conversation.IsPrivateObject())
{
if (e.Action.destroyConversation.isPrivate == 0 || !targets.Any(target => target.GetGUID() == conversation.GetPrivateObjectOwner()))
return;
}
else if (e.Action.destroyConversation.isPrivate != 0)
return;
conversation.Remove();
}
ConversationWorker worker = new(PhasingHandler.GetAlwaysVisiblePhaseShift(), work);
Cell.VisitGridObjects(GetBaseObject(), worker, e.Action.destroyConversation.range);
break;
}
default:
Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType());
break;