Skip to content

Commit

Permalink
[10584] Prevent lost aura connection with item at Aura::ReapplyAffect…
Browse files Browse the repository at this point in the history
…edPassiveAuras

Thanks to Lynx3d for research problem and testing.
  • Loading branch information
VladimirMangos committed Oct 6, 2010
1 parent c731b5d commit 40685ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/game/SpellAuras.cpp
Expand Up @@ -953,7 +953,10 @@ bool Aura::CanProcFrom(SpellEntry const *spell, uint32 EventProcEx, uint32 procE

void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
{
std::set<uint32> affectedSelf;
// we need store cast item guids for self casted spells
// expected that not exist permanent auras from stackable auras from different items
std::map<uint32, ObjectGuid> affectedSelf;

std::set<uint32> affectedAuraCaster;

for(Unit::SpellAuraHolderMap::const_iterator itr = target->GetSpellAuraHolderMap().begin(); itr != target->GetSpellAuraHolderMap().end(); ++itr)
Expand All @@ -968,16 +971,22 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
{
// only applied by self or aura caster
if (itr->second->GetCasterGUID() == target->GetGUID())
affectedSelf.insert(itr->second->GetId());
affectedSelf[itr->second->GetId()] = itr->second->GetCastItemGUID();
else if (itr->second->GetCasterGUID() == GetCasterGUID())
affectedAuraCaster.insert(itr->second->GetId());
}
}

for(std::set<uint32>::const_iterator set_itr = affectedSelf.begin(); set_itr != affectedSelf.end(); ++set_itr)
if (!affectedSelf.empty())
{
target->RemoveAurasDueToSpell(*set_itr);
target->CastSpell(GetTarget(), *set_itr, true);
Player* pTarget = target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : NULL;

for(std::map<uint32, ObjectGuid>::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr)
{
Item* item = pTarget && !map_itr->second.IsEmpty() ? pTarget->GetItemByGuid(map_itr->second) : NULL;
target->RemoveAurasDueToSpell(map_itr->first);
target->CastSpell(target, map_itr->first, true, item);
}
}

if (!affectedAuraCaster.empty())
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10583"
#define REVISION_NR "10584"
#endif // __REVISION_NR_H__

0 comments on commit 40685ff

Please sign in to comment.