Refactor buy similar to match by stat descriptors #2314
Draft
vaisest wants to merge 6 commits into
Draft
Conversation
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:
I don't think my previous approach of looking up mods that would fit the item was really correct. This doesn't have many advantages right now, but I think this is more maintainable (e.g. new mod categories don't need to be paid attention to), makes more sense, and solves some mod matching issues.
Basically, the idea is to convert the
{n}pattern of stat descriptors to a Lua pattern, which we can then iterate over to find a match. Local vs global mods are handled similar to EE2 by just adding a count filter with all matched optionsSome option-based mods were also fixed that were broken due to casing or incorrect newline handling. Timeless jewel mods are still broken because PoB splits it into two mods, but who cares. This allows for matching mods which can have various forms based on the mod value, and the same descriptors should also include data on whether the value should be negated. This should also fix some mods where the first number in the line is NOT what is entered on the trade site, although this only includes a handful of mods
I'm also going to add tests of some sort
Steps taken to verify a working solution:
Link to a build that showcases this PR:
Before screenshot:
After screenshot:
Based on display item buy similar PR for testing purposes (first 3 commits)