Refactor TSU to event3 from event1
This commit is contained in:
@@ -1,55 +1,6 @@
|
|||||||
-- COMBAT_LOG_EVENT_UNFILTERED TICKER_1000
|
-- COMBAT_LOG_EVENT_UNFILTERED
|
||||||
---@param allstates allstates
|
|
||||||
---@param e string
|
---@param e string
|
||||||
function(allstates, e, ...)
|
function(e, ...)
|
||||||
if e == "TICKER_1000" then
|
|
||||||
local ttl = aura_env.config.ttl or 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)
|
|
||||||
local _, race = UnitRace("nameplate" .. i)
|
|
||||||
local raceFaction = aura_env.raceFactions[race]
|
|
||||||
if not raceFaction then
|
|
||||||
print("Unknown race faction", race)
|
|
||||||
else
|
|
||||||
faction = raceFaction
|
|
||||||
end
|
|
||||||
WeakAurasSaved.Cyka.PlayerFactionCache[name] = faction
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local detected = false
|
local detected = false
|
||||||
local stinky = ""
|
local stinky = ""
|
||||||
|
|
||||||
@@ -72,17 +23,6 @@ function(allstates, e, ...)
|
|||||||
|
|
||||||
if detected then
|
if detected then
|
||||||
aura_env.StinkyDetected(stinky)
|
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
|
end
|
||||||
|
|
||||||
local overkill, err = CLEUParser.GetOverkill(...)
|
local overkill, err = CLEUParser.GetOverkill(...)
|
||||||
@@ -94,13 +34,13 @@ function(allstates, e, ...)
|
|||||||
local spellName, err = CLEUParser.GetSpellName(...)
|
local spellName, err = CLEUParser.GetSpellName(...)
|
||||||
if err ~= nil then spellName = "unknown" end
|
if err ~= nil then spellName = "unknown" end
|
||||||
local sourceid, err = CLEUParser.GetSourceGUID(...)
|
local sourceid, err = CLEUParser.GetSourceGUID(...)
|
||||||
if err then
|
if err and aura_env.config.debug then
|
||||||
print("Could not get source id for " .. source)
|
print("Could not get source id for " .. source)
|
||||||
print(...)
|
print(...)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local destid, err = CLEUParser.GetDestGUID(...)
|
local destid, err = CLEUParser.GetDestGUID(...)
|
||||||
if err then
|
if err and aura_env.config.debug then
|
||||||
print("Could not get destination id for " .. destination)
|
print("Could not get destination id for " .. destination)
|
||||||
print(...)
|
print(...)
|
||||||
return true
|
return true
|
||||||
|
@@ -1,9 +1,73 @@
|
|||||||
-- CHAT_MSG_ADDON
|
-- CHAT_MSG_ADDON TICKER_1000
|
||||||
function(e, prefix, msg, ...)
|
---@param allstates allstates
|
||||||
print(string.format("e = %s", e))
|
---@param e string
|
||||||
print(string.format("prefix = %s", prefix))
|
---@param prefix string
|
||||||
print(string.format("msg = %s", msg))
|
---@param msg string
|
||||||
for i = 1, select("#", ...) do
|
function(allstates, e, prefix, msg, ...)
|
||||||
print(string.format("arg %d = %s", i, select(i, ...)))
|
if e == "TICKER_1000" then
|
||||||
|
local ttl = aura_env.config.ttl or 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
|
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)
|
||||||
|
local _, race = UnitRace("nameplate" .. i)
|
||||||
|
local raceFaction = aura_env.raceFactions[race]
|
||||||
|
if not raceFaction then
|
||||||
|
print("Unknown race faction", race)
|
||||||
|
else
|
||||||
|
faction = raceFaction
|
||||||
|
end
|
||||||
|
WeakAurasSaved.Cyka.PlayerFactionCache[name] = faction
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
if not prefix or prefix ~= aura_env.addonprefix then return end
|
||||||
|
local data = string.split(msg, aura_env.separator)
|
||||||
|
local name = data[1]
|
||||||
|
local threat = data[2]
|
||||||
|
local note = data[3]
|
||||||
|
|
||||||
|
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"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
end
|
end
|
Reference in New Issue
Block a user