X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/6e06bfb151855f946ceb1885d310598e612fa128..f2bb49433c3e5edfc81625f21c91557a841ef64e:/OmaUF/Events.lua?ds=sidebyside diff --git a/OmaUF/Events.lua b/OmaUF/Events.lua index 0e63e9c..d68affe 100644 --- a/OmaUF/Events.lua +++ b/OmaUF/Events.lua @@ -22,6 +22,7 @@ local updateAuraFrames = OmaUFAuras.UpdateAuras; local Settings = OmaUFSettings; local baseColor = Settings.BaseColor; +local healthColor = Settings.HealthColor; local overlayColorDispel = Settings.OverlayColorDispel; local overlayColorCharm = Settings.OverlayColorCharm; local overlayColorAlert = Settings.OverlayColorAlert; @@ -146,10 +147,6 @@ local function updateName(frame, unit) local name = UnitName(unit); if not name then return end frame.name:SetText(ssub(name, 1, 10)); - - local _, class = UnitClass(unit); - local color = RAID_CLASS_COLORS[class]; - if color then frame.name:SetVertexColor(color.r, color.g, color.b) end end local function updateHealPred(frame, unit) @@ -347,6 +344,24 @@ local function updateLeaderIcon(frame, unit) end end +local function updateHealthColor(frame, unit) + if not UnitPlayerControlled(unit) and UnitIsTapDenied(unit) then + frame.health:SetVertexColor(0.5, 0.5, 0.5); + elseif UnitIsPlayer(unit) then + local _, class = UnitClass(unit); + local color = RAID_CLASS_COLORS[class]; + if color then + frame.health:SetVertexColor(color.r, color.g, color.b) + else + frame.health:SetVertexColor(unpack(healthColor)) + end + elseif UnitPlayerControlled(unit) then + frame.health:SetVertexColor(0, 1, 0); + else + frame.health:SetVertexColor(UnitSelectionColor(unit)); + end +end + local eventFuncs = { ["UNIT_HEALTH"] = function(frame) updateHealth(frame, frame.displayed); @@ -391,6 +406,7 @@ local eventFuncs = { end, ["UNIT_NAME_UPDATE"] = function(frame) updateName(frame, frame.displayed); + updateHealthColor(frame, frame.unit); end, ["UNIT_CONNECTION"] = function(frame) updateHealthText(frame, frame.displayed); @@ -418,6 +434,7 @@ local eventFuncs = { end, ["UNIT_FACTION"] = function(frame) updatePVP(frame, frame.unit); + updateHealthColor(frame, frame.unit); end, ["PARTY_LEADER_CHANGED"] = function(frame) updateLeaderIcon(frame, frame.unit); @@ -442,6 +459,7 @@ local eventFuncs = { updateStatus(frame, frame.unit); updatePVP(frame, frame.unit); updateLeaderIcon(frame, frame.unit); + updateHealthColor(frame, frame.unit); end, }; eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];