Skip to content

Allow negative values in trade filters and add Max filter support - #10248

Open
ikidoncc wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
ikidoncc:fix/trade-negatives-max
Open

Allow negative values in trade filters and add Max filter support#10248
ikidoncc wants to merge 1 commit into
PathOfBuildingCommunity:devfrom
ikidoncc:fix/trade-negatives-max

Conversation

@ikidoncc

Copy link
Copy Markdown

Description of the problem being solved:

  1. Negative Value Input Restriction in Trade UI

    Many modifiers in Path of Exile have negative values (e.g., -# to Total Mana Cost of Skills, -#% to Nearby Enemies' Cold Resistance).

    When players used the PoB Trader pane to search for item upgrades, the UI stripped out the minus sign (-), preventing users from entering negative values in custom mod filters.

  2. Missing Max Filter in Required Modifiers

    The Trade Query Generator pop-up only had a Min field for required modifiers. Users could not specify a Max limit, which is often necessary when searching for items within a specific range or when capping certain stats.

Solution implemented

  1. Allow Negative Numbers

    Updated TradeHelpers.lua:550 to include %- in the sanitization filter patterns.

    • Decimal fields: changed from ^%d. to ^%-%d.
    • Integer fields: changed from %D to ^%-%d
  2. Add Max Input Field to the UI

    Modified TradeQueryGenerator.lua to add a new maximumBox using the newPlainNumericEdit helper.

    • Adjusted layout parameters, including fieldWidth from 60 to 50 and auxControlWidth, so both Min and Max fields fit next to the dropdown in the pop-up.
    • Bound the Max field to save changes to the maxValue field of the selected modifier.
  3. Include Max Value in PoE Trade API Query

    Updated the query serialization logic in TradeQueryGenerator.lua to include the max field inside the value object when maxValue is set.

    "value": {
        "min": X,
        "max": Y
    }

Verification / Testing performed

  1. Unit Tests Added

    • Added tests to TestTradeHelpers_spec.lua validating that newPlainNumericEdit generates the correct filter patterns for decimal and integer fields, allowing the - sign.

    • Added tests to TestTradeQueryGenerator_spec.lua verifying that the query serializer correctly handles value.min and value.max for:

      • min only
      • max only
      • both min and max
      • neither
      • negative values
  2. Full Test Suite

    Ran the entire test suite using Docker:

    docker compose up

    525 tests passed, with 0 failures and 0 errors.

Before screenshot:

image

After screenshot:

image

@ikidoncc
ikidoncc force-pushed the fix/trade-negatives-max branch from 354e4fa to f3018e9 Compare August 19, 2026 05:23
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