fix(Core/Util): EventMap::RepeatEvent when eventId is retrieved by ExecuteEvent() call (#3426)

This commit is contained in:
Andrius Peleckas
2020-10-17 15:59:22 +03:00
committed by GitHub
parent 32da0eeb9e
commit ab5933effa
131 changed files with 558 additions and 1012 deletions

View File

@@ -97,14 +97,13 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_CHECK_HEALTH:
if (HealthBelowPct(25))
{
Talk(SAY_SUMMON);
me->CastSpell(me, SPELL_SUMMON_AVATAR, false);
events.PopEvent();
return;
}
events.RepeatEvent(2000);
@@ -190,7 +189,7 @@ public:
return;
events.Update(diff);
if (events.GetEvent() == EVENT_STOLEN_SOUL_SPELL)
if (events.ExecuteEvent() == EVENT_STOLEN_SOUL_SPELL)
{
switch (myClass)
{

View File

@@ -98,7 +98,7 @@ public:
void UpdateAI(uint32 diff)
{
events.Update(diff);
uint32 eventId = events.GetEvent();
uint32 eventId = events.ExecuteEvent();
if (eventId == EVENT_SPELL_INHIBIT_MAGIC)
{
@@ -157,11 +157,9 @@ public:
case EVENT_SPELL_FOCUS_FIRE_2:
if (Unit* flare = ObjectAccessor::GetCreature(*me, focusGUID))
me->CastSpell(flare, SPELL_FOCUS_CAST, true);
events.PopEvent();
break;
case EVENT_SPELL_FOCUS_FIRE_3:
me->SetControlled(false, UNIT_STATE_ROOT);
events.PopEvent();
break;
}

View File

@@ -125,7 +125,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_FROST_NOVA:
me->CastSpell(me, SPELL_FROSTNOVA, false);
@@ -139,7 +139,6 @@ public:
break;
case EVENT_SPELL_BLINK:
me->CastSpell(me, SPELL_BLINK, false);
events.PopEvent();
events.RescheduleEvent(EVENT_SPELL_FR_FI, 0);
break;
case EVENT_SPELL_BEACON:

View File

@@ -81,7 +81,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_VOID_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))

View File

@@ -105,7 +105,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_ARCANE_VOLLEY:
me->CastSpell(me, SPELL_ARCANE_VOLLEY_N, false);
@@ -124,7 +124,6 @@ public:
if (me->HealthBelowPct(20))
{
me->CastSpell(me, SPELL_MANA_SHIELD, false);
events.PopEvent();
return;
}
events.RepeatEvent(1000);
@@ -145,7 +144,6 @@ public:
case EVENT_SPELL_BLINK_2:
me->CastSpell(me, SPELL_ARCANE_EXPLOSION_N, false);
me->CastSpell(me, SPELL_ARCANE_BUBBLE, true);
events.PopEvent();
break;
}
@@ -271,7 +269,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_SCREECH:
me->CastSpell(me, SPELL_PARALYZING_SCREECH, false);
@@ -294,7 +292,6 @@ public:
if (me->HealthBelowPct(66))
{
SummonBroods();
events.PopEvent();
events.DelayEvents(10000);
return;
}
@@ -304,7 +301,6 @@ public:
if (me->HealthBelowPct(33))
{
SummonBroods();
events.PopEvent();
events.DelayEvents(10000);
return;
}

View File

@@ -133,7 +133,7 @@ public:
}
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_CORROSIVE:
me->CastSpell(me->GetVictim(), SPELL_CORROSIVE_ACID, false);
@@ -145,7 +145,6 @@ public:
break;
case EVENT_SPELL_ENRAGE:
me->CastSpell(me->GetVictim(), SPELL_ENRAGE, false);
events.PopEvent();
break;
}

View File

@@ -94,11 +94,10 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_INCITE_WAIT:
InciteChaos = false;
events.PopEvent();
break;
case EVENT_SPELL_INCITE:
{

View File

@@ -155,7 +155,7 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_SHADOWBOLT:
me->CastSpell(me, SPELL_SHADOWBOLT_VOLLEY, false);

View File

@@ -91,7 +91,7 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_SONIC_BOOM:
Talk(EMOTE_SONIC_BOOM);
@@ -102,7 +102,6 @@ public:
return;
case EVENT_SPELL_SONIC_BOOM_EFFECT:
me->CastSpell(me, DUNGEON_MODE(SPELL_SONIC_BOOM_EFFECT_N, SPELL_SONIC_BOOM_EFFECT_H), true);
events.PopEvent();
break;
case EVENT_SPELL_MURMURS_TOUCH:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true))

View File

@@ -128,20 +128,18 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch(events.GetEvent())
switch(events.ExecuteEvent())
{
case 0:
break;
case EVENT_EMERGE:
me->SetVisible(true);
me->CastSpell(me, SPELL_EMERGE_0, false);
events.PopEvent();
events.RescheduleEvent(EVENT_ATTACK, 2000);
break;
case EVENT_SUMMON_TOTEMS:
for (uint8 i = 0; i < 3; ++i)
DoSummon(NPC_TOTEM, TotemPos[i], 10 * 60 * 1000, TEMPSUMMON_TIMED_DESPAWN);
events.PopEvent();
break;
case EVENT_INVOKER_SAY_1:
if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
@@ -149,19 +147,16 @@ public:
plr->MonsterSay("The Ice Stone has melted!", LANG_UNIVERSAL, 0);
plr->CastSpell(plr, SPELL_MAKE_BONFIRE, true);
}
events.PopEvent();
events.RescheduleEvent(EVENT_INVOKER_SAY_2, 2000);
break;
case EVENT_INVOKER_SAY_2:
if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
plr->MonsterSay("Ahune, your strength grows no more!", LANG_UNIVERSAL, 0);
events.PopEvent();
events.RescheduleEvent(EVENT_INVOKER_SAY_3, 2000);
break;
case EVENT_INVOKER_SAY_3:
if (Player* plr = ObjectAccessor::GetPlayer(*me, InvokerGUID))
plr->MonsterSay("Your frozen reign will not come to pass!", LANG_UNIVERSAL, 0);
events.PopEvent();
break;
case EVENT_ATTACK:
events.Reset();
@@ -180,7 +175,6 @@ public:
for (uint8 i = 0; i < 3; ++i)
if (Creature* bunny = me->FindNearestCreature(NPC_TOTEM_BUNNY_1 + i, 150.0f, true))
bunny->CastSpell(me, SPELL_TOTEM_BEAM, false);
events.PopEvent();
events.RescheduleEvent(EVENT_SUBMERGE, 10000);
break;
case EVENT_SUBMERGE:
@@ -198,7 +192,6 @@ public:
break;
case EVENT_EMERGE_WARNING:
me->MonsterTextEmote(TEXT_RESURFACE, 0, true);
events.PopEvent();
break;
case EVENT_COMBAT_EMERGE:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -206,7 +199,6 @@ public:
me->CastSpell(me, SPELL_EMERGE_0, false);
// me->CastSpell(me, SPELL_AHUNE_RESURFACES, true); // done in SummonedCreatureDespawn
me->RemoveAura(SPELL_SUBMERGE_0);
events.PopEvent();
StartPhase1();
break;
@@ -246,7 +238,6 @@ public:
break;
default:
events.PopEvent();
break;
}

View File

@@ -79,7 +79,7 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_LIGHTNING:
for (uint8 i = 0; i < DUNGEON_MODE(1, 2); ++i)

View File

@@ -106,7 +106,7 @@ public:
return;
events.Update(diff);
switch (uint32 eventId = events.GetEvent())
switch (uint32 eventId = events.ExecuteEvent())
{
case EVENT_SPELL_SHRINK:
me->CastSpell(me->GetVictim(), SPELL_SUPER_SHRINK_RAY, false);
@@ -130,7 +130,6 @@ public:
if (me->HealthBelowPct(eventId * 25))
{
SummonMechanics();
events.PopEvent();
return;
}
events.RepeatEvent(2000);

View File

@@ -85,7 +85,7 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_REFLECTION:
me->CastSpell(me, SPELL_SPELL_REFLECTION, false);

View File

@@ -101,7 +101,7 @@ public:
return;
events.Update(diff);
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_CHECK:
float x, y, z, o;
@@ -149,7 +149,6 @@ public:
events.ScheduleEvent(EVENT_LEVITATE_TARGET_2, 1500);
}
}
events.PopEvent();
break;
case EVENT_LEVITATE_TARGET_2:
if (Unit* target = ObjectAccessor::GetUnit(*me, lTarget))
@@ -162,7 +161,6 @@ public:
lTarget = 0;
}
}
events.PopEvent();
break;
}

View File

@@ -75,7 +75,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_SLIME:
me->CastSpell(me->GetVictim(), SPELL_SLIME_SPRAY, false);

View File

@@ -223,7 +223,6 @@ public:
CheckChannelers();
if (!me->HasUnitState(UNIT_STATE_CASTING))
me->CastSpell(me, SPELL_EVOCATION, false);
}
return;
}
@@ -232,7 +231,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_VOLLEY:
me->CastSpell(me, SPELL_SHADOW_BOLT_VOLLEY, false);
@@ -258,7 +257,6 @@ public:
break;
case EVENT_SPELL_FIRE_NOVA:
me->CastSpell(me, SPELL_FIRE_NOVA, true);
events.PopEvent();
break;
}
@@ -321,7 +319,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_SHADOW_BOLT:
me->CastSpell(me->GetVictim(), IsHeroic() ? SPELL_SHADOW_BOLT_H : SPELL_SHADOW_BOLT, false);

View File

@@ -94,7 +94,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.GetEvent())
switch (events.ExecuteEvent())
{
case EVENT_SPELL_ACID:
me->CastSpell(me->GetVictim(), SPELL_ACID_SPRAY, false);