-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQEConf.lua
355 lines (278 loc) · 12.2 KB
/
QEConf.lua
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
--[[
Questionably Epic Mythic+ Dungeon Tips
Configuration Page
Version: 4.8
Developed by: Voulk
Contact:
Discord: Voulk#1858
Email: [email protected]
]]--
local _, addon = ...;
-- UI
QEConf = {}
--local ACD = LibStub("MSA-AceConfigDialog-3.0")
-- Saved Variables
QEConfig = {
["Important"] = true,
["PriorityTargets"] = true,
["Defensives"] = true,
["Interrupts"] = true,
["Fluff"] = false,
["Advanced"] = true,
["Dodge"] = true,
["RoleChoice"] = "Show my role only",
["ClassChoice"] = "Show my class only",
["ShowFrame"] = "Show in separate frame",
["TargetTrigger"] = "Show targeted mob",
["RaidToggle"] = true,
["MythicPlusToggle"] = true,
["FrameWidth"] = 450,
["FrameHeight"] = 175,
["FontSize"] = 12,
["FrameOpacity"] = 0.55
}
-- Create Checkboxes
local function createCheck(label, description, frame, onClick)
local check = CreateFrame("CheckButton", "QECheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate")
check:SetScript("OnClick", function(self)
onClick(self)
end)
getglobal(check:GetName() .. 'Text'):SetText(description)
return check
end
local function createString(frame, text, font, size)
local fontString = frame:CreateFontString()
fontString:SetFont(font, size)
fontString:SetText(text)
fontString:SetWidth(215)
fontString:SetJustifyH("LEFT")
fontString:SetJustifyV("TOP")
return fontString
end
local function updateTextSize(size)
local p,_,_ = QE_TipText:GetFont();
--print("Resetting Font Size" .. QEConfig.FontSize)
QE_TipText:SetFont(p, QEConfig.FontSize, nil)
end
--[[
function createDropdown(frame, label, option1, option2, changingVar)
local dd = CreateFrame("Frame", label, frame, "UIDropDownMenuTemplate")
local function dd_OnClick(self, arg1, arg2, checked)
UIDropDownMenu_SetText(dd, arg1)
QEConfig[changingVar] = arg1
setEnabled() -- This just clears the addons frame.
setDropdownEnabled() -- This shows / hides a second dropdown based on the current selection.
end
function ddMenu(frame, level, menuList)
local info = UIDropDownMenu_CreateInfo()
info.func = dd_OnClick
info.text, info.arg1, info.checked = option1, option1, QEConfig[changingVar] == option1
UIDropDownMenu_AddButton(info)
info.text, info.arg1, info.checked = option2, option2, QEConfig[changingVar] == option2
UIDropDownMenu_AddButton(info)
end
UIDropDownMenu_Initialize(dd, ddMenu)
UIDropDownMenu_SetWidth(dd, 180, 0);
return dd
end
]]--
-- Create Panels
local function createConfigMenu()
-- Setup Panel --
addon.configPanel = CreateFrame("Frame", "QEConfiguration", UIParent)
addon.configPanel.name = "QE Mythic+ Dungeon Tips";
addon.configPanel.okay = function (self) return end
addon.configPanel.cancel = function (self) return end
-- Set up Title --
local ddTitleString = addon.configPanel:CreateFontString()
ddTitleString:SetPoint("TOPLEFT", 10, -10)
ddTitleString:SetFont("Fonts\\MORPHEUS.ttf", 22, "OUTLINE")
ddTitleString:SetTextColor(0.9, 0.68, 0.22, 1)
ddTitleString:SetText("QE Mythic+ Dungeon Tips - Config")
-----------------------
-- Set up Checkboxes --
-----------------------
local chkGeneral = createCheck("General", "Show Important General Information", addon.configPanel, function(self, value) end)
chkGeneral:SetPoint("TOPLEFT", ddTitleString, "BOTTOMLEFT", 0, -10)
chkGeneral:SetEnabled(false)
chkGeneral:SetChecked(true)
local chkPriority = createCheck("PriorityTargets", "Show Priority Targets", addon.configPanel, function(self, value) QEConfig.PriorityTargets = self:GetChecked() end)
chkPriority:SetPoint("TOPLEFT", chkGeneral, "BOTTOMLEFT", 0, -8)
local chkInterrupts = createCheck("Interrupts", "Show Priority Interrupts", addon.configPanel, function(self, value) QEConfig.Interrupts = self:GetChecked() end)
chkInterrupts:SetPoint("TOPLEFT", chkPriority, "BOTTOMLEFT", 0, -8)
local chkDefensives = createCheck("Defensives", "Show Defensive Recommendations", addon.configPanel, function(self, value) QEConfig.Defensives = self:GetChecked() end)
chkDefensives:SetPoint("TOPLEFT", chkInterrupts, "BOTTOMLEFT", 0, -8)
local chkFluff = createCheck("Fluff", "Show Fluff", addon.configPanel, function(self, value) QEConfig.Fluff = self:GetChecked() end)
chkFluff:SetPoint("TOPLEFT", chkDefensives, "BOTTOMLEFT", 0, -8)
local chkAdvanced = createCheck("Advanced", "Show advanced tips for high level keys", addon.configPanel, function(self, value) QEConfig.Advanced = self:GetChecked() end)
chkAdvanced:SetPoint("TOPLEFT", chkFluff, "BOTTOMLEFT", 0, -8)
----------------------------
-- Setup "Dropdown" boxes --
----------------------------
-- Dropdown Taint Sucks
local headerFont = "Fonts\\MORPHEUS.ttf"
local headerSize = 16
-- Tip Location Selector --
local locFS = createString(addon.configPanel, "Tip Location", headerFont, headerSize)
locFS:SetPoint("TOPLEFT", chkAdvanced, "BOTTOMLEFT", 0, -30)
--locDD = createDropdown(addon.configPanel, "TipLocation", "Show in separate frame", "Show in mob tooltips", "ShowFrame")
--locDD:SetPoint("TOPLEFT", locFS, "BOTTOMLEFT", 0, -8)
local locCB = createCheck("Location", "Show tips in separate frame", addon.configPanel,
function(self, value)
if self:GetChecked() then
QEConfig.ShowFrame = "Show in separate frame"
else
QEConfig.ShowFrame = "Show in mob tooltips"
end
addon:setEnabled() -- This just clears the addons frame.
--addon:setMinimized(true) -- Ensures the tip frame is showing.
addon:setDropdownEnabled() -- This shows / hides a second dropdown based on the current selection.
end)
locCB.tooltip = "Uncheck to have tips appear in mob tooltips instead"
locCB:SetPoint("TOPLEFT", locFS, "BOTTOMLEFT", 0, -8)
-- Target / Mouseover Selector --
addon.targetFS = createString(addon.configPanel, "Show Target or Mouseover", headerFont, headerSize)
addon.targetFS:SetPoint("TOPLEFT", locFS, "TOPRIGHT", 70, 0)
--targetDD = createDropdown(addon.configPanel, "TargetMouseover", "Show targeted mob", "Show mouseover", "TargetTrigger")
--targetDD:SetPoint("TOPLEFT", targetFS, "BOTTOMLEFT", 0, -8)
addon.chkTarget = createCheck("Target", "Show Targeted Mob", addon.configPanel,
function(self, value)
if self:GetChecked() then
QEConfig.TargetTrigger = "Show targeted mob"
else
QEConfig.TargetTrigger = "Show mouseover"
end
end)
addon.chkTarget:SetPoint("TOPLEFT", addon.targetFS, "BOTTOMLEFT", 0, -8)
-- Role Selector --
local roleFS = createString(addon.configPanel, "Role Specific Tips", headerFont, headerSize)
roleFS:SetPoint("TOPLEFT", locCB, "BOTTOMLEFT", 0, -14)
--roleDD = createDropdown(addon.configPanel, "RoleSelector", "Show my role only", "Show all roles", "RoleChoice")
--roleDD:SetPoint("TOPLEFT", roleFS, "BOTTOMLEFT", 0, -8)
local chkRole = createCheck("Role", "Show all roles", addon.configPanel,
function(self, value)
if self:GetChecked() then
QEConfig.RoleChoice = "Show all roles"
else
QEConfig.RoleChoice = "Show my role only"
end
end)
chkRole:SetPoint("TOPLEFT", roleFS, "BOTTOMLEFT", 0, -8)
-- Class Selector --
local classFS = createString(addon.configPanel, "Class Specific Tips", headerFont, headerSize)
classFS:SetPoint("TOPLEFT", roleFS, "TOPRIGHT", 70, 0)
--classDD = createDropdown(addon.configPanel, "ClassSelector", "Show my class only", "Show all classes", "ClassChoice")
--classDD:SetPoint("TOPLEFT", classFS, "BOTTOMLEFT", 0, -8)
local chkClass = createCheck("Class", "Show all classes", addon.configPanel,
function(self, value)
if self:GetChecked() then
QEConfig.ClassChoice = "Show all classes"
else
QEConfig.ClassChoice = "Show my class only"
end
end)
chkClass:SetPoint("TOPLEFT", classFS, "BOTTOMLEFT", 0, -8)
-- Activate in
-- Tip Location Selector --
local showinFS = createString(addon.configPanel, "Content", headerFont, headerSize)
showinFS:SetPoint("TOPLEFT", roleFS, "BOTTOMLEFT", 0, -54)
local chkRegDungeons = createCheck("RegDungeons", "Show Tips in Dungeons", addon.configPanel, function(self, value) end)
chkRegDungeons:SetPoint("TOPLEFT", showinFS, "BOTTOMLEFT", 0, -8)
chkRegDungeons:SetEnabled(false)
chkRegDungeons:SetChecked(true)
--[[local chkMythicPlus = createCheck("MythicPlus", "Show Tips in Mythic+", addon.configPanel, function(self, value)
QEConfig.MythicPlusToggle = self:GetChecked()
addon:setEnabled()
end)
chkMythicPlus:SetPoint("TOPLEFT", chkRegDungeons, "BOTTOMLEFT", 0, -8)]]--
local chkRaid = createCheck("Raid", "Show Tips in Raid", addon.configPanel, function(self, value)
QEConfig.RaidToggle = self:GetChecked()
addon:setEnabled()
end)
chkRaid:SetPoint("TOPLEFT", chkRegDungeons, "BOTTOMLEFT", 0, -8)
-- Other Stuff
local OtherFS = createString(addon.configPanel, "Font Size", headerFont, headerSize)
OtherFS:SetPoint("TOPLEFT", classFS, "BOTTOMLEFT", 0, -54)
--local deleteme = createString(addon.configPanel, "Delete me after", headerFont, headerSize)
--deleteme:SetPoint("TOPLEFT", OtherFS, "BOTTOMLEFT", 0, -16)
local sliderName = "FontSizeS"
local fontEdit = CreateFrame("Slider", sliderName, addon.configPanel, "OptionsSliderTemplate")
fontEdit:SetWidth(120)
fontEdit:SetHeight(20)
fontEdit:SetOrientation('HORIZONTAL')
fontEdit:SetMinMaxValues(8, 18)
fontEdit:SetValue(QEConfig.FontSize)
fontEdit:SetValueStep(1)
fontEdit.textLow = _G[sliderName.."Low"]
fontEdit.textHigh = _G[sliderName.."High"]
fontEdit.text = _G[sliderName.."Text"]
fontEdit.minValue, fontEdit.maxValue = fontEdit:GetMinMaxValues()
fontEdit.textLow:SetText(fontEdit.minValue)
fontEdit.textHigh:SetText(fontEdit.maxValue)
fontEdit.text:SetText(QEConfig.FontSize)
fontEdit.textLow = 8
fontEdit.textHigh = 14
--fontEdit.text = "Font Size"
fontEdit:SetPoint("TOPLEFT", OtherFS, "BOTTOMLEFT", 0, -22)
fontEdit:Enable()
fontEdit:SetScript("OnValueChanged", function(self,event,arg1)
QEConfig.FontSize = math.floor(event + 0.5)
updateTextSize()
--print(QEConfig.FontSize)
self.text:SetText(QEConfig.FontSize)
end)
--[[
local fontEdit = CreateFrame("EditBox", nil, addon.configPanel)
fontEdit:SetMultiLine(false)
fontEdit:SetWidth(40)
fontEdit:SetText(12)
fontEdit:SetFontObject(ChatFontNormal)
fontEdit:SetPoint("TOPLEFT", OtherFS, "BOTTOMLEFT", 0, -8)
fontEdit:SetEnabled(true) ]]--
--chkRegDungeons:SetChecked(true)
-- Load in SavedVariables on ADDON_LOADED
addon.configPanel:RegisterEvent("ADDON_LOADED")
addon.configPanel:SetScript("OnEvent", function(self, event, arg1)
if event == "ADDON_LOADED" then
-- Check for new variables added in a later release
QEConfig.ShowFrame = QEConfig.ShowFrame or "Show in separate frame"
QEConfig.TargetTrigger = QEConfig.TargetTrigger or "Show targeted mob"
-- More variables added in a later release
if QEConfig.RaidToggle == nil then QEConfig.RaidToggle = true end
if QEConfig.MythicPlusToggle == nil then QEConfig.MythicPlusToggle = true end
QEConfig.FrameOpacity = QEConfig.FrameOpacity or 0.55
QEConfig.FrameWidth = QEConfig.FrameWidth or 450
QEConfig.FrameHeight = QEConfig.FrameHeight or 175
QEConfig.FontSize = QEConfig.FontSize or 14
--print(QEConfig.FontSize)
-- Set default checkbox behaviour
chkPriority:SetChecked(QEConfig.PriorityTargets)
chkInterrupts:SetChecked(QEConfig.Interrupts)
chkDefensives:SetChecked(QEConfig.Defensives)
chkFluff:SetChecked(QEConfig.Fluff)
chkAdvanced:SetChecked(QEConfig.Advanced)
--chkMythicPlus:SetChecked(QEConfig.MythicPlusToggle)
chkRaid:SetChecked(QEConfig.RaidToggle)
-- Set default Drop Down text
--UIDropDownMenu_SetText(locDD, QEConfig.ShowFrame)
--UIDropDownMenu_SetText(targetDD, QEConfig.TargetTrigger)
--UIDropDownMenu_SetText(roleDD, QEConfig.RoleChoice)
--UIDropDownMenu_SetText(classDD, QEConfig.ClassChoice)
-- "Drop downs"
locCB:SetChecked(QEConfig.ShowFrame == "Show in separate frame")
addon.chkTarget:SetChecked(QEConfig.TargetTrigger == "Show targeted mob")
chkRole:SetChecked(QEConfig.RoleChoice == "Show all roles")
chkClass:SetChecked(QEConfig.ClassChoice == "Show all classes")
updateTextSize()
fontEdit.text:SetText(QEConfig.FontSize)
fontEdit:SetValue(QEConfig.FontSize)
addon:setEnabled()
addon:setDropdownEnabled()
end
end);
-- Add panel to config options
InterfaceOptions_AddCategory(addon.configPanel)
-- Proceed
createQEFrame()
end
createConfigMenu()