View Single Post
01-17-05, 01:34 PM   #15
Cide
Swedeheart
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 96
Originally Posted by bahzeel
Thanks for the quick response Cide. Not the response I wanted to hear you understand

I'm not really planning to try and build one of these things myself - my development skills aren't all that grand, but if a person were going to attempt such a thing, is there an existing script/mod that you'd point them to as a good start?


(thinking out loud now )
I'm reasonably confident that I can work out the logic for such a thing (need to keep track of time and dmg taken, and convert them to DPS). What more is there to track?

H'mm - some way of noticing the start and stop of a fight. Fight ending at mob death is probably pretty easy. I bet there's an event of some kind when character transitions out of combat mode.

Fight starting - I'm thinking this is best started when I dish out some damage (which will lower the reported DPS taken, but better represents those situations where I control the start of things and what I can do as a result of that control).

Heck - I bet there's an event for character transitioning into combat mode. That's probably the height of easy - report on DPS taken from beginning to end of combat mode....

With start and stop of a fight, in time, seconds elapsed can be calculated. With a counter that increments damage taken, you'd have total damage taken. And damage / elapsed time (sec) would be DPS.

And it shouldn't be too hard to use end of the fight as <current time> if the end of the fight hasn't been reached yet to provide numbers for constant updating.


I bet there's a DPS mod already in existence that tracks start and end of a fight. Is it a good bet that all that a DPS Taken mod would need is to change the guts of such a thing to track dmg done to the player, instead of damage they do? Then apply all the same math after that?


I'm specifically interested in 1:1 fights that are player initiated for my defensive testing. So a mod that's more tuned for these situations, and not as robust for those long running / many mob battles are not as important to me (though that wouldn't stop me from using it in those situations just to see what happens).

I think COSMOS gets around this problem with a simple window type of control that sets the time window within which to track damage dealt. So it has a way to roll old damage off the end of the stack while adding new damage dealt to the top of the stack. I think I'd rather have something that relies on quiescence / out of combat as an end, and then reports everything over an entire fight.


Anyway, if I could trouble you for your thoughts on how to go about this Cide, as well as advice on any mods you know of that are pretty close already, I'd appreciate it. If I'm as close as I think I am, then I think it might be time to learn some .lua
Well, I don't know if there's an event for especially entering combat, but I've always used PLAYER_REGEN_DISABLED/PLAYER_REGEN_ENABLED, and it seems to work out good(can't think of any other time when the player's regen would be disabled?). Other than that, what you said sounds good. You just need some regular expressions for getting damage done.

Some code to log the combatlog and check for some messages(directly from our upcoming mod):

Code:
DamageTaken = 0;

CT_OldChatFrame_OnEvent = ChatFrame_OnEvent;

local function CT_ChatFrame_OnEvent(event)
	if ( strsub(event, 1, 8) == "CHAT_MSG" ) then
		local type = strsub(event, 10);
		if ( strsub(type,1,7) == "COMBAT_" or strsub(type,1,6) == "SPELL_" ) then
			CT_CheckLine(arg1);
		end
	end
	CT_OldChatFrame_OnEvent(event);
end

ChatFrame_OnEvent = CT_ChatFrame_OnEvent;

function CT_CheckLine(line)
	local iStart, iEnd, damage = string.find(line, ".+ hits you for (%d+).*");
	if ( damage ) then
		DamageTaken = DamageTaken + tonumber(damage);
	end
	iStart, iEnd, damage = string.find(line, ".+ crits you for (%d+).*");
	if ( damage ) then
		DamageTaken = DamageTaken + tonumber(damage);
	end
	iStart, iEnd, damage = string.find(line, "You suffer (%d+) .+ from .+%.");
	if ( damage ) then
		DamageTaken = DamageTaken + tonumber(damage);
	end
end
This logs the combatlog, and then increments the DamageTaken variable with the amount of damage taken. If you want me to explain something in the code, please ask .
__________________
CTMod Developer
  Reply With Quote