DPS taken addon?

UI and Macro
I've looked everywhere and I simply cannot find any addon that will show my DPS TAKEN at any given time, not done.

Does one exist?
I think Recount can do this.
10/01/2012 12:28 AMPosted by Choonster
I think Recount can do this.
It can't. It shows Damage taken, not DPS taken.
Bump.
<Damage taken> / <fight length in seconds> = DPS taken. Recount does this with a handy little addon I call a "calculator."
<Damage taken> / <fight length in seconds> = DPS taken. Recount does this with a handy little addon I call a "calculator."
This doesn't help me whatsoever. I need to know my damage taken every second, not my overall DPS taken.
I figured it out. I just subtract my current health from my health a second ago and average the totals for the duration.
If you want to write an addon yourself, and prefer to keep it simple, you may be interested in the UNIT_COMBAT event. It was used by some solo dps meters (and partly by Satrina's awesome tanking-centric dps meter) back in vanilla before they overhauled the combat log events.

This short script will keep a running total of incoming damage and print out the total damage, duration and DPS in. As in all dps meters, the "s" in the dps is sort of arbitrary. This script starts a timer at the first attempt to damage you, and ends when you either leave combat or a 5 second timeout. Within that block of time, the duration of damage is defined as the difference between the last attempted damage and the first attempted damage. (so hits at 0, 2, 3, then no hits for 5 seconds will be a 3 sec duration, not 8)

local timeout = 5 -- seconds since no incoming events before reporting

local f=CreateFrame("Frame")
f:Hide()

-- stuff that counts as damage incoming (ie keep timer going)
-- WOUND is actual damage, the rest is no damage (only full block triggers BLOCK)
local actionables = { WOUND=1, MISS=0, PARRY=0, DODGE=0, RESIST=0, BLOCK=0 }

function f:ReportDPSIn()
self:Hide() -- stop timeout OnUpdate
if self.startTime then
local duration = self.endTime - self.startTime
print(format("%d damage, %d secs, DPS in: %.2f",self.damage,duration,duration>0 and self.damage/duration or self.damage))
self.startTime = nil -- reset for next round of damage
end
end

f:SetScript("OnEvent",function(self,event,unit,action,_,damage)
if event=="PLAYER_REGEN_ENABLED" then
self:ReportDPSIn() -- immediately report and stop counters
elseif unit=="player" and actionables[action] then
self.timeout = 0 -- reset timeout timer
if not self.startTime then -- if starting a segment
self.startTime = GetTime()
self.damage = 0 -- reset damage counter
self:Show() -- start timeout timer
end
self.damage = self.damage + damage*actionables[action] -- only WOUND adds
self.endTime = GetTime()
end
end)
f:RegisterEvent("UNIT_COMBAT")
f:RegisterEvent("PLAYER_REGEN_ENABLED")

f:SetScript("OnUpdate",function(self,elapsed)
self.timeout = self.timeout + elapsed
if self.timeout > timeout then -- if 5 seconds pass with nothing interesting
self:ReportDPSIn() -- report results and stop counters
end
end)


COMBAT_LOG_EVENT_UNFILTERED is by far a better event for detailed tracking. You may notice in the comments that a BLOCK action only happens on a full block. UNIT_COMBAT will accurately report the remaining damage you take on a block but it won't tell you that part of it was blocked. You'll get WOUND with the remaining damage instead.
If you want to write an addon yourself, and prefer to keep it simple, you may be interested in the UNIT_COMBAT event. It was used by some solo dps meters (and partly by Satrina's awesome tanking-centric dps meter) back in vanilla before they overhauled the combat log events.

This short script will keep a running total of incoming damage and print out the total damage, duration and DPS in. As in all dps meters, the "s" in the dps is sort of arbitrary. This script starts a timer at the first attempt to damage you, and ends when you either leave combat or a 5 second timeout. Within that block of time, the duration of damage is defined as the difference between the last attempted damage and the first attempted damage. (so hits at 0, 2, 3, then no hits for 5 seconds will be a 3 sec duration, not 8)

local timeout = 5 -- seconds since no incoming events before reporting

local f=CreateFrame("Frame")
f:Hide()

-- stuff that counts as damage incoming (ie keep timer going)
-- WOUND is actual damage, the rest is no damage (only full block triggers BLOCK)
local actionables = { WOUND=1, MISS=0, PARRY=0, DODGE=0, RESIST=0, BLOCK=0 }

function f:ReportDPSIn()
self:Hide() -- stop timeout OnUpdate
if self.startTime then
local duration = self.endTime - self.startTime
print(format("%d damage, %d secs, DPS in: %.2f",self.damage,duration,duration>0 and self.damage/duration or self.damage))
self.startTime = nil -- reset for next round of damage
end
end

f:SetScript("OnEvent",function(self,event,unit,action,_,damage)
if event=="PLAYER_REGEN_ENABLED" then
self:ReportDPSIn() -- immediately report and stop counters
elseif unit=="player" and actionables[action] then
self.timeout = 0 -- reset timeout timer
if not self.startTime then -- if starting a segment
self.startTime = GetTime()
self.damage = 0 -- reset damage counter
self:Show() -- start timeout timer
end
self.damage = self.damage + damage*actionables[action] -- only WOUND adds
self.endTime = GetTime()
end
end)
f:RegisterEvent("UNIT_COMBAT")
f:RegisterEvent("PLAYER_REGEN_ENABLED")

f:SetScript("OnUpdate",function(self,elapsed)
self.timeout = self.timeout + elapsed
if self.timeout > timeout then -- if 5 seconds pass with nothing interesting
self:ReportDPSIn() -- report results and stop counters
end
end)


COMBAT_LOG_EVENT_UNFILTERED is by far a better event for detailed tracking. You may notice in the comments that a BLOCK action only happens on a full block. UNIT_COMBAT will accurately report the remaining damage you take on a block but it won't tell you that part of it was blocked. You'll get WOUND with the remaining damage instead.
Do you do this for a living? You are my personal idol on these forums. This is far better than my sloppy implementation where I recorded my health and printed the difference every x seconds.

Join the Conversation

Return to Forum