X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/121eb4ef1f9210e1c70ebc8e101d37f57fbb30a0..ac5ca8a9cb3cd9c2a6f5850ba5774bd81307fb51:/OmaUF/Events.lua?ds=sidebyside diff --git a/OmaUF/Events.lua b/OmaUF/Events.lua index 6e4fa69..cd8bd7f 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; @@ -200,7 +201,7 @@ local function updateHealAbsorb(frame, unit) end local function updateAuras(frame, unit) - if UnitDebuff(unit, 1, "RAID") ~= nil then + 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 +250,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 +325,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 +416,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 +438,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"];