c809e5d - Add name prefix when in vehicle
[wowui.git] / OmaUF / Events.lua
index 8121ae6..d8cc7af 100644 (file)
@@ -10,7 +10,6 @@ local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
 local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
 local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor;
 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
 local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs;
 local UnitThreatSituation, GetThreatStatusColor = UnitThreatSituation, GetThreatStatusColor;
 local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected;
-local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs;
 local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI;
 local UnitLevel, UnitClassification = UnitLevel, UnitClassification;
 local UnitAffectingCombat, IsResting = UnitAffectingCombat, IsResting;
 local UnitHasVehicleUI, UnitTargetsVehicleInRaidUI = UnitHasVehicleUI, UnitTargetsVehicleInRaidUI;
 local UnitLevel, UnitClassification = UnitLevel, UnitClassification;
 local UnitAffectingCombat, IsResting = UnitAffectingCombat, IsResting;
@@ -50,9 +49,6 @@ function M.RegisterUnitEvents(frame)
     if frame.shield then
         frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
     end
     if frame.shield then
         frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
     end
-    if frame.healabsorb then
-        frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
-    end
     if frame.auras then
         frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed);
     end
     if frame.auras then
         frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed);
     end
@@ -166,20 +162,8 @@ local function updateShield(frame, unit)
     end
 end
 
     end
 end
 
-local function updateHealAbsorb(frame, unit)
-    local absorb = UnitGetTotalHealAbsorbs(unit) or 0;
-    if absorb > 0 then
-        local space = frame.health:GetWidth();
-        absorb = (absorb / frame.health.max) * frame.width;
-        frame.healabsorb:SetWidth(min(space, absorb));
-        frame.healabsorb:Show();
-    else
-        frame.healabsorb:Hide();
-    end
-end
-
 local function updateAuras(frame, unit)
 local function updateAuras(frame, unit)
-    if frame.auras then updateAuraFrames(frame, unit) end
+    updateAuraFrames(frame, unit);
 end
 
 local function updateAggro(frame, unit)
 end
 
 local function updateAggro(frame, unit)
@@ -251,6 +235,10 @@ local function updateStatus(frame, unit)
     end
 end
 
     end
 end
 
+local pvpIcons = {
+    Alliance = "Interface\\TARGETINGFRAME\\UI-PVP-Alliance",
+    Horde = "Interface\\TARGETINGFRAME\\UI-PVP-Horde"
+};
 local function updatePVP(frame, unit)
     if UnitIsPVPFreeForAll(unit) then
         frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-FFA");
 local function updatePVP(frame, unit)
     if UnitIsPVPFreeForAll(unit) then
         frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-FFA");
@@ -266,7 +254,7 @@ local function updatePVP(frame, unit)
                     faction = "Horde";
                 end
             end
                     faction = "Horde";
                 end
             end
-            frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-"..faction);
+            frame.pvp:SetTexture(pvpIcons[faction]);
             frame.pvp:Show();
         else
             frame.pvp:Hide();
             frame.pvp:Show();
         else
             frame.pvp:Hide();
@@ -328,7 +316,6 @@ local eventFuncs = {
         updateHealth(frame, frame.displayed);
         updateHealthText(frame, frame.displayed);
         if frame.shield then updateShield(frame, frame.displayed) end
         updateHealth(frame, frame.displayed);
         updateHealthText(frame, frame.displayed);
         if frame.shield then updateShield(frame, frame.displayed) end
-        if frame.healabsorb then updateHealAbsorb(frame, frame.displayed) end
     end,
     ["UNIT_POWER"] = function(frame)
         updatePower(frame, frame.displayed);
     end,
     ["UNIT_POWER"] = function(frame)
         updatePower(frame, frame.displayed);
@@ -340,9 +327,6 @@ local eventFuncs = {
     ["UNIT_ABSORB_AMOUNT_CHANGED"] = function(frame)
         updateShield(frame, frame.displayed);
     end,
     ["UNIT_ABSORB_AMOUNT_CHANGED"] = function(frame)
         updateShield(frame, frame.displayed);
     end,
-    ["UNIT_HEAL_ABSORB_AMOUNT_CHANGED"] = function(frame)
-        updateHealAbsorb(frame, frame.displayed);
-    end,
     ["UNIT_THREAT_SITUATION_UPDATE"] = function(frame)
         updateAggro(frame, frame.displayed);
     end,
     ["UNIT_THREAT_SITUATION_UPDATE"] = function(frame)
         updateAggro(frame, frame.displayed);
     end,
@@ -351,7 +335,6 @@ local eventFuncs = {
         updateHealth(frame, frame.displayed);
         updateHealthText(frame, frame.displayed);
         if frame.shield then updateShield(frame, frame.displayed) end
         updateHealth(frame, frame.displayed);
         updateHealthText(frame, frame.displayed);
         if frame.shield then updateShield(frame, frame.displayed) end
-        if frame.healabsorb then updateHealAbsorb(frame, frame.displayed) end
     end,
     ["UNIT_MAXPOWER"] = function(frame)
         updateMaxPower(frame, frame.displayed);
     end,
     ["UNIT_MAXPOWER"] = function(frame)
         updateMaxPower(frame, frame.displayed);
@@ -417,7 +400,6 @@ local eventFuncs = {
         end
         if frame.auras then updateAuras(frame, frame.displayed) end
         if frame.shield then updateShield(frame, frame.displayed) end
         end
         if frame.auras then updateAuras(frame, frame.displayed) end
         if frame.shield then updateShield(frame, frame.displayed) end
-        if frame.healabsorb then updateHealAbsorb(frame, frame.displayed) end
         if frame.name then updateName(frame, frame.displayed) end
         if frame.level then updateLevelText(frame, frame.unit) end
         if frame.status then updateStatus(frame, frame.unit) end
         if frame.name then updateName(frame, frame.displayed) end
         if frame.level then updateLevelText(frame, frame.unit) end
         if frame.status then updateStatus(frame, frame.unit) end