-
Notifications
You must be signed in to change notification settings - Fork 0
/
Save.lua
44 lines (35 loc) · 1.09 KB
/
Save.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
local addonName, addon = ...
function addon:SaveProfile()
if self.db.global.update_bindings_trigger then
self:SaveBindings()
end
end
function addon:SaveBindings()
local bindings = {}
local index
for index = 1, GetNumBindings() do
local bind = { GetBinding(index) }
if bind[3] then
bindings[bind[1]] = { select(3, unpack(bind)) }
end
end
self.db.profile.bindings = bindings
local bindingsDominos = nil
if LibStub("AceAddon-3.0"):GetAddon("Dominos", true) then
bindingsDominos = {}
for index = 1, 60 do
local bind = { GetBindingKey(string.format("CLICK DominosActionButton%d:LeftButton", index)) }
if #bind > 0 then
bindingsDominos[index] = bind
end
end
end
self.db.profile.bindingsDominos = bindingsDominos
end
function addon:InitializeProfile()
local profile = self.db.profile
if profile.bindings == nil then
self:Print("Created a new profile for '" .. self.db:GetCurrentProfile() .. "'")
addon:SaveBindings()
end
end