53 lines
1.9 KiB
Lua
53 lines
1.9 KiB
Lua
--COMBAT_LOG_EVENT_UNFILTERED PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED UPDATE_DCPS TICK_TIMER
|
|
function(e, ...)
|
|
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
|
|
local se = select(2, ...)
|
|
if se == "SPELL_HEAL" then
|
|
local source = select(5, ...)
|
|
if source == UnitName("player") then
|
|
local time, spell = GetTime(), select(13, ...)
|
|
if spell == "Judgment of Light" then
|
|
aura_env.htable[#aura_env.htable + 1] = time
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
elseif e == "PLAYER_REGEN_DISABLED" then
|
|
aura_env.htable = {}
|
|
aura_env.combatTimer = 0
|
|
if not aura_env.ticker then print("No ticker found, starting new one"); aura_env.ticker = C_Timer.NewTicker(aura_env.interval, function() WeakAuras.ScanEvents("UPDATE_DCPS") end) end
|
|
elseif e == "PLAYER_REGEN_ENABLED" then
|
|
if aura_env.ticker then print("Ticker found, killing it"); aura_env.ticker:Cancel(); aura_env.ticker = nil end
|
|
elseif e == "UPDATE_DCPS" then
|
|
aura_env.tempcount = aura_env.tempcount + 1
|
|
if aura_env.tempcount >= 1 / aura_env.interval then
|
|
aura_env.tempcount = 0
|
|
aura_env.combatTimer = aura_env.combatTimer + 1
|
|
end
|
|
return true
|
|
end
|
|
end
|
|
|
|
--DISPLAY
|
|
function()
|
|
local dc = 0
|
|
local timeinterval = 10
|
|
for i = #aura_env.htable, 1, -1 do
|
|
if aura_env.htable[i] > GetTime() - timeinterval then
|
|
dc = dc + 1
|
|
else
|
|
break
|
|
end
|
|
end
|
|
return string.format("%.1f\n%.1f", dc / timeinterval, #aura_env.htable / aura_env.combatTimer)
|
|
end
|
|
|
|
--INIT
|
|
if not aura_env.combatTimer then aura_env.combatTimer = 0 end
|
|
if not aura_env.htable then aura_env.htable = {} end
|
|
if not aura_env.interval then aura_env.interval = 0.1 end
|
|
if not aura_env.tempcount then aura_env.tempcount = 0 end
|
|
if WeakAuras.IsOptionsOpen() and aura_env.ticker then
|
|
aura_env.ticker:Cancel()
|
|
end
|