-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuffTheGroupMenu.lua
More file actions
200 lines (195 loc) · 5.13 KB
/
Copy pathBuffTheGroupMenu.lua
File metadata and controls
200 lines (195 loc) · 5.13 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
btg = btg or { }
function btg.buildMenu()
local panelData = {
type = "panel",
name = btg.name,
displayName = "BuffTheGroup",
author = "bitrock, garlicmoon",
version = ""..btg.version,
registerForDefaults = true,
registerForRefresh = true
}
local options = {
{
type = "header",
name = "Settings",
},
{
type = "checkbox",
name = "Enabled",
tooltip = "Toggles the UI",
default = btg.defaults.enabled,
getFunc = function()
return btg.savedVars.enabled
end,
setFunc = function(value)
btg.savedVars.enabled = value
btg.CheckActivation()
end,
},
{
type = "checkbox",
name = "Show Only DPS",
tooltip = "Shows only players marked as DPS in the BTG group frames",
default = btg.defaults.showOnlyDPS,
getFunc = function()
return btg.savedVars.showOnlyDPS
end,
setFunc = function(value)
btg.savedVars.showOnlyDPS = value
zo_callLater(btg.CheckActivation, 500)
end,
},
{
type = "checkbox",
name = "Single Column Mode",
tooltip = "Lays out the frames in a single column instead of a 6x2 layout",
default = btg.defaults.singleColumnMode,
getFunc = function()
return btg.savedVars.singleColumnMode
end,
setFunc = function(value)
btg.savedVars.singleColumnMode = value
if(value) then
btg.savedVars.maxRows = GROUP_SIZE_MAX
else
btg.savedVars.maxRows = 6
end
zo_callLater(btg.CheckActivation, 500)
end,
},
{
type = "checkbox",
name = "Minimal Mode",
tooltip = "Reduces the UI to a simple percentage display. The color background represents the time left on the buff. Respects the \'Show Only DPS\' option.",
default = btg.defaults.minimalMode,
getFunc = function()
return btg.savedVars.minimalMode
end,
setFunc = function(value)
btg.savedVars.minimalMode = value
zo_callLater(btg.CheckActivation, 500)
end,
},
{
type = "checkbox",
name = "Gradient Mode",
tooltip = "Changes whether the buff duration will decay using a color gradient",
default = btg.defaults.gradientMode,
getFunc = function()
return btg.savedVars.gradientMode
end,
setFunc = function(value)
btg.savedVars.gradientMode = value
end,
},
{
type = "colorpicker",
name = "Buff Start Color",
tooltip = "Sets the color of the start of the gradient for a tracked buff.",
getFunc = function()
local red = btg.savedVars.startR / 255.0
local green = btg.savedVars.startG / 255.0
local blue = btg.savedVars.startB / 255.0
return red, green, blue
end,
setFunc = function(red,green,blue,alpha)
btg.savedVars.startR = red * 255
btg.savedVars.startG = green * 255
btg.savedVars.startB = blue * 255
zo_callLater(btg.CheckActivation, 500)
end,
},
{
type = "colorpicker",
name = "Buff End Color",
tooltip = "Sets the color of the end of the gradient for a tracked buff.",
getFunc = function()
local red = btg.savedVars.endR / 255.0
local green = btg.savedVars.endG / 255.0
local blue = btg.savedVars.endB / 255.0
return red, green, blue
end,
setFunc = function(red,green,blue,alpha)
btg.savedVars.endR = red * 255
btg.savedVars.endG = green * 255
btg.savedVars.endB = blue * 255
zo_callLater(btg.CheckActivation, 500)
end,
},
{
type = "header",
name = " Major Buffs",
},
-- 'Major' buffs inserted here
{
type = "header",
name = " Minor Buffs",
},
-- 'Minor' buffs inserted here
{
type = "header",
name = " Misc Buffs",
},
-- 'Misc' buffs inserted here
{
type = "button",
name = "Deselect All",
width = "half",
func = function()
for i, _ in pairs(btgData.buffs) do
btg.savedVars.trackedBuffs[i] = false
end
btg.CheckActivation()
end,
},
{
type = "button",
name = "Reset Positions",
width = "half",
func = function()
for i, _ in pairs(btgData.buffs) do
btg.savedVars.framePositions[i] = {
left = 1300,
top = 150 + (i-1)*10 % 1000,
}
btg.frames[i].frame:ClearAnchors()
btg.frames[i].frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, btg.savedVars.framePositions[i].left, btg.savedVars.framePositions[i].top)
end
end,
},
}
local majorInsert = 10
local minorInsert = 11
local etcInsert = 12
for j, buff in pairs(btgData.buffs) do
local buffName = GetAbilityName(buff)
local buffOption = {
type = "checkbox",
name = buffName,
default = btg.defaults.trackedBuffs[j],
getFunc = function()
return btg.savedVars.trackedBuffs[j]
end,
setFunc = function(value)
btg.savedVars.trackedBuffs[j] = value
btg.CheckActivation()
end,
}
if ( buffName:find("Major") ) then
table.insert(options, majorInsert, buffOption)
majorInsert = majorInsert + 1
minorInsert = minorInsert + 1
etcInsert = etcInsert + 1
elseif ( buffName:find("Minor") ) then
table.insert(options, minorInsert, buffOption)
minorInsert = minorInsert + 1
etcInsert = etcInsert + 1
else
table.insert(options, etcInsert, buffOption)
etcInsert = etcInsert + 1
end
end
LibAddonMenu2:RegisterAddonPanel(btg.name.."Options", panelData)
LibAddonMenu2:RegisterOptionControls(btg.name.."Options", options)
end