Core/Scripts: Added ExecuteEvent BossAI hook designed to contain event code which would otherwise be in while (uint32 eventId = events.ExecuteEvent()) switch blocks. This allows to define a base class sharing spells with other scripts

This commit is contained in:
Shauren
2011-05-25 18:50:44 +02:00
parent 5f5af1e95d
commit c8f71c00a1
2 changed files with 24 additions and 2 deletions

View File

@@ -624,6 +624,22 @@ void BossAI::SummonedCreatureDespawn(Creature* summon)
summons.Despawn(summon);
}
void BossAI::UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STAT_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
ExecuteEvent(eventId);
DoMeleeAttackIfReady();
}
// SD2 grid searchers.
Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive /*= true*/)
{