+local function updateAggro(frame, unit)
+ local status = UnitThreatSituation(unit);
+ if status and status > 0 then
+ frame.base:SetColorTexture(GetThreatStatusColor(status));
+ else
+ frame.base:SetColorTexture(unpack(baseColor));
+ end
+end
+
+local eventFuncs = {
+ ["UNIT_HEALTH"] = function(frame, unit)
+ updateHealth(frame, unit);
+ updateShield(frame, unit);
+ updateHealAbsorb(frame, unit);
+ -- no heal prediction update, that doesn't overflow too much
+ end,
+ ["UNIT_POWER"] = function(frame, unit)
+ updatePower(frame, unit);
+ end,
+ ["UNIT_AURA"] = function(frame, unit)
+ updateAuras(frame, unit);
+ end,
+ ["UNIT_HEAL_PREDICTION"] = function(frame, unit)
+ updateHealPred(frame, unit);
+ end,
+ ["UNIT_ABSORB_AMOUNT_CHANGED"] = function(frame, unit)
+ updateShield(frame, unit);
+ end,
+ ["UNIT_HEAL_ABSORB_AMOUNT_CHANGED"] = function(frame, unit)
+ updateHealAbsorb(frame, unit);
+ end,
+ ["UNIT_THREAT_SITUATION_UPDATE"] = function(frame, unit)
+ updateAggro(frame, unit);
+ end,
+ ["UNIT_MAXHEALTH"] = function(frame, unit)
+ updateMaxHealth(frame, unit);
+ end,
+ ["UNIT_MAXPOWER"] = function(frame, unit)
+ updateMaxPower(frame, unit);
+ end,
+ ["UNIT_DISPLAYPOWER"] = function(frame, unit)
+ updatePowerColor(frame, unit);
+ end,
+ ["UNIT_NAME_UPDATE"] = function(frame, unit)
+ updateName(frame, unit);
+ end,
+ ["UNIT_CONNECTION"] = function(frame, unit)
+ updateHealth(frame, unit);
+ end,
+ ["INCOMING_RESURRECT_CHANGED"] = function(frame, unit)
+ -- TODO have an icon
+ updateHealth(frame, unit);
+ end,
+ ["PARTY_MEMBER_ENABLE"] = function(frame)
+ -- new power info possibly (FrameXML/CompactUnitFrame.lua)
+ updateMaxPower(frame, frame.unit);
+ updatePowerColor(frame, frame.unit);
+ end,
+ ["UPDATE_ALL_BARS"] = function(frame, unit)
+ updateMaxHealth(frame, unit);
+ updateMaxPower(frame, unit);
+ --updateHealth(frame, unit); -- MaxHealth covers this
+ --updatePower(frame, unit); -- MaxPower covers this
+ updateAuras(frame, unit);
+ updateShield(frame, unit);
+ updateHealPred(frame, unit);
+ updateHealAbsorb(frame, unit);
+ updatePowerColor(frame, unit);
+ updateName(frame, unit);
+ end,
+};
+eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];
+eventFuncs["PARTY_MEMBER_DISABLE"] = eventFuncs["PARTY_MEMBER_ENABLE"];