Implement the basic structure for macroer
This commit is contained in:
@@ -35,6 +35,7 @@ local function init()
|
|||||||
---@field AgentTracker InitTable
|
---@field AgentTracker InitTable
|
||||||
---@field Emoter InitTable
|
---@field Emoter InitTable
|
||||||
---@field Echoer InitTable
|
---@field Echoer InitTable
|
||||||
|
---@field Macroer InitTable
|
||||||
|
|
||||||
--- Config ---
|
--- Config ---
|
||||||
---@class HeimdallConfig
|
---@class HeimdallConfig
|
||||||
@@ -114,6 +115,7 @@ local function init()
|
|||||||
|
|
||||||
---@class HeimdallMacroerConfig
|
---@class HeimdallMacroerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field priority string[]
|
||||||
|
|
||||||
--- Data ---
|
--- Data ---
|
||||||
---@class HeimdallMessengerData
|
---@class HeimdallMessengerData
|
||||||
@@ -224,6 +226,7 @@ local function init()
|
|||||||
},
|
},
|
||||||
macroer = {
|
macroer = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "enabled" }, false),
|
||||||
|
priority = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "priority" }, {}),
|
||||||
},
|
},
|
||||||
agents = shared.GetOrDefault(Heimdall_Data, { "config", "agents" }, {}),
|
agents = shared.GetOrDefault(Heimdall_Data, { "config", "agents" }, {}),
|
||||||
}
|
}
|
||||||
@@ -318,6 +321,7 @@ local function init()
|
|||||||
shared.Dueler.Init()
|
shared.Dueler.Init()
|
||||||
shared.Bully.Init()
|
shared.Bully.Init()
|
||||||
shared.AgentTracker.Init()
|
shared.AgentTracker.Init()
|
||||||
|
shared.Macroer.Init()
|
||||||
print("Heimdall loaded!")
|
print("Heimdall loaded!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ Modules/Bully.lua
|
|||||||
Modules/AgentTracker.lua
|
Modules/AgentTracker.lua
|
||||||
Modules/Emoter.lua
|
Modules/Emoter.lua
|
||||||
Modules/Echoer.lua
|
Modules/Echoer.lua
|
||||||
|
Modules/Macroer.lua
|
||||||
Heimdall.lua
|
Heimdall.lua
|
||||||
@@ -5,5 +5,45 @@ local addonname, shared = ...
|
|||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Macroer = {}
|
shared.Macroer = {}
|
||||||
function shared.Macroer.Init()
|
function shared.Macroer.Init()
|
||||||
|
local function FindOrCreateMacro(macroName)
|
||||||
|
local idx = GetMacroIndexByName(macroName)
|
||||||
|
if idx == 0 then
|
||||||
|
CreateMacro(macroName, "INV_Misc_QuestionMark", "")
|
||||||
|
end
|
||||||
|
idx = GetMacroIndexByName(macroName)
|
||||||
|
return idx
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type table<string, number>
|
||||||
|
local recentStinkies = {}
|
||||||
|
|
||||||
|
local frame = CreateFrame("Frame")
|
||||||
|
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
|
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
|
if not Heimdall_Data.config.macroer.enabled then return end
|
||||||
|
local stinky = string.match(msg, "I see (Hostile) (.*) of")
|
||||||
|
if not stinky then
|
||||||
|
stinky = string.match(msg, "^(.*) of class")
|
||||||
|
end
|
||||||
|
if stinky then
|
||||||
|
stinky = strtrim(stinky)
|
||||||
|
stinky = string.match(stinky, "^(.*)-?")
|
||||||
|
recentStinkies[stinky] = GetTime()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hooksecurefunc("JumpOrAscendStart", function()
|
||||||
|
local idx = FindOrCreateMacro("HeimdallTarget")
|
||||||
|
local stinkies = {}
|
||||||
|
for stinky, time in pairs(recentStinkies) do
|
||||||
|
if time > GetTime() - 10 then
|
||||||
|
stinkies[#stinkies + 1] = string.format("/tar %s", stinky)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local body = strjoin("\n", unpack(stinkies))
|
||||||
|
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
||||||
|
print("Jumped")
|
||||||
|
end)
|
||||||
|
|
||||||
print("Heimdall - Macroer loaded")
|
print("Heimdall - Macroer loaded")
|
||||||
end
|
end
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -94,6 +94,7 @@ local config = {
|
|||||||
},
|
},
|
||||||
macroer = {
|
macroer = {
|
||||||
enabled = aura_env.config.macroer.enabled,
|
enabled = aura_env.config.macroer.enabled,
|
||||||
|
priority = StringToArray(aura_env.config.macroer.priority),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,6 +148,7 @@ Heimdall_Data.config.echoer.masterChannel = config.echoer.masterChannel
|
|||||||
Heimdall_Data.config.echoer.prefix = config.echoer.prefix
|
Heimdall_Data.config.echoer.prefix = config.echoer.prefix
|
||||||
|
|
||||||
Heimdall_Data.config.macroer.enabled = config.macroer.enabled
|
Heimdall_Data.config.macroer.enabled = config.macroer.enabled
|
||||||
|
Heimdall_Data.config.macroer.priority = config.macroer.priority
|
||||||
|
|
||||||
Heimdall_Data.config.whisperNotify = config.whisperNotify
|
Heimdall_Data.config.whisperNotify = config.whisperNotify
|
||||||
Heimdall_Data.config.stinkies = config.stinkies
|
Heimdall_Data.config.stinkies = config.stinkies
|
||||||
|
|||||||
Reference in New Issue
Block a user