aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Instances/InstanceScript.cpp
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-06-29 19:24:05 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-13 00:42:18 +0100
commit6a63200e40d286dd49cc90135a519b0680a6f435 (patch)
tree37bb28dad9cdad7fabdafd955418066a201a4f12 /src/server/game/Instances/InstanceScript.cpp
parentfc6dc06513da4449fade9655da5d0db942fb132e (diff)
Core/Instance: add new hook & method
(cherry picked from commit 953b05459a517fb83f18047ab82ac09021bc9440)
Diffstat (limited to 'src/server/game/Instances/InstanceScript.cpp')
-rw-r--r--src/server/game/Instances/InstanceScript.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 0d8b75ddbf9..cbfa17dbf48 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -681,6 +681,35 @@ void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell, bool include
}
}
+void InstanceScript::DoRemoveAurasDueToSpellOnPlayer(Player* player, uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
+{
+ if (!player)
+ return;
+
+ player->RemoveAurasDueToSpell(spell);
+
+ if (!includePets)
+ return;
+
+ 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)
+ return;
+
+ 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);
+ }
+}
+
void InstanceScript::DoCastSpellOnPlayers(uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
{
Map::PlayerList const& playerList = instance->GetPlayers();