forked from SwimmingTiger/ClassicCodex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.lua
459 lines (446 loc) · 18 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
local L = LibStub("AceLocale-3.0"):GetLocale("ClassicCodex")
local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfigCmd = LibStub("AceConfigCmd-3.0")
CodexConfig = {}
CodexColors = {}
DefaultCodexConfig = {
["trackingMethod"] = 1, -- 1: All Quests; 2: Tracked Quests; 3: Manual; 4: Hide
["autoAccept"] = false, -- Auto-accept quests
["autoTurnin"] = false, -- Auto-turnin quests
["nameplateIcon"] = false, -- Show quest icon above nameplates
["minimapButton"] = true, -- Show button of codex browser on the edge of the minimap
["continentIcon"] = false, -- Show quest markers on continent map (top two levels of the world map)
["zoneMapIcon"] = true, -- Show quest markers on zone map (the third and subsequent levels of the world map)
["miniMapIcon"] = true, -- Show quest markers on mini map
["allQuestGivers"] = true, -- Show available quest givers
["currentQuestGivers"] = true, -- Show current quest giver nodes
["alwaysShowId"] = false, -- Display unit/object/item/quest id in non-id search results
["showLowLevel"] = false, -- Show low level quest giver nodes
["showHighLevel"] = true, -- Show level+3 quest giver nodes
["showFestival"] = false, -- Show event quest giver nodes
["colorBySpawn"] = true,
["questMarkerSize"] = 15,
["spawnMarkerSize"] = 15,
["bossMarkerSize"] = 25, -- Display a larger icon for the boss or a single target to help you find it.
["minimumDropChance"] = 2, -- (%) Hide markers with a drop probability less than this value
["showTrackingMethodDropdown"] = true, -- Show Tracking Method Dropdown on the World Map
["showUnitTooltip"] = true, -- Show quest name in mouseover tooltip of units
}
CodexConfigFrame = CreateFrame("Frame", "CodexConfigFrame", UIParent)
function CodexConfigFrame:LoadConfig()
if not CodexConfig then CodexConfig = {} end
for key, val in pairs(DefaultCodexConfig) do
if CodexConfig[key] == nil then
if key == "colorList" then
CodexConfig[key] = {unpack(val)}
else
CodexConfig[key] = val
end
end
end
self:UpdateMinimapButton()
self.configTable = {
type = "group",
name = "ClassicCodex",
args = {
---------------------------------------- column 1 ----------------------------------------
autoAccept = {
order = 101, -- row: 1, column: 1
type = "toggle",
width = 1.5, -- make two checkboxes on the same line
name = L["Auto-Accept Quests"],
desc = L["Toggle auto-accepting quests"],
get = function(info)
return CodexConfig.autoAccept
end,
set = function(info, val)
CodexConfig.autoAccept = val
end
},
autoTurnin = {
order = 201, -- row: 2, column: 1
type = "toggle",
width = 1.5, -- make two checkboxes on the same line
name = L["Auto-Turnin Quests"],
desc = L["Toggle auto-turning in quests"],
get = function(info)
return CodexConfig.autoTurnin
end,
set = function(info, val)
CodexConfig.autoTurnin = val
end
},
nameplateIcon = {
order = 301,
type = "toggle",
width = 1.5,
name = L["Nameplate Quest Icon"],
desc = L["Toggle quest icon on top of enemy nameplates"],
get = function(info)
return CodexConfig.nameplateIcon
end,
set = function(info, val)
CodexConfig.nameplateIcon = val
CodexQuest:UpdateAllNameplates()
end
},
allQuestGivers = {
order = 401,
type = "toggle",
width = 1.5,
name = L["All Questgivers"],
desc = L["If selected, this will display all questgivers on the map"],
get = function(info)
return CodexConfig.allQuestGivers
end,
set = function(info, val)
CodexConfig.allQuestGivers = val
CodexQuest:ResetAll()
end
},
currentQuestGivers = {
order = 501,
type = "toggle",
width = 1.5,
name = L["Current Questgivers"],
desc = L["If selected, current quest-ender npcs/objects will be displayed on the map for active quests"],
get = function(info)
return CodexConfig.currentQuestGivers
end,
set = function(info, val)
CodexConfig.currentQuestGivers = val
CodexQuest:ResetAll()
end
},
showLowLevel = {
order = 601,
type = "toggle",
width = 1.5,
name = L["Show Low-level Quests"],
desc = L["If selected, low-level quests will be hidden on the map"],
get = function(info)
return CodexConfig.showLowLevel
end,
set = function(info, val)
CodexConfig.showLowLevel = val
CodexQuest:ResetAll()
end
},
showHighLevel = {
order = 701,
type = "toggle",
width = 1.5,
name = L["Show High-level Quests"],
desc = L["If selected, quests with a level requirement of your level + 3 will be shown on the map"],
get = function(info)
return CodexConfig.showHighLevel
end,
set = function(info, val)
CodexConfig.showHighLevel = val
CodexQuest:ResetAll()
end
},
showFestival = {
order = 801,
type = "toggle",
width = 1.5,
name = L["Show Festival/PVP/Misc Quests"],
desc = L["If selected, quests related to WoW festive seasons or PVP or not available at the current stage will be displayed on the map"],
get = function(info)
return CodexConfig.showFestival
end,
set = function(info, val)
CodexConfig.showFestival = val
CodexQuest:ResetAll()
end
},
colorBySpawn = {
order = 901,
type = "toggle",
width = 3, -- make the next checkbox in a new line
name = L["Color By Spawn"],
desc = L["If selected, markers' colors will be set per spawn type or per quest if not selected"],
get = function(info)
return CodexConfig.colorBySpawn
end,
set = function(info, val)
CodexConfig.colorBySpawn = val
CodexQuest:ResetAll()
end
},
---------------------------------------- column 2 ----------------------------------------
alwaysShowId = {
order = 102, -- row: 1, column: 2
type = "toggle",
width = 1.5, -- make two checkboxes on the same line
name = L["Show ID in Codex Browser"],
desc = L["If selected, the item/object/unit/quest ID will be displayed when you searching something in Codex browser."],
get = function(info)
return CodexConfig.alwaysShowId
end,
set = function(info, val)
CodexConfig.alwaysShowId = val
CodexBrowser.input:Search()
end
},
minimapButton = {
order = 202, -- row: 2, column: 2
type = "toggle",
width = 1.5, -- make two checkboxes on the same line
name = L["Show Minimap Button"],
desc = L["Show a button on the edge of the minimap, click to open Codex browser"],
get = function(info)
return CodexConfig.minimapButton
end,
set = function(info, val)
CodexConfig.minimapButton = val
CodexConfigFrame:UpdateMinimapButton()
end
},
continentIcon = {
order = 302,
type = "toggle",
width = 1.5,
name = L["Show Markers on Continent Maps"],
desc = L["Show markers on the top two levels of the world map"],
get = function(info)
return CodexConfig.continentIcon
end,
set = function(info, val)
CodexConfig.continentIcon = val
if CodexConfig.continentIcon and not CodexConfig.zoneMapIcon then
CodexConfig.zoneMapIcon = true
end
CodexMap:UpdateNodes()
end
},
zoneMapIcon = {
order = 402,
type = "toggle",
width = 1.5,
name = L["Show Markers on Zone Maps"],
desc = L["Show markers on the third and subsequent levels of the world map"],
get = function(info)
return CodexConfig.zoneMapIcon
end,
set = function(info, val)
CodexConfig.zoneMapIcon = val
if not CodexConfig.zoneMapIcon and CodexConfig.continentIcon then
CodexConfig.continentIcon = false
end
CodexMap:UpdateNodes()
end
},
miniMapIcon = {
order = 502,
type = "toggle",
width = 1.5,
name = L["Show Markers on the Minimap"],
get = function(info)
return CodexConfig.miniMapIcon
end,
set = function(info, val)
CodexConfig.miniMapIcon = val
CodexMap:UpdateNodes()
end
},
showUnitTooltip = {
order = 602,
type = "toggle",
width = 1.5,
name = L["Show Quest Name in Unit Tooltip"],
desc = L["Show quest name in mouseover tooltip of units"],
get = function(info)
return CodexConfig.showUnitTooltip
end,
set = function(info, val)
CodexConfig.showUnitTooltip = val
end
},
showTrackingMethodDropdown = {
order = 702,
type = "toggle",
width = 1.5,
name = L["Show Tracking Method Dropdown on the World Map"],
get = function(info)
return CodexConfig.showTrackingMethodDropdown
end,
set = function(info, val)
CodexConfig.showTrackingMethodDropdown = val
if CodexConfig.showTrackingMethodDropdown then
CodexQuest.mapButton:Show()
else
CodexQuest.mapButton:Hide()
end
end
},
trackingMethod = {
order = 802,
type = "select",
width = 1.5,
name = L["Quest Tracking Method"],
values = {
L["All Quests"],
L["Tracked Quests"],
L["Manual Selection"],
L["Hide Quests"],
},
get = function(info)
return CodexConfig.trackingMethod
end,
set = function(info, val)
CodexConfig.trackingMethod = val
CodexQuest:ResetAll()
end
},
---------------------------------------- sliders ----------------------------------------
questMarkerSize = {
order = 1001,
type = "range",
width = 1,
name = L["Quest Marker Size"],
min = 0,
max = 300,
step = 1,
softMin = 10,
softMax = 50,
bigStep = 1,
get = function(info)
return CodexConfig.questMarkerSize
end,
set = function(info, val)
CodexConfig.questMarkerSize = tonumber(val)
CodexMap:UpdateNodes()
end
},
spawnMarkerSize = {
order = 1002,
type = "range",
width = 1,
name = L["Spawn Marker Size"],
min = 0,
max = 300,
step = 1,
softMin = 10,
softMax = 50,
bigStep = 1,
get = function(info)
return CodexConfig.spawnMarkerSize
end,
set = function(info, val)
CodexConfig.spawnMarkerSize = tonumber(val)
CodexMap:UpdateNodes()
end
},
bossMarkerSize = {
order = 1003,
type = "range",
width = 1,
name = L["Boss Marker Size"],
desc = L["Display a larger icon for the boss or a single target to help you find it"],
min = 0,
max = 300,
step = 1,
softMin = 10,
softMax = 50,
bigStep = 1,
get = function(info)
return CodexConfig.bossMarkerSize
end,
set = function(info, val)
CodexConfig.bossMarkerSize = tonumber(val)
CodexMap:UpdateNodes()
end
},
minimumDropChance = {
order = 1101,
type = "range",
width = 3,
name = L["Hide items with a drop probability less than (%)"],
min = 0,
max = 100,
step = 1,
get = function(info)
return CodexConfig.minimumDropChance
end,
set = function(info, val)
CodexConfig.minimumDropChance = tonumber(val)
CodexQuest:ResetAll()
end
},
---------------------------------------- buttons ----------------------------------------
listHiddenQuests = {
order = 1201,
type = "execute",
width = 1.5,
name = L["List Manually Hidden Quests"],
func = function(info)
if CodexBrowser then
CodexBrowser.input:SetText('!')
CodexBrowser:OpenView('quests')
end
end,
},
listCompletedQuests = {
order = 1202,
type = "execute",
width = 1.5,
name = L["List Completed Quests"],
func = function(info)
if CodexBrowser then
CodexBrowser.input:SetText('@')
CodexBrowser:OpenView('quests')
end
end,
},
showAllHiddenQuests = {
order = 1301,
type = "execute",
width = 1.5,
name = L["Show All Quests You Manually Hide Again"],
desc = L["Show all the quests you have hidden by shift + click."].."\n"..
L["Hide a quest by holding the shift key and clicking on the quest icon on the minimap or world map."],
func = function(info)
local size = Codex:tablelen(CodexHiddenQuests)
CodexHiddenQuests = {}
CodexQuest:ResetAll()
if size < 1 then
print(L["ClassicCodex: You have no manually hidden quests. You can hold the shift key and click on the quest icon on the minimap or world map to hide it."])
else
print(string.format(L["ClassicCodex: %d hidden quests will be able to show again."], size))
end
end,
},
openCodexBrowser = {
order = 1302,
type = "execute",
width = 1.5,
name = L["Open Codex Browser"],
func = function(info)
if CodexBrowser then
CodexBrowser:Show()
end
end,
},
},
}
self.registeredOptionsTable = AceConfigRegistry:RegisterOptionsTable("ClassicCodex", self.configTable)
self.blizOptions = AceConfigDialog:AddToBlizOptions("ClassicCodex", "ClassicCodex")
self.cmdOptions = AceConfigCmd:CreateChatCommand("codexcfg", "ClassicCodex")
end
function CodexConfigFrame:UpdateMinimapButton()
if not CodexBrowserIcon then return end
if CodexConfig.minimapButton then
CodexBrowserIcon:Show()
else
CodexBrowserIcon:Hide()
end
end
CodexConfigFrame:RegisterEvent("ADDON_LOADED")
CodexConfigFrame:SetScript("OnEvent", function(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "ClassicCodex" then
self:LoadConfig()
CodexConfigFrame:UnregisterEvent("ADDON_LOADED")
end
end)