-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDB.lua
executable file
·88 lines (70 loc) · 2.44 KB
/
DB.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
-- DB
-- access to Bliz's persisted data facility
-------------------------------------------------------------------------------
-- Module Loading
--
-- Bliz's SavedVariables don't like my Wormhole magic, so, I've isolated them here
-- there is no call to Wormhole() so we're in the global namespace, NOT in the Ufo !
-------------------------------------------------------------------------------
---@class DB
local DB = {}
---@type Ufo
local ADDON_NAME, Ufo = ...
Ufo.DB = DB
-------------------------------------------------------------------------------
-- Flyouts
-------------------------------------------------------------------------------
function DB:initializeFlyouts()
if not UFO_SV_ACCOUNT then
UFO_SV_ACCOUNT = { flyouts={}, n=0, orderedFlyoutIds={} }
end
end
-- the set of flyouts is shared between all toons on the account
function DB:getFlyoutDefs()
return UFO_SV_ACCOUNT.flyouts
end
function DB:getOrderedFlyoutIds()
return UFO_SV_ACCOUNT.orderedFlyoutIds
end
function DB:nextN()
UFO_SV_ACCOUNT.n = (UFO_SV_ACCOUNT.n or 0) + 1
return UFO_SV_ACCOUNT.n
end
-------------------------------------------------------------------------------
-- Placements
-------------------------------------------------------------------------------
function DB:initializePlacements()
if not UFO_SV_TOON then
UFO_SV_TOON = { placementsForAllSpecs = {} }
end
end
-- the placement of flyouts on the action bars is stored separately for each toon
function DB:getAllSpecsPlacementsConfig()
return UFO_SV_TOON.placementsForAllSpecs
end
function DB:canHazPet(arg)
local specId = GetSpecialization()
if UFO_SV_TOON.canHazPet == nil then
UFO_SV_TOON.canHazPet = {}
end
if arg ~= nil then
UFO_SV_TOON.canHazPet[specId] = arg and true or false
end
return UFO_SV_TOON.canHazPet[specId] or false
end
-------------------------------------------------------------------------------
-- Config Opts
-------------------------------------------------------------------------------
function DB:initializeOptsMemory()
if not UFO_SV_ACCOUNT.opts then
UFO_SV_ACCOUNT.opts = Ufo.Config:getOptionDefaults()
end
---@type Config
local Config = Ufo.Config
Config.opts = UFO_SV_ACCOUNT.opts
Config.optDefaults = Config:getOptionDefaults()
-- new opt introduced by UFO v10.1.7.a
if not Config.opts.clickers then
Config.opts.clickers = Config.optDefaults.clickers
end
end