-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMacros.lua
62 lines (48 loc) · 1.42 KB
/
Macros.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
local addonName, ATOM = ...
local Module = ATOM:NewModule('Macros')
local raidTargetIndex = 0
function Module:OnEnable()
self:RegisterChatCommand('mtar', 'TargetMacroSlashCommand')
end
function Module:CreateOrUpdateMacro(name, body, icon)
local macroID = GetMacroIndexByName(name)
if macroID ~= 0 then
return EditMacro(macroID, name, icon or select(2, GetMacroInfo(name)), body or '')
end
return CreateMacro(name, icon or 'INV_MISC_QUESTIONMARK', body or '', false)
end
function Module:UpdateTargetMacro(name)
local body = [[
/tar %s
/cleartarget [noexists][dead]
/stopmacro [noexists][dead]
/atom mark
]]
if not name then
body = '/atom mark'
end
self:CreateOrUpdateMacro('TARGET', body:format(name), 'ACHIEVEMENT_HALLOWEEN_SMILEY_01')
end
function Module:TargetMacroSlashCommand(msg)
self:UpdateTargetMacro(self:GetArgs(msg))
end
function Module:MarkTarget(index)
local cycle = index == 'cycle'
if cycle then
index = raidTargetIndex < 8 and raidTargetIndex + 1 or 1
raidTargetIndex = index
else
index = tonumber(index) or 8
end
if GetRaidTargetIndex('target') ~= index then
SetRaidTarget('target', index)
if not cycle then
PlaySound(SOUNDKIT.ALARM_CLOCK_WARNING_3)
end
end
end
function Module:PickPocketMark()
if IsSpellInRange('Pick Pocket') then
self:MarkTarget('cycle')
end
end