Add riochecker

This commit is contained in:
2024-06-05 17:14:35 +02:00
parent d75a9b65f2
commit 69278e7736
4 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
function()
return aura_env.displayString
end

View File

@@ -0,0 +1,25 @@
-- CHAT_MSG_SYSTEM
function(e, msg)
-- if e == "OPTIONS" then
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "-> Return to Karazhan: Lower / isDPS / +++5 / 8m29s / 59.1 ")
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "-> Cathedral of Eternal Night / isDPS / +++2 / 9m41s / 23.4 ")
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "-> Seat of the Triumvirate / isDPS / +++14 / 14m54s / 165.5 ")
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "-> Return to Karazhan: Upper / isDPS / +++11 / 10m23s / 128.0 ")
-- WeakAuras.ScanEvents("CHAT_MSG_SYSTEM", "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ")
-- end
if not msg then return end
if string.byte(msg, 1) + string.byte(msg, 6) == 77 then
aura_env.reading = not aura_env.reading
if aura_env.reading then
aura_env.fullMessage = {}
else
aura_env.Process()
end
return
end
if aura_env.reading then
aura_env.fullMessage[#aura_env.fullMessage + 1] = msg
end
end

View File

@@ -0,0 +1,11 @@
-- UNIT_TARGET
function(e, source)
if not source then return end
if not source == "player" then return end
if not UnitExists("target") then return end
if not UnitIsPlayer("target") then return end
local name = UnitName("target")
if not name then return end
if not aura_env.me then aura_env.me = UnitName("player") end
SendChatMessage(".ch " .. name, "WHISPER", nil, aura_env.me)
end

View File

@@ -0,0 +1,86 @@
aura_env.me = UnitName("player")
aura_env.reading = false
aura_env.fullMessage = {}
aura_env.displayString = ""
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
if not WeakAurasSaved.Cyka.MData then WeakAurasSaved.Cyka.MData = {} end
---@class Key
---@field name string
---@field role string
---@field level string
---@field time string
---@field score string
Key = {
---@return Key
---@param name string
---@param role string
---@param level string
---@param time string
---@param score string
new = function(name, role, level, time, score)
local self = setmetatable({}, {
__index = Key,
__tostring = function(self)
return string.format("%-30s %-8s %-8s %-10s %-10s", self.name, self.role, self.level, self.time, self.score)
end,
})
self.name = name
self.role = role
self.level = level
self.time = time
self.score = score
return self
end,
---@return string
hash = function(self)
return table.concat({ self.name, self.role, self.level, self.time, self.score }, "/")
end,
---@param self Key
---@param other Key
---@return boolean
compareTo = function(self, other)
if not self then return true end
if not other then return false end
if self.name <= other.name then
return true
end
return false
end
}
---@param keys Key[]
local function render(keys)
local str = {}
for k, v in ipairs(keys) do
str[#str + 1] = tostring(v)
end
aura_env.displayString = table.concat(str, "\n")
end
function aura_env.Process()
---@type Key[]
local keys = {}
for k, msg in ipairs(aura_env.fullMessage) do
local key, role, level, time, score = string.match(msg, "^->([^/]+)/([^/]+)/([^/]+)/([^/]+)/(.+)$")
key = string.gsub(key, "^%s+", "")
key = string.gsub(key, "%s+$", "")
role = string.gsub(role, "%s+", "")
level = string.gsub(level, "%s+", "")
time = string.gsub(time, "%s+", "")
score = string.gsub(score, "%s+", "")
local keyObj = Key.new(key, role, level, time, score)
if key then
keys[#keys + 1] = keyObj
end
WeakAurasSaved.Cyka.MData[keyObj:hash()] = keyObj
end
table.sort(keys, Key.compareTo)
render(keys)
end
-- /run WeakAurasSaved.Cyka.MData = {}