aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Instances/InstanceScript.cpp
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-06-30 15:47:17 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-13 00:42:19 +0100
commitfce492d2e29f911ac078455ea356a1dd8325079a (patch)
tree8f23e92b7c4f5108feefaac20141d4c569469a08 /src/server/game/Instances/InstanceScript.cpp
parent9d861a51c20ed3d436297b9b8926690eaa4cad78 (diff)
Core/Instance: 14788ce followup
No need to repeat code (cherry picked from commit b9a80959673a377bce537d32a7dacaa732761d55)
Diffstat (limited to 'src/server/game/Instances/InstanceScript.cpp')
-rw-r--r--src/server/game/Instances/InstanceScript.cpp56
1 files changed, 2 insertions, 54 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 5779316b6c9..acabe87cfb6 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -652,33 +652,7 @@ void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool include
{
Map::PlayerList const& playerList = instance->GetPlayers();
for (auto itr = playerList.begin(); itr != playerList.end(); ++itr)
- {
- if (Player* player = itr->GetSource())
- {
- player->RemoveAurasDueToSpell(spell);
-
- 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->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);
- }
- }
- }
+ DoRemoveAurasDueToSpellOnPlayer(itr->GetSource(), spell, includePets, includeControlled);
}
void InstanceScript::DoRemoveAurasDueToSpellOnPlayer(Player* player, uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
@@ -714,33 +688,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell, bool includePets /*= fal
{
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 (!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);
- }
- }
- }
+ DoCastSpellOnPlayer(itr->GetSource(), spell, includePets, includeControlled);
}
void InstanceScript::DoCastSpellOnPlayer(Player* player, uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)