Various reorganizing.
This commit is contained in:
parent
d7efdbe934
commit
79ba491c9a
1 changed files with 99 additions and 97 deletions
196
ChoreTracker.lua
196
ChoreTracker.lua
|
@ -1,15 +1,12 @@
|
||||||
ChoreTracker = LibStub('AceAddon-3.0'):NewAddon('ChoreTracker', 'AceConsole-3.0', 'AceEvent-3.0')
|
ChoreTracker = LibStub('AceAddon-3.0'):NewAddon('ChoreTracker', 'AceConsole-3.0', 'AceEvent-3.0')
|
||||||
local core = ChoreTracker
|
local core = ChoreTracker
|
||||||
local LQT, LDB, LDBIcon, LBZ
|
local LQT, LDB, LDBIcon
|
||||||
local db, tooltip, vpResetTime
|
|
||||||
local fontObjects = { }
|
|
||||||
|
|
||||||
-- Localization
|
-- Localization
|
||||||
local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker')
|
local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker')
|
||||||
|
|
||||||
-- Get localized instances
|
-- Get localized instances
|
||||||
LBZ = LibStub('LibBabble-Zone-3.0')
|
local Z = LibStub('LibBabble-Zone-3.0'):GetLookupTable()
|
||||||
local Z = LBZ:GetLookupTable()
|
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
global = {},
|
global = {},
|
||||||
|
@ -44,8 +41,8 @@ local options = {
|
||||||
desc = L['Removes the icon from your minimap.'],
|
desc = L['Removes the icon from your minimap.'],
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
order = 1,
|
order = 1,
|
||||||
get = function(info) return db.profile.minimap.hide end,
|
get = function(info) return core.db.profile.minimap.hide end,
|
||||||
set = function(info, value) db.profile.minimap.hide = value LDBIcon[value and 'Hide' or 'Show'](LDBIcon, 'ChoreTracker') end,
|
set = function(info, value) core.db.profile.minimap.hide = value LDBIcon[value and 'Hide' or 'Show'](LDBIcon, 'ChoreTracker') end,
|
||||||
},
|
},
|
||||||
verticalHeader = {
|
verticalHeader = {
|
||||||
name = L['Vertical Sorting'],
|
name = L['Vertical Sorting'],
|
||||||
|
@ -58,8 +55,8 @@ local options = {
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
width = 'full',
|
width = 'full',
|
||||||
order = 3,
|
order = 3,
|
||||||
get = function(info) return db.profile.currentOnTop end,
|
get = function(info) return core.db.profile.currentOnTop end,
|
||||||
set = function(info, value) db.profile.currentOnTop = value end,
|
set = function(info, value) core.db.profile.currentOnTop = value end,
|
||||||
},
|
},
|
||||||
sortType = {
|
sortType = {
|
||||||
name = L['Sort Field'],
|
name = L['Sort Field'],
|
||||||
|
@ -67,8 +64,8 @@ local options = {
|
||||||
type = 'select',
|
type = 'select',
|
||||||
order = 5,
|
order = 5,
|
||||||
values = { L['Character'], L['Valor Points'], L['Class'] },
|
values = { L['Character'], L['Valor Points'], L['Class'] },
|
||||||
get = function(info) return db.profile.sortType end,
|
get = function(info) return core.db.profile.sortType end,
|
||||||
set = function(info, value) db.profile.sortType = value end,
|
set = function(info, value) core.db.profile.sortType = value end,
|
||||||
},
|
},
|
||||||
sortingDirection = {
|
sortingDirection = {
|
||||||
name = L['Sorting Direction'],
|
name = L['Sorting Direction'],
|
||||||
|
@ -76,8 +73,8 @@ local options = {
|
||||||
type = 'select',
|
type = 'select',
|
||||||
order = 6,
|
order = 6,
|
||||||
values = { L['Ascending'], L['Descending'] },
|
values = { L['Ascending'], L['Descending'] },
|
||||||
get = function(info) return db.profile.sortDirection end,
|
get = function(info) return core.db.profile.sortDirection end,
|
||||||
set = function(info, value) db.profile.sortDirection = value end,
|
set = function(info, value) core.db.profile.sortDirection = value end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -91,16 +88,16 @@ local options = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function core:OnInitialize()
|
function core:OnInitialize()
|
||||||
db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
|
self.db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
|
||||||
|
|
||||||
local level = UnitLevel('player')
|
local level = UnitLevel('player')
|
||||||
local realm = GetRealmName()
|
local realm = GetRealmName()
|
||||||
local name = UnitName('player')
|
local name = UnitName('player')
|
||||||
if db.global[realm] == nil then
|
if self.db.global[realm] == nil then
|
||||||
db.global[realm] = {}
|
db.global[realm] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
if db.global[realm][name] == nil and level == 85 then
|
if self.db.global[realm][name] == nil and level == 85 then
|
||||||
db.global[realm][name] = {}
|
db.global[realm][name] = {}
|
||||||
|
|
||||||
local class = UnitClass('player')
|
local class = UnitClass('player')
|
||||||
|
@ -111,7 +108,7 @@ function core:OnInitialize()
|
||||||
|
|
||||||
db.global[realm][name].class = class
|
db.global[realm][name].class = class
|
||||||
db.global[realm][name].valorPoints = {
|
db.global[realm][name].valorPoints = {
|
||||||
valorPoints = 0,
|
points = 0,
|
||||||
resetTime = 0,
|
resetTime = 0,
|
||||||
}
|
}
|
||||||
db.global[realm][name].lockouts = {}
|
db.global[realm][name].lockouts = {}
|
||||||
|
@ -120,26 +117,30 @@ end
|
||||||
|
|
||||||
function core:OnEnable()
|
function core:OnEnable()
|
||||||
LQT = LibStub('LibQTip-1.0')
|
LQT = LibStub('LibQTip-1.0')
|
||||||
|
|
||||||
|
self.instanceInfoTime = false
|
||||||
|
self.vpResetTime = false
|
||||||
|
|
||||||
-- Setup font strings for later. (RAID_CLASS_COLORS always indexed in English?)
|
-- Setup font strings for later. (RAID_CLASS_COLORS always indexed in English?)
|
||||||
|
self.fontObjects = { }
|
||||||
for class,color in pairs(RAID_CLASS_COLORS) do
|
for class,color in pairs(RAID_CLASS_COLORS) do
|
||||||
class = class:lower()
|
class = class:lower()
|
||||||
if class == 'deathknight' then
|
if class == 'deathknight' then
|
||||||
class = 'death knight'
|
class = 'death knight'
|
||||||
end
|
end
|
||||||
|
|
||||||
fontObjects[class] = CreateFont('ClassFont' .. class)
|
self.fontObjects[class] = CreateFont('ClassFont' .. class)
|
||||||
fontObjects[class]:CopyFontObject(GameTooltipText)
|
self.fontObjects[class]:CopyFontObject(GameTooltipText)
|
||||||
fontObjects[class]:SetTextColor(color.r, color.g, color.b)
|
self.fontObjects[class]:SetTextColor(color.r, color.g, color.b)
|
||||||
end
|
end
|
||||||
|
|
||||||
fontObjects['green'] = CreateFont('FlagFontGreen')
|
self.fontObjects['green'] = CreateFont('FlagFontGreen')
|
||||||
fontObjects['green']:CopyFontObject(GameTooltipText)
|
self.fontObjects['green']:CopyFontObject(GameTooltipText)
|
||||||
fontObjects['green']:SetTextColor(0, 255, 0)
|
self.fontObjects['green']:SetTextColor(0, 255, 0)
|
||||||
|
|
||||||
fontObjects['red'] = CreateFont('FlagFontRed')
|
self.fontObjects['red'] = CreateFont('FlagFontRed')
|
||||||
fontObjects['red']:CopyFontObject(GameTooltipText)
|
self.fontObjects['red']:CopyFontObject(GameTooltipText)
|
||||||
fontObjects['red']:SetTextColor(255, 0, 0)
|
self.fontObjects['red']:SetTextColor(255, 0, 0)
|
||||||
|
|
||||||
-- Setup LDB
|
-- Setup LDB
|
||||||
LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', {
|
LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', {
|
||||||
|
@ -155,10 +156,10 @@ function core:OnEnable()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Cycle through our sort options
|
-- Cycle through our sort options
|
||||||
if db.profile.sortType == 1 then
|
if self.db.profile.sortType == 1 then
|
||||||
db.profile.sortType = 2
|
db.profile.sortType = 2
|
||||||
core:DrawTooltip()
|
core:DrawTooltip()
|
||||||
elseif db.profile.sortType == 2 then
|
elseif self.db.profile.sortType == 2 then
|
||||||
db.profile.sortType = 3
|
db.profile.sortType = 3
|
||||||
core:DrawTooltip()
|
core:DrawTooltip()
|
||||||
else
|
else
|
||||||
|
@ -170,20 +171,20 @@ function core:OnEnable()
|
||||||
OnEnter = function(self)
|
OnEnter = function(self)
|
||||||
core:DrawTooltip()
|
core:DrawTooltip()
|
||||||
|
|
||||||
tooltip:SmartAnchorTo(self)
|
core.tooltip:SmartAnchorTo(self)
|
||||||
tooltip:Show()
|
core.tooltip:Show()
|
||||||
end,
|
end,
|
||||||
OnLeave = function(self)
|
OnLeave = function(self)
|
||||||
LQT:Release(tooltip)
|
LQT:Release(core.tooltip)
|
||||||
tooltip = nil
|
core.tooltip = nil
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Deal with minimap
|
-- Deal with minimap
|
||||||
LDBIcon = LibStub('LibDBIcon-1.0')
|
LDBIcon = LibStub('LibDBIcon-1.0')
|
||||||
LDBIcon:Register('ChoreTracker', LDB, db.profile.minimap)
|
LDBIcon:Register('ChoreTracker', LDB, self.db.profile.minimap)
|
||||||
|
|
||||||
if db.profile.minimap.hide then
|
if self.db.profile.minimap.hide then
|
||||||
LDBIcon:Hide('ChoreTracker')
|
LDBIcon:Hide('ChoreTracker')
|
||||||
else
|
else
|
||||||
LDBIcon:Show('ChoreTracker')
|
LDBIcon:Show('ChoreTracker')
|
||||||
|
@ -226,7 +227,8 @@ function core:CALENDAR_UPDATE_EVENT_LIST()
|
||||||
core:GetNextVPReset()
|
core:GetNextVPReset()
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:UPDATE_INSTANCE_INFO()
|
function core:UPDATE_INSTANCE_INFO()
|
||||||
|
self.instanceInfoTime = time()
|
||||||
core:UpdateRaidLockouts()
|
core:UpdateRaidLockouts()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -253,22 +255,22 @@ function core:UpdateValorPoints()
|
||||||
local realm = GetRealmName()
|
local realm = GetRealmName()
|
||||||
local name = UnitName('player')
|
local name = UnitName('player')
|
||||||
|
|
||||||
local _,_,_,earnedThisWeek = GetCurrencyInfo(396)
|
local _, _, _, earnedThisWeek = GetCurrencyInfo(396)
|
||||||
|
|
||||||
if db.global[realm][name].valorPoints == nil then
|
if self.db.global[realm][name].valorPoints == nil then
|
||||||
db.global[realm][name].valorPoints = {}
|
self.db.global[realm][name].valorPoints = {}
|
||||||
end
|
end
|
||||||
db.global[realm][name].valorPoints.points = earnedThisWeek
|
self.db.global[realm][name].valorPoints.points = earnedThisWeek
|
||||||
if vpResetTime ~= nil then
|
if vpResetTime ~= false then
|
||||||
db.global[realm][name].valorPoints.resetTime = vpResetTime
|
self.db.global[realm][name].valorPoints.resetTime = self.vpResetTime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:ResetValorPoints()
|
function core:ResetValorPoints()
|
||||||
for realm,realmTable in pairs(db.global) do
|
for realm,realmTable in pairs(self.db.global) do
|
||||||
for name in pairs(realmTable) do
|
for name in pairs(realmTable) do
|
||||||
if db.global[realm][name].valorPoints.resetTime < time() then
|
if self.db.global[realm][name].valorPoints.resetTime < time() then
|
||||||
db.global[realm][name].valorPoints = {
|
self.db.global[realm][name].valorPoints = {
|
||||||
points = 0,
|
points = 0,
|
||||||
resetTime = 0,
|
resetTime = 0,
|
||||||
}
|
}
|
||||||
|
@ -285,22 +287,22 @@ function core:UpdateRaidLockouts()
|
||||||
for i = 1, savedInstances do
|
for i = 1, savedInstances do
|
||||||
local instanceName, _, instanceReset, _, _, _, _, _, _, _, _, defeatedBosses = GetSavedInstanceInfo(i)
|
local instanceName, _, instanceReset, _, _, _, _, _, _, _, _, defeatedBosses = GetSavedInstanceInfo(i)
|
||||||
|
|
||||||
if db.profile.instances[instanceName] ~= nil then
|
if self.db.profile.instances[instanceName] ~= nil then
|
||||||
if instanceReset > 0 then
|
if instanceReset > 0 then
|
||||||
db.global[realm][name].lockouts[instanceName] = {}
|
self.db.global[realm][name].lockouts[instanceName] = {}
|
||||||
db.global[realm][name].lockouts[instanceName].defeatedBosses = defeatedBosses
|
self.db.global[realm][name].lockouts[instanceName].defeatedBosses = defeatedBosses
|
||||||
db.global[realm][name].lockouts[instanceName].resetTime = time() + instanceReset
|
self.db.global[realm][name].lockouts[instanceName].resetTime = self.instanceInfoTime + instanceReset
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:ResetRaidLockouts()
|
function core:ResetRaidLockouts()
|
||||||
for realm,realmTable in pairs(db.global) do
|
for realm,realmTable in pairs(self.db.global) do
|
||||||
for name in pairs(realmTable) do
|
for name in pairs(realmTable) do
|
||||||
for instance,instanceTable in pairs(db.global[realm][name].lockouts) do
|
for instance,instanceTable in pairs(self.db.global[realm][name].lockouts) do
|
||||||
if instanceTable.resetTime < time() then
|
if instanceTable.resetTime < time() then
|
||||||
db.global[realm][name].lockouts[instance] = nil
|
self.db.global[realm][name].lockouts[instance] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -336,13 +338,13 @@ function core:DrawInstanceOptions()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
local i = 1
|
local i = 1
|
||||||
for instance, abbreviation in pairs(db.profile.instances) do
|
for instance, abbreviation in pairs(self.db.profile.instances) do
|
||||||
if db.profile.instances[instance].removed == false then
|
if self.db.profile.instances[instance].removed == false then
|
||||||
options.args.instances.args[instance .. 'Enable'] = {
|
options.args.instances.args[instance .. 'Enable'] = {
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = instance,
|
name = instance,
|
||||||
order = 4 * i,
|
order = 4 * i,
|
||||||
get = function(info) return db.profile.instances[instance].enable end,
|
get = function(info) return self.db.profile.instances[instance].enable end,
|
||||||
set = function(info, value)
|
set = function(info, value)
|
||||||
db.profile.instances[instance].enable = value
|
db.profile.instances[instance].enable = value
|
||||||
core:DrawInstanceOptions()
|
core:DrawInstanceOptions()
|
||||||
|
@ -353,8 +355,8 @@ function core:DrawInstanceOptions()
|
||||||
name = '',
|
name = '',
|
||||||
order = 4 * i + 1,
|
order = 4 * i + 1,
|
||||||
width = 'half',
|
width = 'half',
|
||||||
get = function(info) return db.profile.instances[instance].abbreviation end,
|
get = function(info) return self.db.profile.instances[instance].abbreviation end,
|
||||||
set = function(info, value) db.profile.instances[instance].abbreviation = value end,
|
set = function(info, value) self.db.profile.instances[instance].abbreviation = value end,
|
||||||
}
|
}
|
||||||
options.args.instances.args[instance .. 'Remove'] = {
|
options.args.instances.args[instance .. 'Remove'] = {
|
||||||
type = 'execute',
|
type = 'execute',
|
||||||
|
@ -423,10 +425,9 @@ function core:GetNextVPReset()
|
||||||
resetDate.min = resetTime.min
|
resetDate.min = resetTime.min
|
||||||
resetDate.sec = resetTime.sec
|
resetDate.sec = resetTime.sec
|
||||||
|
|
||||||
vpResetTime = time(resetDate)
|
self.vpResetTime = time(resetDate)
|
||||||
else
|
else
|
||||||
print('Error: Could not caculate the next VP Reset Time.')
|
print('Error: Could not caculate the next VP Reset Time.')
|
||||||
vpResetTime = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -474,46 +475,47 @@ function core:DrawTooltip()
|
||||||
local level = UnitLevel('player')
|
local level = UnitLevel('player')
|
||||||
if level == 85 then
|
if level == 85 then
|
||||||
-- Should not update without being 100% sure our raid info is correct
|
-- Should not update without being 100% sure our raid info is correct
|
||||||
--core:UpdateChores()
|
core:UpdateValorPoints()
|
||||||
|
core:UpdateRaidLockouts()
|
||||||
end
|
end
|
||||||
|
|
||||||
if tooltip then
|
if self.tooltip then
|
||||||
tooltip:ClearAllPoints()
|
self.tooltip:ClearAllPoints()
|
||||||
tooltip:Clear()
|
self.tooltip:Clear()
|
||||||
tooltip = nil
|
self.tooltip = nil
|
||||||
end
|
end
|
||||||
local columnCount = 2
|
local columnCount = 2
|
||||||
for instance in pairs(db.profile.instances) do
|
for instance in pairs(self.db.profile.instances) do
|
||||||
if db.profile.instances[instance].enable == true and db.profile.instances[instance].removed == false then
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
||||||
columnCount = columnCount + 1
|
columnCount = columnCount + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
|
self.tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
|
||||||
|
|
||||||
-- 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 currentTable = {}
|
local currentTable = {}
|
||||||
for realm in pairs(db.global) do
|
for realm in pairs(self.db.global) do
|
||||||
for name in pairs(db.global[realm]) do
|
for name in pairs(self.db.global[realm]) do
|
||||||
local valorPoints = db.global[realm][name].valorPoints.points
|
local valorPoints = self.db.global[realm][name].valorPoints.points
|
||||||
local class = db.global[realm][name].class
|
local class = self.db.global[realm][name].class
|
||||||
|
|
||||||
if valorPoints == nil then
|
if valorPoints == nil then
|
||||||
valorPoints = 0
|
valorPoints = 0
|
||||||
end
|
end
|
||||||
local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints }
|
local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints }
|
||||||
|
|
||||||
for instance in pairs(db.profile.instances) do
|
for instance in pairs(self.db.profile.instances) do
|
||||||
local defeatedBosses
|
local defeatedBosses
|
||||||
if db.global[realm][name].lockouts[instance] ~= nil then
|
if self.db.global[realm][name].lockouts[instance] ~= nil then
|
||||||
defeatedBosses = db.global[realm][name].lockouts[instance].defeatedBosses
|
defeatedBosses = self.db.global[realm][name].lockouts[instance].defeatedBosses
|
||||||
else
|
else
|
||||||
defeatedBosses = 0
|
defeatedBosses = 0
|
||||||
end
|
end
|
||||||
characterTable[instance] = defeatedBosses
|
characterTable[instance] = defeatedBosses
|
||||||
end
|
end
|
||||||
|
|
||||||
if name == UnitName('player') and db.profile.currentOnTop == true then
|
if name == UnitName('player') and self.db.profile.currentOnTop == true then
|
||||||
currentTable = characterTable
|
currentTable = characterTable
|
||||||
else
|
else
|
||||||
table.insert(tooltipTable, characterTable)
|
table.insert(tooltipTable, characterTable)
|
||||||
|
@ -524,18 +526,18 @@ function core:DrawTooltip()
|
||||||
-- Sort table according to options.
|
-- Sort table according to options.
|
||||||
local sortTooltip = function(a, b)
|
local sortTooltip = function(a, b)
|
||||||
local aValue, bValue
|
local aValue, bValue
|
||||||
if db.profile.sortType == 1 then
|
if self.db.profile.sortType == 1 then
|
||||||
aValue = a.name:lower()
|
aValue = a.name:lower()
|
||||||
bValue = b.name:lower()
|
bValue = b.name:lower()
|
||||||
elseif db.profile.sortType == 2 then
|
elseif self.db.profile.sortType == 2 then
|
||||||
aValue = a.valorPoints
|
aValue = a.valorPoints
|
||||||
bValue = b.valorPoints
|
bValue = b.valorPoints
|
||||||
elseif db.profile.sortType == 3 then
|
elseif self.db.profile.sortType == 3 then
|
||||||
aValue = a.class
|
aValue = a.class
|
||||||
bValue = b.class
|
bValue = b.class
|
||||||
end
|
end
|
||||||
|
|
||||||
if db.profile.sortDirection == 1 then
|
if self.db.profile.sortDirection == 1 then
|
||||||
return aValue < bValue
|
return aValue < bValue
|
||||||
else
|
else
|
||||||
return aValue > bValue
|
return aValue > bValue
|
||||||
|
@ -544,7 +546,7 @@ function core:DrawTooltip()
|
||||||
table.sort(tooltipTable, sortTooltip )
|
table.sort(tooltipTable, sortTooltip )
|
||||||
|
|
||||||
-- Toss the current character on top if it is set that way
|
-- Toss the current character on top if it is set that way
|
||||||
if db.profile.currentOnTop == true then
|
if self.db.profile.currentOnTop == true then
|
||||||
table.insert(tooltipTable, 1, currentTable)
|
table.insert(tooltipTable, 1, currentTable)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -552,49 +554,49 @@ function core:DrawTooltip()
|
||||||
-- Draw tooltip table then looped through.
|
-- Draw tooltip table then looped through.
|
||||||
|
|
||||||
-- Draw the tooltip
|
-- Draw the tooltip
|
||||||
tooltip:AddHeader('')
|
self.tooltip:AddHeader('')
|
||||||
tooltip:SetScale(1)
|
self.tooltip:SetScale(1)
|
||||||
local valorPointColumn = tooltip:AddColumn('LEFT')
|
local valorPointColumn = self.tooltip:AddColumn('LEFT')
|
||||||
tooltip:SetCell(1, 1, '')
|
self.tooltip:SetCell(1, 1, '')
|
||||||
tooltip:SetCell(1, 2, 'VP')
|
self.tooltip:SetCell(1, 2, 'VP')
|
||||||
|
|
||||||
-- Build and sort our headers
|
-- Build and sort our headers
|
||||||
local headerTable = { }
|
local headerTable = { }
|
||||||
--headerTable['Valor Points'] = { abbreviation = 'VP', enable = true, removed = false, }
|
--headerTable['Valor Points'] = { abbreviation = 'VP', enable = true, removed = false, }
|
||||||
for instance, instanceInfo in pairs(db.profile.instances) do
|
for instance, instanceInfo in pairs(self.db.profile.instances) do
|
||||||
if db.profile.instances[instance].enable == true and db.profile.instances[instance].removed == false then
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
||||||
table.insert(headerTable,instanceInfo)
|
table.insert(headerTable,instanceInfo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local nextColumn = 3
|
local nextColumn = 3
|
||||||
for instance,instanceInfo in pairs(headerTable) do
|
for instance,instanceInfo in pairs(headerTable) do
|
||||||
tooltip:SetCell(1, nextColumn, instanceInfo.abbreviation, nil, 'CENTER')
|
self.tooltip:SetCell(1, nextColumn, instanceInfo.abbreviation, nil, 'CENTER')
|
||||||
nextColumn = nextColumn + 1
|
nextColumn = nextColumn + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,information in pairs(tooltipTable) do
|
for _,information in pairs(tooltipTable) do
|
||||||
local characterLine = tooltip:AddLine('')
|
local characterLine = self.tooltip:AddLine('')
|
||||||
tooltip:SetCell(characterLine, 1, information.name, fontObjects[information.class], 'LEFT')
|
self.tooltip:SetCell(characterLine, 1, information.name, self.fontObjects[information.class], 'LEFT')
|
||||||
|
|
||||||
local valorPointColor
|
local valorPointColor
|
||||||
if information.valorPoints == 980 then
|
if information.valorPoints == 980 then
|
||||||
valorPointColor = fontObjects['red']
|
valorPointColor = self.fontObjects['red']
|
||||||
else
|
else
|
||||||
valorPointColor = fontObjects['green']
|
valorPointColor = self.fontObjects['green']
|
||||||
end
|
end
|
||||||
tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
|
self.tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
|
||||||
|
|
||||||
local nextColumn = 3
|
local nextColumn = 3
|
||||||
for instance, abbreviation in pairs(db.profile.instances) do
|
for instance, abbreviation in pairs(self.db.profile.instances) do
|
||||||
if db.profile.instances[instance].enable == true and db.profile.instances[instance].removed == false then
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
||||||
local instanceColor
|
local instanceColor
|
||||||
if information[instance] == 0 then
|
if information[instance] == 0 then
|
||||||
instanceColor = fontObjects['green']
|
instanceColor = self.fontObjects['green']
|
||||||
else
|
else
|
||||||
instanceColor = fontObjects['red']
|
instanceColor = self.fontObjects['red']
|
||||||
end
|
end
|
||||||
tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
self.tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
||||||
|
|
||||||
nextColumn = nextColumn + 1
|
nextColumn = nextColumn + 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue