end
end
-local function unitEvent(self, event, ...)
- local arg1, arg2, arg3, arg4 = ...;
- if event == "UNIT_HEALTH" or event == "UNIT_HEALTH_FREQUENT" then
- updateHealth(self, arg1);
- updateShield(self, arg1);
- updateHealAbsorb(self, arg1);
+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
- elseif event == "UNIT_POWER" then
- updatePower(self, arg1);
- elseif event == "UNIT_AURA" then
- updateAuras(self, arg1);
- elseif event == "UNIT_ABSORB_AMOUNT_CHANGED" then
- updateShield(self, arg1);
- elseif event == "UNIT_HEAL_PREDICTION" then
- updateHealPred(self, arg1);
- elseif event == "UNIT_HEAL_ABSORB_AMOUNT_CHANGED" then
- updateHealAbsorb(self, arg1);
- elseif event == "UNIT_THREAT_SITUATION_UPDATE" then
- updateAggro(self, arg1);
- elseif event == "UNIT_MAXHEALTH" then
- updateMaxHealth(self, arg1);
- elseif event == "UNIT_MAXPOWER" then
- updateMaxPower(self, arg1);
- elseif event == "UNIT_DISPLAYPOWER" then
- updatePowerColor(self, arg1);
- elseif event == "INCOMING_RESURRECT_CHANGED" then
+ 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(self, arg1);
- elseif event == "UNIT_NAME_UPDATE" then
- updateName(self, arg1);
- elseif event == "PARTY_MEMBER_ENABLE" or event == "PARTY_MEMBER_DISABLE" then
+ updateHealth(frame, unit);
+ end,
+ ["PARTY_MEMBER_ENABLE"] = function(frame)
-- new power info possibly (FrameXML/CompactUnitFrame.lua)
- updateMaxPower(self, self.unit);
- updatePowerColor(self, self.unit);
- elseif event == "UNIT_CONNECTION" then
- updateHealth(self, arg1);
- elseif event == "UPDATE_ALL_BARS" then
- updateMaxHealth(self, arg1);
- updateMaxPower(self, arg1);
- --updateHealth(self, arg1); -- MaxHealth covers this
- --updatePower(self, arg1); -- MaxPower covers this
- updateAuras(self, arg1);
- updateShield(self, arg1);
- updateHealPred(self, arg1);
- updateHealAbsorb(self, arg1);
- updatePowerColor(self, arg1);
- updateName(self, arg1);
- end
+ 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"];
+local function unitEvent(self, event, ...)
+ local arg1, arg2, arg3, arg4 = ...;
+ eventFuncs[event](self, arg1);
end
local function unitUpdate(self, elapsed)