Skip to content

Commit

Permalink
[6992] More strong checking to prevent stacking passive auras. This f…
Browse files Browse the repository at this point in the history
…ix 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.
  • Loading branch information
VladimirMangos committed Dec 31, 2008
1 parent 608814a commit 7545cd4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/game/Player.cpp
Expand Up @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions src/game/SpellMgr.h
Expand Up @@ -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)
Expand Down
31 changes: 13 additions & 18 deletions src/game/Unit.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 7545cd4

Please sign in to comment.