diff options
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rwxr-xr-x | src/server/game/Spells/SpellMgr.cpp | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 550dafc449d..db34245e0b0 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3044,6 +3044,16 @@ DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group) return DRTYPE_NONE; } +bool IsPartOfSkillLine(uint32 skillId, uint32 spellId) +{ + SkillLineAbilityMapBounds skillBounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId); + for (SkillLineAbilityMap::const_iterator itr = skillBounds.first; itr != skillBounds.second; ++itr) + if (itr->second->skillId == skillId) + return true; + + return false; +} + bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const { if (gender != GENDER_NONE) // not in expected gender @@ -3156,7 +3166,7 @@ bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCast if (spellId_1 == 44413) return true; if (aura1->GetCastItemGUID() && aura2->GetCastItemGUID()) - if (aura1->GetCastItemGUID() != aura2->GetCastItemGUID() && (sSpellMgr->GetSpellCustomAttr(spellId_1) & SPELL_ATTR0_CU_ENCHANT_PROC)) + if (aura1->GetCastItemGUID() != aura2->GetCastItemGUID() && (GetSpellCustomAttr(spellId_1) & SPELL_ATTR0_CU_ENCHANT_PROC)) return true; // same spell with same caster should not stack return false; @@ -3424,17 +3434,14 @@ void SpellMgr::LoadSpellCustomAttr() { uint32 oldMSTime = getMSTime(); - mSpellCustomAttr.resize(GetSpellStore()->GetNumRows()); - + mSpellCustomAttr.resize(GetSpellStore()->GetNumRows(), 0); // initialize with 0 values uint32 count = 0; - SpellEntry *spellInfo; - for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i) + SpellEntry* spellInfo = NULL; + for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { - - mSpellCustomAttr[i] = 0; - spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i); + spellInfo = (SpellEntry*)sSpellStore.LookupEntry(i); if (!spellInfo) continue; @@ -3470,6 +3477,36 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE; count++; break; + case SPELL_EFFECT_ENCHANT_ITEM: + case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: + case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC: + case SPELL_EFFECT_ENCHANT_HELD_ITEM: + { + // only enchanting profession enchantments procs can stack + if (IsPartOfSkillLine(SKILL_ENCHANTING, i)) + { + uint32 enchantId = spellInfo->EffectMiscValue[j]; + SpellItemEnchantmentEntry const *enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId); + for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) + { + if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + continue; + + SpellEntry const *procInfo = sSpellStore.LookupEntry(enchant->spellid[s]); + if (!procInfo) + continue; + + // if proced directly from enchantment, not via proc aura + // NOTE: Enchant Weapon - Blade Ward also has proc aura spell and is proced directly + // however its not expected to stack so this check is good + if (IsSpellHaveAura(procInfo, SPELL_AURA_PROC_TRIGGER_SPELL)) + continue; + + mSpellCustomAttr[enchant->spellid[s]] |= SPELL_ATTR0_CU_ENCHANT_PROC; + } + } + break; + } } switch (SpellTargetType[spellInfo->EffectImplicitTargetA[j]]) @@ -3528,7 +3565,7 @@ void SpellMgr::LoadSpellCustomAttr() count++; } - switch(i) + switch (i) { // Bind case 3286: @@ -3981,25 +4018,6 @@ void SpellMgr::LoadSpellCustomAttr() } } - for (uint32 i = 0; i < sSpellItemEnchantmentStore.GetNumRows(); ++i) - { - SpellItemEnchantmentEntry const *enchant = sSpellItemEnchantmentStore.LookupEntry(i); - if (!enchant) - continue; - - for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) - { - if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) - continue; - - SpellEntry const *spellInfo = sSpellStore.LookupEntry(enchant->spellid[s]); - if (!spellInfo) - continue; - - mSpellCustomAttr[enchant->spellid[s]] |= SPELL_ATTR0_CU_ENCHANT_PROC; - } - } - SummonPropertiesEntry *properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121)); properties->Type = SUMMON_TYPE_TOTEM; properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893 |