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 GetRaidTargetIndex, SetRaidTargetIconTexture = GetRaidTargetIndex, SetRaidTargetIconTexture;
local RAID_CLASS_COLORS = RAID_CLASS_COLORS;
-local updateAuraFrames = OmaUFAuras.UpdateAuras;
+local updateAuras = OmaUFAuras.UpdateAuras;
local Settings = OmaUFSettings;
local baseColor = Settings.BaseColor;
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
local function updateMaxHealth(frame, unit)
frame.health.max = UnitHealthMax(unit);
end
+M.UpdateMaxHealth = updateMaxHealth;
local function updateHealth(frame, unit)
local current, max = UnitHealth(unit), frame.health.max;
frame.health:Show();
end
end
+M.UpdateHealth = updateHealth;
local function updateHealthText(frame, unit)
if UnitIsDeadOrGhost(unit) then
end
end
end
+M.UpdateHealthText = updateHealthText;
local function updateMaxPower(frame, unit)
frame.mana.max = UnitPowerMax(unit);
end
+M.UpdateMaxPower = updateMaxPower;
local function updatePower(frame, unit)
local current, max = UnitPower(unit), frame.mana.max;
frame.mana:Show();
end
end
+M.UpdatePower = updatePower;
local function updatePowerText(frame, unit)
local current, max = UnitPower(unit), frame.mana.max;
frame.manaText:Hide();
end
end
+M.UpdatePowerText = updatePowerText;
local function updatePowerColor(frame, unit)
frame.mana:SetVertexColor(unpack(powerColors[UnitPowerType(unit)]));
end
+M.UpdatePowerColor = updatePowerColor;
local function updateName(frame, unit)
local name = UnitName(unit);
if not name then return end
frame.name:SetText(ssub(name, 1, frame.name.count));
end
+M.UpdateName = updateName;
local function updateShield(frame, unit)
local shield = UnitGetTotalAbsorbs(unit) or 0;
frame.shieldhl:Hide();
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)
- if frame.auras then updateAuraFrames(frame, unit) end
-end
+M.UpdateShield = updateShield;
local function updateAggro(frame, unit)
local status = UnitThreatSituation(unit);
frame.base:SetVertexColor(unpack(baseColor));
end
end
+M.UpdateAggro = updateAggro;
-- only works for player frame
local function updateVehicle(frame)
registerUnitEvents(frame);
end
end
+M.UpdateVehicle = updateVehicle;
local function updateLevelText(frame, unit, levelup)
if levelup then
frame.level:SetFormattedText("%s%s", leveltext, classtext);
end
end
+M.UpdateLevelText = updateLevelText;
local function updateStatus(frame, unit)
-- coords from FrameXML/PlayerFrame.lua
frame.status:Hide();
end
end
+M.UpdateStatus = updateStatus;
+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");
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:Hide();
end
end
+M.UpdatePVP = updatePVP;
local function updateLeaderIcon(frame, unit)
if UnitIsGroupLeader(frame.unit) then
frame.leader:Hide();
end
end
+M.UpdateLeaderIcon = updateLeaderIcon;
local function updateHealthColor(frame, unit)
if not UnitPlayerControlled(unit) and UnitIsTapDenied(unit) then
frame.health:SetVertexColor(UnitSelectionColor(unit));
end
end
+M.UpdateHealthColor = updateHealthColor;
local function updateRaidMarker(frame, unit)
local index = GetRaidTargetIndex(unit);
frame.targeticon:Hide();
end
end
+M.UpdateRaidMarker = updateRaidMarker;
local eventFuncs = {
["UNIT_HEALTH"] = function(frame)
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);
["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,
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
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
eventFuncs["UNIT_TARGETABLE_CHANGED"] = eventFuncs["UPDATE_ALL_BARS"];
function M.UnitEvent(self, event, arg1)
- eventFuncs[event](self, arg1);
+ return eventFuncs[event](self, arg1);
end