aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <none@none>2010-12-27 22:27:11 +0100
committerShauren <none@none>2010-12-27 22:27:11 +0100
commit52620db629688f398e49d52aa5482715942d933c (patch)
tree7caa7211327ac8769db5a7cce1818ea962130a09
parentef968f4b1552c2f1673a2ec79d8cd6b1ec9c2d11 (diff)
Core/Auras: Fixed enchant proc stack rules
Closes issue #5222. --HG-- branch : trunk
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp2
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp74
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h2
3 files changed, 49 insertions, 29 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ab0eb074506..db91eac7052 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3343,7 +3343,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
if (!aura->IsPassive() && aura->GetId() != 44413)
{
// find current aura from spell and change it's stackamount
- if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), aura->GetCastItemGUID(), 0, aura))
+ if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), (sSpellMgr->GetSpellCustomAttr(aura->GetId()) & SPELL_ATTR0_CU_ENCHANT_PROC) ? aura->GetCastItemGUID() : 0, 0, aura))
{
if (aura->GetSpellProto()->StackAmount)
aura->ModStackAmount(foundAura->GetStackAmount());
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
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index fa618657202..6ecd69524b1 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -913,6 +913,8 @@ inline bool IsProfessionOrRidingSkill(uint32 skill)
return IsProfessionSkill(skill) || skill == SKILL_RIDING;
}
+bool IsPartOfSkillLine(uint32 skillId, uint32 spellId);
+
class SpellMgr
{
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;