Core/SAI: Implement SMART_ACTION_SET_RANGED_MOVEMENT (79) and SMART_ACTION_SET_STAND_STATE (101). Updated wiki accordingly. These were required in order to properly be able to convert EventAI to SmartAI.

This commit is contained in:
Discover-
2012-05-29 12:19:46 +02:00
parent e83f913fc5
commit 013fe44b92
3 changed files with 42 additions and 3 deletions

View File

@@ -1534,6 +1534,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
case SMART_ACTION_CALL_SCRIPT_RESET:
OnReset();
break;
case SMART_ACTION_SET_RANGED_MOVEMENT:
{
float attackDistance = (float)e.action.setRangedMovement.distance;
float attackAngle = e.action.setRangedMovement.angle / 180.0f * M_PI;
if (CAST_AI(SmartAI, me->AI())->CanCombatMove())
me->GetMotionMaster()->MoveChase(me->getVictim(), attackDistance, attackAngle);
break;
}
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
if (e.GetTargetType() == SMART_TARGET_NONE)
@@ -1924,6 +1933,24 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
case SMART_ACTION_SET_STAND_STATE:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsUnit(*itr))
{
(*itr)->ToUnit()->SetStandState(e.action.setStandState.standState);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set standstate to %u", (*itr)->GetGUIDLow(), e.action.emote.emote);
}
}
delete targets;
break;
}
default:
sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;