Sell Fence items by Quantity (after Quality-sort) #7
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.
This implements a new function which not only sorts by Quality, but also by Quantity in each individual stack.
This is useful for Vendors with limited transactions (i.e. Fences), and can be used to sell both the highest quality goods (which is already the case), as well as freeing as many bag slots as possible by prioritising smaller stacks in the inventory. Dustman already handles selling parts of larger stacks so "leftover" stacks are not a concern.
If you have any pointers on how this may be achieved more elegantly/efficiently, I'll be happy to work on this more. I'm just not very experienced in LUA (I dabbled back in the WoW days but that was 10 years ago...), but from preliminary testing it seems to work just fine.
I'm putting this in Draft until I had some time to actually test in game (I wrote this overnight when my Fence limit was already reached), but from the debug dumps I was logging it seems to all be working as expected.
Although this should be working just fine with any vendor, I deliberately implemented a new function so as to not interfere with other functionality I may not be aware of, and only adopted it for selling at a fence.
edit:
One day and a full bag of stolen goods later...
I'd say it works pretty well :)