-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.lua
More file actions
executable file
·173 lines (159 loc) · 4.28 KB
/
Copy pathoptions.lua
File metadata and controls
executable file
·173 lines (159 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
local TimeToDie = TimeToDie
local LibStub = LibStub
local function GetValue(info)
return info.handler.db.profile[info.arg]
end
local function SetValue(info, value)
local self = info.handler
local profile = self.db.profile
profile[info.arg] = value
self:ApplySettings(profile)
end
local function SetFrameValue(info, value)
local self = info.handler
local profile = self.db.profile
profile[info.arg] = value
self:UpdateFrame(profile)
end
local function GetColor(info)
local p = info.handler.db.profile
return p.r, p.g, p.b
end
local function SetColor(info, r,g,b)
local self = info.handler
local p = self.db.profile
p.r, p.g, p.b = r,g,b
self:UpdateFrame(p)
end
local function IsFrameDisabled(info)
return not info.handler.db.profile.frame
end
local function GetFontList()
return AceGUIWidgetLSMlists.font
end
local options = {
name = 'TimeToDie',
type = 'group',
desc = 'Estimated time until current target will die.',
get = GetValue,
set = SetValue,
handler = TimeToDie,
args = {
formatting = {
name = 'formatting',
type = 'select',
values = {['%d:%02d'] = '12:34', ['%dm %ds'] = '12m 34s', seconds = '754'},
order = 250,
arg = 'timeFormat',
},
display = {
name = 'display',
type = 'group',
order = 400,
guiInline = true,
set = SetFrameValue,
disabled = IsFrameDisabled,
args = {
locked = {
name = 'Locked',
type = 'toggle',
desc = LOCK_FOCUS_FRAME,
order = 150,
arg = 'locked',
},
font = {
name = 'Font',
type = 'select',
dialogControl = 'LSM30_Font',
values = GetFontList, --wrap in function to keep values current
order = 200,
arg = 'font',
},
fontSize = {
name = 'Font Size',
type = 'range',
min = 4, max = 27, step = 1,
order = 250,
arg = 'size',
},
outline = {
name = 'Outline',
type = 'select',
desc = 'Set font outline.',
values = {[''] = NONE, OUTLINE = VOICE_CHAT_NORMAL, THICKOUTLINE = 'Thick'},
order = 300,
arg = 'outline',
},
color = {
name = 'Color',
type = 'color',
set = SetColor,
get = GetColor,
order = 350,
},
strata = {
name = 'Strata',
type = 'select',
desc = 'Set frame strata.',
values = {HIGH = HIGH, MEDIUM = AUCTION_TIME_LEFT2, LOW = LOW, BACKGROUND = BACKGROUND},
order = 400,
arg = 'strata',
},
justify = {
name = 'Justify',
type = 'select',
values = {LEFT = 'Left', CENTER = 'Center', RIGHT = 'Right'},
order = 450,
arg = 'justify',
},
updateFrequency = {
name = "Update Frequency",
type = 'range',
min = 0.1, max = 10, step = 0.1,
order = 500,
arg = 'updateFrequency',
},
samplingFrequency = {
name = "Sampling Frequency",
type = 'range',
min = 0.1, max = 10, step = 0.1,
order = 550,
arg = 'samplingFrequency',
},
interpolationMaxPoints = {
name = "Interpolation Max Points",
type = 'range',
min = 2, max = 100, step = 1,
order = 600,
arg = 'interpolationMaxPoints',
},
interpolationMinPoints = {
name = "Interpolation Min Points",
type = 'range',
min = 2, max = 100, step = 1,
order = 650,
arg = 'interpolationMinPoints',
},
},
},
},
}
TimeToDie.optionTable = options
function TimeToDie:RegisterOptions()
local profile = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db)
local registry = LibStub('AceConfigRegistry-3.0')
local dialog = LibStub('AceConfigDialog-3.0')
LibStub('AceConfig-3.0'):RegisterOptionsTable('TimeToDie', options, {'timetodie', 'ttd'})
registry:RegisterOptionsTable('TimeToDie Options', options)
registry:RegisterOptionsTable('TimeToDie Profiles', profile)
local main = dialog:AddToBlizOptions('TimeToDie Options', 'TimeToDie')
dialog:AddToBlizOptions('TimeToDie Profiles', 'Profiles', 'TimeToDie')
local dataobj = self.dataobj
if dataobj then
dataobj.OnClick = function() InterfaceOptionsFrame_OpenToCategory(main) end
dataobj.OnTooltipShow = function(tooltip)
tooltip:AddLine('TimeToDie')
tooltip:AddLine('Estimated time until current target will die.')
end
end
end