Files
wow-weakauras/WeakAuras/Projects/DPS HPS.lua

52 lines
1.8 KiB
Lua

COMBAT_LOG_EVENT_UNFILTERED
function(...)
local subEvent = select(3, ...) or ""
local caster = select(6, ...) or ""
local amount = select(16, ...) or 0
local spellName = select(14, ...) or ""
if subEvent == "SWING_DAMAGE" then
amount = select(13, ...) or 0
end
if subEvent == "SPELL_HEAL" or subEvent == "SPELL_PERIODIC_HEAL" then
overheal = select(17, ...) or 0
amount = amount - overheal
end
if caster == UnitName("player") and amount ~= nil and (subEvent == "SPELL_HEAL" or subEvent == "SPELL_PERIODIC_HEAL") then
aura_env.healtotal = aura_env.healtotal + amount
end
if caster == UnitName("player") and amount ~= nil and (subEvent == "SPELL_DAMAGE" or subEvent == "SPELL_PERIODIC_DAMAGE" or subEvent == "SWING_DAMAGE") then
aura_env.dmgtotal = aura_env.dmgtotal + amount
end
end
DISPLAY
function()
local output = ""
local elapsed_time = GetTime() - aura_env.starttime
aura_env.dps = math.floor(aura_env.dmgtotal / elapsed_time)
aura_env.hps = math.floor(aura_env.healtotal / elapsed_time)
if aura_env.dps > 1e3 then
output = output .. "DPS: " .. math.floor(aura_env.dps / 1e3) .. "k "
elseif
aura_env.dps > 1e6 then
output = output .. "DPS: " .. (math.floor((aura_env.dps / 1e6) / 100) * 100) .. "M "
end
if aura_env.hps > 1e3 then
output = output .. "HPS: " .. math.floor(aura_env.hps / 1e3) .. "k "
elseif
aura_env.hps > 1e6 then
output = output .. "HPS: " .. (math.floor((aura_env.hps / 1e6) / 100) * 100) .. "M "
end
if WeakAuras.IsOptionsOpen() then
return "DPS: 985k HPS: 312k"
end
return output
end
INIT
aura_env.starttime = GetTime()
aura_env.dps = 0
aura_env.hps = 0
aura_env.dmgtotal = 0
aura_env.healtotal = 0