Code polish
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
-- COMBAT_LOG_EVENT_UNFILTERED
|
-- COMBAT_LOG_EVENT_UNFILTERED
|
||||||
---@param e string
|
---@param e string
|
||||||
function(e, ...)
|
function(e, ...)
|
||||||
|
-- /run RegisterAddonMessagePrefix("STINKY_DETECTOR")
|
||||||
|
-- RegisterAddonMessagePrefix(aura_env.addonprefix)
|
||||||
local detected = false
|
local detected = false
|
||||||
local stinky = ""
|
local stinky = ""
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ function()
|
|||||||
table.remove(aura_env.messageQueue, 1)
|
table.remove(aura_env.messageQueue, 1)
|
||||||
if aura_env.config.debug then
|
if aura_env.config.debug then
|
||||||
print(string.format("Processing message; %d in queue", #aura_env.messageQueue))
|
print(string.format("Processing message; %d in queue", #aura_env.messageQueue))
|
||||||
|
DevTools_Dump(message)
|
||||||
end
|
end
|
||||||
|
|
||||||
if message.addon then
|
if message.addon then
|
||||||
|
|||||||
@@ -86,7 +86,12 @@ function(allstates, e, prefix, msg, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local stinky = aura_env.stinkies[name]
|
local stinky = aura_env.stinkies[name]
|
||||||
if not stinky then return false end
|
if not stinky then
|
||||||
|
if aura_env.config.debug then
|
||||||
|
print(string.format("Could not find stinky for %s", name))
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if not allstates[name] then
|
if not allstates[name] then
|
||||||
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
|
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
-- TODO: Add zone detection and all that shit so we're not always in orgrimmar
|
|
||||||
-- see GetSubZoneText() and GetZoneText()
|
|
||||||
|
|
||||||
---@type Message[]
|
---@type Message[]
|
||||||
aura_env.messageQueue = {}
|
aura_env.messageQueue = {}
|
||||||
aura_env.separator = "ž"
|
aura_env.separator = "ž"
|
||||||
@@ -9,31 +6,24 @@ RegisterAddonMessagePrefix(aura_env.addonprefix)
|
|||||||
|
|
||||||
---@param string string
|
---@param string string
|
||||||
---@param deliminer string
|
---@param deliminer string
|
||||||
---@return string[]
|
---@return string[], string|nil
|
||||||
local function StrSplit(input, deliminer)
|
local function StrSplit(input, deliminer)
|
||||||
|
if not deliminer then return {}, "deliminer is nil" end
|
||||||
|
if not input then return {}, "input is nil" end
|
||||||
local parts = {}
|
local parts = {}
|
||||||
for part in string.gmatch(input, "([^" .. deliminer .. "]+)") do
|
for part in string.gmatch(input, "([^" .. deliminer .. "]+)") do
|
||||||
table.insert(parts, strtrim(part))
|
table.insert(parts, strtrim(part))
|
||||||
end
|
end
|
||||||
return parts
|
return parts, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local toNotify = StrSplit(msg, ",")
|
local toNotify = StrSplit(aura_env.config.notify, ",")
|
||||||
for i, part in ipairs(toNotify) do
|
for i, part in ipairs(toNotify) do
|
||||||
toNotify[i] = strtrim(part)
|
toNotify[i] = strtrim(part)
|
||||||
end
|
end
|
||||||
-- local toNotify = { "Deathleta" }
|
|
||||||
|
|
||||||
---@type Stinky[]
|
---@type Stinky[]
|
||||||
aura_env.stinkies = {}
|
aura_env.stinkies = {}
|
||||||
local stinkies = StrSplit(msg, ",")
|
|
||||||
for i, part in ipairs(stinkies) do
|
|
||||||
local datum = StrSplit(part, ":")
|
|
||||||
local name = strtrim(datum[1])
|
|
||||||
local threat = tonumber(strtrim(datum[2] or "0"))
|
|
||||||
aura_env.stinkies[name] = Stinky.new(name, threat)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
---@class Message
|
---@class Message
|
||||||
@@ -212,6 +202,14 @@ aura_env.GetZone = function()
|
|||||||
return string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
return string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local stinkies = StrSplit(aura_env.config.stinkies, ",")
|
||||||
|
for i, part in ipairs(stinkies) do
|
||||||
|
local datum = StrSplit(part, ":")
|
||||||
|
local name = strtrim(datum[1])
|
||||||
|
local threat = tonumber(strtrim(datum[2] or "0"))
|
||||||
|
aura_env.stinkies[name] = Stinky.new(name, threat)
|
||||||
|
end
|
||||||
|
|
||||||
local killSpamTime = 30
|
local killSpamTime = 30
|
||||||
local recentlyKilled = {}
|
local recentlyKilled = {}
|
||||||
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
aura_env.RegisterKill = function(source, destination, spellName, overkill)
|
||||||
@@ -237,6 +235,7 @@ aura_env.localStinkies = {}
|
|||||||
|
|
||||||
---@param name string
|
---@param name string
|
||||||
aura_env.StinkyDetected = function(name)
|
aura_env.StinkyDetected = function(name)
|
||||||
|
if aura_env.config.debug then print(string.format("StinkyDetected (%s)", name)) end
|
||||||
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
||||||
GetTime() - aura_env.config.messageThrottle then
|
GetTime() - aura_env.config.messageThrottle then
|
||||||
local stinky = aura_env.stinkies[name]
|
local stinky = aura_env.stinkies[name]
|
||||||
|
|||||||
Reference in New Issue
Block a user