Skip to content

Fix Trader picking the wrong trade stat for signed and fixed-number mods - #10504

Open
mcagnion wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
mcagnion:bugfix/trade-signed-stat-id
Open

mcagnion wants to merge 2 commits into
PathOfBuildingCommunity:devfrom
mcagnion:bugfix/trade-signed-stat-id

Conversation

@mcagnion

Copy link
Copy Markdown
Contributor

Description of the problem being solved:

The trade query generator matches mod lines to trade stats with signs and numbers stripped, and keeps the first match. So:

  • Block mods on staves and two-handed weapons, the shield spell block on Low Life and the glove implicit used the unsigned stat ("#% Chance to Block Attack Damage" instead of "+#%"), so a Required Stat on staff block found nothing. 10 entries.
  • Mods such as "per 16 Intelligence" or Onslaught "for 4 seconds" used the "per 10" or "for 10 seconds" stat. 8 entries.

A shared helper now skips labels whose fixed numbers disagree, unless none agree, and on a sign-only difference prefers the stat the mod exports in tradeHashes. QueryMods.lua includes only the 18 changed entries.

Steps taken to verify a working solution:

  • Three new tests in TestTradeQueryGenerator_spec.lua.
  • In PoB, Find best with a sample of the changed block mods as Required Stat (staff, two-handed axe, sword and mace, shield spell block on Low Life, glove implicit): no results before. After, results for every one the trade site has listings for. Two-handed sword spell block and mace attack block have no listings, so they stay empty.
  • Same check for the fixed numbers on a dagger ("per 16 Intelligence"), a sceptre ("per 16 Strength") and boots (Onslaught "for 4 seconds"): no results before, results after.
  • On the trade site, no non-unique item in these slots lists the old unsigned stat. The ordinary shield spell block keeps its current stat.

Before and after screenshots:

Required Stat list (Find best on a staff, search "Block Attack")

Before After
before-required-stat-block-attack after-required-stat-block-attack

Search result (Standard, explicit attack block, min 6)

Before:

before-find-best-block-attack-results

After:

after-find-best-block-attack-results

Other item classes (Covens, Find best with the block mod as Required Stat)

Two-handed axe, sword and mace, shield, gloves

Two-handed axe, attack block:

before-after-2h-axe-attack

Two-handed axe, spell block:

before-after-2h-axe-spell

Two-handed sword, attack block:

before-after-2h-sword-attack

Two-handed mace, spell block:

before-after-2h-mace-spell

Shield, spell block on Low Life:

before-after-shield-spell-low-life

Gloves, implicit attack block:

before-after-gloves-implicit-attack

Fixed numbers (Covens, Find best with the mod as Required Stat)

Dagger, sceptre, boots

Dagger, "per 16 Intelligence":

before-after-dagger-spell-per-int

Sceptre, "per 16 Strength":

before-after-sceptre-spell-per-str

Boots, Onslaught "for 4 seconds":

before-after-boots-onslaught

ProcessMod matched trade stats by their label with signs and numbers
stripped, so "#% Chance to Block Attack Damage" and its "+#%" sibling
were the same key and the first one in label order won. Ten attack and
spell block mods, seven explicit and three implicit, then queried the
unsigned stat instead of the one they export.

When the stat the mod exports in tradeHashes differs from the first
match only by sign, use it. Identical labels keep label order, because
legacy mods export hashes that Trade no longer lists.
Stripping numbers from labels also merged trade stats that differ only
by a fixed number, such as "per 10 Intelligence" and "per 16
Intelligence", or Onslaught "for 4 seconds" and "for 10 seconds". The
first label in order won, so those mods queried the wrong stat.

Compare the label's fixed numbers with the mod line's numbers at the
same positions, treating a roll range as a value position, and keep
only the labels that agree. When none agree, every label stays a
candidate as before.
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