Rework stinky detector to be a little more simple and a lot more functional

This commit is contained in:
2024-12-13 13:54:37 +01:00
parent de08a1e9df
commit 5ef92b23de
4 changed files with 56 additions and 443 deletions

View File

@@ -1,14 +1,12 @@
-- COMBAT_LOG_EVENT_UNFILTERED
---@param e string
function(e, ...)
-- /run RegisterAddonMessagePrefix("STINKY_DETECTOR")
-- RegisterAddonMessagePrefix(aura_env.addonprefix)
local detected = false
local stinky = ""
local source, err = CLEUParser.GetSourceName(...)
if not err then
if WeakAurasSaved.Cyka.stinkies[source] then
if aura_env.stinkies[source] then
stinky = source
detected = true
end
@@ -16,7 +14,7 @@ function(e, ...)
if not detected then
local destination, err = CLEUParser.GetDestName(...)
if not err then
if WeakAurasSaved.Cyka.stinkies[destination] then
if aura_env.stinkies[destination] then
stinky = destination
detected = true
end
@@ -27,36 +25,5 @@ function(e, ...)
aura_env.StinkyDetected(stinky)
end
local overkill, err = CLEUParser.GetOverkill(...)
if err == nil then
local source, err = CLEUParser.GetSourceName(...)
if err ~= nil then source = "unknown" end
local destination, err = CLEUParser.GetDestName(...)
if err ~= nil then destination = "unknown" end
local spellName, err = CLEUParser.GetSpellName(...)
if err ~= nil then spellName = "unknown" end
local sourceid, err = CLEUParser.GetSourceGUID(...)
if err and aura_env.config.debug then
print("Could not get source id for " .. source)
print(...)
return true
end
local destid, err = CLEUParser.GetDestGUID(...)
if err and aura_env.config.debug then
print("Could not get destination id for " .. destination)
print(...)
return true
end
if not string.match(sourceid, "Player") then
-- print("Source is not a player, nevermind...")
return true
end
if not string.match(destid, "Player") then
-- print("Destination is not a player, nevermind...")
return true
end
aura_env.RegisterKill(source, destination, spellName, overkill)
end
return true
end