forked from Hyperioxes/AlchemyTooltips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.lua
343 lines (290 loc) · 12.1 KB
/
Settings.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
function ATT_LoadSettings()
local panelData = {
type = "panel",
name = "Alchemy Tooltips",
displayName = "Alchemy Tooltips",
author = "Hyperioxes",
version = "1.17",
website = "https://www.esoui.com/downloads/info2531-AlchemyTooltips.html",
feedback = "https://www.esoui.com/downloads/info2531-AlchemyTooltips.html#comments",
donation = "https://www.esoui.com/downloads/info2531-AlchemyTooltips.html#donate",
slashCommand = "/alchemytooltips",
registerForRefresh = true,
registerForDefaults = true,
}
LibAddonMenu2:RegisterAddonPanel("AlchemyTooltips",panelData)
local optionsTable = {
[1] = {
type = "header",
name = "General Settings",
width = "full",
},
[2] = {
type = "checkbox",
name = "Use Custom Potion Tooltips",
tooltip = "If the checkbox is on, cheapest way to craft a potion will be shown in its tooltip, along with crafting cost",
getFunc = function() return savedVars.useTooltips end,
setFunc = function(value) savedVars.useTooltips=value end,
width = "full",
--warning = "Will need to reinitialize prices",
},
[3] = {
type = "checkbox",
name = "Use Custom Potion Icons",
tooltip = "If the checkbox is on, some potion icons will be altered to reflect their actual effects",
getFunc = function() return savedVars.useCustomIcons end,
setFunc = function(value) savedVars.useCustomIcons=value end,
width = "full",
warning = "Will need to reload UI",
},
[4] = {
type = "checkbox",
name = "Use Custom Potion Names",
tooltip = "If the checkbox is on, potion names will be altered to reflect their actual effects",
getFunc = function() return savedVars.useCustomNames end,
setFunc = function(value) savedVars.useCustomNames=value end,
width = "full",
warning = "Will need to reload UI",
},
[5] = {
type = "checkbox",
name = "Use Custom Potion Quality Colors",
tooltip = "If the checkbox is on, potion name colors will be altered to reflect their crafting cost",
getFunc = function() return savedVars.useCustomQualities end,
setFunc = function(value) savedVars.useCustomQualities=value end,
width = "full",
warning = "Will need to reload UI",
},
[6] = {
type = "checkbox",
name = "Show Craft Cost",
tooltip = "If the checkbox is on, show the craft cost.",
getFunc = function() return savedVars.showCraftCost end,
setFunc = function(value) savedVars.showCraftCost=value end,
width = "full",
},
[7] = {
type = "submenu",
name = "Advanced Custom Potion Names Settings",
tooltip = "Change the way potion names are displayed in your inventory",
controls = {},
},
[8] = {
type = "submenu",
name = "Custom Potion Quality Settings",
tooltip = "Change the way potion names are displayed in your inventory",
controls = {
},
},
[9] = {
type = "header",
name = "Pricing Settings",
width = "full",
},
[10] = {
type = "checkbox",
name = "Use Tamriel Trade Centre prices",
tooltip = "If the checkbox is on, pricing formula will use Tamriel Trade Centre's suggested price to calculate crafting cost",
getFunc = function() return savedVars.TTCuse end,
setFunc = function(value) savedVars.TTCuse=value end,
width = "full",
warning = "Will need to reinitialize prices",
},
[11] = {
type = "checkbox",
name = "Use Master Merchant prices",
tooltip = "If the checkbox is on, pricing formula will use Master Merchant's average price to calculate crafting cost",
getFunc = function() return savedVars.MMuse end,
setFunc = function(value) savedVars.MMuse=value end,
width = "full",
warning ="Will need to reinitialize prices",
},
[12] = {
type = "checkbox",
name = "Use Arkadius' Trade Tools prices",
tooltip = "If the checkbox is on, pricing formula will use Arkadius Trade Tools' average price to calculate crafting cost",
getFunc = function() return savedVars.ATTuse end,
setFunc = function(value) savedVars.ATTuse=value end,
width = "full",
warning = "Will need to reinitialize prices",
},
[13] = {
type = "submenu",
name = "Altering pricing formulas",
tooltip = "Add multipliers to prices extracted from pricing addons",
controls = {
[1] = {
type = "editbox",
name = "Tamriel Trade Centre multiplier",
tooltip = "Multiplies Tamriel Trade Centre's suggested price used in Alchemy Tooltips calculations by number you input",
getFunc = function() return savedVars.TTCMultiplier end,
setFunc = function(value) savedVars.TTCMultiplier = value end,
isMultiline = false,
width = "full",
warning = "Will need to reinitialize prices",
default = "1",
},
[2] = {
type = "editbox",
name = "Master Merchant multiplier",
tooltip = "Multiplies Master Merchant's suggested price used in Alchemy Tooltips calculations by number you input",
getFunc = function() return savedVars.MMMultiplier end,
setFunc = function(value) savedVars.MMMultiplier = value end,
isMultiline = false,
width = "full",
warning = "Will need to reinitialize prices",
default = "1",
},
[3] = {
type = "editbox",
name = "Arkadius Trade Tools multiplier",
tooltip = "Multiplies Arkadius Trade Tools' suggested price used in Alchemy Tooltips calculations by number you input",
getFunc = function() return savedVars.ATTMultiplier end,
setFunc = function(value) savedVars.ATTMultiplier = value end,
isMultiline = false,
width = "full",
warning = "Will need to reinitialize prices",
default = "1",
},
},
},
[14] = {
type = "button",
name = "Reinitialize prices",
tooltip = "Reinitializes prices, click it after making changes to pricing settings above to update prices",
func = function() ATT_Functions:InitializePrices() end,
width = "full",
},
[15] = {
type = "header",
name = "Example pricing formula for Blue Entoloma",
width = "full",
},
[16] = {
type = "texture",
image = "/esoui/art/icons/crafting_mushroom_blue_entoloma_cap_r1.dds",
imageWidth = 100,
imageHeight = 100,
width = "half",
},
[17] = {
type = "description",
text = function()
result = "("
if savedVars.TTCuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","ttc") ~= nil then
result = result .. savedVars.TTCMultiplier .. " * TTC + "
end
if savedVars.MMuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","mm") ~= nil then
result = result .. savedVars.MMMultiplier .. " * MM + "
end
if savedVars.ATTuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","att") ~= nil then
result = result .. savedVars.ATTMultiplier .. " * ATT + "
end
result = result:sub(1,-3)
result = result .. ") / " .. ATT_Functions:countPricingAddons()
return result
end,
width = "full",
},
[18] = {
type = "description",
text = function()
result = "Price: ("
if savedVars.TTCuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","ttc") ~= nil then
result = result .. savedVars.TTCMultiplier .. " * " .. string.format("%.3f",LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","ttc")) .. " + "
end
if savedVars.MMuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","mm") ~= nil then
result = result .. savedVars.MMMultiplier .. " * " .. string.format("%.3f",LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","mm")) .. " + "
end
if savedVars.ATTuse and LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","att") ~= nil then
result = result .. savedVars.ATTMultiplier .. " * " .. string.format("%.3f",LibPrice.ItemLinkToPriceGold("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h","att")) .. " + "
end
result = result:sub(1,-3)
result = result .. ") / " .. ATT_Functions:countPricingAddons() .. " = " .. string.format("%.3f",ATT_Functions:GeneratePrice("|H0:item:30148:30:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h"))
return result
end,
width = "full",
},
[19] = {
type = "header",
name = "Other Settings",
width = "full",
},
[20] = {
type = "checkbox",
name = "Use old tooltip layout",
tooltip = "If the checkbox is on, tooltip layout will look like before version 1.5",
getFunc = function() return savedVars.useOld end,
setFunc = function(value) savedVars.useOld=value end,
width = "full",
},
}
table.insert(optionsTable[7].controls,{
type = "description",
text = "For any changes made here to take effect you will need to reload ui",
width = "full",
})
table.insert(optionsTable[7].controls,{
type = "description",
text = "Full name of an effect ---> Name displayed in inventory",
width = "full",
})
for key,name in pairs(ATT_Variables.properEffectNames) do
table.insert(optionsTable[7].controls,{
type = "description",
text = name.." ---> "..savedVars.effectsByWritIDShort[key],
width = "half",
reference = "description"..key
})
table.insert(optionsTable[7].controls, {
type = "editbox",
name = "Change displayed name to:",
getFunc = function() return savedVars.effectsByWritIDShort[key] end,
setFunc = function(text) savedVars.effectsByWritIDShort[key] = text
_G["description"..key].data.text = name.." ---> "..savedVars.effectsByWritIDShort[key]
_G["description"..key]:UpdateValue()
end,
isMultiline = false, --boolean
width = "half", --or "half" (optional)
default = "", --(optional)
})
end
table.insert(optionsTable[8].controls,{
type = "description",
text = "For any changes made here to take effect you will need to reload ui",
width = "full",
})
for i=1,5 do
table.insert(optionsTable[8].controls, {
type = "description",
text = ATT_Variables.qualityColors[i].." quality: "..savedVars.craftingCostQualityBrackets[i-1].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t - "..savedVars.craftingCostQualityBrackets[i].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t",
width = "half",
reference = "qualityDescription"..i,
})
table.insert(optionsTable[8].controls, {
type = "editbox",
name = "Change top bracket to:",
getFunc = function() return savedVars.craftingCostQualityBrackets[i] end,
setFunc = function(text) savedVars.craftingCostQualityBrackets[i] = tonumber(text)
_G["qualityDescription"..i].data.text = ATT_Variables.qualityColors[i].." quality: "..savedVars.craftingCostQualityBrackets[i-1].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t - "..savedVars.craftingCostQualityBrackets[i].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t"
if i == 5 then
_G["qualityDescription"..6].data.text = ATT_Variables.qualityColors[6].." quality: "..savedVars.craftingCostQualityBrackets[5].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t and more"
else
_G["qualityDescription"..i+1].data.text = ATT_Variables.qualityColors[i+1].." quality: "..savedVars.craftingCostQualityBrackets[i].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t - "..savedVars.craftingCostQualityBrackets[i+1].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t"
end
_G["qualityDescription"..i]:UpdateValue()
_G["qualityDescription"..i+1]:UpdateValue()
end,
isMultiline = false, --boolean
width = "half", --or "half" (optional)
default = "", --(optional)
})
end
table.insert(optionsTable[8].controls, {
type = "description",
text = ATT_Variables.qualityColors[6].." quality: "..savedVars.craftingCostQualityBrackets[5].."|t16:16:EsoUI/Art/currency/currency_gold.dds|t and more",
width = "full",
reference = "qualityDescription6"
})
LibAddonMenu2:RegisterOptionControls("AlchemyTooltips",optionsTable)
end