From 1f8eb154f5eccd4b9f4f0fd2737744a938869b19 Mon Sep 17 00:00:00 2001 From: Lightguard Date: Fri, 20 Mar 2009 00:13:14 +0300 Subject: [PATCH] [7500] Not allow stacking some auras at target from different casters. Signed-off-by: VladimirMangos --- src/game/SpellMgr.cpp | 15 ++++++++++++++- src/game/SpellMgr.h | 3 ++- src/game/Unit.cpp | 20 ++++++++++++++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 124448f50..1f6a7467b 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -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 diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 2f0a6afc4..5e068887e 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -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) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c2e87bb58..9b069d776 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 957e1737e..fde12d594 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7499" + #define REVISION_NR "7500" #endif // __REVISION_NR_H__ -- 2.11.4.GIT