Core/Items: ported several enchantment flag implementations from master branch

This commit is contained in:
Ovahlord committed 2022-01-09 18:15:38 +01:00
1 parent 009e1dba37
commit 3ff8840fe2
8 files changed
+35 -63

No files matched your search

+4 -41
View File
@@ -637,7 +637,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;
}
const std::vector<int32>* SpellMgr::GetSpellLinked(int32 spell_id) const
@@ -2098,46 +2101,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] = 0;
uint32 count = 0;
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo const* spellInfo = GetSpellInfo(i);
if (!spellInfo)
continue;
/// @todo find a better check
if (!spellInfo->HasAttribute(SPELL_ATTR2_PRESERVE_ENCHANT_IN_ARENA) || !spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT))
continue;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (spellInfo->Effects[j].Effect == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
{
uint32 enchId = spellInfo->Effects[j].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();