[8982] Prevent infinity recusion at repally auras at sepllmod change.

Passive auras (in different area auras) not affected by another group member spellmods.
In different from owned unit case.
This commit is contained in:
VladimirMangos 2009-12-13 01:16:41 +03:00
parent 807cd94166
commit 181ecdc20d
3 changed files with 12 additions and 10 deletions

View file

@ -1331,7 +1331,7 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
return false;
}
void Aura::ReapplyAffectedPassiveAuras( Unit* target )
void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
{
std::set<uint32> affectedSelf;
std::set<uint32> affectedAuraCaster;
@ -1339,16 +1339,17 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target )
for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr)
{
// permanent passive or permanent area aura
if (itr->second->IsPermanent() && (itr->second->IsPassive() || itr->second->IsAreaAura()) &&
// passive spells can be affected only by own or owner spell mods)
if (itr->second->IsPermanent() && (owner_mode && itr->second->IsPassive() || itr->second->IsAreaAura()) &&
// non deleted and not same aura (any with same spell id)
!itr->second->IsDeleted() && itr->second->GetId() != GetId() &&
// and affected by aura
isAffectedOnSpell(itr->second->GetSpellProto()))
{
// only applied by self or aura caster
if(itr->second->GetCasterGUID() == target->GetGUID())
if (itr->second->GetCasterGUID() == target->GetGUID())
affectedSelf.insert(itr->second->GetId());
else if(itr->second->GetCasterGUID() == GetCasterGUID())
else if (itr->second->GetCasterGUID() == GetCasterGUID())
affectedAuraCaster.insert(itr->second->GetId());
}
}
@ -1429,25 +1430,26 @@ void Aura::HandleAddModifier(bool apply, bool Real)
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
// reapply talents to own passive persistent auras
ReapplyAffectedPassiveAuras(m_target);
ReapplyAffectedPassiveAuras(m_target, true);
// re-apply talents/passives/area auras applied to pet (it affected by player spellmods)
if(Pet* pet = m_target->GetPet())
ReapplyAffectedPassiveAuras(pet);
ReapplyAffectedPassiveAuras(pet, true);
// re-apply talents/passives/area auras applied to totems (it affected by player spellmods)
for(int i = 0; i < MAX_TOTEM; ++i)
if(m_target->m_TotemSlot[i])
if(Creature* totem = m_target->GetMap()->GetCreature(m_target->m_TotemSlot[i]))
ReapplyAffectedPassiveAuras(totem);
ReapplyAffectedPassiveAuras(totem, true);
// re-apply talents/passives/area auras applied to group members (it affected by player spellmods)
if (Group* group = ((Player*)m_target)->GetGroup())
for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player* member = itr->getSource())
if (member != m_target && member->IsInMap(m_target))
ReapplyAffectedPassiveAuras(member);
ReapplyAffectedPassiveAuras(member, false);
}
void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
{
// Use SpellModifier structure for check

View file

@ -352,7 +352,7 @@ class MANGOS_DLL_SPEC Aura
void PeriodicDummyTick();
bool IsCritFromAbilityAura(Unit* caster, uint32& damage);
void ReapplyAffectedPassiveAuras(Unit* target);
void ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode);
Modifier m_modifier;
SpellModifier *m_spellmod;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8981"
#define REVISION_NR "8982"
#endif // __REVISION_NR_H__