Add macro command
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## Interface: 70300
|
## Interface: 70300
|
||||||
## Title: Heimdall
|
## Title: Heimdall
|
||||||
## Version: 3.3.1
|
## Version: 3.4.0
|
||||||
## Notes: Watches over areas and alerts when hostiles spotted
|
## Notes: Watches over areas and alerts when hostiles spotted
|
||||||
## Author: Cyka
|
## Author: Cyka
|
||||||
## SavedVariables: Heimdall_Data
|
## SavedVariables: Heimdall_Data
|
||||||
|
BIN
Heimdall.zip
(Stored with Git LFS)
BIN
Heimdall.zip
(Stored with Git LFS)
Binary file not shown.
@@ -202,6 +202,41 @@ function shared.Commander.Init()
|
|||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param args string[]
|
||||||
|
local function MacroTarget(args)
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("[%s] Macroing: %s", ModuleName,
|
||||||
|
strjoin(" ", unpack(args))))
|
||||||
|
end
|
||||||
|
if #args < 2 or #args % 2 ~= 0 then
|
||||||
|
if #args < 2 or #args % 2 ~= 0 then
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format(
|
||||||
|
"[%s] Invalid number of arguments for MacroTarget", ModuleName))
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.remove(args, 1)
|
||||||
|
|
||||||
|
for i = 1, #args do
|
||||||
|
local stinky = strtrim(args[i])
|
||||||
|
local name = stinky:match("([^/]+)")
|
||||||
|
local class = stinky:match("/([^ $]+)")
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("[%s] Adding stinky: %s/%s", ModuleName, name, tostring(class)))
|
||||||
|
end
|
||||||
|
shared.stinkyTracker.stinkies[name] = {
|
||||||
|
name = name,
|
||||||
|
class = class or "unknown",
|
||||||
|
seenAt = GetTime(),
|
||||||
|
hostile = true
|
||||||
|
}
|
||||||
|
shared.dumpTable(shared.stinkyTracker.stinkies)
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
---@class Command
|
---@class Command
|
||||||
---@field keywordRe string
|
---@field keywordRe string
|
||||||
---@field commanderOnly boolean
|
---@field commanderOnly boolean
|
||||||
@@ -216,6 +251,7 @@ function shared.Commander.Init()
|
|||||||
{ keywordRe = "^joingroup$", commanderOnly = false, callback = JoinGroup },
|
{ keywordRe = "^joingroup$", commanderOnly = false, callback = JoinGroup },
|
||||||
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
|
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
|
||||||
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
|
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
|
||||||
|
{ keywordRe = "^macro", commanderOnly = false, callback = MacroTarget },
|
||||||
}
|
}
|
||||||
|
|
||||||
local commanderChannelFrame = CreateFrame("Frame")
|
local commanderChannelFrame = CreateFrame("Frame")
|
||||||
|
Reference in New Issue
Block a user