mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8924] Implement reapply permanent area auras for group.
This commit is contained in:
parent
090c8b8854
commit
fef94f9b36
2 changed files with 33 additions and 9 deletions
|
|
@ -1333,26 +1333,42 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
|
|||
|
||||
void Aura::ReapplyAffectedPassiveAuras( Unit* target )
|
||||
{
|
||||
std::set<uint32> affectedPassives;
|
||||
std::set<uint32> affectedSelf;
|
||||
std::set<uint32> affectedAuraCaster;
|
||||
|
||||
for(Unit::AuraMap::const_iterator itr = target->GetAuras().begin(); itr != target->GetAuras().end(); ++itr)
|
||||
{
|
||||
// permanent passive
|
||||
if (itr->second->IsPassive() && itr->second->IsPermanent() &&
|
||||
// permanent passive or permanent area aura
|
||||
if (itr->second->IsPermanent() && (itr->second->IsPassive() || itr->second->IsAreaAura()) &&
|
||||
// non deleted and not same aura (any with same spell id)
|
||||
!itr->second->IsDeleted() && itr->second->GetId() != GetId() &&
|
||||
// only applied by self and affected by aura
|
||||
itr->second->GetCasterGUID() == target->GetGUID() && isAffectedOnSpell(itr->second->GetSpellProto()))
|
||||
// and affected by aura
|
||||
isAffectedOnSpell(itr->second->GetSpellProto()))
|
||||
{
|
||||
affectedPassives.insert(itr->second->GetId());
|
||||
// only applied by self or aura caster
|
||||
if(itr->second->GetCasterGUID() == target->GetGUID())
|
||||
affectedSelf.insert(itr->second->GetId());
|
||||
else if(itr->second->GetCasterGUID() == GetCasterGUID())
|
||||
affectedAuraCaster.insert(itr->second->GetId());
|
||||
}
|
||||
}
|
||||
|
||||
for(std::set<uint32>::const_iterator set_itr = affectedPassives.begin(); set_itr != affectedPassives.end(); ++set_itr)
|
||||
for(std::set<uint32>::const_iterator set_itr = affectedSelf.begin(); set_itr != affectedSelf.end(); ++set_itr)
|
||||
{
|
||||
target->RemoveAurasDueToSpell(*set_itr);
|
||||
target->CastSpell(m_target, *set_itr, true);
|
||||
}
|
||||
|
||||
if (!affectedAuraCaster.empty())
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
for(std::set<uint32>::const_iterator set_itr = affectedAuraCaster.begin(); set_itr != affectedAuraCaster.end(); ++set_itr)
|
||||
{
|
||||
target->RemoveAurasDueToSpell(*set_itr);
|
||||
if (caster)
|
||||
caster->CastSpell(m_target, *set_itr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
|
|
@ -1412,14 +1428,22 @@ void Aura::HandleAddModifier(bool apply, bool Real)
|
|||
// reapply talents to own passive persistent auras
|
||||
ReapplyAffectedPassiveAuras(m_target);
|
||||
|
||||
// re-aplly talents and passives applied to pet (it affected by player spellmods)
|
||||
// re-apply talents/passives/area auras applied to pet (it affected by player spellmods)
|
||||
if(Pet* pet = m_target->GetPet())
|
||||
ReapplyAffectedPassiveAuras(pet);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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)
|
||||
ReapplyAffectedPassiveAuras(member);
|
||||
}
|
||||
void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8923"
|
||||
#define REVISION_NR "8924"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue