refactor(Core/Item): Add helpers (#19828)

This commit is contained in:
Kitzunu
2024-09-01 00:38:50 +02:00
committed by GitHub
parent f88812443d
commit 5d31b9f98f
19 changed files with 183 additions and 129 deletions

View File

@@ -319,7 +319,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
return;
}
if (pItem->GetTemplate()->Flags & ITEM_FLAG_NO_USER_DESTROY)
if (pItem->GetTemplate()->HasFlag(ITEM_FLAG_NO_USER_DESTROY))
{
_player->SendEquipError(EQUIP_ERR_CANT_DROP_SOULBOUND, nullptr, nullptr);
return;
@@ -783,7 +783,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
// prevent selling item for sellprice when the item is still refundable
// this probably happens when right clicking a refundable item, the client sends both
// CMSG_SELL_ITEM and CMSG_REFUND_ITEM (unverified)
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE))
if (pItem->IsRefundable())
return; // Therefore, no feedback to client
// special case at auto sell (sell all)
@@ -1091,7 +1091,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
}
// Only display items in vendor lists for the team the
// player is on. If GM on, display all items.
if (!_player->IsGameMaster() && ((itemTemplate->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY && _player->GetTeamId() == TEAM_ALLIANCE) || (itemTemplate->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY && _player->GetTeamId() == TEAM_HORDE)))
if (!_player->IsGameMaster() && ((itemTemplate->HasFlag2(ITEM_FLAG2_FACTION_HORDE) && _player->GetTeamId() == TEAM_ALLIANCE) || (itemTemplate->HasFlag2(ITEM_FLAG2_FACTION_ALLIANCE) && _player->GetTeamId() == TEAM_HORDE)))
{
continue;
}
@@ -1282,7 +1282,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
return;
}
if (!(gift->GetTemplate()->Flags & ITEM_FLAG_IS_WRAPPER)) // cheating: non-wrapper wrapper
if (!(gift->GetTemplate()->HasFlag(ITEM_FLAG_IS_WRAPPER))) // cheating: non-wrapper wrapper
{
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, nullptr);
return;
@@ -1483,7 +1483,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
ItemTemplate const* iGemProto = Gems[i]->GetTemplate();
// unique item (for new and already placed bit removed enchantments
if (iGemProto->Flags & ITEM_FLAG_UNIQUE_EQUIPPABLE)
if (iGemProto->HasFlag(ITEM_FLAG_UNIQUE_EQUIPPABLE))
{
for (int j = 0; j < MAX_GEM_SOCKETS; ++j)
{