-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTradeskillInfoOptions.lua
508 lines (479 loc) · 10.8 KB
/
TradeskillInfoOptions.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
local L = LibStub("AceLocale-3.0"):GetLocale("TradeSkillInfo")
local DBI = LibStub("LibDBIcon-1.0", true)
-- upvalues, will be populated in :CreateConfig() at the end of the file
local knownSelect = {} -- the multiselect array for "Known by", "Learnable by", "Will be learnable by"
local db
local function getOption(info)
return db[info.arg]
end
local function setOption(info, value)
db[info.arg] = value
end
local function getColor(info)
return db[info.arg].r, db[info.arg].g, db[info.arg].b
end
local function setColor(info, r, g, b)
db[info.arg] = { r = r, g = g, b = b }
end
local function getMultiSelect(info, key)
return db[info.arg][key]
end
local function setMultiSelect(info, key, state)
db[info.arg][key] = state
end
local tooltipOptions = {
name = L["Tooltip"],
type = "group",
desc = L["Tooltip Options"],
order = 1,
args = {
flags = {
name = L["Flags"],
type = "group",
get = getOption,
set = setOption,
inline = true,
order = 1,
args = {
usedIn = {
name = L["Used in"],
desc = L["Show what tradeskill an item is used"],
type = "toggle",
arg = "TooltipUsedIn",
order = 1,
},
usableBy = {
name = L["Usable by"],
desc = L["Show who can use an item"],
type = "toggle",
arg = "TooltipUsableBy",
order = 2,
},
colorUsableBy = {
name = L["Color usable by"],
desc = L["Color the alt names in tooltip according to maximum combine difficulty"],
type = "toggle",
arg = "TooltipColorUsableBy",
disabled = function() return not db["TooltipUsableBy"] end,
order = 3,
},
source = {
name = L["Source"],
desc = L["Show the source of the item"],
type = "toggle",
arg = "TooltipSource",
order = 4,
},
recipeSource = {
name = L["Recipe Source"],
desc = L["Show the source of recipes"],
type = "toggle",
arg = "TooltipRecipeSource",
order = 5,
},
recipePrice = {
name = L["Recipe Price"],
desc = L["Show the price of recipes sold by vendors"],
type = "toggle",
arg = "TooltipRecipePrice",
order = 6,
},
itemID = {
name = L["Item ID"],
desc = L["Show the item's ID"],
type = "toggle",
arg = "TooltipID",
order = 7,
},
stackSize = {
name = L["Stack Size"],
desc = L["Show the item's stack size"],
type = "toggle",
arg = "TooltipStack",
order = 8,
},
marketValue = {
name = L["Market Value"],
desc = L["Show the profit calculation from Auctioneer Market Value"],
type = "toggle",
arg = "TooltipMarketValue",
order = 9,
},
knownBy = {
name = L["Known by"],
desc = L["Show who knows a recipe"],
type = "multiselect",
control = "Dropdown",
values = knownSelect,
get = getMultiSelect,
set = setMultiSelect,
arg = "TooltipKnownBy",
order = 10,
},
learnableBy = {
name = L["Learnable by"],
desc = L["Show who can learn a recipe"],
type = "multiselect",
control = "Dropdown",
values = knownSelect,
get = getMultiSelect,
set = setMultiSelect,
arg = "TooltipLearnableBy",
order = 11,
},
willBeLearnable = {
name = L["Will be able to learn"],
desc = L["Show who will be able to learn a recipe"],
type = "multiselect",
control = "Dropdown",
values = knownSelect,
get = getMultiSelect,
set = setMultiSelect,
arg = "TooltipAvailableTo",
order = 12,
},
recipesOnly = {
name = L["Only add extra data to recipes"],
desc = L["Only show extra profession data in recipe tooltips instead of every crafted item ever"],
type = "toggle",
width = "full",
arg = "RecipesOnly",
order = 13,
},
},
},
colors = {
name = L["Colors"],
type = "group",
get = getColor,
set = setColor,
inline = true,
order = 2,
args = {
usedIn = {
name = L["Used in"],
desc = L["Show what tradeskill an item is used"],
type = "color",
arg = "ColorSource",
order = 1,
},
usableBy = {
name = L["Usable by"],
desc = L["Show who can use an item"],
type = "color",
arg = "ColorUsableBy",
width = "double",
order = 2,
},
source = {
name = L["Source"],
desc = L["Show the source of the item"],
type = "color",
arg = "ColorSource",
order = 3,
},
recipeSource = {
name = L["Recipe Source"],
desc = L["Show the source of recipes"],
type = "color",
arg = "ColorRecipeSource",
order = 4,
},
recipePrice = {
name = L["Recipe Price"],
desc = L["Show the price of recipes sold by vendors"],
type = "color",
arg = "ColorRecipePrice",
order = 5,
},
itemID = {
name = L["Item ID"],
desc = L["Show the item's ID"],
type = "color",
arg = "ColorID",
order = 6,
},
stackSize = {
name = L["Stack Size"],
type = "color",
arg = "ColorStack",
order = 7,
},
marketValue = {
name = L["Market Value"],
desc = L["Show the profit calculation from Auctioneer Market Value"],
type = "color",
arg = "ColorMarketValue",
order = 8,
},
knownBy = {
name = L["Known by"],
desc = L["Show who knows a recipe"],
type = "color",
arg = "ColorKnownBy",
order = 9,
},
learnableBy = {
name = L["Learnable by"],
desc = L["Show who can learn a recipe"],
type = "color",
arg = "ColorLearnableBy",
order = 10,
},
willBeLearnable = {
name = L["Will be able to learn"],
desc = L["Show who will be able to learn a recipe"],
type = "color",
arg = "ColorAvailableTo",
order = 11,
},
},
},
},
}
local tradeskillOptions = {
name = L["Trade Skill"],
desc = L["Trade Skill Window options"],
type = "group",
order = 2,
get = getOption,
set = setOption,
args = {
skillReq = {
name = L["Skill required"],
desc = L["Show skill required"],
type = "toggle",
arg = "ShowSkillLevel",
width = "full",
order = 1,
},
combineCost = {
name = L["Combine cost"],
desc = L["Show combine cost"],
type = "toggle",
arg = "ShowSkillProfit",
width = "full",
order = 2,
},
},
}
local mouseSelect = {
[1] = L["Left Button"],
[2] = L["Right Button"],
}
local modSelect = {
[1] = L["Shift"],
[2] = L["Control"],
[3] = L["Alt"],
}
local strataSelect = {
[1] = L["LOW"],
[2] = L["MEDIUM"],
[3] = L["HIGH"],
}
local uiOptions = {
name = L["UI"],
desc = L["UI Options"],
type = "group",
order = 3,
args = {
saveFrame = {
name = L["Save Frame Position"],
desc = L["Remember TradeskillInfoUI frame position"],
type = "toggle",
arg = "SavePosition",
get = getOption,
set = setOption,
order = 1,
},
strata = {
name = L["Frame Strata"],
desc = L["Set TradeskillInfoUI frame strata"],
values = strataSelect,
type = "select",
get = getOption,
set = setOption,
arg = "FrameStrata",
order = 2,
},
scale = {
name = L["UI Scale"],
type = "range",
desc = L["Change scale of user interface"],
min = 0.5, max = 2, step = 0.05,
isPercent = false,
get = getOption,
set = setOption,
arg = "UIScale",
order = 3,
},
quickSearch = {
name = L["Quick Search"],
desc = L["Enable Quick Search"],
type = "toggle",
arg = "QuickSearch",
get = getOption,
set = setOption,
order = 4,
},
mouse = {
name = L["Search Mouse Button"],
desc = L["Mouse button that does a quick search"],
type = "select",
values = mouseSelect,
get = getOption,
set = setOption,
arg = "SearchMouseButton",
disabled = function() return not db["QuickSearch"] end,
order = 5,
},
modifier = {
name = L["Search Modifier Key"],
desc = L["Modifier key to be held down for quick search"],
type = "select",
values = modSelect,
get = getOption,
set = setOption,
arg = "SearchShiftKey",
disabled = function() return not db["QuickSearch"] end,
order = 6,
},
minimapButton = {
name = L["Hide Minimap Button"],
type = "toggle",
arg = "hide",
get = getOption,
set = function(info, arg)
setOption(info, arg)
if arg then
DBI:Hide("TradeSkillInfo")
else
DBI:Show("TradeSkillInfo")
end
end,
order = 7,
},
debugModeButton = {
name = L["Turn on debug info output"],
type = "toggle",
arg = "DebugMode",
get = getOption,
set = setOption,
width = "full",
order = 8,
},
},
}
local colorOptions = {
name = L["Colors"],
type = "group",
order = 4,
get = getColor,
set = setColor,
args = {
ahcolor = {
name = L["Color Auction Recipes"],
desc = L["Color recipes in the Auction House"],
type = "toggle",
arg = "ColorAHRecipes",
get = getOption,
set = setOption,
width = "double",
order = 1,
},
merchantcolor = {
name = L["Color Merchant Recipes"],
desc = L["Color recipes in Merchant windows"],
type = "toggle",
arg = "ColorMerchantRecipes",
get = getOption,
set = setOption,
width = "double",
order = 2,
},
bagcolor = {
name = L["Color Bag Recipes"],
desc = L["Color recipes in bags and banks"],
type = "toggle",
arg = "ColorBagRecipes",
get = getOption,
set = setOption,
width = "double",
order = 3,
},
colors = {
name = L["Colors"],
type = "group",
get = getColor,
set = setColor,
inline = true,
order = 4,
args = {
playerCan = {
name = L["You can learn"],
type = "color",
arg = "AHColorLearnable",
width = "full",
order = 1,
},
altCan = {
name = L["An alt can learn"],
type = "color",
arg = "AHColorAltLearnable",
width = "full",
order = 2,
},
playerWill = {
name = L["You will be able to learn"],
type = "color",
arg = "AHColorWillLearn",
width = "full",
order = 3,
},
altWill = {
name = L["An alt will be able to learn"],
type = "color",
arg = "AHColorAltWillLearn",
width = "full",
order = 4,
},
known = {
name = L["You know"],
type = "color",
arg = "AHColorKnown",
width = "full",
order = 5,
},
unavailable = {
name = L["Unavailable"],
type = "color",
arg = "AHColorUnavailable",
width = "full",
order = 6,
},
},
},
},
}
function TradeskillInfo:CreateConfig()
-- do not use "self" in this function as it will be attributed
-- to AceConfig-3.0's namespace, not TradeSkillInfo's
db = TradeskillInfo.db.profile
for x, y in pairs(TradeskillInfo.vars.tradeskills) do
knownSelect[x] = y
end
local options = {
name = "TradeSkillInfo",
type = "group",
childGroups = "tab",
args = {
tooltip = tooltipOptions,
tradeskill = tradeskillOptions,
ui = uiOptions,
color = colorOptions,
profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(TradeskillInfo.db),
},
}
TradeskillInfo.optionsLoaded = true
return options
end