Core/Items: Implemented many new enchantment flags

This commit is contained in:
Shauren
2022-01-09 16:31:12 +01:00
parent 6df3cb0995
commit 241193cd02
10 changed files with 56 additions and 68 deletions
+4 -37
View File
@@ -634,7 +634,10 @@ SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent(uint32 enchId) c
bool SpellMgr::IsArenaAllowedEnchancment(uint32 ench_id) const
{
return mEnchantCustomAttr[ench_id];
if (SpellItemEnchantmentEntry const* enchantment = sSpellItemEnchantmentStore.LookupEntry(ench_id))
return enchantment->GetFlags().HasFlag(SpellItemEnchantmentFlags::AllowEnteringArena);
return false;
}
std::vector<int32> const* SpellMgr::GetSpellLinked(int32 spell_id) const
@@ -1988,42 +1991,6 @@ void SpellMgr::LoadSpellPetAuras()
TC_LOG_INFO("server.loading", ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Fill custom data about enchancments
void SpellMgr::LoadEnchantCustomAttr()
{
uint32 oldMSTime = getMSTime();
uint32 size = sSpellItemEnchantmentStore.GetNumRows();
mEnchantCustomAttr.resize(size);
for (uint32 i = 0; i < size; ++i)
mEnchantCustomAttr[i] = false;
uint32 count = 0;
for (SpellInfo const& spellInfo : mSpellInfoMap)
{
/// @todo find a better check
if (!spellInfo.HasAttribute(SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !spellInfo.HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT))
continue;
for (SpellEffectInfo const& spellEffectInfo : spellInfo.GetEffects())
{
if (spellEffectInfo.Effect == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
uint32 enchId = spellEffectInfo.MiscValue;
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
if (!ench)
continue;
mEnchantCustomAttr[enchId] = true;
++count;
break;
}
}
}
TC_LOG_INFO("server.loading", ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellEnchantProcData()
{
uint32 oldMSTime = getMSTime();