-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMacros.lua
More file actions
69 lines (54 loc) · 1.6 KB
/
Macros.lua
File metadata and controls
69 lines (54 loc) · 1.6 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
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
/tm 8
]]
if not name then
body = [[
/atom mark
/tm 8
]]
end
self:CreateOrUpdateMacro('TARGET', body:format(name), 'ACHIEVEMENT_HALLOWEEN_SMILEY_01')
end
function Module:TargetMacroSlashCommand(msg)
local arg = msg:match('^(%S+)') -- previously used self:GetArgs(msg)
self:UpdateTargetMacro(arg)
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
local targetIndex = GetRaidTargetIndex('target')
if not issecretvalue(targetIndex) and targetIndex ~= index then
-- SetRaidTarget('target', index) -- don't work in Midnight anymore
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