-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsettings.lua
More file actions
98 lines (86 loc) · 2.26 KB
/
settings.lua
File metadata and controls
98 lines (86 loc) · 2.26 KB
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
local _, addon = ...
local L = addon.L
local DEFAULT_POSITION = {'CENTER', 'UIParent', 'CENTER', 0, 0}
local settings = addon:T{
{
key = 'alwaysShow',
type = 'toggle',
title = L['Auto show'],
tooltip = L['Always show the loot list'],
default = false
},
{
key = 'fillDirection',
type = 'menu',
title = L['Direction'],
tooltip = L['Direction the loot list should appear'],
default = 'UP',
options = {
{value = 'UP', label = L['Up']},
{value = 'DOWN', label = L['Down']},
},
},
}
if addon.GetAvailableFavoriteProviders then
local providers = addon:GetAvailableFavoriteProviders()
if providers and #providers > 0 then
local providerOptions = {
{value = 'ANY', label = L['Any']},
}
for _, name in next, providers do
table.insert(providerOptions, {
value = name,
label = name,
})
end
settings:insert({
key = 'favoriteProvider',
type = 'menu',
title = L['Favorites from'],
tooltip = L['Select a Favorite Items provider'],
default = 'ANY',
options = providerOptions,
})
settings:insert({
key = 'favoriteAlert',
type = 'toggle',
title = L['Favorite alert'],
tooltip = L['Visual and Audio cue for favorited Items'],
default = true,
parent = 'favoriteProvider',
})
settings:insert({
key = 'favoritesOnly',
type = 'toggle',
title = L['Only favorites'],
tooltip = L['Filter preview to favorited items only'],
default = false,
parent = 'favoriteProvider',
})
end
end
addon:RegisterSettings('BonusRollPreviewDB', settings)
addon:RegisterSlash('/bonusrollpreview', '/brp', function(msg)
msg = msg:lower()
if msg == 'unlock' or msg == 'lock' then
BonusRollPreview:ToggleLock()
elseif msg == 'reset' then
BonusRollPreviewDB.anchor = CopyTable(DEFAULT_POSITION)
BonusRollPreview:OnEvent('PLAYER_LOGIN')
else
addon:OpenSettings()
end
end)
function addon:OnLogin()
if addon.GetAvailableFavoriteProviders then
local providers = addon:GetAvailableFavoriteProviders()
if #providers == 0 then
BonusRollPreviewDB.favoritesOnly = false
elseif not addon:HasFavoriteProvider(BonusRollPreviewDB.favoriteProvider) then
BonusRollPreviewDB.favoriteProvider = 'ANY'
end
end
if not BonusRollPreviewDB.anchor then
BonusRollPreviewDB.anchor = CopyTable(DEFAULT_POSITION)
end
end