From 7545cd45e42d2797c4b5d57a994e5d6b58e53ff3 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 31 Dec 2008 12:33:49 +0300 Subject: [PATCH] [6992] More strong checking to prevent stacking passive auras. This fix unexpected statking 16252 and ranks. Also this checking will prevent staking talent ranks if it will casted at character by some reason in any cases. TODO: non-talent passive spells like 16252 or 31785 with ranks still as before not reapplied in lesser rank form if higher rank unlearned. But this possible only at .unlearn command use and required re-loginning for activation lesser rank spell. --- src/game/Player.cpp | 2 ++ src/game/SpellMgr.h | 9 +++++++++ src/game/Unit.cpp | 31 +++++++++++++------------------ src/shared/revision_nr.h | 2 +- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 6db136d6c..b65577b53 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3008,6 +3008,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled) for(SpellLearnSpellMap::const_iterator itr2 = spell_begin; itr2 != spell_end; ++itr2) removeSpell(itr2->second.spell, disabled); + + // TODO: recast if need lesser ranks spell for passive with IsPassiveSpellStackableWithRanks } void Player::RemoveArenaSpellCooldowns() diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index c5d005b98..24b277510 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -315,6 +315,15 @@ int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, ui bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2); bool IsPassiveSpell(uint32 spellId); +inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) +{ + if(!IsPassiveSpell(spellProto->Id)) + return false; + + return !IsSpellHaveEffect(spellProto,SPELL_EFFECT_APPLY_AURA); +} + + inline bool IsDeathPersistentSpell(SpellEntry const *spellInfo) { switch(spellInfo->Id) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f62caaac9..e01d6ac92 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -68,20 +68,6 @@ static bool isNonTriggerAura[TOTAL_AURAS]; // Prepare lists static bool procPrepared = InitTriggerAuraData(); -bool IsPassiveStackableSpell( uint32 spellId ) -{ - if(!IsPassiveSpell(spellId)) - return false; - - SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); - if(!spellProto) - return false; - if (spellProto->procFlags) - return false; - - return true; -} - Unit::Unit() : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) { @@ -3256,9 +3242,8 @@ bool Unit::AddAura(Aura *Aur) } } - // passive auras stack with all (except passive spell proc auras) - if ((!Aur->IsPassive() || !IsPassiveStackableSpell(Aur->GetId())) && - !(Aur->GetId() == 20584 || Aur->GetId() == 8326)) + // passive auras not stacable with other ranks + if (!IsPassiveSpellStackableWithRanks(aurSpellInfo)) { if (!RemoveNoStackAurasDueToAura(Aur)) { @@ -3353,6 +3338,14 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) return false; uint32 spellId = Aur->GetId(); + + // passive spell special case (only non stackable with ranks) + if(IsPassiveSpell(spellId)) + { + if(IsPassiveSpellStackableWithRanks(spellProto)) + return true; + } + uint32 effIndex = Aur->GetEffIndex(); SpellSpecific spellId_spec = GetSpellSpecific(spellId); @@ -3371,9 +3364,11 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) uint32 i_spellId = i_spellProto->Id; + // early checks that spellId is passive non stackable spell if(IsPassiveSpell(i_spellId)) { - if(IsPassiveStackableSpell(i_spellId)) + // passive non-stackable spells not stackable only for same caster + if(Aur->GetCasterGUID()!=i->second->GetCasterGUID()) continue; // passive non-stackable spells not stackable only with another rank of same spell diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 391b89009..1382197f9 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 "6991" + #define REVISION_NR "6992" #endif // __REVISION_NR_H__ -- 2.11.4.GIT