Core/SAI: Added Action SMART_ACTION_DO_ACTION for calling DoAction on target AI
Port From (https://github.com/TrinityCore/TrinityCore/commit/a4eafbd3f6a4d4ea4934dca564cd6c4beae54280)
This commit is contained in:
@@ -2480,6 +2480,23 @@ namespace Game.AI
|
||||
|
||||
break;
|
||||
}
|
||||
case SmartActions.DoAction:
|
||||
{
|
||||
foreach (WorldObject target in targets)
|
||||
{
|
||||
Unit unitTarget = target?.ToUnit();
|
||||
if (unitTarget != null)
|
||||
unitTarget.GetAI()?.DoAction((int)e.Action.doAction.actionId);
|
||||
else
|
||||
{
|
||||
GameObject goTarget = target?.ToGameObject();
|
||||
if (goTarget != null)
|
||||
goTarget.GetAI()?.DoAction((int)e.Action.doAction.actionId);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user