116 lines
2.9 KiB
Lua
116 lines
2.9 KiB
Lua
-- COMBAT_LOG_EVENT_UNFILTERED TICKER_1000
|
|
---@param allstates allstates
|
|
---@param e string
|
|
function(allstates, e, ...)
|
|
if e == "TICKER_1000" then
|
|
local ttl = 120
|
|
for _, state in pairs(allstates) do
|
|
if state.progress then
|
|
local elapsedTime = GetTime() - state.index
|
|
if elapsedTime > ttl then
|
|
state.show = false
|
|
state.changed = true
|
|
else
|
|
local prettyTime = ""
|
|
|
|
local minutes = 0
|
|
while elapsedTime > 60 do
|
|
elapsedTime = elapsedTime - 60
|
|
minutes = minutes + 1
|
|
end
|
|
if minutes > 0 then
|
|
prettyTime = string.format("%s%dm", prettyTime, minutes)
|
|
end
|
|
if elapsedTime > 0 then
|
|
prettyTime = string.format("%s %ds", prettyTime, elapsedTime)
|
|
end
|
|
|
|
state.progress = string.format("%20s", prettyTime)
|
|
state.changed = true
|
|
end
|
|
end
|
|
end
|
|
|
|
for i = 1, 40 do
|
|
if UnitIsPlayer("nameplate" .. i) then
|
|
local name = UnitName("nameplate" .. i)
|
|
local faction = UnitFactionGroup("nameplate" .. i)
|
|
if faction and faction == "Alliance" then
|
|
aura_env.RegisterAlly(name)
|
|
end
|
|
end
|
|
end
|
|
|
|
aura_env.CleanAlliance()
|
|
return true
|
|
end
|
|
|
|
|
|
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)
|
|
allstates[stinky] = {
|
|
show = true,
|
|
changed = true,
|
|
name = string.format("%-30s", stinky),
|
|
progressType = "timed",
|
|
duration = 60,
|
|
expirationTime = GetTime() + 60,
|
|
autohide = true,
|
|
index = GetTime(),
|
|
progress = string.format("%20s", "0s"),
|
|
}
|
|
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 then
|
|
print("Could not get source id for " .. source)
|
|
print(...)
|
|
return true
|
|
end
|
|
local destid, err = CLEUParser.GetDestGUID(...)
|
|
if err 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 |