-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddon.lua
37 lines (31 loc) · 990 Bytes
/
addon.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
local addonName, addon = ...
local isBound
local bindParent = CreateFrame('Frame')
function addon:Unbind()
self:Defer('ClearOverrideBindings', bindParent)
isBound = true
end
function addon:IsBound()
return not not isBound
end
local ACTION_NAME = 'ACTIONBUTTON%d'
function addon:BindAction(actionIndex)
self:Unbind()
self:Defer('SetOverrideBinding', bindParent, true, 'SPACE', ACTION_NAME:format(actionIndex))
isBound = true
end
do
local macroButton = addon:CreateButton('Button', addonName .. 'MacroButton', UIParent, 'SecureActionButtonTemplate')
macroButton:SetAttribute('type', 'macro')
function addon:BindMacro(macro)
self:Unbind()
self:DeferMethod(macroButton, 'SetAttribute', 'macrotext', macro)
self:Defer('SetOverrideBindingClick', bindParent, true, 'SPACE', macroButton:GetName(), 'LeftButton')
isBound = true
end
end
function addon:SendNotice(message)
for _ = 1, 2 do
RaidNotice_AddMessage(RaidWarningFrame, message, ChatTypeInfo.RAID_WARNING)
end
end