Core/SmartAI: all actions regarding to TIMED_ACTIONLIST will now use targeting:

you can now 'send' a list of timed actions to any targeted creature if it has SmartAI

NOTE: already made script with timed actions should be remade to use self as target

--HG--
branch : trunk
This commit is contained in:
Rat
2010-12-07 18:31:34 +01:00
parent 703835ee94
commit bb09a4a50f
4 changed files with 47 additions and 5 deletions

View File

@@ -1063,7 +1063,18 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CALL_TIMED_ACTIONLIST:
{
SetScript9(e, e.action.timedActionList.id);
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
{
if (Creature* target = (*itr)->ToCreature())
{
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id);
}
}
}
break;
}
case SMART_ACTION_SET_NPC_FLAG:
@@ -1135,12 +1146,36 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
count++;
}
}
SetScript9(e, temp[urand(0, count)]);
uint32 id = temp[urand(0, count)];
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
{
if (Creature* target = (*itr)->ToCreature())
{
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
}
}
}
break;
}
case SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST:
{
SetScript9(e, urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2));
uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
for (ObjectList::iterator itr = targets->begin(); itr != targets->end(); itr++)
{
if (Creature* target = (*itr)->ToCreature())
{
if (IsSmart(target))
CAST_AI(SmartAI, target->AI())->SetScript9(e, id);
}
}
}
break;
}
case SMART_ACTION_ACTIVATE_TAXI: