Skip to content

Fix trade picker missing enchanted/brewed items and Ready cancelling trades - #8

Merged
absol89 merged 2 commits into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg
Oct 7, 2026
Merged

absol89 merged 2 commits into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg

Conversation

@absol89

@absol89 absol89 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Requested by *absol89 · project thread

Before: in the playtest, items enchanted and renamed during the session ("AAA ...") and freshly brewed potions were missing from the trade picker, and clicking Ready cancelled the trade. Trading away an enchanted, renamed or poisoned item could also leave it with the sender while a plain copy (or nothing) was removed.

After: the picker lists the player's actual inventory, so those items can be offered, and Ready keeps the trade open. If an offer is out of date, Ready now unreadies the player instead of cancelling the trade. The sender loses the exact item that was traded.

The picker and server validation used the server's copy of the player's inventory. That copy is built at join and then updated through incremental inventory events, and enchanting, renaming and brewing can change items without firing those events. The copy then no longer matched the game. The client-side Ready check compared the live inventory with that outdated copy and cancelled on any mismatch.

How:

  • New TradeInventorySyncRequest. The client sends its live GetInventory() when a trade starts and before each Ready, and the server replaces its copy for that player.
  • After a sync, offered items the snapshot no longer covers are dropped (KeepCoveredTradeOffer), and both players are unreadied.
  • The client-side pre-Ready check that cancelled is removed. On the server, an invalid own offer or an outdated accepted list now unreadies instead of cancelling.
  • AddOrRemoveItem used to pass a freshly built extra data list to RemoveItem for removals. Removals now pass the inventory's own stored list that matches the entry (FindExtraDataForItem), and only rebuild one, with a warning, when no stored list matches.

Verification: I built the encoding library and Code/tests with g++ on Linux. All 15 test cases pass, including new ones for offer pruning and the sync message round trip. The client and server still need CI and playtest step 11 in PLAYER_TRADING_POTIONS.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid

Enchanting, renaming and brewing change items without the incremental
inventory events the server copy relies on, so those items were missing
from the trade picker and the client's Ready check cancelled trades
whose offer no longer matched the live inventory.

The client now sends its live inventory when a trade starts and before
each Ready, and the server replaces its copy and drops offered items the
snapshot no longer covers. Outdated offers unready instead of cancelling.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid
@absol89 absol89 self-assigned this Oct 7, 2026
Inventory removals passed a freshly built extra data list to RemoveItem.
It matches none of the inventory's stored lists, so trading away an
enchanted, renamed or poisoned item could leave it with the sender and
take a plain copy (or nothing) instead. Removals now find the stored
extra data list that describes the entry and remove that one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid
@absol89
absol89 marked this pull request as ready for review October 7, 2026 08:09
@absol89
absol89 merged commit 2a4adcf into codex/player-trading-1.6.1170 Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants