Show
Ignore:
Timestamp:
11/21/08 08:48:41 (17 years ago)
Author:
yumileroy
Message:

*Re-commit some reverted patch: aura stacking check. By QAston.

Original author: megamage
Date: 2008-11-20 18:13:10-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r257 r264  
    38963896        if(!is_triggered_by_spell) 
    38973897        { 
    3898             SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId); 
    3899  
    3900             bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec); 
    3901  
    3902             if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) 
    3903             { 
    3904                 // cannot remove higher rank 
    3905                 if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) 
    3906                     if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) 
    3907                         return false; 
     3898            bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); 
     3899            if( spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, sameCaster) ) 
     3900            { 
     3901                //some spells should be not removed by lower rank of them 
     3902                // what is this spell? 
     3903                if (!sameCaster 
     3904                    &&(spellProto->Effect[effIndex]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY) 
     3905                    &&(spellProto->DurationIndex==21) 
     3906                    &&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) 
     3907                    &&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)) 
     3908                    return false; 
    39083909 
    39093910                // Its a parent aura (create this aura in ApplyModifier) 
     
    39193920                else 
    39203921                    next =  m_Auras.begin(); 
    3921             } 
    3922             else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) 
    3923             { 
    3924                 // Its a parent aura (create this aura in ApplyModifier) 
    3925                 if ((*i).second->IsInUse()) 
    3926                 { 
    3927                     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()); 
    3928                     continue; 
    3929                 } 
    3930                 RemoveAurasDueToSpell(i_spellId); 
    3931  
    3932                 if( m_Auras.empty() ) 
    3933                     break; 
    3934                 else 
    3935                     next =  m_Auras.begin(); 
    3936             } 
    3937             // Potions stack aura by aura (elixirs/flask already checked) 
    3938             else if( spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION ) 
    3939             { 
    3940                 if (IsNoStackAuraDueToAura(spellId, effIndex, i_spellId, i_effIndex)) 
    3941                 { 
    3942                     if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) 
    3943                         return false;                       // cannot remove higher rank 
    3944  
    3945                     // Its a parent aura (create this aura in ApplyModifier) 
    3946                     if ((*i).second->IsInUse()) 
    3947                     { 
    3948                         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()); 
    3949                         continue; 
    3950                     } 
    3951                     RemoveAura(i); 
    3952                     next = i; 
    3953                 } 
    39543922            } 
    39553923        }