Originally Posted by sacrife
However, is it possible to add a third sorting? Now it's quality, itemid. Is it possible to add itemcount as a third sort?
And also, how would I go about reversing the quality sort? Now its green > blue > epic. I want to see how it looks the other way.
Its not very important though so don't stress yourself if it's hard ;P
|
This should flip the item quality sort (just replace '<' with '>' to invert) and fall back on item stack counts if two buttons contain the same itemID.
lua Code:
local QuickSort;
do
local func = function(v1, v2)
if v1[2] ~= v2[2] then
return v1[2] > v2[2]; -- Higher quality first
elseif v1[1] ~= v2[1] then
return v1[1] < v2[1];
else -- Compare stack counts
local _, c1 = GetContainerItemInfo(v1[3].bagID, v1[3].slotID);
local _, c2 = GetContainerItemInfo(v2[3].bagID, v2[3].slotID);
return c1 < c2;
end
end;
QuickSort = function(tbl) table.sort(tbl, func); end
end