From 2106926a1e0f753d5fba9128e02c5d5627e9548d Mon Sep 17 00:00:00 2001 From: atomaka Date: Mon, 19 Sep 2011 07:42:17 -0400 Subject: [PATCH] Create table of information needed in tooltip. --- ChoreTracker.lua | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ChoreTracker.lua b/ChoreTracker.lua index b5a50f0..072e2b0 100644 --- a/ChoreTracker.lua +++ b/ChoreTracker.lua @@ -268,7 +268,40 @@ end function core:DrawTooltip() -- Instead of drawing the tooltip directly from data, we will populate a table, -- sort the table, and then use the table to draw the tooltip - + local tooltipTable = {} + for realm in pairs(db.global) do + for name in pairs(db.global[realm]) do + local valorPoints = db.global[realm][name].valorPoints.points + if valorPoints == nil then + valorPoints = 0 + end + tooltipTable[name] = { name = name, valorPoints = valorPoints } + + for instance in pairs(trackedInstances) do + local defeatedBosses + if db.global[realm][name].lockouts[instance] ~= nil then + defeatedBosses = db.global[realm][name].lockouts[instance].defeatedBosses + else + defeatedBosses = 0 + end + tooltipTable[name][instance] = defeatedBosses + end + end + end + + + -- Sort by name for now + table.sort(tooltipTable, function(a, b) return a.name < b.name end ) + + for name,info in pairs(tooltipTable) do + local printString = name + + for header,value in pairs(info) do + printString = printString .. ' ' .. value + end + print(printString) + end + tooltip:AddHeader('') local valorPointColumn = tooltip:AddColumn('LEFT') tooltip:SetCell(1, 1, '')