1
0
Fork 0

Store with name and realm in table to prevent duplicate name issues.

This commit is contained in:
Andrew Tomaka 2011-09-19 09:11:10 -04:00
parent 934b03bed9
commit 4d11c25c2c

View file

@ -111,12 +111,6 @@ function core:OnEnable()
end end
end, end,
OnEnter = function(self) OnEnter = function(self)
local columnCount = 2
for instance,abbreviation in pairs(trackedInstances) do
columnCount = columnCount + 1
end
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
core:DrawTooltip() core:DrawTooltip()
tooltip:SmartAnchorTo(self) tooltip:SmartAnchorTo(self)
@ -266,8 +260,13 @@ function core:GetNextVPReset()
end end
function core:DrawTooltip() function core:DrawTooltip()
-- Instead of drawing the tooltip directly from data, we will populate a table, local columnCount = 2
-- sort the table, and then use the table to draw the tooltip for instance,abbreviation in pairs(trackedInstances) do
columnCount = columnCount + 1
end
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
-- Populate a table with the information we want for our tooltip
local tooltipTable = {} local tooltipTable = {}
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
@ -276,7 +275,7 @@ function core:DrawTooltip()
if valorPoints == nil then if valorPoints == nil then
valorPoints = 0 valorPoints = 0
end end
tooltipTable[name] = { name = name, realm = realm, class = class, valorPoints = valorPoints } tooltipTable[name .. '-' .. realm] = { name = name, realm = realm, class = class, valorPoints = valorPoints }
for instance in pairs(trackedInstances) do for instance in pairs(trackedInstances) do
local defeatedBosses local defeatedBosses
@ -285,15 +284,18 @@ function core:DrawTooltip()
else else
defeatedBosses = 0 defeatedBosses = 0
end end
tooltipTable[name][instance] = defeatedBosses tooltipTable[name .. '-' .. realm][instance] = defeatedBosses
end end
end end
end end
-- Sort by name for now -- Sort by name for now
table.sort(tooltipTable, function(a, b) return a.name:lower() < b.name:lower() end ) table.sort(tooltipTable, function(a, b) return a.name < b.name end )
-- Draw the tooltip
tooltip:SetScale(1)
tooltip:AddHeader('') tooltip:AddHeader('')
local valorPointColumn = tooltip:AddColumn('LEFT') local valorPointColumn = tooltip:AddColumn('LEFT')
tooltip:SetCell(1, 1, '') tooltip:SetCell(1, 1, '')