-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.lua
143 lines (136 loc) · 4.42 KB
/
Menu.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
-- Addon Settings Menu File
local LAM = LibAddonMenu2
function CurrencyTracker.InitializeLAM()
-- LibAddonMenu-2.0 Setup
local saveData = CurrencyTracker.savedVariables
-- Test if addon is launched for first time for each value picked by user
if saveData.displayAddonLoadedMessage == nil then
saveData.displayAddonLoadedMessage = true
end
if saveData.eventTickets == nil then
saveData.eventTickets = {}
end
if saveData.eventTickets.tracking == nil then
saveData.eventTickets.tracking = true
end
if saveData.eventTickets.GUILeft == nil then
saveData.eventTickets.GUILeft = 1800
end
if saveData.eventTickets.GUITop == nil then
saveData.eventTickets.GUITop = 400
end
if saveData.eventTickets.alwaysDisplay == nil then
saveData.eventTickets.alwaysDisplay = false
end
if saveData.eventTickets.amountThreshold == nil then
saveData.eventTickets.amountThreshold = 10
end
if saveData.writVouchers == nil then
saveData.writVouchers = {}
end
if saveData.writVouchers.tracking == nil then
saveData.writVouchers.tracking = true
end
if saveData.writVouchers.GUILeft == nil then
saveData.writVouchers.GUILeft = 1800
end
if saveData.writVouchers.GUITop == nil then
saveData.writVouchers.GUITop = 450
end
if saveData.writVouchers.alwaysDisplay == nil then
saveData.writVouchers.alwaysDisplay = false
end
if saveData.writVouchers.amountThreshold == nil then
saveData.writVouchers.amountThreshold = 200
end
local settingsPanel
local settingsPanelName = CurrencyTracker.name .. "SettingsPanel"
local settingsPanelData = {
type = "panel",
name = CurrencyTracker.name,
author = CurrencyTracker.author,
version = CurrencyTracker.version,
website = CurrencyTracker.website
}
local settingsOptionsData = {{
type = "header",
name = "general"
}, {
type = "checkbox",
name = "Enable start message",
getFunc = function()
return saveData.displayAddonLoadedMessage
end,
setFunc = function(value)
saveData.displayAddonLoadedMessage = value
end
}, {
type = "header",
name = "Event tickets"
}, {
type = "checkbox",
name = "Enable event tickets tracking",
getFunc = function()
return saveData.eventTickets.tracking
end,
setFunc = function(value)
saveData.eventTickets.tracking = value
end
}, {
type = "checkbox",
name = "Hide warning when amount is under treshold",
getFunc = function()
return not saveData.eventTickets.alwaysDisplay
end,
setFunc = function(value)
saveData.eventTickets.alwaysDisplay = not value
end
}, {
type = "slider",
name = "Amount required to trigger display",
min = 0,
max = 12,
getFunc = function()
return saveData.eventTickets.amountThreshold
end,
setFunc = function(value)
saveData.eventTickets.amountThreshold = value
CurrencyTracker.EventTickets.OnAmountThresholdChanged()
end
}, {
type = "header",
name = "Writ vouchers"
}, {
type = "checkbox",
name = "Enable writ vouchers tracking",
getFunc = function()
return saveData.writVouchers.tracking
end,
setFunc = function(value)
saveData.writVouchers.tracking = value
end
}, {
type = "checkbox",
name = "Hide warning when amount is under treshold",
getFunc = function()
return not saveData.writVouchers.alwaysDisplay
end,
setFunc = function(value)
saveData.writVouchers.alwaysDisplay = not value
end
}, {
type = "slider",
name = "Amount required to trigger display",
min = 0,
max = 10000,
getFunc = function()
return saveData.writVouchers.amountThreshold
end,
setFunc = function(value)
saveData.writVouchers.amountThreshold = value
CurrencyTracker.WritVouchers.OnAmountThresholdChanged()
end
}}
settingsPanel = LAM:RegisterAddonPanel(settingsPanelName, settingsPanelData)
LAM:RegisterOptionControls(settingsPanelName, settingsOptionsData)
end