From e1b85a66e99cac193c5d756a4cb843b1b1c526b5 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 31 May 2022 20:05:07 -0400 Subject: [PATCH] Core/SAI: Support gameobject targets for SMART_ACTION_PLAY_ANIMKIT Port From (https://github.com/TrinityCore/TrinityCore/commit/b8246d1ba76cabcd034b60b806505f1a5a87465f) --- Source/Game/AI/SmartScripts/SmartScript.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 9e99c2843..6c8c3292f 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -2231,14 +2231,24 @@ namespace Game.AI target.ToCreature().SetMeleeAnimKitId((ushort)e.Action.animKit.animKit); else if (e.Action.animKit.type == 3) target.ToCreature().SetMovementAnimKitId((ushort)e.Action.animKit.animKit); - else + + Log.outDebug(LogFilter.ScriptsAi, $"SmartScript::ProcessAction:: SMART_ACTION_PLAY_ANIMKIT: target: {target.GetName()} ({target.GetGUID()}), AnimKit: {e.Action.animKit.animKit}, Type: {e.Action.animKit.type}"); + } + else if(IsGameObject(target)) + { + switch (e.Action.animKit.type) { - Log.outError(LogFilter.Sql, "SmartScript: Invalid type for SMART_ACTION_PLAY_ANIMKIT, skipping"); - break; + case 0: + target.ToGameObject().SetAnimKitId((ushort)e.Action.animKit.animKit, true); + break; + case 1: + target.ToGameObject().SetAnimKitId((ushort)e.Action.animKit.animKit, false); + break; + default: + break; } - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction:: SMART_ACTION_PLAY_ANIMKIT: target: {0} ({1}), AnimKit: {2}, Type: {3}", - target.GetName(), target.GetGUID().ToString(), e.Action.animKit.animKit, e.Action.animKit.type); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction:: SMART_ACTION_PLAY_ANIMKIT: target: {0} ({1}), AnimKit: {2}, Type: {3}", target.GetName(), target.GetGUID().ToString(), e.Action.animKit.animKit, e.Action.animKit.type); } } break;