forked from DennisWG/Roid-Macros
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathConsole.lua
93 lines (69 loc) · 2.43 KB
/
Console.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--[[
Author: Dennis Werner Garske (DWG)
License: MIT License
]]
local _G = _G or getfenv(0)
local Roids = _G.Roids or {}
SLASH_PETATTACK1 = "/petattack";
SlashCmdList.PETATTACK = function(msg) Roids.DoPetAttack(msg); end
SLASH_RELOAD1 = "/rl";
SlashCmdList.RELOAD = function() ReloadUI(); end
SLASH_USE1 = "/use";
SlashCmdList.USE = Roids.DoUse;
SLASH_EQUIP1 = "/equip";
SlashCmdList.EQUIP = Roids.DoUse;
-- take back supermacro and pfUI /equip
SlashCmdList.SMEQUIP = Roids.DoUse;
SlashCmdList.PFEQUIP = Roids.DoUse;
SLASH_EQUIPOH1 = "/equipoh";
SlashCmdList.EQUIPOH = Roids.DoEquipOffhand;
SLASH_UNSHIFT1 = "/unshift";
SlashCmdList.UNSHIFT = Roids.DoUnshift;
-- TODO make this conditional too
SLASH_CANCELAURA1 = "/cancelaura";
SLASH_CANCELAURA2 = "/unbuff";
SlashCmdList.CANCELAURA = Roids.CancelAura;
SLASH_STARTATTACK1 = "/startattack";
SlashCmdList.STARTATTACK = function(msg)
if not UnitExists("target") or UnitIsDead("target") then TargetNearestEnemy() end
if not Roids.CurrentSpell.autoAttack and not Roids.CurrentSpell.autoAttackLock and UnitExists("target") and UnitCanAttack("player","target") then
Roids.CurrentSpell.autoAttackLock = true
-- time a reset in case an attack could not be started
local elapsed = 0
Roids.Frame:SetScript("OnUpdate", function ()
elapsed = elapsed + arg1
if Roids.CurrentSpell.autoAttackLock and elapsed > 0.2 then
Roids.CurrentSpell.autoAttackLock = false
Roids.Frame:SetScript("OnUpdate", nil)
end
end)
AttackTarget()
end
end
SLASH_STOPATTACK1 = "/stopattack";
SlashCmdList.STOPATTACK = function(msg)
if Roids.CurrentSpell.autoAttack and UnitExists("target") then
AttackTarget()
Roids.CurrentSpell.autoAttack = false
end
end
SLASH_STOPCASTING1 = "/stopcasting";
SlashCmdList.STOPCASTING = SpellStopCasting;
Roids.Hooks.CAST_SlashCmd = SlashCmdList.CAST;
Roids.CAST_SlashCmd = function(msg)
-- get in there first, i.e do a PreHook
if Roids.DoCast(msg) then
return;
end
-- if there was nothing for us to handle pass it to the original
Roids.Hooks.CAST_SlashCmd(msg);
end
SlashCmdList.CAST = Roids.CAST_SlashCmd;
Roids.Hooks.TARGET_SlashCmd = SlashCmdList.TARGET;
Roids.TARGET_SlashCmd = function(msg)
if Roids.DoTarget(msg) then
return;
end
Roids.Hooks.TARGET_SlashCmd(msg);
end
SlashCmdList.TARGET = Roids.TARGET_SlashCmd;