Core/SAI: Implemented SMART_ACTION_INTERRUPT_SPELL action.

Signed-off-by: Manuel Carrasco <manue.l@live.com.ar>
This commit is contained in:
Manuel Carrasco
2011-02-15 00:29:33 -03:00
parent 5241fefe7f
commit ad11baffe6
3 changed files with 24 additions and 1 deletions

View File

@@ -1245,6 +1245,20 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
(*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.delunitByte.byte1);
break;
}
case SMART_ACTION_INTERRUPT_SPELL:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
return;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
{
if (IsUnit((*itr)))
(*itr)->ToUnit()->InterruptNonMeleeSpells(e.action.interruptSpellCasting.withDelayed,e.action.interruptSpellCasting.spell_id,e.action.interruptSpellCasting.withInstant);
}
break;
}
default:
sLog->outErrorDb("SmartScript::ProcessAction: Unhandled Action type %u", e.GetActionType());
break;

View File

@@ -768,6 +768,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_ACTION_RANDOM_MOVE:
case SMART_ACTION_SET_UNIT_FIELD_BYTES_1:
case SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1:
case SMART_ACTION_INTERRUPT_SPELL:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);

View File

@@ -448,7 +448,9 @@ enum SMART_ACTION
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 = 91, // bytes, target
SMART_ACTION_END = 92,
SMART_ACTION_INTERRUPT_SPELL = 92,
SMART_ACTION_END = 93,
};
struct SmartAction
@@ -821,6 +823,12 @@ struct SmartAction
uint32 entry6;
} randTimedActionList;
struct
{
bool withDelayed;
uint32 spell_id;
bool withInstant;
} interruptSpellCasting;
struct
{
uint32 param1;