mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/Players: Fixed recently introduced crashes in Player::ApplyEnchantment
Closes issue #5193. --HG-- branch : trunk
This commit is contained in:
@@ -13196,8 +13196,8 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
|
||||
{
|
||||
// Check if the requirements for the prismatic socket are met before applying the gem stats
|
||||
SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
|
||||
if(pPrismaticEnchant->requiredSkill > 0 && pPrismaticEnchant->requiredSkillValue > GetSkillValue(pPrismaticEnchant->requiredSkill))
|
||||
return;
|
||||
if (!pPrismaticEnchant || (pPrismaticEnchant->requiredSkill > 0 && pPrismaticEnchant->requiredSkillValue > GetSkillValue(pPrismaticEnchant->requiredSkill)))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!item->IsBroken())
|
||||
@@ -13568,7 +13568,7 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16
|
||||
{
|
||||
SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
|
||||
|
||||
if (pPrismaticEnchant->requiredSkill == skill_id)
|
||||
if (pPrismaticEnchant && pPrismaticEnchant->requiredSkill == skill_id)
|
||||
{
|
||||
if (curr_value < pPrismaticEnchant->requiredSkillValue && new_value >= pPrismaticEnchant->requiredSkillValue)
|
||||
ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
|
||||
|
||||
Reference in New Issue
Block a user