-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathInit.lua
64 lines (55 loc) · 2.02 KB
/
Init.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
---@type string
local Name = ...
---@class Addon: AceAddon, AceConsole-3.0, AceComm-3.0, AceSerializer-3.0, AceEvent-3.0, AceTimer-3.0, AceHook-3.0
local Addon = select(2, ...)
local Version = C_AddOns.GetAddOnMetadata("PersoLootRoll", "Version")
LibStub("AceAddon-3.0"):NewAddon(Addon, Name, "AceConsole-3.0", "AceComm-3.0", "AceSerializer-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0")
-- Constants
Addon.ABBR = "PLR"
Addon.VERSION = tonumber(Version) or Version
Addon.DEBUG = false
-- Modules
---@class Module: AceModule
local Module = {}
Addon.Module = Module
---@return boolean
function Module:ShouldBeEnabled() return self.enabledState end
function Module:CheckState(...)
if Addon.Util.Bool.XOR(self:ShouldBeEnabled(...), self.enabledState) then
if not self.initialized then
self:SetEnabledState(not self.enabledState)
else
self[self.enabledState and "Disable" or "Enable"](self)
end
end
self.initialized = true
end
-- Core
---@class GUI: AceModule, AceEvent-3.0
Addon.GUI = Addon:NewModule("GUI", Module, "AceEvent-3.0")
Addon.Options = {}
Addon.Roll = {}
-- Util
Addon.Comm = {}
Addon.Item = {}
Addon.Locale = {}
Addon.Unit = {}
Addon.Util = {}
-- Modules
---@class Inspect: AceModule, AceEvent-3.0, AceTimer-3.0
Addon.Inspect = Addon:NewModule("Inspect", Module, "AceEvent-3.0", "AceTimer-3.0")
---@class Session: AceModule, AceEvent-3.0
Addon.Session = Addon:NewModule("Session", Module, "AceEvent-3.0")
---@class Trade: AceModule, AceEvent-3.0
Addon.Trade = Addon:NewModule("Trade", Module, "AceEvent-3.0")
-- Plugins
---@class EPGP: AceModule, AceEvent-3.0, AceTimer-3.0
Addon.EPGP = Addon:NewModule("EPGP", Module, "AceEvent-3.0", "AceTimer-3.0")
---@class PLH: AceModule, AceEvent-3.0
Addon.PLH = Addon:NewModule("PLH", Module, "AceEvent-3.0")
---@class RCLC: AceModule, AceEvent-3.0, AceTimer-3.0, AceSerializer-3.0
Addon.RCLC = Addon:NewModule("RCLC", Module, "AceEvent-3.0", "AceTimer-3.0", "AceSerializer-3.0")
-- TODO: DEBUG
if true or Addon.DEBUG then
PLR = Addon
end