Add option to place current character at the top of the list.
This commit is contained in:
parent
a4d74ac126
commit
f8f20f2229
1 changed files with 31 additions and 4 deletions
|
@ -20,6 +20,7 @@ local defaults = {
|
||||||
sortDirection = 1,
|
sortDirection = 1,
|
||||||
vertSortDirection = 1,
|
vertSortDirection = 1,
|
||||||
vpPos = 1,
|
vpPos = 1,
|
||||||
|
currentOnTop = false,
|
||||||
instances = {
|
instances = {
|
||||||
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, },
|
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, },
|
||||||
[Z['Firelands']] = { abbreviation = 'FL', enable = true, removed = false, },
|
[Z['Firelands']] = { abbreviation = 'FL', enable = true, removed = false, },
|
||||||
|
@ -52,11 +53,25 @@ local options = {
|
||||||
type = 'header',
|
type = 'header',
|
||||||
order = 2,
|
order = 2,
|
||||||
},
|
},
|
||||||
|
currentOnTop = {
|
||||||
|
name = L['Current Character On Top'],
|
||||||
|
desc = L['Place the character you are currently logged in as on the top of the list.'],
|
||||||
|
type = 'toggle',
|
||||||
|
width = 'full',
|
||||||
|
order = 3,
|
||||||
|
get = function(info) return db.profile.currentOnTop end,
|
||||||
|
set = function(info, value) db.profile.currentOnTop = value end,
|
||||||
|
},
|
||||||
|
--sortSpacer = {
|
||||||
|
-- type = 'description',
|
||||||
|
-- name = '',
|
||||||
|
-- order = 4,
|
||||||
|
--},
|
||||||
sortType = {
|
sortType = {
|
||||||
name = L['Sort Field'],
|
name = L['Sort Field'],
|
||||||
desc = L['Field to sort the tooltip by.'],
|
desc = L['Field to sort the tooltip by.'],
|
||||||
type = 'select',
|
type = 'select',
|
||||||
order = 3,
|
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 db.profile.sortType end,
|
||||||
set = function(info, value) db.profile.sortType = value end,
|
set = function(info, value) db.profile.sortType = value end,
|
||||||
|
@ -65,7 +80,7 @@ local options = {
|
||||||
name = L['Sorting Direction'],
|
name = L['Sorting Direction'],
|
||||||
desc = L['Which direction to sort.'],
|
desc = L['Which direction to sort.'],
|
||||||
type = 'select',
|
type = 'select',
|
||||||
order = 4,
|
order = 6,
|
||||||
values = { L['Ascending'], L['Descending'] },
|
values = { L['Ascending'], L['Descending'] },
|
||||||
get = function(info) return db.profile.sortDirection end,
|
get = function(info) return db.profile.sortDirection end,
|
||||||
set = function(info, value) db.profile.sortDirection = value end,
|
set = function(info, value) db.profile.sortDirection = value end,
|
||||||
|
@ -172,6 +187,8 @@ function core:OnEnable()
|
||||||
else
|
else
|
||||||
LibStub('AceConfigDialog-3.0'):Open('ChoreTracker')
|
LibStub('AceConfigDialog-3.0'):Open('ChoreTracker')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Implement right click to change sorting?
|
||||||
end,
|
end,
|
||||||
OnEnter = function(self)
|
OnEnter = function(self)
|
||||||
core:DrawTooltip()
|
core:DrawTooltip()
|
||||||
|
@ -473,6 +490,7 @@ 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 currentTable = {}
|
||||||
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
|
||||||
local valorPoints = db.global[realm][name].valorPoints.points
|
local valorPoints = db.global[realm][name].valorPoints.points
|
||||||
|
@ -492,8 +510,12 @@ function core:DrawTooltip()
|
||||||
end
|
end
|
||||||
characterTable[instance] = defeatedBosses
|
characterTable[instance] = defeatedBosses
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(tooltipTable,characterTable)
|
if name == UnitName('player') and db.profile.currentOnTop == true then
|
||||||
|
currentTable = characterTable
|
||||||
|
else
|
||||||
|
table.insert(tooltipTable, characterTable)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -519,6 +541,11 @@ function core:DrawTooltip()
|
||||||
end
|
end
|
||||||
table.sort(tooltipTable, sortTooltip )
|
table.sort(tooltipTable, sortTooltip )
|
||||||
|
|
||||||
|
-- Toss the current character on top if it is set that way
|
||||||
|
if db.profile.currentOnTop == true then
|
||||||
|
table.insert(tooltipTable, 1, currentTable)
|
||||||
|
end
|
||||||
|
|
||||||
-- Create a table for the header; vpPos to decide where to place Valor Points column
|
-- Create a table for the header; vpPos to decide where to place Valor Points column
|
||||||
-- Draw tooltip table then looped through.
|
-- Draw tooltip table then looped through.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue