fix(Core/Player): correct socket checks for prismatic belt socket (#26122)

This commit is contained in:
sogladev
2026-06-22 20:22:32 +02:00
committed by GitHub
parent b5ceb7fc18
commit eb9261aa06
4 changed files with 16 additions and 7 deletions

View File

@@ -201,7 +201,7 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
for (uint32 i = 0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if (pItem && pItem != eItem && pItem->GetTemplate()->Socket[0].Color)
if (pItem && pItem != eItem && pItem->HasSocket())
count += pItem->GetGemCountWithID(item);
}
}

View File

@@ -1014,8 +1014,11 @@ bool Item::HasSocket() const
uint8 Item::GetGemCountWithID(uint32 GemID) const
{
uint8 count = 0;
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
{
if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
continue;
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
if (!enchant_id)
continue;
@@ -1033,8 +1036,11 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
{
uint8 count = 0;
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
{
if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
continue;
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
if (!enchant_id)
continue;

View File

@@ -13913,8 +13913,11 @@ InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limi
return res;
// check unique-equipped on gems
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + 3; ++enchant_slot)
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot <= PRISMATIC_ENCHANTMENT_SLOT; ++enchant_slot)
{
if (enchant_slot == BONUS_ENCHANTMENT_SLOT)
continue;
uint32 enchant_id = pItem->GetEnchantmentId(EnchantmentSlot(enchant_slot));
if (!enchant_id)
continue;

View File

@@ -347,7 +347,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (skipItem && skipItem->GetTemplate()->GemProperties)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
if (pItem != skipItem && pItem->HasSocket())
count += pItem->GetGemCountWithID(item);
if (inBankAlso)
@@ -365,7 +365,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (skipItem && skipItem->GetTemplate()->GemProperties)
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
if (pItem != skipItem && pItem->HasSocket())
count += pItem->GetGemCountWithID(item);
}
@@ -754,7 +754,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_
continue;
Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem && pItem->GetTemplate()->Socket[0].Color)
if (pItem && pItem->HasSocket())
{
tempcount += pItem->GetGemCountWithID(item);
if (tempcount >= count)