Apparently, this is not PHP and you cannot sort lists.
This commit is contained in:
parent
4d11c25c2c
commit
070a1641ef
1 changed files with 10 additions and 7 deletions
|
@ -268,10 +268,13 @@ function core:DrawTooltip()
|
||||||
|
|
||||||
-- Populate a table with the information we want for our tooltip
|
-- Populate a table with the information we want for our tooltip
|
||||||
local tooltipTable = {}
|
local tooltipTable = {}
|
||||||
|
local characters = {}
|
||||||
for realm in pairs(db.global) do
|
for realm in pairs(db.global) do
|
||||||
for name in pairs(db.global[realm]) do
|
for name in pairs(db.global[realm]) do
|
||||||
|
table.insert(characters,name .. '-' .. realm)
|
||||||
local valorPoints = db.global[realm][name].valorPoints.points
|
local valorPoints = db.global[realm][name].valorPoints.points
|
||||||
local class = db.global[realm][name].class
|
local class = db.global[realm][name].class
|
||||||
|
|
||||||
if valorPoints == nil then
|
if valorPoints == nil then
|
||||||
valorPoints = 0
|
valorPoints = 0
|
||||||
end
|
end
|
||||||
|
@ -291,7 +294,7 @@ function core:DrawTooltip()
|
||||||
|
|
||||||
|
|
||||||
-- Sort by name for now
|
-- Sort by name for now
|
||||||
table.sort(tooltipTable, function(a, b) return a.name < b.name end )
|
table.sort(characters, function(a, b) return tooltipTable[a].name:lower() < tooltipTable[b].name:lower() end )
|
||||||
|
|
||||||
|
|
||||||
-- Draw the tooltip
|
-- Draw the tooltip
|
||||||
|
@ -306,27 +309,27 @@ function core:DrawTooltip()
|
||||||
nextColumn = nextColumn + 1
|
nextColumn = nextColumn + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for name,information in pairs(tooltipTable) do
|
for _,name in pairs(characters) do
|
||||||
local characterLine = tooltip:AddLine('')
|
local characterLine = tooltip:AddLine('')
|
||||||
tooltip:SetCell(characterLine, 1, information.name, classColors[information.class], 'LEFT')
|
tooltip:SetCell(characterLine, 1, tooltipTable[name].name, classColors[tooltipTable[name].class], 'LEFT')
|
||||||
|
|
||||||
local valorPointColor
|
local valorPointColor
|
||||||
if information.valorPoints == 980 then
|
if tooltipTable[name].valorPoints == 980 then
|
||||||
valorPointColor = flagColors['red']
|
valorPointColor = flagColors['red']
|
||||||
else
|
else
|
||||||
valorPointColor = flagColors['green']
|
valorPointColor = flagColors['green']
|
||||||
end
|
end
|
||||||
tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
|
tooltip:SetCell(characterLine, 2, tooltipTable[name].valorPoints, valorPointColor, 'RIGHT')
|
||||||
|
|
||||||
local nextColumn = 3
|
local nextColumn = 3
|
||||||
for instance, abbreviation in pairs(trackedInstances) do
|
for instance, abbreviation in pairs(trackedInstances) do
|
||||||
local instanceColor
|
local instanceColor
|
||||||
if information[instance] == 0 then
|
if tooltipTable[name][instance] == 0 then
|
||||||
instanceColor = flagColors['green']
|
instanceColor = flagColors['green']
|
||||||
else
|
else
|
||||||
instanceColor = flagColors['red']
|
instanceColor = flagColors['red']
|
||||||
end
|
end
|
||||||
tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
tooltip:SetCell(characterLine, nextColumn, tooltipTable[name][instance], instanceColor, 'RIGHT')
|
||||||
|
|
||||||
nextColumn = nextColumn + 1
|
nextColumn = nextColumn + 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue