fix(inventory): deleting more than the stack holds does nothing, as the client

LWOInventoryComponent_Common::msgRemoveItemFromInventory (0x00d203b0)
counts the item (GetInvItemCount) and does nothing when it holds fewer
than iStackCount; a request for an item with no count takes the whole
stack. The server cut the request down to the stack and deleted it, and
deleted nothing for a count of 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-10-02 10:22:17 -05:00
parent 5bf637b02e
commit 9497d20027
2 changed files with 33 additions and 1 deletions

View File

@@ -2231,7 +2231,10 @@ void InventoryComponent::OnRemoveItemFromInventory(const GameMessages::RemoveIte
return;
}
const auto iStackCount = std::min<uint32_t>(item->GetCount(), msg.iStackCount);
// As LWOInventoryComponent_Common::msgRemoveItemFromInventory (0x00d203b0): no count means the whole stack, and a
// stack holding fewer than asked is left alone
const auto iStackCount = msg.iStackCount == 0 ? item->GetCount() : msg.iStackCount;
if (item->GetCount() < iStackCount) return;
if (msg.bConfirmed && !CanDelete(*item)) {
LOG("%llu tried to delete %llu (LOT %i), which its deletion restriction does not allow", m_Parent->GetObjectID(), item->GetId(), item->GetLot());