Show
Ignore:
Timestamp:
11/19/08 13:50:41 (17 years ago)
Author:
yumileroy
Message:

*Update aura stacking check. By QAston.
*Update pet autocast check. By qubix.

Original author: megamage
Date: 2008-11-17 17:59:33-06:00

Files:
1 modified

Legend:

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

    r236 r250  
    9999    return (spellInfo->Attributes & SPELL_ATTR_PASSIVE) != 0; 
    100100} 
    101  
     101/*not used for now so commented out 
    102102bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 
    103103{ 
     
    108108 
    109109    if (spellInfo_1->Effect[effIndex_1] != spellInfo_2->Effect[effIndex_2] || 
    110         spellInfo_1->EffectItemType[effIndex_1] != spellInfo_2->EffectItemType[effIndex_2] || 
    111110        spellInfo_1->EffectMiscValue[effIndex_1] != spellInfo_2->EffectMiscValue[effIndex_2] || 
    112111        spellInfo_1->EffectApplyAuraName[effIndex_1] != spellInfo_2->EffectApplyAuraName[effIndex_2]) 
     
    114113 
    115114    return true; 
    116 } 
     115}*/ 
    117116 
    118117int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 
     
    245244        case SPELL_CURSE: 
    246245        case SPELL_ASPECT: 
     246        case SPELL_POSITIVE_SHOUT: 
     247        case SPELL_JUDGEMENT: 
     248        case SPELL_WARLOCK_CORRUPTION: 
     249            return spellSpec1==spellSpec2; 
     250        default: 
     251            return false; 
     252    } 
     253} 
     254 
     255bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2) 
     256{ 
     257    switch(spellSpec1) 
     258    { 
    247259        case SPELL_TRACKER: 
    248260        case SPELL_WARLOCK_ARMOR: 
     
    250262        case SPELL_ELEMENTAL_SHIELD: 
    251263        case SPELL_MAGE_POLYMORPH: 
    252         case SPELL_POSITIVE_SHOUT: 
    253         case SPELL_JUDGEMENT: 
    254         case SPELL_WARLOCK_CORRUPTION: 
    255264            return spellSpec1==spellSpec2; 
    256265        case SPELL_BATTLE_ELIXIR: 
     
    10311040} 
    10321041 
    1033 bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const 
    1034 { 
    1035     if(spellId_1 == spellId_2) // auras due to the same spell 
    1036         return false; 
    1037  
     1042bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool isFromTheSameCaster ) const 
     1043{ 
    10381044    SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); 
    10391045    SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2); 
     
    10411047    if(!spellInfo_1 || !spellInfo_2) 
    10421048        return false; 
     1049 
     1050    SpellSpecific spellId_spec_1 = GetSpellSpecific(spellId_1); 
     1051    SpellSpecific spellId_spec_2 = GetSpellSpecific(spellId_2); 
     1052    if (spellId_spec_1 && spellId_spec_2) 
     1053        if (IsSingleFromSpellSpecificPerTarget(spellId_spec_1,spellId_spec_2) 
     1054            || (IsSingleFromSpellSpecificPerCaster(spellId_spec_1,spellId_spec_2) && isFromTheSameCaster)) 
     1055            return true; 
    10431056 
    10441057    if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName) 
     
    10511064            return false; 
    10521065    } 
     1066 
     1067    //if both elixirs are not battle/guardian/potions/flasks then always stack 
     1068    else if ((spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION) 
     1069        &&(spellId_spec_1 || spellId_spec_2)) 
     1070        return false; 
     1071 
    10531072    else if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) 
    10541073        return false; 
    10551074 
    10561075    for(uint32 i = 0; i < 3; ++i) 
    1057         if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i] 
    1058             || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) 
     1076    { 
     1077        if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i]) 
    10591078            return false; 
    1060  
     1079        if (spellInfo_1->EffectApplyAuraName[i] || spellInfo_2->EffectApplyAuraName[i]) 
     1080        { 
     1081            if(spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i] 
     1082                || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) 
     1083                    // need itemtype check? need to find an example 
     1084                return false; 
     1085            else if (!isFromTheSameCaster) 
     1086                switch(spellInfo_1->EffectApplyAuraName[i]) 
     1087                    { 
     1088                    //spells with these auras from different casters will stack 
     1089                        case SPELL_AURA_PERIODIC_DAMAGE: 
     1090                        case SPELL_AURA_PERIODIC_HEAL: 
     1091                        case SPELL_AURA_PERIODIC_TRIGGER_SPELL: 
     1092                        case SPELL_AURA_PERIODIC_ENERGIZE: 
     1093                        case SPELL_AURA_PERIODIC_MANA_LEECH: 
     1094                        case SPELL_AURA_PERIODIC_LEECH: 
     1095                        //exception for shaman positive totems with these auras 
     1096                        if ((spellInfo_1->SpellFamilyName != SPELLFAMILY_SHAMAN) 
     1097                            ||(spellInfo_1->Effect[i]!=SPELL_AURA_MOD_INCREASE_ENERGY)) 
     1098                            return false; 
     1099                        default: 
     1100                            break; 
     1101                    } 
     1102        } 
     1103    } 
    10611104    return true; 
    10621105}