Fix up macroer to work with the arrival and movement messages
This commit is contained in:
@@ -55,11 +55,12 @@ function shared.Macroer.Init()
|
|||||||
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, stinky>
|
||||||
local function ParseWho(msg)
|
local function ParseWho(msg)
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
for name, class in string.gmatch(msg, "([^ -/]+)-?%w*/(%w+)") do
|
for name, class in string.gmatch(msg, whoRegex) do
|
||||||
stinkies[name] = {
|
stinkies[name] = {
|
||||||
name = name,
|
name = name,
|
||||||
class = class,
|
class = class,
|
||||||
@@ -69,11 +70,15 @@ function shared.Macroer.Init()
|
|||||||
end
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, stinky>
|
||||||
local function ParseSee(msg)
|
local function ParseSee(msg)
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
local aggression, name, class = string.match(msg, "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)")
|
local aggression, name, class = string.match(msg, seeRegex)
|
||||||
|
if not name or not class then
|
||||||
|
return stinkies
|
||||||
|
end
|
||||||
local stinky = {
|
local stinky = {
|
||||||
name = name,
|
name = name,
|
||||||
class = class,
|
class = class,
|
||||||
@@ -83,10 +88,25 @@ function shared.Macroer.Init()
|
|||||||
stinkies[name] = stinky
|
stinkies[name] = stinky
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
local arrivedRegex = "([^ -/]+)-?%w* of class (%w+)"
|
||||||
|
local arrivedRegexAlt = "([^ -/]+)-?%w* %(!!!!%) of class (%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, stinky>
|
||||||
local function ParseArrived(msg)
|
local function ParseArrived(msg)
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
|
local name, class = string.match(msg, arrivedRegex)
|
||||||
|
if not name or not class then
|
||||||
|
name, class = string.match(msg, arrivedRegexAlt)
|
||||||
|
end
|
||||||
|
if not name or not class then
|
||||||
|
return stinkies
|
||||||
|
end
|
||||||
|
local stinky = {
|
||||||
|
name = name,
|
||||||
|
class = class,
|
||||||
|
seenAt = GetTime(),
|
||||||
|
hostile = true
|
||||||
|
}
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -119,6 +139,13 @@ function shared.Macroer.Init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if string.find(msg, " and guild ") then
|
||||||
|
local arrivedStinkies = ParseArrived(msg)
|
||||||
|
for name, stinky in pairs(arrivedStinkies) do
|
||||||
|
recentStinkies[name] = stinky
|
||||||
|
doUpdate = true
|
||||||
|
end
|
||||||
|
end
|
||||||
if doUpdate then
|
if doUpdate then
|
||||||
FixMacro(recentStinkies)
|
FixMacro(recentStinkies)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user