View Single Post
02-09-19, 05:47 PM   #1
Ethly
A Fallenroot Satyr
Join Date: Mar 2018
Posts: 23
UNIT_HEALTH vs UNIT_HEALTH_FREQUENT vs combat log parsing

I have the following snippet to test:
Code:
local frame = CreateFrame("Frame");
frame:RegisterUnitEvent("UNIT_HEALTH", "player");
frame:RegisterUnitEvent("UNIT_MAXHEALTH", "player");
frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
frame:SetScript("OnEvent", function(self, event, unit)
	print(event, unit, UnitHealth("player"), UnitHealthMax("player"));
end);
With this code I could see that UNIT_HEALTH_FREQUENT works as expected. But UNIT_HEALTH works very strange. First of all, this event fires a lot. On one character it fires 3 times for each UNIT_HEALTH_FREQUENT. On another character it fires like 20 times. And, what's the most strange, UnitHealth value is obsolete, it shows from previous tick or something. So I'm seeing
Code:
UNIT_HEALTH player 165 171
UNIT_HEALTH player 165 171
UNIT_HEALTH player 165 171
UNIT_HEALTH_FREQUENT 168 171
delay
UNIT_HEALTH player 168 171
UNIT_HEALTH player 168 171
UNIT_HEALTH player 168 171
UNIT_HEALTH_FREQUENT 171 171
and I don't even getting UNIT_HEALTH player 171 171 at all. I thought that UNIT_HEALTH is supposed to be throttled, so I could use it for insignificant frames, but it seems like it's just broken.

Also I want to ask whether it's worth it to parse combat log for more reactive health updates. It seems like a lot of effort, potentially buggy code because combat log parsing is not a easy task and it seems that sometimes it'll display wrong values no matter what. Is there any objective measurements of benefits?
  Reply With Quote