-
Notifications
You must be signed in to change notification settings - Fork 1
/
Settings.lua
68 lines (61 loc) · 2.05 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
local addon = 'Classic Achievements'
local loc = SexyLib:Localization(addon)
SexyLib:InitLogger(addon, '&6')
local options = {
type = 'group',
args = {
enableSharing = {
name = loc:Get('OPTION_SHARING'),
desc = loc:Get('OPTION_SHARING_DESC'),
type = 'toggle',
width = 2,
set = function(info, val) CA_Settings.sharing = val end,
get = function(info) return CA_Settings.sharing end
},
enableMicrobutton = {
name = loc:Get('OPTION_MICROBUTTON'),
desc = loc:Get('OPTION_MICROBUTTON_DESC'),
type = 'toggle',
width = 2,
set = function(info, val) CA_Settings.microbutton = val end,
get = function(info) return CA_IsMicrobuttonEnabled() end
},
updateMapExploration = {
name = loc:Get('OPTION_UPDATE_MAP_EXPLORATION'),
desc = loc:Get('OPTION_UPDATE_MAP_EXPLORATION_DESC'),
type = 'execute',
width = 2,
func = function() ClassicAchievements_UpdateExploredAreas() end
},
resetAchievements = {
name = loc:Get('OPTION_RESET_ACHIEVEMENTS'),
desc = loc:Get('OPTION_RESET_ACHIEVEMENTS_DESC'),
type = 'execute',
width = 2,
func = function()
CA_CompletionManager:GetLocal():Reset()
ClassicAchievements_performInitialCheck()
end
}
}
}
LibStub("AceConfig-3.0"):RegisterOptionsTable(addon, options)
LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addon)
SexyLib:Util():AfterLogin(function()
if not CA_Settings then
CA_Settings = {
sharing = true,
microbutton = true
}
end
end)
C_Timer.After(2, function()
CA_FirstLogin = false
end)
function CA_IsSharingAchievementsInChat()
return CA_Settings.sharing and not CA_FirstLogin
end
function CA_IsMicrobuttonEnabled()
if CA_Settings.microbutton == nil then CA_Settings.microbutton = true end
return CA_Settings.microbutton
end