[7500] Not allow stacking some auras at target from different casters.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lightguard 2009-03-20 00:13:14 +03:00 committed by VladimirMangos
parent ebd292a226
commit 610a040240
4 changed files with 37 additions and 3 deletions

View file

@ -222,7 +222,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
return SPELL_NORMAL;
}
bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2)
bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2)
{
switch(spellSpec1)
{
@ -255,6 +255,19 @@ bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2)
}
}
bool IsSingleFromSpellSpecificRanksPerTarget(SpellSpecific spellId_spec, SpellSpecific i_spellId_spec)
{
switch(spellId_spec)
{
case SPELL_BLESSING:
case SPELL_AURA:
case SPELL_CURSE:
return spellId_spec==i_spellId_spec;
default:
return false;
}
}
bool IsPositiveTarget(uint32 targetA, uint32 targetB)
{
// non-positive targets

View file

@ -145,7 +145,8 @@ inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
}
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2);
bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2);
bool IsSingleFromSpellSpecificRanksPerTarget(SpellSpecific spellId_spec, SpellSpecific i_spellId_spec);
bool IsPassiveSpell(uint32 spellId);
inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto)

View file

@ -3561,6 +3561,7 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId);
bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec);
bool is_sspt = IsSingleFromSpellSpecificRanksPerTarget(spellId_spec,i_spellId_spec);
if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() )
{
@ -3582,6 +3583,25 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
else
next = m_Auras.begin();
}
else if( is_sspt && Aur->GetCasterGUID() != (*i).second->GetCasterGUID() && spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId) )
{
// cannot remove higher rank
if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)
return false;
// Its a parent aura (create this aura in ApplyModifier)
if ((*i).second->IsInUse())
{
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
continue;
}
RemoveAurasDueToSpell(i_spellId);
if( m_Auras.empty() )
break;
else
next = m_Auras.begin();
}
else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) )
{
// Its a parent aura (create this aura in ApplyModifier)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7499"
#define REVISION_NR "7500"
#endif // __REVISION_NR_H__