Core/Auras: Fixed enchant proc stack rules
Closes issue #5222. --HG-- branch : trunk
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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]])
|
||||
@@ -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
|
||||
|
||||
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user