forked from Rhyono/CraftStore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCraftStore_LAM.lua
402 lines (396 loc) · 14.3 KB
/
CraftStore_LAM.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
local CS = CraftStoreFixedAndImprovedLongClassName
local LAM = LibAddonMenu2
function CS.UpdateGridPerSettings()
for craft, storeCraft in pairs(CS.Account.crafting.stored) do
for line, storeLine in pairs(storeCraft) do
for trait,_ in pairs(storeLine) do
CS.UpdatePanelIcon(craft,line,trait)
end
end
end
CS.RepairStored()
end
function CS.SettingsUpdate(setname,setval)
CS.Account.options[setname] = setval
end
-- return local name of setting via index
function CS.SettingFromIndex(setname,setval)
return CS.Loc.suboptions[setname][setval]
end
-- save relative index of setting via local name
function CS.DropdownSettingsUpdate(setname,setval,subname)
if subname == nil then subname = setname end
local index={}
for k,v in pairs(CS.Loc.suboptions[subname]) do
index[v]=k
end
CS.Account.options[setname] = index[setval]
end
--Menu
CS.PanelData = {
type = "panel",
name = CS.Title,
displayName = CS.Title,
author = CS.Author,
version = CS.Version,
slashCommand = "/csoptions",
registerForRefresh = true,
registerForDefaults = true,
}
CS.OptionsTable = {
--UI options
[1] = {
type = "header",
name = "UI Settings",
width = "full",
},
[2] = {
type = "checkbox",
name = CS.Loc.options.showbutton,
tooltip = "",
getFunc = function() return CS.Account.options.showbutton end,
setFunc = function(value)
CS.SettingsUpdate('showbutton',value)
CS.OptionSet()
end,
default = CS.AccountInit.options.showbutton,
},
[3] = {
type = "checkbox",
name = CS.Loc.options.lockbutton,
tooltip = "",
getFunc = function() return CS.Account.options.lockbutton end,
setFunc = function(value)
CS.SettingsUpdate('lockbutton',value)
CS.OptionSet()
end,
default = CS.AccountInit.options.lockbutton,
},
[4] = {
type = "checkbox",
name = CS.Loc.options.lockelements,
tooltip = "",
getFunc = function() return CS.Account.options.lockelements end,
setFunc = function(value)
CS.SettingsUpdate('lockelements',value)
CS.OptionSet()
end,
default = CS.AccountInit.options.lockelements,
},
[5] = {
type = "checkbox",
name = CS.Loc.options.closeonmove,
tooltip = "",
getFunc = function() return CS.Account.options.closeonmove end,
setFunc = function(value) CS.SettingsUpdate('closeonmove',value) end,
default = CS.AccountInit.options.closeonmove,
},
[6] = {
type = "checkbox",
name = CS.Loc.options.useartisan,
tooltip = "",
getFunc = function() return CS.Account.options.useartisan end,
setFunc = function(value) CS.SettingsUpdate('useartisan',value) end,
default = CS.AccountInit.options.useartisan,
disabled = true,
},
[7] = {
type = "checkbox",
name = CS.Loc.options.useflask,
tooltip = "",
getFunc = function() return CS.Account.options.useflask end,
setFunc = function(value) CS.SettingsUpdate('useflask',value) end,
default = CS.AccountInit.options.useflask,
disabled = true,
},
[8] = {
type = "checkbox",
name = CS.Loc.options.usequest,
tooltip = CS.Loc.options.usequestTooltip,
getFunc = function() return CS.Account.options.usequest end,
setFunc = function(value) CS.SettingsUpdate('usequest',value) end,
default = CS.AccountInit.options.usequest,
},
[9] = {
type = "checkbox",
name = CS.Loc.options.usecook,
tooltip = CS.Loc.options.usecookTooltip,
getFunc = function() return CS.Account.options.usecook end,
setFunc = function(value) CS.SettingsUpdate('usecook',value) end,
default = CS.AccountInit.options.usecook,
},
[10] = {
type = "dropdown",
name = CS.Loc.options.overviewstyle,
tooltip = "",
choices = CS.Loc.suboptions.overviewstyle,
getFunc = function() return CS.SettingFromIndex('overviewstyle',CS.Account.options.overviewstyle) end,
setFunc = function(value) CS.DropdownSettingsUpdate('overviewstyle',value) end,
default = CS.SettingFromIndex('overviewstyle',CS.AccountInit.options.overviewstyle),
warning = CS.Loc.reload,
},
-- CraftStoreRune Settings
[11] = {
type = "header",
name = "CraftStoreRune Settings",
width = "full",
},
[12] = {
type = "checkbox",
name = CS.Loc.options.userune,
tooltip = CS.Loc.options.useruneTooltip,
getFunc = function() return CS.Account.options.userune end,
setFunc = function(value) CS.SettingsUpdate('userune',value) end,
default = CS.AccountInit.options.userune,
},
[13] = {
type = "checkbox",
name = CS.Loc.options.userunecreation,
tooltip = CS.Loc.options.userunecreationTooltip,
getFunc = function() return CS.Account.options.userunecreation end,
setFunc = function(value) CS.SettingsUpdate('userunecreation',value) end,
default = CS.AccountInit.options.userunecreation,
disabled = function() return not CS.Account.options.userune end,
},
[14] = {
type = "checkbox",
name = CS.Loc.options.useruneextraction,
tooltip = CS.Loc.options.useruneextractionTooltip,
getFunc = function() return CS.Account.options.useruneextraction end,
setFunc = function(value) CS.SettingsUpdate('useruneextraction',value) end,
default = CS.AccountInit.options.useruneextraction,
disabled = function() return not CS.Account.options.userune end,
},
[15] = {
type = "checkbox",
name = CS.Loc.options.userunerecipe,
tooltip = CS.Loc.options.userunerecipeTooltip,
getFunc = function() return CS.Account.options.userunerecipe end,
setFunc = function(value) CS.SettingsUpdate('userunerecipe',value) end,
default = CS.AccountInit.options.userunerecipe,
disabled = function() return not CS.Account.options.userune end,
},
--Item options
[16] = {
type = "header",
name = "Item Settings",
width = "full",
},
[17] = {
type = "checkbox",
name = CS.Loc.options.markitems,
tooltip = "",
getFunc = function() return CS.Account.options.markitems end,
setFunc = function(value) CS.SettingsUpdate('markitems',value) end,
default = CS.AccountInit.options.markitems,
},
[18] = {
type = "checkbox",
name = CS.Loc.options.showsymbols,
tooltip = "",
getFunc = function() return CS.Account.options.showsymbols end,
setFunc = function(value) CS.SettingsUpdate('showsymbols',value) end,
default = CS.AccountInit.options.showsymbols,
},
[19] = {
type = "checkbox",
name = CS.Loc.options.marksetitems,
tooltip = "",
getFunc = function() return CS.Account.options.marksetitems end,
setFunc = function(value)
CS.SettingsUpdate('marksetitems',value)
CS.UpdateGridPerSettings()
end,
default = CS.AccountInit.options.marksetitems,
},
[20] = {
type = "checkbox",
name = CS.Loc.options.stacksplit,
tooltip = "",
getFunc = function() return CS.Account.options.stacksplit end,
setFunc = function(value) CS.SettingsUpdate('stacksplit',value) end,
default = CS.AccountInit.options.stacksplit,
},
[21] = {
type = "checkbox",
name = CS.Loc.options.markduplicates,
tooltip = "",
getFunc = function() return CS.Account.options.markduplicates end,
setFunc = function(value) CS.SettingsUpdate('markduplicates',value) end,
default = CS.AccountInit.options.markduplicates,
},
--Alarm options
[22] = {
type = "header",
name = "Alarm Settings",
width = "full",
},
[23] = {
type = "dropdown",
name = CS.Loc.options.timeralarm,
tooltip = "",
choices = CS.Loc.suboptions.alarms,
getFunc = function() return CS.SettingFromIndex('alarms',CS.Account.options.timeralarm) end,
setFunc = function(value) CS.DropdownSettingsUpdate('timeralarm',value,'alarms') end,
default = CS.SettingFromIndex('alarms',CS.AccountInit.options.timeralarm),
},
[24] = {
type = "dropdown",
name = CS.Loc.options.mountalarm,
tooltip = "",
choices = CS.Loc.suboptions.alarms,
getFunc = function() return CS.SettingFromIndex('alarms',CS.Account.options.mountalarm) end,
setFunc = function(value) CS.DropdownSettingsUpdate('mountalarm',value,'alarms') end,
default = CS.SettingFromIndex('alarms',CS.AccountInit.options.mountalarm),
},
[25] = {
type = "dropdown",
name = CS.Loc.options.researchalarm,
tooltip = "",
choices = CS.Loc.suboptions.alarms,
getFunc = function() return CS.SettingFromIndex('alarms',CS.Account.options.researchalarm) end,
setFunc = function(value) CS.DropdownSettingsUpdate('researchalarm',value,'alarms') end,
default = CS.SettingFromIndex('alarms',CS.AccountInit.options.researchalarm),
},
--Tooltip settings
[26] = {
type = "header",
name = "Tooltip Settings",
width = "full",
},
[27] = {
type = "checkbox",
name = CS.Loc.options.displayrunelevel,
tooltip = "",
getFunc = function() return CS.Account.options.displayrunelevel end,
setFunc = function(value) CS.SettingsUpdate('displayrunelevel',value) end,
default = CS.AccountInit.options.displayrunelevel,
},
[28] = {
type = "checkbox",
name = CS.Loc.options.displaymm,
tooltip = "",
getFunc = function() return CS.Account.options.displaymm end,
setFunc = function(value) CS.SettingsUpdate('displaymm',value) end,
default = CS.AccountInit.options.displaymm,
},
[29] = {
type = "checkbox",
name = CS.Loc.options.displayttc,
tooltip = "",
getFunc = function() return CS.Account.options.displayttc end,
setFunc = function(value) CS.SettingsUpdate('displayttc',value) end,
default = CS.AccountInit.options.displayttc,
},
[30] = {
type = "checkbox",
name = CS.Loc.options.displaystyles,
tooltip = "",
getFunc = function() return CS.Account.options.displaystyles end,
setFunc = function(value) CS.SettingsUpdate('displaystyles',value) end,
default = CS.AccountInit.options.displaystyles,
},
[31] = {
type = "checkbox",
name = CS.Loc.options.showstock,
tooltip = "",
getFunc = function() return CS.Account.options.showstock end,
setFunc = function(value) CS.SettingsUpdate('showstock',value) end,
default = CS.AccountInit.options.showstock,
},
[32] = {
type = "checkbox",
name = CS.Loc.options.displayunknown,
tooltip = "",
getFunc = function() return CS.Account.options.displayunknown end,
setFunc = function(value) CS.SettingsUpdate('displayunknown',value) end,
default = CS.AccountInit.options.displayunknown,
},
[33] = {
type = "checkbox",
name = CS.Loc.options.displayknown,
tooltip = "",
getFunc = function() return CS.Account.options.displayknown end,
setFunc = function(value) CS.SettingsUpdate('displayknown',value) end,
default = CS.AccountInit.options.displayknown,
},
[34] = {
type = "checkbox",
name = CS.Loc.options.displaycount,
tooltip = "",
getFunc = function() return CS.Account.options.displaycount end,
setFunc = function(value) CS.SettingsUpdate('displaycount',value) end,
default = CS.AccountInit.options.displaycount,
},
--Misc options
[35] = {
type = "header",
name = "Misc Settings",
width = "full",
},
[36] = {
type = "checkbox",
name = CS.Loc.options.playrunevoice,
tooltip = "",
getFunc = function() return CS.Account.options.playrunevoice end,
setFunc = function(value) CS.SettingsUpdate('playrunevoice',value) end,
default = CS.AccountInit.options.playrunevoice,
},
[37] = {
type = "checkbox",
name = CS.Loc.options.advancedcolorgrid,
tooltip = "",
getFunc = function() return CS.Account.options.advancedcolorgrid end,
setFunc = function(value)
CS.SettingsUpdate('advancedcolorgrid',value)
CS.UpdateGridPerSettings()
end,
default = CS.AccountInit.options.advancedcolorgrid,
},
[38] = {
type = "checkbox",
name = CS.Loc.options.lockprotection,
tooltip = "",
getFunc = function() return CS.Account.options.lockprotection end,
setFunc = function(value) CS.SettingsUpdate('lockprotection',value) end,
default = CS.AccountInit.options.lockprotection,
},
[39] = {
type = "checkbox",
name = CS.Loc.options.inspirationgain,
tooltip = "",
getFunc = function() return CS.Account.options.inspirationgain end,
setFunc = function(value) CS.SettingsUpdate('inspirationgain',value) end,
default = CS.AccountInit.options.inspirationgain,
},
[40] = {
type = "dropdown",
name = CS.Loc.options.sortsets,
tooltip = "",
choices = CS.Loc.suboptions.sortsets,
getFunc = function() return CS.SettingFromIndex('sortsets',CS.Account.options.sortsets) end,
setFunc = function(value) CS.DropdownSettingsUpdate('sortsets',value) end,
default = CS.SettingFromIndex('sortsets',CS.AccountInit.options.sortsets),
},
[41] = {
type = "dropdown",
name = CS.Loc.options.sortstyles,
tooltip = "",
choices = CS.Loc.suboptions.sortstyles,
getFunc = function() return CS.SettingFromIndex('sortstyles',CS.Account.options.sortstyles) end,
setFunc = function(value)
CS.DropdownSettingsUpdate('sortstyles',value)
CS.StyleInitialize()
end,
default = CS.SettingFromIndex('sortstyles',CS.AccountInit.options.sortstyles),
},
[42] = {
type = "editbox",
name = CS.Loc.options.bulkcraftlimit,
tooltip = "",
isMultiline = false,
getFunc = function() return CS.Account.options.bulkcraftlimit end,
setFunc = function(value) CS.SettingsUpdate('bulkcraftlimit',tonumber(value)) end,
default = CS.AccountInit.options.bulkcraftlimit,
},
}