Bagnon
Bagnon copied to clipboard
Sorting of stackable items clunky
Running Software:
- Addon version: 9.0.6
- Server patch: 1.3.17.38475
Have you read the changelog? Yarp.
Describe the bug Video says more than a thousand words...
https://user-images.githubusercontent.com/15060897/116624885-05350680-a949-11eb-8c8b-18fca61fcb94.mp4
Expected behaviour Only swap first and last item stack.
This solution is for TBC-Classic. I think I fixed the problem by replacing the stack count sorting method, though I haven't tested it extensively to see if it results in other problems but seems to work.
You only need to change this file (too lazy to fork and do a pull-request):
AddOns\Bagnon\common\Wildpants\api\sorting.lua
Comment out the stack count property like below so that it no longer sorts it using this method (near the top of the file):
Sort.Proprieties = {
'set',
'class', 'subclass', 'equip',
'quality',
'icon',
'level', 'name', 'id',
-- 'count' -- comment this out
}
Add in the stack-count-sorting code block below at the bottom of the Sort:Iterate function: (Note: it looks almost like the block of code at the top of the same function, don't touch that one)
function Sort:Iterate()
...
...
...
-- Add this new block of code
-- Sort by count after everything else is done
if not self:Delaying('Run') then
for k, target in pairs(spaces) do
local item = target.item
if item.id and item.count then
for j = #spaces, k+1, -1 do
local from = spaces[j]
local other = from.item
if item.id == other.id and item.count < other.count then
self:Move(from, target)
self:Delay(0.05, 'Run')
break
end
end
end
end
end
-- Existing code
if not self:Delaying('Run') then
self:Stop()
end
end