Files
wow-weakauras/FreshShit/StinkyDetector/event.lua
2024-10-14 20:16:34 +02:00

62 lines
1.7 KiB
Lua

-- 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 aura_env.stinkies[source] then
stinky = source
detected = true
end
end
if not detected then
local destination, err = CLEUParser.GetDestName(...)
if not err then
if aura_env.stinkies[destination] then
stinky = destination
detected = true
end
end
end
if detected then
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