Finished my test. Thank god. UNIT_HEALTH_FREQUENT does fire correctly for all boss units. No clue what is wrong with UNIT_HEALTH. So adding frequentUpdates to the boss unit healthbars fixes the health issue.
If you are changing your health values via tags make sure that boss unit health strings use a health tag that uses UNIT_HEALTH_FREQUENT aswell. Otherwise only that statusbar will update correctly. I suggest creating a new tag for that purpose since you may not want that event on all units.
I will just post some stuff I'm using atm:
Boss tags
Lua Code:
--boss health value
oUF.Tags.Methods["diablo:bosshp"] = function(unit)
local val = oUF.Tags.Methods["perhp"](unit)
return val or ""
end
oUF.Tags.Events["diablo:bosshp"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_TARGETABLE_CHANGED"
--boss power value
oUF.Tags.Methods["diablo:bosspp"] = function(unit)
if UnitIsDeadOrGhost(unit) then return "" end
local str = ""
--power value tracking (show percentage if max power > 0)
local pp_max = UnitPowerMax(unit)
if pp_max > 0 then
str = str..oUF.Tags.Methods["perpp"](unit).."%"
end
--additional altpower tracking
local ap_max = UnitPowerMax(unit, ALTERNATE_POWER_INDEX)
local color = "0099ff"
if pp_max > 0 and ap_max > 0 then
str = str.." ("
end
if ap_max > 0 then
local ap_cur = UnitPower(unit, ALTERNATE_POWER_INDEX)
str = str.."|cff"..color..("%s%%"):format(floor(ap_cur/ap_max*100)).."|r"
end
if pp_max > 0 and ap_max > 0 then
str = str..")"
end
--return "93% (|cff"..color..("%s%%"):format(30).."|r)" --debug
return str or ""
end
oUF.Tags.Events["diablo:bosspp"] = "UNIT_POWER UNIT_MAXPOWER UNIT_TARGETABLE_CHANGED"
Boss health statusbar. The powerbar does not need frequentupdates it works properly without.
Lua Code:
self.Health.frequentUpdates = true
I added this to oUF/units.lua
Lua Code:
elseif(unit:match'(boss)%d?$' == 'boss') then
object:RegisterEvent('INSTANCE_ENCOUNTER_ENGAGE_UNIT', object.UpdateAllElements, true)
object:RegisterEvent('UNIT_TARGETABLE_CHANGED', object.UpdateAllElements)
INSTANCE_ENCOUNTER_ENGAGE_UNIT is unitless thus the third attribute has to be set to true.