mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 08:45:27 +00:00
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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user