X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/60bc5ec4ced3b57fd841af7f693728049a0d09a0..d51d314274936814dec7d124c9ec5e5165666918:/OmaUF/Events.lua diff --git a/OmaUF/Events.lua b/OmaUF/Events.lua index 6e4fa69..1d3644d 100644 --- a/OmaUF/Events.lua +++ b/OmaUF/Events.lua @@ -1,11 +1,12 @@ -- Events.lua +-- TODO -- recheck these, pvp functions not added yet local _; local unpack = unpack; local ssub = string.sub; local min = math.min; local ceil = math.ceil; local UnitName, UnitClass, UnitExists = UnitName, UnitClass, UnitExists; -local UnitDebuff, UnitIsCharmed = UnitDebuff, UnitIsCharmed; +local UnitDebuff, UnitIsCharmed, UnitIsFriend = UnitDebuff, UnitIsCharmed, UnitIsFriend; local UnitPower, UnitPowerMax, UnitPowerType = UnitPower, UnitPowerMax, UnitPowerType; local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax; local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetTotalAbsorbs; @@ -17,6 +18,8 @@ local UnitGroupRolesAssigned = UnitGroupRolesAssigned; local UnitLevel, UnitClassification = UnitLevel, UnitClassification; local RAID_CLASS_COLORS = RAID_CLASS_COLORS; +local updateAuraFrames = OmaUFAuras.UpdateAuras; + local Settings = OmaUFSettings; local baseColor = Settings.BaseColor; local overlayColorDispel = Settings.OverlayColorDispel; @@ -200,7 +203,8 @@ local function updateHealAbsorb(frame, unit) end local function updateAuras(frame, unit) - if UnitDebuff(unit, 1, "RAID") ~= nil then + updateAuraFrames(frame, unit); + if UnitIsFriend("player", unit) and UnitDebuff(unit, 1, "RAID") ~= nil then -- something dispellable if frame.overlay.color ~= overlayColorDispel then frame.overlay:SetVertexColor(unpack(overlayColorDispel)); @@ -249,7 +253,7 @@ end local function updateRole(frame, unit) local role = UnitGroupRolesAssigned(unit); if role == "HEALER" or role == "TANK" or role == "DAMAGER" then - frame.role:SetTexCoord(GetTexCoordsForRole(role)); + frame.role:SetTexCoord(GetTexCoordsForRoleSmallCircle(role)); frame.role:Show(); else frame.role:Hide(); @@ -324,6 +328,25 @@ local function updatePVP(frame, unit) end end +local function updateLeaderIcon(frame, unit) + if UnitIsGroupLeader(frame.unit) then + if HasLFGRestrictions() then + frame.leader:SetTexture("Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES"); + frame.leader:SetTexCoord(0, 0.296875, 0.015625, 0.3125); + else + frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-LeaderIcon"); + frame.leader:SetTexCoord(0, 1, 0, 1); + end + frame.leader:Show(); + elseif UnitIsGroupAssistant(frame.unit) then + frame.leader:SetTexture("Interface\\GROUPFRAME\\UI-Group-AssistantIcon"); + frame.leader:SetTexCoord(0, 1, 0, 1); + frame.leader:Show(); + else + frame.leader:Hide(); + end +end + local eventFuncs = { ["UNIT_HEALTH"] = function(frame) updateHealth(frame, frame.displayed); @@ -396,6 +419,9 @@ local eventFuncs = { ["UNIT_FACTION"] = function(frame) updatePVP(frame, frame.unit); end, + ["PARTY_LEADER_CHANGED"] = function(frame) + updateLeaderIcon(frame, frame.unit); + end, ["UPDATE_ALL_BARS"] = function(frame) updateVehicle(frame); updateMaxHealth(frame, frame.displayed); @@ -415,6 +441,7 @@ local eventFuncs = { updateLevelText(frame, frame.unit); updateStatus(frame, frame.unit); updatePVP(frame, frame.unit); + updateLeaderIcon(frame, frame.unit); end, }; eventFuncs["UNIT_HEALTH_FREQUENT"] = eventFuncs["UNIT_HEALTH"];