-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Core.lua
56 lines (46 loc) · 1.57 KB
/
Core.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
---@class DragonflightUI : AceAddon-3.0, AceConsole-3.0, AceComm-3.0, AceHook-3.0
---@diagnostic disable-next-line: assign-type-mismatch
local DF = LibStub('AceAddon-3.0'):NewAddon('DragonflightUI', 'AceConsole-3.0', 'AceComm-3.0', 'AceHook-3.0')
local db
DF.InterfaceVersion = select(4, GetBuildInfo())
DF.Cata = (DF.InterfaceVersion >= 40000)
DF.Wrath = (DF.InterfaceVersion >= 30400)
DF.Era = DF.InterfaceVersion <= 20000
DF.EraLater = DF.Era and DF.InterfaceVersion >= 11503
local defaults = {profile = {bestnumber = 42}}
function DF:OnInitialize()
-- Called when the addon is loaded
self.db = LibStub('AceDB-3.0'):New('DragonflightUIDB', defaults, true)
db = self.db.profile
self:SetupOptions()
self:RegisterSlashCommands()
self:InitVersionCheck()
end
function DF:OnEnable()
-- Called when the addon is enabled
-- self:Print('DragonflightUI enabled!')
self:ShowStartMessage()
end
function DF:OnDisable()
-- Called when the addon is disabled
end
local name, realm = UnitName('player')
local showDebug = name == 'Zimtdev'
function DF:Debug(m, value)
if showDebug then m:Print(value) end
end
function DF:Dump(value)
if showDebug then DevTools_Dump(value) end
end
function DF:ShowStartMessage()
local version = C_AddOns.GetAddOnMetadata('DragonflightUI', 'Version')
self:Print(version .. " loaded! Type '/dragonflight' or '/df' to open the options menu.")
end
function DF:GetClassColor(class, alpha)
local r, g, b, hex = GetClassColor(class)
if alpha then
return r, g, b, alpha
else
return r, g, b, 1
end
end