-
-
Notifications
You must be signed in to change notification settings - Fork 55
/
config.lua
617 lines (539 loc) · 22.2 KB
/
config.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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
-- multi api compat
local compat = pfQuestCompat
local L = pfQuest_Loc
pfQuest_history = {}
pfQuest_colors = {}
pfQuest_config = {}
local reset = {
config = function()
local dialog = StaticPopupDialogs["PFQUEST_RESET"]
dialog.text = L["Do you really want to reset the configuration?"]
dialog.OnAccept = function()
pfQuest_config = nil
ReloadUI()
end
StaticPopup_Show("PFQUEST_RESET")
end,
history = function()
local dialog = StaticPopupDialogs["PFQUEST_RESET"]
dialog.text = L["Do you really want to reset the quest history?"]
dialog.OnAccept = function()
pfQuest_history = nil
ReloadUI()
end
StaticPopup_Show("PFQUEST_RESET")
end,
cache = function()
local dialog = StaticPopupDialogs["PFQUEST_RESET"]
dialog.text = L["Do you really want to reset the caches?"]
dialog.OnAccept = function()
pfQuest_questcache = nil
ReloadUI()
end
StaticPopup_Show("PFQUEST_RESET")
end,
everything = function()
local dialog = StaticPopupDialogs["PFQUEST_RESET"]
dialog.text = L["Do you really want to reset everything?"]
dialog.OnAccept = function()
pfQuest_config, pfBrowser_fav, pfQuest_history, pfQuest_colors, pfQuest_server = nil
ReloadUI()
end
StaticPopup_Show("PFQUEST_RESET")
end,
}
-- default config
pfQuest_defconfig = {
{ -- 1: All Quests; 2: Tracked; 3: Manual; 4: Hide
config = "trackingmethod",
text = nil, default = 1, type = nil
},
{ text = L["General"],
default = nil, type = "header" },
{ text = L["Enable World Map Menu"],
default = "1", type = "checkbox", config = "worldmapmenu" },
{ text = L["Enable Minimap Button"],
default = "1", type = "checkbox", config = "minimapbutton" },
{ text = L["Enable Quest Tracker"],
default = "1", type = "checkbox", config = "showtracker" },
{ text = L["Enable Quest Log Buttons"],
default = "1", type = "checkbox", config = "questlogbuttons" },
{ text = L["Enable Quest Link Support"],
default = "1", type = "checkbox", config = "questlinks" },
{ text = L["Show Database IDs"],
default = "0", type = "checkbox", config = "showids" },
{ text = L["Draw Favorites On Login"],
default = "0", type = "checkbox", config = "favonlogin" },
{ text = L["Minimum Item Drop Chance"],
default = "1", type = "text", config = "mindropchance" },
{ text = L["Show Tooltips"],
default = "1", type = "checkbox", config = "showtooltips" },
{ text = L["Show Help On Tooltips"],
default = "1", type = "checkbox", config = "tooltiphelp" },
{ text = L["Show Level On Quest Tracker"],
default = "1", type = "checkbox", config = "trackerlevel" },
{ text = L["Show Level On Quest Log"],
default = "0", type = "checkbox", config = "questloglevel" },
{ text = L["Questing"],
default = nil, type = "header" },
{ text = L["Quest Tracker Visibility"],
default = "0", type = "text", config = "trackeralpha" },
{ text = L["Quest Tracker Font Size"],
default = "12", type = "text", config = "trackerfontsize", },
{ text = L["Quest Tracker Unfold Objectives"],
default = "0", type = "checkbox", config = "trackerexpand" },
{ text = L["Quest Objective Spawn Points (World Map)"],
default = "1", type = "checkbox", config = "showspawn" },
{ text = L["Quest Objective Spawn Points (Mini Map)"],
default = "1", type = "checkbox", config = "showspawnmini" },
{ text = L["Quest Objective Icons (World Map)"],
default = "1", type = "checkbox", config = "showcluster" },
{ text = L["Quest Objective Icons (Mini Map)"],
default = "0", type = "checkbox", config = "showclustermini" },
{ text = L["Display Available Quest Givers"],
default = "1", type = "checkbox", config = "allquestgivers" },
{ text = L["Display Current Quest Givers"],
default = "1", type = "checkbox", config = "currentquestgivers" },
{ text = L["Display Low Level Quest Givers"],
default = "0", type = "checkbox", config = "showlowlevel" },
{ text = L["Display Level+3 Quest Givers"],
default = "0", type = "checkbox", config = "showhighlevel" },
{ text = L["Display Event & Daily Quests"],
default = "0", type = "checkbox", config = "showfestival" },
{ text = L["Map & Minimap"],
default = nil, type = "header" },
{ text = L["Enable Minimap Nodes"],
default = "1", type = "checkbox", config = "minimapnodes" },
{ text = L["Use Monochrome Cluster Icons"],
default = "0", type = "checkbox", config = "clustermono" },
{ text = L["Use Cut-Out Minimap Node Icons"],
default = "1", type = "checkbox", config = "cutoutminimap" },
{ text = L["Use Cut-Out World Map Node Icons"],
default = "0", type = "checkbox", config = "cutoutworldmap" },
{ text = L["Color Map Nodes By Spawn"],
default = "0", type = "checkbox", config = "spawncolors" },
{ text = L["World Map Node Transparency"],
default = "1.0", type = "text", config = "worldmaptransp" },
{ text = L["Minimap Node Transparency"],
default = "1.0", type = "text", config = "minimaptransp" },
{ text = L["Node Fade Transparency"],
default = "0.3", type = "text", config = "nodefade" },
{ text = L["Highlight Nodes On Mouseover"],
default = "1", type = "checkbox", config = "mouseover" },
{ text = L["Routes"],
default = nil, type = "header" },
{ text = L["Show Route Between Objects"],
default = "1", type = "checkbox", config = "routes" },
{ text = L["Include Unified Quest Locations"],
default = "1", type = "checkbox", config = "routecluster" },
{ text = L["Include Quest Enders"],
default = "1", type = "checkbox", config = "routeender" },
{ text = L["Include Quest Starters"],
default = "0", type = "checkbox", config = "routestarter" },
{ text = L["Show Route On Minimap"],
default = "0", type = "checkbox", config = "routeminimap" },
{ text = L["Show Arrow Along Routes"],
default = "1", type = "checkbox", config = "arrow" },
{ text = L["User Data"],
default = nil, type = "header" },
{ text = L["Reset Configuration"],
default = "1", type = "button", func = reset.config },
{ text = L["Reset Quest History"],
default = "1", type = "button", func = reset.history },
{ text = L["Reset Cache"],
default = "1", type = "button", func = reset.cache },
{ text = L["Reset Everything"],
default = "1", type = "button", func = reset.everything },
}
StaticPopupDialogs["PFQUEST_RESET"] = {
button1 = YES,
button2 = NO,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
}
pfQuestConfig = CreateFrame("Frame", "pfQuestConfig", UIParent)
pfQuestConfig:Hide()
pfQuestConfig:SetWidth(280)
pfQuestConfig:SetHeight(550)
pfQuestConfig:SetPoint("CENTER", 0, 0)
pfQuestConfig:SetFrameStrata("HIGH")
pfQuestConfig:SetMovable(true)
pfQuestConfig:EnableMouse(true)
pfQuestConfig:SetClampedToScreen(true)
pfQuestConfig:RegisterEvent("ADDON_LOADED")
pfQuestConfig:SetScript("OnEvent", function()
if arg1 == "pfQuest" or arg1 == "pfQuest-tbc" or arg1 == "pfQuest-wotlk" then
pfQuestConfig:LoadConfig()
pfQuestConfig:MigrateHistory()
pfQuestConfig:CreateConfigEntries(pfQuest_defconfig)
pfQuest_questcache = pfQuest_questcache or {}
pfQuest_history = pfQuest_history or {}
pfQuest_colors = pfQuest_colors or {}
pfQuest_config = pfQuest_config or {}
pfBrowser_fav = pfBrowser_fav or {["units"] = {}, ["objects"] = {}, ["items"] = {}, ["quests"] = {}}
-- clear quest history on new characters
if UnitXP("player") == 0 and UnitLevel("player") == 1 then
pfQuest_history = {}
end
if pfBrowserIcon and pfQuest_config["minimapbutton"] == "0" then
pfBrowserIcon:Hide()
end
end
end)
pfQuestConfig:SetScript("OnMouseDown", function()
this:StartMoving()
end)
pfQuestConfig:SetScript("OnMouseUp", function()
this:StopMovingOrSizing()
end)
pfQuestConfig:SetScript("OnShow", function()
this:UpdateConfigEntries()
end)
pfQuestConfig.vpos = 40
pfUI.api.CreateBackdrop(pfQuestConfig, nil, true, 0.75)
table.insert(UISpecialFrames, "pfQuestConfig")
-- detect current addon path
local tocs = { "", "-master", "-tbc", "-wotlk" }
for _, name in pairs(tocs) do
local current = string.format("pfQuest%s", name)
local _, title = GetAddOnInfo(current)
if title then
pfQuestConfig.path = "Interface\\AddOns\\" .. current
pfQuestConfig.version = tostring(GetAddOnMetadata(current, "Version"))
break
end
end
pfQuestConfig.title = pfQuestConfig:CreateFontString("Status", "LOW", "GameFontNormal")
pfQuestConfig.title:SetFontObject(GameFontWhite)
pfQuestConfig.title:SetPoint("TOP", pfQuestConfig, "TOP", 0, -8)
pfQuestConfig.title:SetJustifyH("LEFT")
pfQuestConfig.title:SetFont(pfUI.font_default, 14)
pfQuestConfig.title:SetText("|cff33ffccpf|rQuest " .. L["Config"])
pfQuestConfig.close = CreateFrame("Button", "pfQuestConfigClose", pfQuestConfig)
pfQuestConfig.close:SetPoint("TOPRIGHT", -5, -5)
pfQuestConfig.close:SetHeight(20)
pfQuestConfig.close:SetWidth(20)
pfQuestConfig.close.texture = pfQuestConfig.close:CreateTexture("pfQuestionDialogCloseTex")
pfQuestConfig.close.texture:SetTexture(pfQuestConfig.path.."\\compat\\close")
pfQuestConfig.close.texture:ClearAllPoints()
pfQuestConfig.close.texture:SetPoint("TOPLEFT", pfQuestConfig.close, "TOPLEFT", 4, -4)
pfQuestConfig.close.texture:SetPoint("BOTTOMRIGHT", pfQuestConfig.close, "BOTTOMRIGHT", -4, 4)
pfQuestConfig.close.texture:SetVertexColor(1,.25,.25,1)
pfUI.api.SkinButton(pfQuestConfig.close, 1, .5, .5)
pfQuestConfig.close:SetScript("OnClick", function()
this:GetParent():Hide()
end)
pfQuestConfig.save = CreateFrame("Button", "pfQuestConfigReload", pfQuestConfig)
pfQuestConfig.save:SetWidth(160)
pfQuestConfig.save:SetHeight(28)
pfQuestConfig.save:SetPoint("BOTTOM", 0, 10)
pfQuestConfig.save:SetScript("OnClick", ReloadUI)
pfQuestConfig.save.text = pfQuestConfig.save:CreateFontString("Caption", "LOW", "GameFontWhite")
pfQuestConfig.save.text:SetAllPoints(pfQuestConfig.save)
pfQuestConfig.save.text:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
pfQuestConfig.save.text:SetText(L["Close & Reload"])
pfUI.api.SkinButton(pfQuestConfig.save)
function pfQuestConfig:LoadConfig()
if not pfQuest_config then pfQuest_config = {} end
for id, data in pairs(pfQuest_defconfig) do
if data.config and not pfQuest_config[data.config] then
pfQuest_config[data.config] = data.default
end
end
end
function pfQuestConfig:MigrateHistory()
if not pfQuest_history then return end
local match = false
for entry, data in pairs(pfQuest_history) do
if type(entry) == "string" then
for id in pairs(pfDatabase:GetIDByName(entry, "quests")) do
pfQuest_history[id] = { 0, 0 }
pfQuest_history[entry] = nil
match = true
end
elseif data == true then
pfQuest_history[entry] = { 0, 0 }
elseif type(data) == "table" and not data[1] then
pfQuest_history[entry] = { 0, 0 }
end
end
if match == true then
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|cffffffffQuest|r: " .. L["Quest history migration completed."])
end
end
local maxh, maxw = 0, 0
local width, height = 230, 22
local maxtext = 130
local configframes = {}
function pfQuestConfig:CreateConfigEntries(config)
local count = 1
for _, data in pairs(config) do
if data.type then
-- basic frame
local frame = CreateFrame("Frame", "pfQuestConfig" .. count, pfQuestConfig)
configframes[data.text] = frame
-- caption
frame.caption = frame:CreateFontString("Status", "LOW", "GameFontWhite")
frame.caption:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
frame.caption:SetPoint("LEFT", 20, 0)
frame.caption:SetJustifyH("LEFT")
frame.caption:SetText(data.text)
maxtext = max(maxtext, frame.caption:GetStringWidth())
-- header
if data.type == "header" then
frame.caption:SetPoint("LEFT", 10, 0)
frame.caption:SetTextColor(.3,1,.8)
frame.caption:SetFont(pfUI.font_default, pfUI_config.global.font_size+2, "OUTLINE")
-- checkbox
elseif data.type == "checkbox" then
frame.input = CreateFrame("CheckButton", nil, frame, "UICheckButtonTemplate")
frame.input:SetNormalTexture("")
frame.input:SetPushedTexture("")
frame.input:SetHighlightTexture("")
pfUI.api.CreateBackdrop(frame.input, nil, true)
frame.input:SetWidth(16)
frame.input:SetHeight(16)
frame.input:SetPoint("RIGHT" , -20, 0)
frame.input.config = data.config
if pfQuest_config[data.config] == "1" then
frame.input:SetChecked()
end
frame.input:SetScript("OnClick", function ()
if this:GetChecked() then
pfQuest_config[this.config] = "1"
else
pfQuest_config[this.config] = "0"
end
pfQuest:ResetAll()
end)
elseif data.type == "text" then
-- input field
frame.input = CreateFrame("EditBox", nil, frame)
frame.input:SetTextColor(.2,1,.8,1)
frame.input:SetJustifyH("RIGHT")
frame.input:SetTextInsets(5,5,5,5)
frame.input:SetWidth(32)
frame.input:SetHeight(16)
frame.input:SetPoint("RIGHT", -20, 0)
frame.input:SetFontObject(GameFontNormal)
frame.input:SetAutoFocus(false)
frame.input:SetScript("OnEscapePressed", function(self)
this:ClearFocus()
end)
frame.input.config = data.config
frame.input:SetText(pfQuest_config[data.config])
frame.input:SetScript("OnTextChanged", function(self)
pfQuest_config[this.config] = this:GetText()
end)
pfUI.api.CreateBackdrop(frame.input, nil, true)
elseif data.type == "button" and data.func then
frame.input = CreateFrame("Button", nil, frame)
frame.input:SetWidth(32)
frame.input:SetHeight(16)
frame.input:SetPoint("RIGHT", -20, 0)
frame.input:SetScript("OnClick", data.func)
frame.input.text = frame.input:CreateFontString("Caption", "LOW", "GameFontWhite")
frame.input.text:SetAllPoints(frame.input)
frame.input.text:SetFont(pfUI.font_default, pfUI_config.global.font_size, "OUTLINE")
frame.input.text:SetText("OK")
pfUI.api.SkinButton(frame.input)
end
-- increase size and zoom back due to blizzard backdrop reasons...
if frame.input and pfUI.api.emulated then
frame.input:SetWidth(frame.input:GetWidth()/.6)
frame.input:SetHeight(frame.input:GetHeight()/.6)
frame.input:SetScale(.8)
if frame.input.SetTextInsets then
frame.input:SetTextInsets(8,8,8,8)
end
end
count = count + 1
end
end
-- update sizes / positions
width = maxtext + 100
local column, row = 1, 0
for _, data in pairs(config) do
if data.type then
-- empty line for headers, next column for > 20 entries
row = row + ( data.type == "header" and row > 1 and 2 or 1 )
if row > 20 and data.type == "header" then
column, row = column + 1, 1
end
-- update max size values
maxw, maxh = max(maxw, column), max(maxh, row)
-- align frames to sizings
local spacer = (column-1)*20
local x, y = (column-1)*width, -(row-1)*height
local frame = configframes[data.text]
frame:SetWidth(width)
frame:SetHeight(height)
frame:SetPoint("TOPLEFT", pfQuestConfig, "TOPLEFT", x + spacer + 10, y - 40)
end
end
local spacer = (maxw-1)*20
pfQuestConfig:SetWidth(maxw*width + spacer + 20)
pfQuestConfig:SetHeight(maxh*height + 100)
end
function pfQuestConfig:UpdateConfigEntries()
for _, data in pairs(pfQuest_defconfig) do
if data.type and configframes[data.text] then
if data.type == "checkbox" then
configframes[data.text].input:SetChecked((pfQuest_config[data.config] == "1" and true or nil))
elseif data.type == "text" then
configframes[data.text].input:SetText(pfQuest_config[data.config])
end
end
end
end
do -- welcome/init popup dialog
local config_stage = {
arrow = 1,
mode = 2
}
-- create welcome/init window
pfQuestInit = CreateFrame("Frame", "pfQuestInit", UIParent)
pfQuestInit:Hide()
pfQuestInit:SetWidth(400)
pfQuestInit:SetHeight(270)
pfQuestInit:SetPoint("CENTER", 0, 0)
pfQuestInit:RegisterEvent("PLAYER_ENTERING_WORLD")
pfQuestInit:SetScript("OnEvent", function()
if pfQuest_config.welcome ~= "1" then
-- parse current config
if pfQuest_config["showspawn"] == "0" and pfQuest_config["showcluster"] == "1" then
config_stage.mode = 1
elseif pfQuest_config["showspawn"] == "1" and pfQuest_config["showcluster"] == "0" then
config_stage.mode = 3
end
if pfQuest_config["arrow"] == "0" then
config_stage.arrow = nil
end
-- reload ui elements
pfQuestInit[1].bg:SetDesaturated(true)
pfQuestInit[2].bg:SetDesaturated(true)
pfQuestInit[3].bg:SetDesaturated(true)
pfQuestInit[config_stage.mode].bg:SetDesaturated(false)
pfQuestInit.checkbox:SetChecked(config_stage.arrow)
pfQuestInit:Show()
end
this:UnregisterAllEvents()
end)
pfUI.api.CreateBackdrop(pfQuestInit, nil, true, 0.85)
-- welcome title
pfQuestInit.title = pfQuestInit:CreateFontString("Status", "LOW", "GameFontWhite")
pfQuestInit.title:SetPoint("TOP", pfQuestInit, "TOP", 0, -17)
pfQuestInit.title:SetJustifyH("LEFT")
pfQuestInit.title:SetText(L["Please select your preferred |cff33ffccpf|cffffffffQuest|r mode:"])
-- questing mode
local buttons = {
{ caption = L["Simple Markers"], texture = "\\img\\init\\simple", position = { "TOPLEFT", 10, -40 },
tooltip = L["Only show cluster icons with summarized objective locations based on spawn points"] },
{ caption = L["Combined"], texture = "\\img\\init\\combined", position = { "TOP", 0, -40 },
tooltip = L["Show cluster icons with summarized locations and also display all spawn points of each quest objective"] },
{ caption = L["Spawn Points"], texture = "\\img\\init\\spawns", position = { "TOPRIGHT", -10, -40 },
tooltip = L["Display all spawn points of each quest objective and hide summarized cluster icons."] },
}
for i, button in pairs(buttons) do
pfQuestInit[i] = CreateFrame("Button", "pfQuestInitLeft", pfQuestInit)
pfQuestInit[i]:SetWidth(120)
pfQuestInit[i]:SetHeight(160)
pfQuestInit[i]:SetPoint(unpack(button.position))
pfQuestInit[i]:SetID(i)
pfQuestInit[i].bg = pfQuestInit[i]:CreateTexture(nil, "NORMAL")
pfQuestInit[i].bg:SetWidth(200)
pfQuestInit[i].bg:SetHeight(200)
pfQuestInit[i].bg:SetPoint("CENTER", 0, 0)
pfQuestInit[i].bg:SetTexture(pfQuestConfig.path..button.texture)
pfQuestInit[i].caption = pfQuestInit:CreateFontString("Status", "LOW", "GameFontWhite")
pfQuestInit[i].caption:SetPoint("TOP", pfQuestInit[i], "BOTTOM", 0, -5)
pfQuestInit[i].caption:SetJustifyH("LEFT")
pfQuestInit[i].caption:SetText(button.caption)
pfUI.api.SkinButton(pfQuestInit[i])
pfQuestInit[i]:SetScript("OnClick", function()
pfQuestInit[1].bg:SetDesaturated(true)
pfQuestInit[2].bg:SetDesaturated(true)
pfQuestInit[3].bg:SetDesaturated(true)
pfQuestInit[this:GetID()].bg:SetDesaturated(false)
config_stage.mode = this:GetID()
end)
local OnEnter = pfQuestInit[i]:GetScript("OnEnter")
pfQuestInit[i]:SetScript("OnEnter", function()
if OnEnter then OnEnter() end
GameTooltip_SetDefaultAnchor(GameTooltip, this)
GameTooltip:SetText(this.caption:GetText())
GameTooltip:AddLine(buttons[this:GetID()].tooltip, 1, 1, 1, true)
GameTooltip:SetWidth(100)
GameTooltip:Show()
end)
local OnLeave = pfQuestInit[i]:GetScript("OnLeave")
pfQuestInit[i]:SetScript("OnLeave", function()
if OnLeave then OnLeave() end
GameTooltip:Hide()
end)
end
-- show arrows
pfQuestInit.checkbox = CreateFrame("CheckButton", nil, pfQuestInit, "UICheckButtonTemplate")
pfQuestInit.checkbox:SetPoint("BOTTOMLEFT", 10, 10)
pfQuestInit.checkbox:SetNormalTexture("")
pfQuestInit.checkbox:SetPushedTexture("")
pfQuestInit.checkbox:SetHighlightTexture("")
pfQuestInit.checkbox:SetWidth(22)
pfQuestInit.checkbox:SetHeight(22)
pfUI.api.CreateBackdrop(pfQuestInit.checkbox, nil, true)
pfQuestInit.checkbox.caption = pfQuestInit:CreateFontString("Status", "LOW", "GameFontWhite")
pfQuestInit.checkbox.caption:SetPoint("LEFT", pfQuestInit.checkbox, "RIGHT", 5, 0)
pfQuestInit.checkbox.caption:SetJustifyH("LEFT")
pfQuestInit.checkbox.caption:SetText(L["Show Navigation Arrow"])
pfQuestInit.checkbox:SetScript("OnClick", function()
config_stage.arrow = this:GetChecked()
end)
pfQuestInit.checkbox:SetScript("OnEnter", function()
GameTooltip_SetDefaultAnchor(GameTooltip, this)
GameTooltip:SetText(L["Navigation Arrow"])
GameTooltip:AddLine(L["Show navigation arrow that points you to the nearest quest location."], 1, 1, 1, true)
GameTooltip:SetWidth(100)
GameTooltip:Show()
end)
pfQuestInit.checkbox:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
-- save button
pfQuestInit.save = CreateFrame("Button", nil, pfQuestInit)
pfQuestInit.save:SetWidth(100)
pfQuestInit.save:SetHeight(24)
pfQuestInit.save:SetPoint("BOTTOMRIGHT", -10, 10)
pfQuestInit.save.text = pfQuestInit.save:CreateFontString("Caption", "LOW", "GameFontWhite")
pfQuestInit.save.text:SetAllPoints(pfQuestInit.save)
pfQuestInit.save.text:SetText("Save & Close")
pfUI.api.SkinButton(pfQuestInit.save)
pfQuestInit.save:SetScript("OnClick", function()
-- write current config
if config_stage.mode == 1 then
pfQuest_config["showspawn"] = "0"
pfQuest_config["showspawnmini"] = "0"
pfQuest_config["showcluster"] = "1"
pfQuest_config["showclustermini"] = "1"
elseif config_stage.mode == 2 then
pfQuest_config["showspawn"] = "1"
pfQuest_config["showspawnmini"] = "1"
pfQuest_config["showcluster"] = "1"
pfQuest_config["showclustermini"] = "0"
elseif config_stage.mode == 3 then
pfQuest_config["showspawn"] = "1"
pfQuest_config["showspawnmini"] = "1"
pfQuest_config["showcluster"] = "0"
pfQuest_config["showclustermini"] = "0"
end
if config_stage.arrow then
pfQuest_config["arrow"] = "1"
else
pfQuest_config["arrow"] = "0"
end
-- save welcome flag and reload
pfQuest_config["welcome"] = "1"
pfQuest:ResetAll()
pfQuestInit:Hide()
end)
end