Core/Entities: Remove gem bonuses if requirements of prismatic sockets are not met
Closes issue 4949. --HG-- branch : trunk
This commit is contained in:
@@ -13182,6 +13182,17 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
|
||||
if (pEnchant->requiredSkill > 0 && pEnchant->requiredSkillValue > GetSkillValue(pEnchant->requiredSkill))
|
||||
return;
|
||||
|
||||
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
|
||||
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
|
||||
if((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
|
||||
&& !item->GetProto()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
|
||||
{
|
||||
// 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 (!item->IsBroken())
|
||||
{
|
||||
for (int s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
@@ -13542,6 +13553,22 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16
|
||||
else if (new_value < Enchant->requiredSkillValue && curr_value >= Enchant->requiredSkillValue)
|
||||
ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
|
||||
}
|
||||
|
||||
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
|
||||
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
|
||||
if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
|
||||
&& !m_items[i]->GetProto()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
|
||||
{
|
||||
SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
|
||||
|
||||
if (pPrismaticEnchant->requiredSkill == skill_id)
|
||||
{
|
||||
if (curr_value < pPrismaticEnchant->requiredSkillValue && new_value >= pPrismaticEnchant->requiredSkillValue)
|
||||
ApplyEnchantment(m_items[i], EnchantmentSlot(slot), true);
|
||||
else if (new_value < pPrismaticEnchant->requiredSkillValue && curr_value >= pPrismaticEnchant->requiredSkillValue)
|
||||
ApplyEnchantment(m_items[i], EnchantmentSlot(slot), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user