-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQEFrame.lua
401 lines (297 loc) · 11.1 KB
/
QEFrame.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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
--[[
Questionably Epic Mythic+ Dungeon Tips
Configuration Page
Version: 4.8
Developed by: Voulk
Contact:
Discord: Voulk#1858
Email: [email protected]
Future Versions - Engine
- Tooltips on all config options
- Lock button on frame
- Alpha channel config
- /QE Slash command to bring up config.
- Add an icon to fluff
Future Versions - Content
- All BFA dungeons
- Possible Raid version for LFR/N/H
]]--
local _, addon = ...;
-- Create a frame
function createQEFrame()
--addon.isShowing = true
QE_ParentFrame = CreateFrame("Frame", "QE_ParentFrame", UIParent)
QE_ParentFrame:SetResizable(true)
QE_ParentFrame:SetMovable(true)
QE_ParentFrame:EnableMouse(true)
QE_ParentFrame:SetWidth(420)
QE_ParentFrame:SetHeight(120)
QE_ParentFrame:SetMinResize(300, 90) -- Real, change back to this
--QE_ParentFrame:SetMinResize(20, 90) -- For testing wraps
QE_ParentFrame:SetMaxResize(500, 200)
QE_ParentFrame:RegisterForDrag("LeftButton")
QE_ParentFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
QE_ParentFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
-- Texture
QE_ParentFrameTexture = QE_ParentFrame:CreateTexture(nil, "Background")
QE_ParentFrameTexture:ClearAllPoints()
--QE_ParentFrameTexture:SetColorTexture(35/255, 35/255, 35/255, 0.0)
--QE_ParentFrameTexture:SetAllPoints(QE_ParentFrame)
------
-- Resize Button
local resizeButton = CreateFrame("Button", nil, QE_ParentFrame)
resizeButton:SetSize(16, 16)
resizeButton:SetPoint("BOTTOMRIGHT")
resizeButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeButton:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
resizeButton:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
resizeButton:SetScript("OnMouseDown", function(self, button)
QE_ParentFrame:StartSizing("BOTTOMRIGHT")
QE_ParentFrame:SetUserPlaced(true)
end)
resizeButton:SetScript("OnMouseUp", function(self, button)
QE_ParentFrame:StopMovingOrSizing()
end)
--
-- Header Panel
QE_HeaderPanel = CreateFrame("Frame", "QE_HeaderFrame", QE_ParentFrame)
QE_HeaderPanel:SetFrameStrata("Background")
--QE_HeaderPanel:SetAllPoints(QE_ParentFrame)
-- Header Texture
QE_HeaderPanelTexture = QE_HeaderPanel:CreateTexture(nil, "Background")
QE_HeaderPanelTexture:ClearAllPoints()
QE_HeaderPanelTexture:SetColorTexture(62/255, 59/255, 55/255, 0.75)
QE_HeaderPanelTexture:SetAllPoints(QE_HeaderPanel)
-- Header Text
headerQE = QE_HeaderPanel:CreateFontString("QE_HeaderText", nil, nil)
headerQE:SetPoint("TOPLEFT", 5, -4)
headerQE:SetPoint("TOPRIGHT", 5, -4)
headerQE:SetFont("Fonts\\SKURRI.TTF", 16, "OUTLINE")
headerQE:SetTextColor(239/255, 191/255, 90/255)
headerQE:SetJustifyH("LEFT")
headerQE:SetJustifyV("CENTER")
headerQE:SetText("Questionably Epic Dungeon Tips")
headerQE:SetWordWrap(true)
QE_HeaderPanel:SetPoint("TOPLEFT", QE_ParentFrame, "TOPLEFT", 0, 0)
QE_HeaderPanel:SetPoint("TOPRIGHT", QE_ParentFrame, "TOPRIGHT", 0, 0)
QE_HeaderPanel:SetHeight(22)
QE_HeaderPanel:SetWidth(450)
QE_HeaderPanel:Show()
-----------------
-- TIPS PANEL ---
-----------------
QE_TipPanel = CreateFrame("Frame", "QE_TipFrame", QE_ParentFrame)
QE_TipPanel:SetFrameStrata("Background")
QE_TipPanel:SetWidth(450)
--QE_TipPanel:SetHeight(98)
QE_TipPanel:SetPoint("TOPLEFT", QE_HeaderPanel, "BOTTOMLEFT", 0, 0)
QE_TipPanel:SetPoint("TOPRIGHT", QE_HeaderPanel, "BOTTOMRIGHT", 0, 0)
QE_TipPanel:SetPoint("BOTTOMLEFT", QE_ParentFrame, "BOTTOMLEFT", 0, 0)
QE_TipPanel:SetPoint("BOTTOMRIGHT", QE_ParentFrame, "BOTTOMRIGHT", 0, 0)
-- Tip Texture
QE_TipPanelTexture = QE_TipPanel:CreateTexture(nil, "Background")
--QE_TipPanelTexture:SetWidth(128)
--QE_TipPanelTexture:SetHeight(64)
QE_TipPanelTexture:ClearAllPoints()
QE_TipPanelTexture:SetColorTexture(55/255, 55/255, 55/255, 0.45)
QE_TipPanelTexture:SetAllPoints(QE_TipPanel)
QE_TipPanel:Show()
QE_MobName = QE_TipPanel:CreateFontString("QE_MobName", nil, nil)
QE_MobName:SetPoint("TOPLEFT", 5, -5)
QE_MobName:SetPoint("TOPRIGHT", 5, -5)
QE_MobName:SetWordWrap(true)
QE_MobName:SetFont("Fonts\\ARIALN.ttf", 16, "OUTLINE")
QE_MobName:SetJustifyH("LEFT")
QE_MobName:SetJustifyV("TOP")
QE_MobName:SetText(" ")
-- Frame Tip Text
QE_TipText = QE_TipPanel:CreateFontString("QE_TipText", nil, GameFontNormal)
QE_TipText:SetPoint("TOPLEFT", QE_MobName, "BOTTOMLEFT", 0, -3)
QE_TipText:SetPoint("TOPRIGHT", QE_MobName, "BOTTOMRIGHT", -3, -3)
QE_TipText:SetPoint("BOTTOMLEFT", QE_ParentFrame, "BOTTOMLEFT", 0, 0)
QE_TipText:SetPoint("BOTTOMRIGHT", QE_ParentFrame, "BOTTOMRIGHT", 0, 0)
--QE_TipText:SetFont("Fonts\\ARIALN.ttf", 14, nil)
QE_TipText:SetFontObject(GameFontWhite);
local p,_,_ = QE_TipText:GetFont();
--print("Creating Frame" .. QEConfig.FontSize)
QE_TipText:SetFont(p, QEConfig.FontSize, nil)
QE_TipText:SetWidth(445)
QE_TipText:SetJustifyH("LEFT")
QE_TipText:SetJustifyV("TOP")
QE_TipText:SetText(" ")
-----------------------
-- Show Frame
QE_ParentFrame:SetPoint("CENTER", UIParent)
QE_ParentFrame:Show()
QE_ParentFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
QE_ParentFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
QE_ParentFrame:RegisterEvent("ENCOUNTER_START")
QE_ParentFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
QE_ParentFrame:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
QE_ParentFrame:SetScript("OnEvent", function(self, event, ...)
if event == "PLAYER_ENTERING_WORLD" then
C_Timer.After(2, function() addon:setEnabled() end)
--addon:setEnabled()
elseif event == "PLAYER_TARGET_CHANGED" then
--print("Player target changed" .. QEConfig.TargetTrigger .. QE_onBoss)
if QEConfig.TargetTrigger == "Show targeted mob" and not QE_onBoss then addon:getTarget("target") end
elseif event == "INSTANCE_ENCOUNTER_ENGAGE_UNIT" and UnitExists("boss1") then
--QE_onBoss = true
if QEConfig.ShowFrame == "Show in separate frame" then
addon:colorFrame(QE_onBoss)
addon:getTarget("boss1")
end
elseif event == "PLAYER_REGEN_ENABLED" then
QE_onBoss = false
addon:colorFrame(QE_onBoss)
end
end)
--QE_ParentFrame:SetClampedToScreen(true)
--[[
-- Create slim header panel to hold title.
QE_HeaderPanel:SetFrameStrata("Background")
QE_HeaderPanel:SetWidth(450)
QE_HeaderPanel:SetHeight(22)
QE_HeaderPanel:EnableMouse(true)
QE_HeaderPanel:SetMovable(true)
QE_HeaderPanel:RegisterForDrag("LeftButton")
QE_HeaderPanel:SetScript("OnDragStart", function(self) self:StartMoving() end)
QE_HeaderPanel:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
QE_ParentFrameTexture = QE_HeaderPanel:CreateTexture(nil, "Background")
--QE_TipPanelTexture:SetWidth(128)
--QE_TipPanelTexture:SetHeight(64)
QE_ParentFrameTexture:ClearAllPoints()
QE_ParentFrameTexture:SetColorTexture(35/255, 35/255, 35/255, 0.55)
QE_ParentFrameTexture:SetAllPoints(QE_HeaderPanel)
QE_HeaderPanel:SetPoint("CENTER", UIParent)
QE_HeaderPanel:Show()
QE_HeaderPanel:SetClampedToScreen(true)
QE_ConfigBtn = CreateFrame("Button", "QE_ConfigButton", QE_HeaderPanel)
QE_ConfigBtn:SetFrameLevel(5)
QE_ConfigBtn:ClearAllPoints()
QE_ConfigBtn:SetHeight(16)
QE_ConfigBtn:SetWidth(16)
QE_ConfigBtn:SetNormalTexture("Interface\\Buttons\\UI-OptionsButton")
QE_ConfigBtn:SetHighlightTexture("Interface\\Buttons\\UI-OptionsButton", 1.0)
QE_ConfigBtn:SetAlpha(0.45)
QE_ConfigBtn:SetPoint("TOPRIGHT", QE_HeaderPanel, "TOPRIGHT", -4, -2)
QE_ConfigBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
QE_ConfigBtn:SetScript("OnClick", function()
InterfaceOptionsFrame_OpenToCategory(addon.configPanel)
InterfaceOptionsFrame_OpenToCategory(addon.configPanel)
end)
QE_ConfigBtn:Show()
-- Minimize Button
minimizeBtn = CreateFrame("Button", "minimize", QE_HeaderPanel)
minimizeBtn:SetFrameLevel(5)
minimizeBtn:ClearAllPoints()
minimizeBtn:SetHeight(30)
minimizeBtn:SetWidth(30)
minimizeBtn:SetNormalTexture("Interface\\Buttons\\UI-MultiCheck-Up")
minimizeBtn:SetHighlightTexture("Interface\\Buttons\\UI-MultiCheck-Up", 1.0)
minimizeBtn:SetAlpha(0.45)
minimizeBtn:SetPoint("TOPRIGHT", QE_HeaderPanel, "TOPRIGHT", -17, 5)
minimizeBtn:SetScript("OnClick", function()
addon:setMinimized()
end)
minimizeBtn:Show()
--]]
end
--[[
lockBtn = CreateFrame("Button", "lock", QE_HeaderPanel)
lockBtn:SetFrameLevel(5)
lockBtn:ClearAllPoints()
lockBtn:SetHeight(25)
lockBtn:SetWidth(25)
lockBtn:SetNormalTexture("Interface\\Buttons\\LockButton-Unlocked-Up")
lockBtn:SetHighlightTexture("Interface\\Buttons\\LockButton-Unlocked-Up", 1.0)
lockBtn:SetAlpha(0.35)
lockBtn:SetPoint("TOPRIGHT", QE_HeaderPanel, "TOPRIGHT", -17, 0)
lockBtn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
lockBtn:SetScript("OnClick", function()
InterfaceOptionsFrame_OpenToCategory(configPanel)
InterfaceOptionsFrame_OpenToCategory(configPanel)
end)
lockBtn:Show()
]]--
-- Returns true or false depending on if the user wants the addon on in the current instance.
function addon:checkInstance()
-- Check if in raid or Mythic+
local inInstance, instanceType = IsInInstance()
local _, _, difficultyID = GetInstanceInfo()
local instanceAllowed = true
if difficultyID == 8 then
if QEConfig.MythicPlusToggle then
instanceAllowed = true
else
instanceAllowed = false
end
elseif instanceType == "raid" then
if QEConfig.RaidToggle then
instanceAllowed = true
else
instanceAllowed = false
end
end
return instanceAllowed
end
function addon:setEnabled()
local inInstance, instanceType = IsInInstance()
local mapID = C_Map.GetBestMapForUnit("player")
local instanceMapID = select(8,GetInstanceInfo())
--QE_MobName:SetText("")
--QE_TipText:SetText("")
if inInstance and QEConfig.ShowFrame == "Show in separate frame" and (
addon.acceptedDungeons[mapID] or (instanceMapID == 269 or instanceMapID == 560)) -- Torghast Maps
then
if addon:checkInstance() then
--QE_HeaderPanel:Show()
QE_ParentFrame:Show()
else
QE_ParentFrame:Hide()
end
--elseif difficultyID ==
--local mapID = C_Map.GetBestMapForUnit("player")
--if not acceptedDungeons[mapID] then return end
--local isShown = QE_TipPanel:IsVisible()
--print(isShown)
--if not isShown then
-- QE_TipPanel:Hide()
--end
else
QE_ParentFrame:Hide()
end
end
function addon:setMinimized(forceShow)
--if not QE_TipText:IsVisible() or forceShow then
if QE_TipPanel:GetHeight() <= 26 then
QE_TipPanel:SetHeight(175)
QE_TipText:Show()
else
--QE_TipPanel:Hide()
QE_TipPanel:SetHeight(25)
QE_TipText:Hide()
end
end
function addon:setDropdownEnabled()
if QEConfig.ShowFrame == "Show in separate frame" then
--targetDD:Show()
addon.targetFS:Show()
addon.chkTarget:Show()
else
--targetDD:Hide()
addon.targetFS:Hide()
addon.chkTarget:Hide()
end
end
function addon:colorFrame(QE_onBoss)
if QE_onBoss then
QE_TipPanelTexture:SetColorTexture(100/255, 80/255, 0/255, 0.55)
QE_ParentFrameTexture:SetColorTexture(70/255, 50/255, 0/255, 0.55)
else
QE_TipPanelTexture:SetColorTexture(55/255, 55/255, 55/255, 0.55)
QE_ParentFrameTexture:SetColorTexture(35/255, 35/255, 35/255, 0.55)
end
end
QE_onBoss = false
--createQEFrame()