Changeset 264
- Timestamp:
- 11/21/08 08:48:41 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/SpellMgr.cpp
r253 r264 100 100 } 101 101 102 bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)102 /*bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) 103 103 { 104 104 SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); … … 114 114 115 115 return true; 116 } 116 }*/ 117 117 118 118 int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2) … … 245 245 case SPELL_CURSE: 246 246 case SPELL_ASPECT: 247 case SPELL_POSITIVE_SHOUT: 248 case SPELL_JUDGEMENT: 249 case SPELL_WARLOCK_CORRUPTION: 250 return spellSpec1==spellSpec2; 251 default: 252 return false; 253 } 254 } 255 256 bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2) 257 { 258 switch(spellSpec1) 259 { 247 260 case SPELL_TRACKER: 248 261 case SPELL_WARLOCK_ARMOR: … … 250 263 case SPELL_ELEMENTAL_SHIELD: 251 264 case SPELL_MAGE_POLYMORPH: 252 case SPELL_POSITIVE_SHOUT:253 case SPELL_JUDGEMENT:254 case SPELL_WARLOCK_CORRUPTION:255 265 return spellSpec1==spellSpec2; 256 266 case SPELL_BATTLE_ELIXIR: … … 1031 1041 } 1032 1042 1033 bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2 ) const1034 { 1035 if(spellId_1 == spellId_2) // auras due to the same spell1036 return false;1043 bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool sameCaster) const 1044 { 1045 //if(spellId_1 == spellId_2) // auras due to the same spell 1046 // return false; 1037 1047 1038 1048 SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); … … 1042 1052 return false; 1043 1053 1054 SpellSpecific spellId_spec_1 = GetSpellSpecific(spellId_1); 1055 SpellSpecific spellId_spec_2 = GetSpellSpecific(spellId_2); 1056 if (spellId_spec_1 && spellId_spec_2) 1057 if (IsSingleFromSpellSpecificPerTarget(spellId_spec_1, spellId_spec_2) 1058 ||(IsSingleFromSpellSpecificPerCaster(spellId_spec_1, spellId_spec_2) && sameCaster)) 1059 return true; 1060 1044 1061 if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName) 1045 1062 return false; 1046 1063 1047 if(!spellInfo_1->SpellFamilyName) // generic spells 1064 // generic spells 1065 if(!spellInfo_1->SpellFamilyName) 1048 1066 { 1049 1067 if(!spellInfo_1->SpellIconID … … 1051 1069 return false; 1052 1070 } 1053 else if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) 1054 return false; 1071 1072 // if both elixirs are not battle/guardian/potions/flasks then always stack 1073 else if(spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION) 1074 { 1075 if(spellId_spec_1 || spellId_spec_2)) 1076 return false; 1077 } 1078 1079 // check for class spells 1080 else 1081 { 1082 if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) 1083 return false; 1084 } 1055 1085 1056 1086 for(uint32 i = 0; i < 3; ++i) 1087 { 1057 1088 if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i] 1058 || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) 1059 return false; 1089 || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i] 1090 || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura 1091 return false; // need itemtype check? need an example to add that check 1092 1093 if(spellInfo_1->EffectApplyAuraName[i] // both spell has the same auras 1094 && !sameCaster 1095 && spellInfo_1->Effect[i] != SPELL_EFFECT_APPLY_AREA_AURA_PARTY) // not area auras (shaman totem) 1096 // a better check may be effect == SPELL_EFFECT_APPLY_AURA 1097 { 1098 switch(spellInfo_1->EffectApplyAuraName[i]) 1099 { 1100 // DOT or HOT from different casters will stack 1101 case SPELL_AURA_PERIODIC_DAMAGE: 1102 case SPELL_AURA_PERIODIC_HEAL: 1103 case SPELL_AURA_PERIODIC_TRIGGER_SPELL: 1104 case SPELL_AURA_PERIODIC_ENERGIZE: 1105 case SPELL_AURA_PERIODIC_MANA_LEECH: 1106 case SPELL_AURA_PERIODIC_LEECH: 1107 return false; 1108 default: 1109 break; 1110 } 1111 } 1112 } 1060 1113 1061 1114 return true; -
trunk/src/game/SpellMgr.h
r253 r264 285 285 } 286 286 287 bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);287 //bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); 288 288 289 289 inline bool IsSealSpell(SpellEntry const *spellInfo) … … 301 301 302 302 int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); 303 bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2); 303 bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1, uint32 spellSpec2); 304 bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1, uint32 spellSpec2); 304 305 bool IsPassiveSpell(uint32 spellId); 305 306 … … 769 770 bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const; 770 771 static bool canStackSpellRanks(SpellEntry const *spellInfo); 771 bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2 ) const;772 bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool sameCaster) const; 772 773 773 774 SpellEntry const* SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const; -
trunk/src/game/Unit.cpp
r257 r264 3896 3896 if(!is_triggered_by_spell) 3897 3897 { 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; 3908 3909 3909 3910 // Its a parent aura (create this aura in ApplyModifier) … … 3919 3920 else 3920 3921 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 else3935 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 rank3944 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 }3954 3922 } 3955 3923 }