Show/hide instances based on user preferences.
This commit is contained in:
parent
99b095a519
commit
c63388354c
1 changed files with 27 additions and 30 deletions
|
@ -17,20 +17,12 @@ local defaults = {
|
||||||
sortDirection = 1,
|
sortDirection = 1,
|
||||||
-- Change table? ['Baradin Hold'] = { abbreviation = 'BH', enable = true }
|
-- Change table? ['Baradin Hold'] = { abbreviation = 'BH', enable = true }
|
||||||
instances = {
|
instances = {
|
||||||
[Z['Baradin Hold']] = 'BH',
|
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true },
|
||||||
[Z['Firelands']] = 'FL',
|
[Z['Firelands']] = { abbreviation = 'FL', enable = true },
|
||||||
[Z['The Bastion of Twilight']] = 'BoT',
|
[Z['The Bastion of Twilight']] = { abbreviation = 'BoT', enable = true },
|
||||||
[Z['Blackwing Descent']] = 'BWD',
|
[Z['Blackwing Descent']] = { abbreviation = 'BWD', enable = true },
|
||||||
[Z['Throne of the Four Winds']] = '4W',
|
[Z['Throne of the Four Winds']] = { abbreviation = '4W', enable = true },
|
||||||
},
|
},
|
||||||
instanceEnable = {
|
|
||||||
[Z['Baradin Hold']] = true,
|
|
||||||
[Z['Firelands']] = true,
|
|
||||||
[Z['The Bastion of Twilight']] = true,
|
|
||||||
[Z['Blackwing Descent']] = true,
|
|
||||||
[Z['Throne of the Four Winds']] = true,
|
|
||||||
},
|
|
||||||
instanceRemoves = { }
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +72,8 @@ local options = {
|
||||||
order = 1,
|
order = 1,
|
||||||
set = function(info, value)
|
set = function(info, value)
|
||||||
if core:VerifyInstance(value) then
|
if core:VerifyInstance(value) then
|
||||||
db.profile.instances[value] = ''
|
db.profile.instances[value].abbreviation = ''
|
||||||
|
db.profile.instances[value].enable = true
|
||||||
else
|
else
|
||||||
print('invalid instance')
|
print('invalid instance')
|
||||||
end
|
end
|
||||||
|
@ -192,16 +185,16 @@ function core:OnEnable()
|
||||||
type = 'toggle',
|
type = 'toggle',
|
||||||
name = instance,
|
name = instance,
|
||||||
order = 4 * i,
|
order = 4 * i,
|
||||||
get = function(info) return db.profile.instanceEnable[instance] end,
|
get = function(info) return db.profile.instances[instance].enable end,
|
||||||
set = function(info, value) db.profile.instanceEnable[instance] = value end,
|
set = function(info, value) db.profile.instances[instance].enable = value end,
|
||||||
}
|
}
|
||||||
options.args.instances.args[instance] = {
|
options.args.instances.args[instance] = {
|
||||||
type = 'input',
|
type = 'input',
|
||||||
name = '',
|
name = '',
|
||||||
order = 4 * i + 1,
|
order = 4 * i + 1,
|
||||||
width = 'half',
|
width = 'half',
|
||||||
get = function(info) return db.profile.instances[info[#info]] end,
|
get = function(info) return db.profile.instances[info[#info]].abbreviation end,
|
||||||
set = function(info, value) db.profile.instances[info[#info]] = value end,
|
set = function(info, value) db.profile.instances[info[#info]].abbreviation = value end,
|
||||||
}
|
}
|
||||||
options.args.instances.args[instance .. 'Remove'] = {
|
options.args.instances.args[instance .. 'Remove'] = {
|
||||||
type = 'execute',
|
type = 'execute',
|
||||||
|
@ -417,7 +410,7 @@ function core:DrawTooltip()
|
||||||
core:UpdateChores()
|
core:UpdateChores()
|
||||||
|
|
||||||
local columnCount = 2
|
local columnCount = 2
|
||||||
for instance,abbreviation in pairs(db.profile.instances) do
|
for instance in pairs(db.profile.instances) do
|
||||||
columnCount = columnCount + 1
|
columnCount = columnCount + 1
|
||||||
end
|
end
|
||||||
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
|
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
|
||||||
|
@ -478,9 +471,11 @@ function core:DrawTooltip()
|
||||||
tooltip:SetCell(1, 1, '')
|
tooltip:SetCell(1, 1, '')
|
||||||
tooltip:SetCell(1, 2, 'VP')
|
tooltip:SetCell(1, 2, 'VP')
|
||||||
local nextColumn = 3
|
local nextColumn = 3
|
||||||
for instance,abbreviation in pairs(db.profile.instances) do
|
for instance,instanceInfo in pairs(db.profile.instances) do
|
||||||
tooltip:SetCell(1, nextColumn, abbreviation, nil, 'CENTER')
|
if db.profile.instances[instance].enable == true then
|
||||||
nextColumn = nextColumn + 1
|
tooltip:SetCell(1, nextColumn, instanceInfo.abbreviation, nil, 'CENTER')
|
||||||
|
nextColumn = nextColumn + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,information in pairs(tooltipTable) do
|
for _,information in pairs(tooltipTable) do
|
||||||
|
@ -497,15 +492,17 @@ function core:DrawTooltip()
|
||||||
|
|
||||||
local nextColumn = 3
|
local nextColumn = 3
|
||||||
for instance, abbreviation in pairs(db.profile.instances) do
|
for instance, abbreviation in pairs(db.profile.instances) do
|
||||||
local instanceColor
|
if db.profile.instances[instance].enable == true then
|
||||||
if information[instance] == 0 then
|
local instanceColor
|
||||||
instanceColor = flagColors['green']
|
if information[instance] == 0 then
|
||||||
else
|
instanceColor = flagColors['green']
|
||||||
instanceColor = flagColors['red']
|
else
|
||||||
|
instanceColor = flagColors['red']
|
||||||
|
end
|
||||||
|
tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
||||||
|
|
||||||
|
nextColumn = nextColumn + 1
|
||||||
end
|
end
|
||||||
tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
|
||||||
|
|
||||||
nextColumn = nextColumn + 1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue