aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SpellHandler.cpp
diff options
context:
space:
mode:
authorDuarte Duarte <dnpd.dd@gmail.com>2014-09-05 21:37:34 +0100
committerDuarte Duarte <dnpd.dd@gmail.com>2014-09-05 21:37:34 +0100
commitd3a50ffb59f315d43c9ba93d5909887c6abe3685 (patch)
tree760cb3fddd603e658b811baa42812b089fa9e2b1 /src/server/game/Handlers/SpellHandler.cpp
parentb3c9d44d36836a1f956f08f535d2db0b083058c3 (diff)
parent31c00b0ce40b96e486bb47d1c66e627e0f49bd25 (diff)
Merge pull request #12954 from MrSmite/ResourceTracking
Allow players to track both herbs and minerals at the same time
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 13f79fb88c5..9cce494a522 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -33,6 +33,7 @@
#include "GameObjectAI.h"
#include "SpellAuraEffects.h"
#include "Player.h"
+#include "Config.h"
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
@@ -436,6 +437,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)