Core/SAI: added new action SMART_ACTION_PLAY_ANIMKIT (#19170)

This commit is contained in:
Lopfest
2017-03-11 13:39:38 +01:00
committed by Shauren
parent fd256884d9
commit 61547cab59
3 changed files with 60 additions and 1 deletions

View File

@@ -2433,6 +2433,38 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
ENSURE_AI(SmartAI, me->AI())->SetEvadeDisabled(e.action.disableEvade.disable != 0);
break;
}
case SMART_ACTION_PLAY_ANIMKIT:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsCreature(*itr))
{
if (e.action.animKit.type == 0)
(*itr)->ToCreature()->PlayOneShotAnimKitId(e.action.animKit.animKit);
else if (e.action.animKit.type == 1)
(*itr)->ToCreature()->SetAIAnimKitId(e.action.animKit.animKit);
else if (e.action.animKit.type == 2)
(*itr)->ToCreature()->SetMeleeAnimKitId(e.action.animKit.animKit);
else if (e.action.animKit.type == 3)
(*itr)->ToCreature()->SetMovementAnimKitId(e.action.animKit.animKit);
else
{
TC_LOG_ERROR("sql.sql", "SmartScript: Invalid type for SMART_ACTION_PLAY_ANIMKIT, skipping");
break;
}
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_ANIMKIT: target: %s (%s), AnimKit: %u, Type: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUID().ToString().c_str(), e.action.animKit.animKit, e.action.animKit.type);
}
}
delete targets;
break;
}
default:
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry " SI64FMTD " SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;