diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-09-06 02:41:45 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-09-06 02:41:45 +0200 |
commit | fe99efd6fa2ea879970d4984361edc6b29d949b5 (patch) | |
tree | eb35a3453fcc88b88a7cf0c962d7b4b218bdd42d /src/server/game/Handlers/SpellHandler.cpp | |
parent | 9a4f062b266315c99d5d2f018abc5161b890f81f (diff) | |
parent | 7f93e1e56e205c974b7644c6efa80fec11a6a78b (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/scripts/Commands/cs_misc.cpp
src/server/scripts/Events/childrens_week.cpp
src/server/scripts/Kalimdor/boss_azuregos.cpp
src/server/scripts/Kalimdor/zone_azshara.cpp
src/server/scripts/Kalimdor/zone_darkshore.cpp
src/server/scripts/Kalimdor/zone_durotar.cpp
src/server/scripts/Kalimdor/zone_moonglade.cpp
src/server/scripts/Kalimdor/zone_mulgore.cpp
src/server/scripts/Kalimdor/zone_orgrimmar.cpp
src/server/scripts/Kalimdor/zone_thousand_needles.cpp
src/server/scripts/Kalimdor/zone_ungoro_crater.cpp
src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index b0e0d60803b..ee428694beb 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -34,6 +34,7 @@ #include "GameObjectAI.h" #include "SpellAuraEffects.h" #include "Player.h" +#include "Config.h" void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets) { @@ -481,6 +482,25 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) // maybe should only remove one buff when there are multiple? _player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL); + + // If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other + if (sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES) && spellInfo->HasAura(SPELL_AURA_TRACK_RESOURCES)) + { + Unit::AuraEffectList const& auraEffects = _player->GetAuraEffectsByType(SPELL_AURA_TRACK_RESOURCES); + if (!auraEffects.empty()) + { + // Build list of spell IDs to cancel. Trying to cancel the aura while iterating + // over AuraEffectList caused "incompatible iterator" errors on second pass + std::list<uint32> spellIDs; + + for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); auraEffect++) + spellIDs.push_back((*auraEffect)->GetId()); + + // Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a) + for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); it++) + _player->RemoveOwnedAura(*it, 0, 0, AURA_REMOVE_BY_CANCEL); + } + } } void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) |