Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.luaincludes only the 18 changed entries.Steps taken to verify a working solution:
TestTradeQueryGenerator_spec.lua.Before and after screenshots:
Required Stat list (Find best on a staff, search "Block Attack")
Search result (Standard, explicit attack block, min 6)
Before:
After:
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:
Two-handed axe, spell block:
Two-handed sword, attack block:
Two-handed mace, spell block:
Shield, spell block on Low Life:
Gloves, implicit attack block:
Fixed numbers (Covens, Find best with the mod as Required Stat)
Dagger, sceptre, boots
Dagger, "per 16 Intelligence":
Sceptre, "per 16 Strength":
Boots, Onslaught "for 4 seconds":