View Single Post
04-01-13, 07:37 AM   #13
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
*edit*

Please see below...

I finished my test. UNIT_HEALTH is not working properly. It does not fire if a boss unit loses HP. It will fire if you target that unit though. That explains why only the current boss that you are looking at will update.

Made some shots for prove:


I think this a bug of the Blizzard API. I tested the same for UNIT_POWER. Guess what. It just works.

Thus UNIT_POWER is currently working properly. UNIT_HEALTH is not.


*edit2*

Hmmm...maybe I still forget sth. But from my understanding UNIT_HEALTH does not fire enough. It does only fire for the current target frame.

Going to try sth special now...damage done with a mouseover macro while targeting a pet. Maybe UNIT_HEALTH will not fire once. This would be really bad.

:-(

Just tested it. As I thought. I targeted my pet and did cleave damage with mouseover macros for 3 minutes. Not a single UNIT_HEALTH event call. Not one! But the mouseover tooltip shows that the boss units have lost health. Quite a downer imo.

UNIT_POWER works. UNIT_HEALTH just does not fire at all unless you are targeting one of the boss units. Then it will fire for that one unit.

Sure you get updates here and there if you register "UNIT_TARGETABLE_CHANGED" or "INSTANCE_ENCOUNTER_ENGAGE_UNIT" when the bossframes swap but that is by far not enough when it comes to unit_health.

The only time you will get UNIT_HEALTH to work is if you actively target a bossframe. If you do this the UNIT_HEALTH event will work. But only for the unit you are targeting.

Thus I went back to the OnUpdate. That still works flawlessly. If Blizzard fixes the BUG that UNIT_HEALTH is not firing for boss units we can remove the OnUpdate. But atm it is not possible.

Lua Code:
  1. elseif(unit:match'(boss)%d?$' == 'boss') then
  2.     --object:RegisterEvent('INSTANCE_ENCOUNTER_ENGAGE_UNIT', object.UpdateAllElements, true)
  3.     --object:RegisterEvent('UNIT_TARGETABLE_CHANGED', object.UpdateAllElements)
  4.     enableTargetUpdate(object)
  5.   elseif(unit:match'%w+target') then
  6.         enableTargetUpdate(object)
  7.     end

I checked the Blizzard code. They are using OnUpdates to poll HealthUpdates but as far as I can tell only for PlayerUnits or TargetTarget.
https://github.com/tekkub/wow-ui-sou...Frame.xml#L483
https://github.com/tekkub/wow-ui-sou...Frame.lua#L403
https://github.com/tekkub/wow-ui-sou...Frame.lua#L765

No clue how the default bossframe health actually is capable of updating properly.

There is a thread on that on wowprogramming aswell:
http://wowprogramming.com/forums/development/639
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 04-01-13 at 09:30 AM.
  Reply With Quote