diff options
author | ccrs <ccrs@users.noreply.github.com> | 2019-06-29 19:24:05 +0200 |
---|---|---|
committer | ccrs <ccrs@users.noreply.github.com> | 2019-06-29 19:24:05 +0200 |
commit | 953b05459a517fb83f18047ab82ac09021bc9440 (patch) | |
tree | f8f988e1eea80c2aa1fa6fc69d7539dd0c2b7f82 /src/server/game/Instances/InstanceScript.cpp | |
parent | 303811399f289184a5080207007ea1c906f6a4ba (diff) |
Core/Instance: add new hook & method
Diffstat (limited to 'src/server/game/Instances/InstanceScript.cpp')
-rw-r--r-- | src/server/game/Instances/InstanceScript.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 1e8458987bc..b451fd6f1f1 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -648,6 +648,34 @@ 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) + { + if (ObjectGuid summonGUID = player->m_SummonSlot[itr2]) + 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(); |