Core/ItemHandler: Fix a logic error when checking for gem equipment limits. (Socketed gems cannot be destroyed, they can only be replaced and that would be the "new gem" case) - fix by leak

Closes issue 4698. Fixes issue 2495.

--HG--
branch : trunk
This commit is contained in:
click
2010-11-08 17:11:05 +01:00
parent 551d0cea4e
commit b1bf8ebfe6

View File

@@ -1263,22 +1263,13 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
{
if (Gems[j])
{
// destroyed gem
if (OldEnchants[j])
{
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)
--limit_newcount;
}
// new gem
if (iGemProto->ItemLimitCategory == Gems[j]->GetProto()->ItemLimitCategory)
++limit_newcount;
}
// existed gem
else if (OldEnchants[j])
{
// existing gem
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(OldEnchants[j]))
if (ItemPrototype const* jProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID))
if (iGemProto->ItemLimitCategory == jProto->ItemLimitCategory)