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