Skip to content

Add requirement filters to trade queries and Trader results - #9824

Open
mcagnion wants to merge 13 commits into
PathOfBuildingCommunity:devfrom
mcagnion:feature/attributes-requirements-for-trade-query
Open

mcagnion wants to merge 13 commits into
PathOfBuildingCommunity:devfrom
mcagnion:feature/attributes-requirements-for-trade-query

Conversation

@mcagnion

@mcagnion mcagnion commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Description of the problem being solved:

Trade searches can return items that look like good upgrades but leave the build short of attribute requirements once equipped, or that the character is not yet high enough level to use.

This adds two complementary controls:

  • Attribute requirements in Query Options, checked by default, adds total Strength, Dexterity, and Intelligence minimums to the generated trade search when the build is short on attributes. The minimums account for increased or reduced attributes on the build and never ask for more than the build is short by. Flasks and builds using Omniscience get no attribute minimums.
  • A requirement list under Sort By in the Trader, with the same choices as the requirement filter of the unique list in the Items tab. It defaults to Any requirements, so results stay visible unless the user picks a filter:
    • Current level hides results whose level requirement is above the character level.
    • Current attributes hides results that, once equipped in the slot they would replace, still leave unmet Strength, Dexterity, Intelligence, or Omniscience requirements. Rows without an equippable slot (the Megalomaniac and Watcher's Eye rows when no jewel socket is allocated) are not filtered by attributes.
    • Current useable applies both.

The Trader now keeps the level requirement shown on the trade listing, which reflects the item's mods, instead of the base item's requirement. Items with socketed gems keep the base requirement.

Steps taken to verify a working solution:

  • Added tests for the generated attribute minimums (including increased and reduced Strength), the level and attribute filters, the listing level requirement, rows without an equippable slot, all results being filtered out, and searches that return no compatible item.
  • Manually checked the Query Options checkbox, and that the Trader opens and lists Watcher's Eye in a new build without an allocated jewel socket.
  • Replayed 85 captured trade listings for a ring on a level 66 copy of a build. Current level kept only the listings requiring level 66 or less (42 of them, against 83 if the base item's requirement were used), Current attributes kept the four rings that cover the Dexterity the build would lose, and Current useable kept the one ring meeting both.
  • Opened the Trader on a build with ten jewel sockets: the requirement list fits under Sort By, all rows stay above Total Price, and Current useable kept a ring the build can use.

Screenshots:

Query Options

after-query-options-attribute-requirements

Trader

after-trader-requirement-list after-trader-requirement-choices-open

@mcagnion
mcagnion marked this pull request as ready for review April 28, 2026 21:45
@mcagnion
mcagnion force-pushed the feature/attributes-requirements-for-trade-query branch from 587c8d2 to 02cf25a Compare May 13, 2026 23:17
@mcagnion
mcagnion force-pushed the feature/attributes-requirements-for-trade-query branch 3 times, most recently from 8d8b185 to c51431f Compare August 6, 2026 09:26
@mcagnion
mcagnion force-pushed the feature/attributes-requirements-for-trade-query branch 2 times, most recently from 2e59d23 to 80f3ac7 Compare August 22, 2026 10:57
mcagnion and others added 4 commits August 26, 2026 20:03
Adds an "Include unusable" checkbox (off by default) to the Trader pane
that hides search results whose Str/Dex/Int (or Omni) requirements the
build cannot meet once equipped. Filtering is applied across all sort
modes and cached per result to avoid redundant calcFunc calls. When
filtering drops every result, the dropdown and total-price state are
cleared and a dedicated notice is shown.

Adds a matching "Attributes Requirements" checkbox (on by default) to
the TradeQueryGenerator popup. When enabled, the shortfall (build
requirement minus build attribute) is inserted as pseudo.pseudo_total_*
min filters in the generated query so trade search only returns items
that cover the missing attributes.

Also hardens UI state transitions around filtered results: the result
dropdown selection callback guards against stale indices, the section
anchor preserves its base Y when the scrollbar offsets it, and empty
sorted results no longer crash UpdateDropdownList / UpdateControlsWithItems.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the obsolete Watcher's Eye fallback, resolve replacement slots from live item state, and share requirement semantics across query generation and result validation.
@mcagnion
mcagnion force-pushed the feature/attributes-requirements-for-trade-query branch from 80f3ac7 to f69c788 Compare August 26, 2026 18:13
Check mixed eligible and ineligible results in every sort mode while preserving the fetched result index. Construct the empty filtered row through UpdateControlsWithItems and verify its controls and total price.
Construct the filtering row directly instead of sharing helpers across test groups. Retain the sort and empty-row assertions while keeping the cumulative test diff smaller.
Keep the sort, empty-row and generated-query checks while removing unused fixture fields, a single-use helper and redundant assertions.
Convert final attribute deficits to raw item minimums using the native
modifier database and rounding. Cap the result at the existing deficit
because a replacement can increase attribute scaling itself.

Cover amplified attributes and candidate scaling with two native cases
sharing the same query fixture.
The rows started one row lower than the pane height allows, so with many
slots the last visible row covered the Total Price label. Use the same
anchor and scroll offset as dev.
Replace the attribute checkbox with the requirement list of the Items tab
unique list (Any requirements, Current level, Current attributes, Current
useable), placed under Sort By. Current level hides results whose level
requirement is above the character level; Current attributes keeps the
equipped attribute check.

Trade results now keep the listing's level requirement, which includes
its mods, so the level check does not fall back to the base level.
Since results can be filtered by requirements, a search returning no
compatible item kept an empty result row and no notice. Go back to the
search view with "No compatible items found for this slot." as before,
and word the filtered-out notice like the other Trader notices.
Restore the original formatting of the whisper button constructor,
comment the Pearl of Tsoatha slot choice, drop a guard the sorted
results never need, and make the dropdown comment cover the level filter.
@mcagnion mcagnion changed the title Add attribute requirement filters to trade queries Add requirement filters to trade queries and Trader results Oct 24, 2026
@mcagnion

Copy link
Copy Markdown
Contributor Author

Updated the PR:

  • The Trader checkbox is replaced by the requirement list of the unique list in the Items tab (Any requirements, Current level, Current attributes, Current useable), placed under Sort By. Current level is new. It uses the level requirement of the trade listing, which reflects its mods, rather than the base item's.
  • Fixed a layout issue from an earlier rebase of this branch: the slot rows started one row lower, so with many jewel sockets the last visible row covered Total Price.
  • A search with no compatible item shows "No compatible items found for this slot." again.

The title and description now cover the level filter.

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.

1 participant