From: Aleksi Blinnikka Date: Sat, 27 Jan 2018 12:05:17 +0000 (+0200) Subject: Add leader icon, aura frame stub X-Git-Url: https://www.aleksib.fi/git/wowui.git/commitdiff_plain/ac5ca8a9cb3cd9c2a6f5850ba5774bd81307fb51?hp=121eb4ef1f9210e1c70ebc8e101d37f57fbb30a0 Add leader icon, aura frame stub --- diff --git a/OmaUF/Auras.lua b/OmaUF/Auras.lua new file mode 100644 index 0000000..deb62fa --- /dev/null +++ b/OmaUF/Auras.lua @@ -0,0 +1,15 @@ +-- Auras.lua +local _; +local CreateFrame = CreateFrame; + +local M = {}; +OmaUFAuras = M; + +function M.CreateAuraFrame(parent) + parent.auras = CreateFrame("Frame", nil, parent); + parent.auras:SetPoint("TOPLEFT", parent, "BOTTOMLEFT", 0, -2); +end + +function M.UpdateAuras(frame, unit) + local auras = frame.auras; +end 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"]; diff --git a/OmaUF/OmaUF.toc b/OmaUF/OmaUF.toc index 8a3beed..15facee 100644 --- a/OmaUF/OmaUF.toc +++ b/OmaUF/OmaUF.toc @@ -5,5 +5,6 @@ ## Notes: My unit frames Settings.lua +Auras.lua Events.lua UnitFrames.lua diff --git a/OmaUF/UnitFrames.lua b/OmaUF/UnitFrames.lua index 8a49add..d5ec0b7 100644 --- a/OmaUF/UnitFrames.lua +++ b/OmaUF/UnitFrames.lua @@ -151,7 +151,7 @@ local function setupFrame(frame, secure, unit) frame.role = frame:CreateTexture(nil, "OVERLAY"); frame.role:SetPoint("TOPLEFT", frame.healthback, "TOPRIGHT", -8, 8); frame.role:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPRIGHT", 8, -8); - frame.role:SetTexture("Interface\\LFGFRAME\\UI-LFG-ICON-ROLES"); + frame.role:SetTexture("Interface\\LFGFRAME\\UI-LFG-ICON-PORTRAITROLES"); frame.role:Hide(); frame.status = frame:CreateTexture(nil, "OVERLAY"); frame.status:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", -8, 8); @@ -159,10 +159,14 @@ local function setupFrame(frame, secure, unit) frame.status:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon"); frame.status:Hide(); frame.pvp = frame:CreateTexture(nil, "OVERLAY"); - frame.pvp:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT", -6, 6); - frame.pvp:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPLEFT", 16, -16); + frame.pvp:SetPoint("TOPLEFT", frame.manaback, "BOTTOMLEFT", 8, 6); + frame.pvp:SetPoint("BOTTOMRIGHT", frame.manaback, "BOTTOMLEFT", 32, -18); frame.pvp:SetTexture("Interface\\TARGETINGFRAME\\UI-PVP-Horde"); frame.pvp:Hide(); + frame.leader = frame:CreateTexture(nil, "OVERLAY"); + frame.leader:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT", -6, 6); + frame.leader:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPLEFT", 6, -6); + frame.leader:Hide(); frame.name = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightLarge"); frame.name:SetPoint("LEFT", frame.healthback, "LEFT", 2, 1); frame.level = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");