-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCore.lua
More file actions
65 lines (51 loc) · 1.56 KB
/
Copy pathCore.lua
File metadata and controls
65 lines (51 loc) · 1.56 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
local addonName, ns = ...
ns.Core = {}
local Core = ns.Core
local isInitialized = false
local clientSupported = false
function Core.IsOperational()
return isInitialized
and clientSupported
and ns.Database.Get("enabled")
end
function Core.ShowLoginHint(isSupported)
if not isSupported then
return false
end
ns.Debug.Info(ns.L.LOGIN_HINT)
return true
end
function Core.OnAddonLoaded()
if isInitialized then return end
isInitialized = true
ns.Database.Initialize()
ns.MoneyTracker.Initialize()
ns.NotificationManager.Initialize()
ns.Options.Initialize()
ns.SlashCommands.Initialize()
clientSupported = ns.ApiCompat.IsSupportedClient()
and ns.ApiCompat.HasCriticalCapabilities()
ns.Database.RegisterCallback("enabled", function(enabled)
if enabled and clientSupported then
ns.MoneyTracker.Synchronize()
end
ns.Events.SetOperational(enabled and clientSupported)
end)
ns.Events.SetOperational(Core.IsOperational())
if not clientSupported then
ns.Debug.Error(ns.L.UNSUPPORTED_CLIENT)
ns.CompatibilityProbe.RunReport()
elseif ns.Database.Get("debug") then
ns.CompatibilityProbe.RunReport()
end
ns.Debug.Log("Simple Scrolling Loot initialized.")
end
function Core.OnPlayerLogin()
Core.ShowLoginHint(clientSupported)
ns.Debug.Log(
"Player logged in. Notification processing is %s.",
Core.IsOperational() and "active" or "inactive"
)
end
-- Initialize event frame immediately
ns.Events.Initialize()