fix: a trade offer takes what the trade window takes

The client's trade window has 8 slots for each player and takes neither
a bound item nor an equipped one. An offer with more than 8 items, a
bound item or an equipped item is now refused like the other offers the
window can not make, when it arrives and again when the trade
completes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 15:37:33 -06:00
parent e164f9aaed
commit 6f7fd5f84e
4 changed files with 53 additions and 17 deletions

View File

@@ -247,11 +247,7 @@ namespace GameMessages {
if (!inventoryComponent) return;
// The LOT and the count the trade works with come from the items the player holds
const auto resolvedItems = Trade::ResolveOffer(items, [inventoryComponent](const LWOOBJID itemId) -> std::optional<HeldTradeItem> {
const auto* const item = inventoryComponent->FindItemById(itemId);
if (!item) return std::nullopt;
return HeldTradeItem{ item->GetLot(), item->GetCount() };
});
const auto resolvedItems = Trade::ResolveOffer(items, Trade::HeldIn(*inventoryComponent));
if (!resolvedItems) {
LOG("Trade update from (%llu) does not match the items they hold, ignoring it", entity.GetObjectID());