PathOfBuilding-PoE2 icon indicating copy to clipboard operation
PathOfBuilding-PoE2 copied to clipboard

Feat: Add new trade mode dropdown and direct trade actions

Open Mizkii opened this issue 3 months ago • 6 comments

Fixes #1314

Description of the problem being solved:

This PR introduces two major enhancements to the Trader pane, overhauling the trade interaction workflow and providing more granular search control.

The new functionality includes:

  • Direct In-Game Trade Actions: The trade process is streamlined by sending whispers and hideout teleports directly via the trade API, removing the need to manually copy and paste messages.
    • Direct Hideout Teleport: When an item listing provides a hideout_token, the button changes to "Teleport" and sends the user directly to the seller's hideout.
    • Direct Whisper: For listings with a whisper_token, the button sends the trade whisper directly to the player in-game.
    • Smart Fallback: If a direct action fails or if only a legacy whisper string is available, the system automatically falls back to copying the message to the clipboard and also showing an error on the buttom right.
    • On-Demand Token Refresh: To prevent expired tokens, fresh data is fetched for an item the moment it is selected from the results list.
  • "Trade Mode" Search Filter: A "Trade Mode" dropdown has been added, giving users control over the online status of their item searches instead of using a hardcoded value.
    • Instant Buyout and In Person Trade (available)
    • Instant Buyout Only (securable)
    • In Person Trade Only (online)
    • Any (any)

Steps taken to verify a working solution:

  • Manually tested the new direct trade actions ("Teleport" and "Whisper") against the live trade site and confirmed they were successful.
  • Verified the button UI correctly updates its text and action based on the hideout_token or whisper_token present in the API response.
  • Confirmed that failed API calls correctly trigger the fallback mechanism, copying the whisper to the clipboard.
  • Selected each of the four options from the new "Trade Mode" dropdown and generated weighted searches, verifying that the resulting trade query used the correct status option (available, securable, online, etc.).
  • Successfully ran the entire project test suite in the Docker environment using docker-compose up.
image
  • Successfully ran the Spellchecker
image

Link to a build that showcases this PR:

Not applicable. This is a core feature enhancement for the Trader and is not build-specific.

Before screenshot:

The Trader pane UI before this change, featuring only a static "Whisper" button and no "Trade Mode" filter.

image

After screenshot:

The Trader pane UI with the new dynamic buttons (showing "Teleport" and "Whisper") and the new "Trade Mode" dropdown in the bottom-right corner.

image

Mizkii avatar Sep 04 '25 21:09 Mizkii