Core / Scripting: Coverted a couple Shattered Halls npc scripts to use events
This commit is contained in:
@@ -66,6 +66,12 @@ enum SetData
|
||||
SETDATA_PEON_DEATH = 2
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
// Fel Orc Convert
|
||||
EVENT_HEMORRHAGE = 1
|
||||
};
|
||||
|
||||
// ########################################################
|
||||
// Grand Warlock Nethekurse
|
||||
// ########################################################
|
||||
@@ -314,13 +320,14 @@ class npc_fel_orc_convert : public CreatureScript
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
me->SetNoCallAssistance(true); //we don't want any assistance (WE R HEROZ!)
|
||||
Hemorrhage_Timer = 3000;
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
events.ScheduleEvent(EVENT_HEMORRHAGE, 3000);
|
||||
|
||||
if (instance)
|
||||
if (Creature* Kurse = Unit::GetCreature(*me, instance->GetData64(NPC_GRAND_WARLOCK_NETHEKURSE)))
|
||||
if (Kurse && me->IsWithinDist(Kurse, 45.0f))
|
||||
@@ -344,18 +351,20 @@ class npc_fel_orc_convert : public CreatureScript
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (Hemorrhage_Timer <= diff)
|
||||
events.Update(diff);
|
||||
|
||||
if (uint32 EVENT_HEMORRHAGE = events.ExecuteEvent())
|
||||
{
|
||||
DoCastVictim(SPELL_HEMORRHAGE);
|
||||
Hemorrhage_Timer = 15000;
|
||||
} else Hemorrhage_Timer -= diff;
|
||||
events.ScheduleEvent(EVENT_HEMORRHAGE, 15000);
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
InstanceScript* instance;
|
||||
uint32 Hemorrhage_Timer;
|
||||
EventMap events;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const OVERRIDE
|
||||
|
||||
+19
-6
@@ -61,6 +61,12 @@ enum SetData
|
||||
SETDATA_YELL = 1
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
// Omrogg Heads
|
||||
EVENT_DEATH_YELL = 1
|
||||
};
|
||||
|
||||
struct Yell
|
||||
{
|
||||
int32 id;
|
||||
@@ -397,11 +403,13 @@ class npc_omrogg_heads : public CreatureScript
|
||||
|
||||
struct npc_omrogg_headsAI : public ScriptedAI
|
||||
{
|
||||
npc_omrogg_headsAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
npc_omrogg_headsAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
}
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
Death_Timer = 4000;
|
||||
DeathYell = false;
|
||||
}
|
||||
|
||||
@@ -410,7 +418,10 @@ class npc_omrogg_heads : public CreatureScript
|
||||
void SetData(uint32 data, uint32 value)
|
||||
{
|
||||
if (data == SETDATA_DATA && value == SETDATA_YELL)
|
||||
{
|
||||
events.ScheduleEvent(EVENT_DEATH_YELL, 4000);
|
||||
DeathYell = true;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) OVERRIDE
|
||||
@@ -418,16 +429,18 @@ class npc_omrogg_heads : public CreatureScript
|
||||
if (!DeathYell)
|
||||
return;
|
||||
|
||||
if (Death_Timer <= diff)
|
||||
events.Update(diff);
|
||||
|
||||
if (uint32 EVENT_DEATH_YELL = events.ExecuteEvent())
|
||||
{
|
||||
Talk(YELL_DIE_R);
|
||||
Death_Timer = false;
|
||||
me->setDeathState(JUST_DIED);
|
||||
} else Death_Timer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 Death_Timer;
|
||||
InstanceScript* instance;
|
||||
EventMap events;
|
||||
bool DeathYell;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user