-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDB.lua
More file actions
executable file
·85 lines (70 loc) · 2.49 KB
/
DB.lua
File metadata and controls
executable file
·85 lines (70 loc) · 2.49 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- 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 Totes !
-------------------------------------------------------------------------------
---@class position
---@field point string
---@field relativeToFrameName string
---@field relativePoint string
---@field xOffset number
---@field yOffset number
---@class DB
---@field opts table
---@field theButtonPos table position coordinates for the button
---@field theMenuPos table position coordinates for the menu
---@field theMenuSize table size and shape of the menu
local DB = {}
---@type TotesEmotes
local ADDON_NAME, Totes = ...
Totes.DB = DB
---@class Options -- IntelliJ-EmmyLua annotation
---@field isButtonShown boolean remembers if the user has hidden the button or not
---@field quickKeyBacktick boolean start menu at ~
---@field quickKeyDash boolean the menu will include - on the end
---@field quickKeyEqual boolean the menu will include = on the end
---@field isKeyboardEnabled boolean intercept keystrokes
---@field faves table<string,boolean> which emotes are favorites { emoteName = t/f }
Options = { }
-------------------------------------------------------------------------------
-- Config Opts
-------------------------------------------------------------------------------
function DB:initializeOptsMemory()
---@type Config
local Config = Totes.Config
if not TOTES_OPTS then
TOTES_OPTS = DB:getOptionDefaults()
end
DB.opts = TOTES_OPTS
end
---@return Options
function DB:getOptionDefaults()
--@type Options
local defaults = {
isButtonShown = true,
quickKeyBacktick = false,
quickKeyDash = true,
quickKeyEqual = false,
faves = {},
isKeyboardEnabled = true,
}
return defaults
end
-------------------------------------------------------------------------------
-- Button & Menu Positions & Size
-------------------------------------------------------------------------------
function DB:initializePositionMemory()
if not TOTES_COORDS then
TOTES_COORDS = {
theButtonPos = {},
theMenuPos = {},
theMenuSize = {},
}
end
DB.theButtonPos = TOTES_COORDS.theButtonPos
DB.theMenuPos = TOTES_COORDS.theMenuPos
DB.theMenuSize = TOTES_COORDS.theMenuSize
end