Open mihawk90 opened 4 months ago
Used this for a couple days now and didn't run into any issues.
Hm so I have used this for a week with no issues, even yesterday, and suddenly today I am getting an error that makes no sense to me...
bad argument #1 to 'table.insert' (table/struct expected, got nil)
stack traceback:
[C]: in function 'table.insert'
user:/AddOns/Dustman/Dustman.lua:554: in function 'pairsByQualityAndQuantity'
user:/AddOns/Dustman/Dustman.lua:594: in function 'SellJunkItems'
user:/AddOns/Dustman/Dustman.lua:1802: in function 'm_callback'
/EsoUI/Libraries/ZO_Dialog/ZO_Dialog.lua:120: in function 'HandleCallback'
/EsoUI/Libraries/ZO_KeybindButton/ZO_KeybindButton.lua:215: in function 'ZO_KeybindButtonMixin:OnClicked'
/EsoUI/Libraries/ZO_Dialog/ZO_Dialog.lua:1238: in function 'ZO_Dialogs_HandleButtonForKeybind'
/EsoUI/Libraries/ZO_Dialog/ZO_Dialog.lua:1250: in function 'ZO_Dialogs_ButtonKeybindPressed'
:1: in function '(main chunk)'
554 table.insert(arrayQuality[data.quality], data)
But the arrayQuality
sub-arrays are getting initialised just above:
for i = 1, 5 do
arrayQuality[i] = {}
end
So I don't know how that can be nil
...
edit: Fixed below, that's what happens when you usually delete all Trash items and don't for once :sweat_smile:
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 :)