-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathITTsRosterBot-Settings.lua
436 lines (399 loc) · 15.8 KB
/
ITTsRosterBot-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
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
local LAM2 = LibAddonMenu2
local Settings = {}
ITTsRosterBot.Settings = Settings
local defaults = {
settings = {
guilds = {
{ name = "Guild Slot #1", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #2", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #3", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #4", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #5", id = 0, disabled = true, selected = false }
},
guildsCache = {
{ name = "Guild Slot #1", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #2", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #3", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #4", id = 0, disabled = true, selected = false },
{ name = "Guild Slot #5", id = 0, disabled = true, selected = false }
},
services = {
sales = "MM3"
},
historyHighlighting = true,
applications = {
applicationAttachment = true,
sales = 14,
rankIcon = true,
donations = true,
guildName = true
}
},
UI = {
history = {
item = true,
gold = true
}
},
timeFrameIndex = 4,
join_records = {}
}
-- --------------------
-- Create Settings
-- --------------------
local lamPanelCreationInitDone = false
local panelData = {
type = "panel",
name = "ITT's Roster Bot",
author = "ghostbane",
registerForRefresh = true,
keywords = "guild"
}
local function disableServiceDropdown()
return defaults.settings.services.auto
end
local function buildSettingsOptions()
local optionsData = {}
optionsData[ #optionsData + 1 ] = {
type = "header",
name = "Guilds"
}
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text = [[]]
}
for i = 1, 5 do
optionsData[ #optionsData + 1 ] = {
type = "checkbox",
name = function()
local color = ""
--[[ if ITTsRosterBot.db.settings.guilds[ i ].selected then
color = "|c" .. ITTsRosterBot.Utils:GetGuildColor( i ).hex
else
color = ""
end ]]
return color .. ITTsRosterBot.db.settings.guilds[ i ].name
end,
tooltip = function()
-- if db.settings.guilds[i].disabled then
-- return "You do not have the correct permissions to scan this guild"
-- else
return "Turn scanning on or off for " .. ITTsRosterBot.db.settings.guilds[ i ].name
-- end
end,
-- disabled = function() return db.settings.guilds[i].disabled end,
getFunc = function()
return ITTsRosterBot.db.settings.guilds[ i ].selected
end,
setFunc = function( value )
ITTsRosterBot.db.settings.guilds[ i ].selected = value
-- "ITTsRosterBotSettingsGuild" .. tostring( i ):UpdateValue( true )
end,
default = defaults.settings.guilds[ i ].selected,
reference = "ITTsRosterBotSettingsGuild" .. tostring( i )
}
end
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text =
[[Whilst we try to handle things automatically, stuff can slip through. If the above guild list is not correct due to a recent change, you may need to run the /reloadui command]]
}
--[[ optionsData[ #optionsData + 1 ] = {
type = "checkbox",
name = "Guild History Highlighting",
getFunc = function()
return ITTsRosterBot.db.settings.historyHighlighting
end,
setFunc = function( value )
ITTsRosterBot.db.settings.historyHighlighting = value
end,
default = defaults.settings.historyHighlighting
} ]]
-- Color dropdown choices based on availability
local choicesLabels = {}
local ATT = "|c474747Arkadius' Trade Tools|r"
local MM = "|c474747Master Merchant 3.6|r"
for k, v in pairs( ITTsRosterBot.SalesAdapter.adapters ) do
if ITTsRosterBot.SalesAdapter.adapters[ k ]:Available() then
if ITTsRosterBot.SalesAdapter.adapters[ k ].settingsLabel == "Arkadius' Trade Tools" then
ATT = "Arkadius' Trade Tools"
elseif ITTsRosterBot.SalesAdapter.adapters[ k ].settingsLabel == "Master Merchant 3.6" then
MM = "Master Merchant 3.6"
end
else
end
end
choicesLabels = { "None", ATT, MM }
local choices = { "None", "Arkadius' Trade Tools", "Master Merchant 3.6" }
-- Sales Services
optionsData[ #optionsData + 1 ] = {
type = "submenu",
name = "General Settings",
tooltip = "Here you can chose your prefered trade addon as well as the colors for colorization of join dates!",
icon = "/esoui/art/tutorial/gamepad/gp_playermenu_icon_settings.dds",
controls = {
[ 1 ] = {
type = "description",
--title = "My Title", --(optional)
title = nil, --(optional)
text =
"Here you can edit various settings. If the color of the sales service of your choice is greyed out it is currently not available. You can still select it and it will keep that settings if you have enabled the addon.",
width = "full" --or "half" (optional)
},
[ 2 ] = {
type = "dropdown",
name = "Sales Service",
tooltip = "Choose a Sales Service for the Sidebar stats",
choices = choicesLabels,
choicesValues = choices,
getFunc = function()
local choice = "None"
if ITTsRosterBot.db.settings.services.sales ~= "None" then
choice = ITTsRosterBot.SalesAdapter.adapters[ ITTsRosterBot.db.settings.services.sales ]
.settingsLabel
end
return choice
end,
setFunc = function( choice )
ITTsRosterBot:SelectSalesService( choice )
end,
},
[ 3 ] = {
type = "slider",
name = "Colorize Joindate #1",
tooltip =
"If the time of membership is |cff0000below|r this number it will colorize the duration since the join red.",
getFunc = function()
return ITTsRosterBot.db.newcomer
end,
setFunc = function( number )
ITTsRosterBot.db.newcomer = number
end,
width = "half",
disabled = false,
min = 0,
max = 14,
step = 1
},
[ 4 ] = {
type = "slider",
name = "Colorize Joindate #2",
tooltip =
"If the time of membership is |cff0000above|r this number it will colorize the duration since the join green.",
getFunc = function()
return ITTsRosterBot.db.oldNumber
end,
setFunc = function( number )
ITTsRosterBot.db.oldNumber = number
end,
width = "half",
disabled = false,
min = 14,
max = 180,
step = 1
},
[ 5 ] = {
type = "checkbox",
name = "Guild History Highlighting",
getFunc = function()
return ITTsRosterBot.db.settings.historyHighlighting
end,
setFunc = function( value )
ITTsRosterBot.db.settings.historyHighlighting = value
end,
default = defaults.settings.historyHighlighting
},
}
}
optionsData[ #optionsData + 1 ] = {
type = "submenu",
name = "Application Attachments",
icon = "/esoui/art/guildfinder/gamepad/gp_guildrecruitment_menuicon_applications.dds",
controls = {
[ 1 ] = {
type = "description",
--title = "My Title", --(optional)
title = nil, --(optional)
text =
"Here you can edit the attachments to the application tooltips.",
width = "full" --or "half" (optional)
},
[ 2 ] = {
type = "checkbox",
name = "Enable Application Attachments",
width = "full",
tooltip = "Will attach information about the applicant under the default application tooltip",
getFunc = function()
return ITTsRosterBot.db.settings.applications.applicationAttachment
end,
setFunc = function( value )
ITTsRosterBot.db.settings.applications.applicationAttachment = value
end,
default = defaults.settings.applications.applicationAttachment
},
[ 3 ] = {
type = "checkbox",
name = "Enable Guild Names",
width = "half",
--disabled = not ITTsRosterBot.db.settings.applications.applicationAttachment,
tooltip = "Include the guild name to the attachment?",
getFunc = function()
return ITTsRosterBot.db.settings.applications.guildName
end,
setFunc = function( value )
ITTsRosterBot.db.settings.applications.guildName = value
end,
disabled = function()
return not ITTsRosterBot.db.settings.applications.applicationAttachment
end,
default = defaults.settings.applications.guildName
},
[ 4 ] = {
type = "checkbox",
name = "Enable Rank Icon",
--disabled = not ITTsRosterBot.db.settings.applications.applicationAttachment,
width = "half",
tooltip = "Include the rank icon to the attachment?",
getFunc = function()
return ITTsRosterBot.db.settings.applications.rankIcon
end,
disabled = function()
return not ITTsRosterBot.db.settings.applications.applicationAttachment
end,
setFunc = function( value )
ITTsRosterBot.db.settings.applications.rankIcon = value
end,
default = defaults.settings.applications.rankIcon
},
[ 5 ] = {
type = "slider",
name = "Sales Timeframe",
tooltip =
"Chose the timeframe which gets used to check the sales and the donations from the applicant. 0 means the option is turned off.",
-- disabled = not ITTsRosterBot.db.settings.applications.applicationAttachment,
getFunc = function()
return ITTsRosterBot.db.settings.applications.sales
end,
setFunc = function( number )
ITTsRosterBot.db.settings.applications.sales = number
end,
disabled = function()
return not ITTsRosterBot.db.settings.applications.applicationAttachment
end,
width = "half",
min = 0,
max = 30,
step = 1,
default = defaults.settings.applications.sales
},
[ 6 ] = {
type = "checkbox",
name = "Enable Donations",
width = "half",
--disabled = not ITTsRosterBot.db.settings.applications.applicationAttachment,
tooltip = "Include the donations to the attachment?",
getFunc = function()
return ITTsRosterBot.db.settings.applications.donations
end,
setFunc = function( value )
ITTsRosterBot.db.settings.applications.donations = value
end,
disabled = function()
return not ITTsRosterBot.db.settings.applications.applicationAttachment
end,
default = defaults.settings.applications.donations
},
}
}
--[[ optionsData[ #optionsData + 1 ] = {
type = "submenu",
name = "Chat Formatting",
icon = "/esoui/art/tutorial/chat-notifications_up.dds",
controls = {
[ 1 ] = {
type = "description",
--title = "My Title", --(optional)
title = nil, --(optional)
text =
"Here you can edit the settings for each guild! First choose the guild in the dropdown below, then edit the templates or turn settings on / off!\n\nThe current placeholders are:",
width = "full" --or "half" (optional)
}
}
} ]]
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text = [[]]
}
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text = [[]]
}
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text = [[ ]]
}
optionsData[ #optionsData + 1 ] = {
type = "description",
title = "",
text = [[ ]]
}
optionsData[ #optionsData + 1 ] = {
type = "texture",
image = "ITTsRosterBot/itt-logo.dds",
imageWidth = "192",
imageHeight = "192",
reference = "ITT_RosterBotSettingsLogo"
}
optionsData[ #optionsData + 1 ] = {
type = "checkbox",
name = "HideMePls",
getFunc = function()
return false
end,
setFunc = function( value )
return false
end,
default = false,
disabled = true,
reference = "ITT_HideMePlsRoster"
}
return optionsData
end
local _desc = true
local function makeITTDescription()
local ITTDTitle = WINDOW_MANAGER:CreateControl( "ITTsRosterBotSettingsLogoTitle", ITT_RosterBotSettingsLogo, CT_LABEL )
ITTDTitle:SetFont( "$(BOLD_FONT)|$(KB_18)|soft-shadow-thin" )
ITTDTitle:SetText( "|Cfcba03INDEPENDENT TRADING TEAM" )
ITTDTitle:SetDimensions( 240, 31 )
ITTDTitle:SetHorizontalAlignment( 1 )
ITTDTitle:SetAnchor( TOP, ITT_RosterBotSettingsLogo, BOTTOM, 0, 40 )
local ITTDLabel = WINDOW_MANAGER:CreateControl( "ITTsRosterBotSettingsLogoTitleServer", ITTsRosterBotSettingsLogoTitle,
CT_LABEL )
ITTDLabel:SetFont( "$(MEDIUM_FONT)|$(KB_16)|soft-shadow-thick" )
ITTDLabel:SetText( "|C646464PC EU" )
ITTDLabel:SetDimensions( 240, 21 )
ITTDLabel:SetHorizontalAlignment( 1 )
ITTDLabel:SetAnchor( TOP, ITTsRosterBotSettingsLogoTitle, BOTTOM, 0, -5 )
ITT_HideMePlsRoster:SetHidden( true )
end
local function LAMControlsCreatedCallbackFunc( pPanel )
if pPanel ~= ITTsRosterBot.panel then
return
end
if lamPanelCreationInitDone == true then
return
end
makeITTDescription()
lamPanelCreationInitDone = true
end
function Settings:Initialize()
ITTsRosterBot.panel = LAM2:RegisterAddonPanel( "ITTsRosterBotOptions", panelData )
local settingsOptions = buildSettingsOptions()
CALLBACK_MANAGER:RegisterCallback( "LAM-PanelControlsCreated", LAMControlsCreatedCallbackFunc )
LAM2:RegisterOptionControls( "ITTsRosterBotOptions", settingsOptions )
end