Skip to content

Commit

Permalink
Fix sorting by ilvl
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirri777 committed Oct 31, 2024
1 parent 703dfa5 commit 3836417
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ end
function AddOn:repositionFrames()
local lastentry = nil
local sortByIlvl = {}
local ilvls = {}

tsort(AddOn.Entries, function(a, b)
-- sort by ilvl
Expand All @@ -119,13 +120,20 @@ function AddOn:repositionFrames()
if ilvl ~= nil and ilvl > 0 then
if sortByIlvl[ilvl] == nil then
sortByIlvl[ilvl] = {}
table.insert(ilvls, ilvl)
end

table.insert(sortByIlvl[ilvl], AddOn.Entries[i])
end
end

for _, entries in pairs(sortByIlvl) do
tsort(ilvls, function(a, b)
return a > b
end)

for _, ilvl in pairs(ilvls) do
local entries = sortByIlvl[ilvl]

tsort(entries, function(a, b)
local aitemID, bitemID = tonumber(a.itemID), tonumber(b.itemID)
return aitemID > bitemID
Expand Down

0 comments on commit 3836417

Please sign in to comment.