aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-06-29 18:36:11 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-13 00:42:18 +0100
commit70fd6e7398040dc197c3470c6db8aa82f4e42ab1 (patch)
treedf41e2f2f5307eacb1921b7de200608c736e628d
parentcadbf42ea4489933f28caf356f8c8d09ca243083 (diff)
Core/Instances: improve DoRemoveAurasDueToSpellOnPlayers & DoCastSpellOnPlayers handling
(cherry picked from commit 22b3b21ae3e60c1f38b8e3bf1d7cd50ee5efca21)
-rw-r--r--src/server/game/Instances/InstanceScript.cpp69
-rw-r--r--src/server/game/Instances/InstanceScript.h4
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp4
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp2
10 files changed, 69 insertions, 31 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 00f8387e0ac..0d8b75ddbf9 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -648,33 +648,70 @@ void InstanceScript::DoStopCriteriaTimer(CriteriaStartEvent startEvent, uint32 e
player->RemoveCriteriaTimer(startEvent, entry);
}
-// Remove Auras due to Spell on all players in instance
-void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
+void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
{
- Map::PlayerList const& PlayerList = instance->GetPlayers();
- if (!PlayerList.isEmpty())
+ Map::PlayerList const& playerList = instance->GetPlayers();
+ for (auto itr = playerList.begin(); itr != playerList.end(); ++itr)
{
- for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
+ if (Player* player = itr->GetSource())
{
- if (Player* player = itr->GetSource())
+ player->RemoveAurasDueToSpell(spell);
+
+ if (!includePets)
+ continue;
+
+ for (uint8 itr2 = 0; itr2 < MAX_SUMMON_SLOT; ++itr2)
{
- player->RemoveAurasDueToSpell(spell);
- if (Pet* pet = player->GetPet())
- pet->RemoveAurasDueToSpell(spell);
+ ObjectGuid summonGUID = player->m_SummonSlot[itr2];
+ if (!summonGUID.IsEmpty())
+ if (Creature* summon = instance->GetCreature(summonGUID))
+ summon->RemoveAurasDueToSpell(spell);
+ }
+
+ if (!includeControlled)
+ continue;
+
+ for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
+ {
+ if (Unit* controlled = *itr2)
+ if (controlled->IsInWorld() && controlled->GetTypeId() == TYPEID_UNIT)
+ controlled->RemoveAurasDueToSpell(spell);
}
}
}
}
-// Cast spell on all players in instance
-void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
+void InstanceScript::DoCastSpellOnPlayers(uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
{
- Map::PlayerList const& PlayerList = instance->GetPlayers();
+ Map::PlayerList const& playerList = instance->GetPlayers();
+ for (auto itr = playerList.begin(); itr != playerList.end(); ++itr)
+ {
+ if (Player* player = itr->GetSource())
+ {
+ player->CastSpell(player, spell, true);
- if (!PlayerList.isEmpty())
- for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
- if (Player* player = i->GetSource())
- player->CastSpell(player, spell, true);
+ if (!includePets)
+ continue;
+
+ for (uint8 itr2 = 0; itr2 < MAX_SUMMON_SLOT; ++itr2)
+ {
+ ObjectGuid summonGUID = player->m_SummonSlot[itr2];
+ if (!summonGUID.IsEmpty())
+ if (Creature* summon = instance->GetCreature(summonGUID))
+ summon->CastSpell(player, spell, true);
+ }
+
+ if (!includeControlled)
+ continue;
+
+ for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
+ {
+ if (Unit* controlled = *itr2)
+ if (controlled->IsInWorld() && controlled->GetTypeId() == TYPEID_UNIT)
+ controlled->CastSpell(player, spell, true);
+ }
+ }
+ }
}
bool InstanceScript::ServerAllowsTwoSideGroups()
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 532d81c3915..e845a56bd94 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -227,10 +227,10 @@ class TC_GAME_API InstanceScript : public ZoneScript
void DoStopCriteriaTimer(CriteriaStartEvent startEvent, uint32 entry);
// Remove Auras due to Spell on all players in instance
- void DoRemoveAurasDueToSpellOnPlayers(uint32 spell);
+ void DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool includePets = false, bool includeControlled = false);
// Cast spell on all players in instance
- void DoCastSpellOnPlayers(uint32 spell);
+ void DoCastSpellOnPlayers(uint32 spell, bool includePets = false, bool includeControlled = false);
// Return wether server allow two side groups or not
static bool ServerAllowsTwoSideGroups();
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
index e3cee3b8a85..592adc1d322 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp
@@ -213,7 +213,7 @@ public:
{
SetData(DATA_EGG_EVENT, DONE);
razor->RemoveAurasDueToSpell(42013); // MindControl
- DoRemoveAurasDueToSpellOnPlayers(42013);
+ DoRemoveAurasDueToSpellOnPlayers(42013, true, true);
}
_events.ScheduleEvent(EVENT_RAZOR_PHASE_TWO, 1s);
_events.CancelEvent(EVENT_RAZOR_SPAWN);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index a1fffb46b93..af4726e3b87 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -166,7 +166,7 @@ struct boss_kalecgos : public BossAI
_EnterEvadeMode();
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM_AURA);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM_AURA, true, true);
summons.DespawnAll();
DespawnPortals();
@@ -503,7 +503,7 @@ struct boss_sathrovarr : public BossAI
{
_JustDied();
Talk(SAY_SATH_DEATH);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM_AURA);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_SPECTRAL_REALM_AURA, true, true);
if (Creature* kalecgos = instance->GetCreature(DATA_KALECGOS_DRAGON))
kalecgos->AI()->DoAction(ACTION_START_OUTRO);
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index de06bea909f..93805b18a96 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -104,7 +104,7 @@ struct boss_amanitar : public BossAI
{
_EnterEvadeMode();
summons.DespawnAll();
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI, true, true);
_DespawnAtEvade();
}
@@ -112,7 +112,7 @@ struct boss_amanitar : public BossAI
{
_JustDied();
DoCastAOE(SPELL_REMOVE_MUSHROOM_POWER);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI, true, true);
}
void JustSummoned(Creature* summon) override
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
index b394ce87df3..3450f33e901 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp
@@ -755,9 +755,9 @@ class npc_acolyte_of_vesperon : public CreatureScript
i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
}
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO);
- instance->DoRemoveAurasDueToSpellOnPlayers(57935);
- instance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO, true, true);
+ instance->DoRemoveAurasDueToSpellOnPlayers(57935, true, true);
+ instance->DoRemoveAurasDueToSpellOnPlayers(58835, true, true); // Components of spell Twilight Torment
}
void UpdateAI(uint32 /*diff*/) override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index 4c51330eec8..a97653ec317 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -69,6 +69,7 @@ enum Spells
SPELL_MALLEABLE_GOO = 70852,
SPELL_UNSTABLE_EXPERIMENT = 70351,
SPELL_TEAR_GAS = 71617, // phase transition
+ SPELL_TEAR_GAS_TRIGGER_MISSILE = 71615,
SPELL_TEAR_GAS_CREATURE = 71618,
SPELL_TEAR_GAS_CANCEL = 71620,
SPELL_TEAR_GAS_PERIODIC_TRIGGER = 73170,
@@ -624,7 +625,7 @@ class boss_professor_putricide : public CreatureScript
AttackStart(me->GetVictim());
// remove Tear Gas
me->RemoveAurasDueToSpell(SPELL_TEAR_GAS_PERIODIC_TRIGGER);
- instance->DoRemoveAurasDueToSpellOnPlayers(71615);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TEAR_GAS_TRIGGER_MISSILE, true, true);
DoCastAOE(SPELL_TEAR_GAS_CANCEL);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GAS_VARIABLE);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_OOZE_VARIABLE);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index 615a5c4bf18..d70382770c4 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -155,7 +155,7 @@ class boss_sapphiron : public CreatureScript
{
if (events.IsInPhase(PHASE_FLIGHT))
{
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICEBOLT);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICEBOLT, true, true);
me->SetReactState(REACT_AGGRESSIVE);
if (me->IsHovering())
{
@@ -378,7 +378,7 @@ class boss_sapphiron : public CreatureScript
case EVENT_EXPLOSION:
DoCastAOE(SPELL_FROST_BREATH);
DoCastAOE(SPELL_FROST_BREATH_ANTICHEAT);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICEBOLT);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_ICEBOLT, true, true);
events.ScheduleEvent(EVENT_LAND, Seconds(3) + Milliseconds(500), 0, PHASE_FLIGHT);
return;
case EVENT_LAND:
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
index ef42e6fbf24..a1667b39c52 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp
@@ -115,7 +115,7 @@ public:
{
Talk(SAY_DEATH);
_JustDied();
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_PULSING_SHOCKWAVE_AURA, true, true);
}
void KilledUnit(Unit* who) override
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 59299330c7b..320cf7bca6e 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -235,7 +235,7 @@ class boss_general_vezax : public CreatureScript
{
_JustDied();
Talk(SAY_DEATH);
- instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_AURA_OF_DESPAIR);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_AURA_OF_DESPAIR, true, true);
}
void CheckShamanisticRage()