mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
update
This commit is contained in:
@@ -16,46 +16,4 @@
|
||||
|
||||
<Cooldown name="oUF_CooldownFrameTemplate" inherits="CooldownFrameTemplate" drawEdge="true" virtual="true"/>
|
||||
|
||||
|
||||
Sub-object as a child of the parent unit frame:
|
||||
<Button name="oUF_HeaderTargetTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
|
||||
<Frames>
|
||||
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
|
||||
<Attributes>
|
||||
<Attribute name="unitsuffix" type="string" value="target"/>
|
||||
<Attribute name="useparent-unit" type="boolean" value="true"/>
|
||||
</Attributes>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Button>
|
||||
|
||||
Separate unit template example:
|
||||
<Button name="oUF_HeaderSeparateSubOjectsTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
|
||||
<Attributes>
|
||||
<Attribute name="oUF-onlyProcessChildren" type="boolean" value="true"/>
|
||||
</Attributes>
|
||||
|
||||
<Frames>
|
||||
<Button name="$parentUnit" inherits="SecureUnitButtonTemplate">
|
||||
<Attributes>
|
||||
<Attribute name="useparent-unit" type="boolean" value="true"/>
|
||||
</Attributes>
|
||||
</Button>
|
||||
|
||||
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
|
||||
<Attributes>
|
||||
<Attribute name="unitsuffix" type="string" value="pet"/>
|
||||
<Attribute name="useparent-unit" type="boolean" value="true"/>
|
||||
</Attributes>
|
||||
</Button>
|
||||
|
||||
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
|
||||
<Attributes>
|
||||
<Attribute name="unitsuffix" type="string" value="target"/>
|
||||
<Attribute name="useparent-unit" type="boolean" value="true"/>
|
||||
</Attributes>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Button>
|
||||
|
||||
</Ui>
|
||||
+17
-19
@@ -282,7 +282,7 @@ local function initObject(unit, style, styleFunc, header, ...)
|
||||
for i = 1, num do
|
||||
local object = arg[i]
|
||||
local objectUnit = object.guessUnit or unit
|
||||
local suffix = match(objectUnit or unit, "%w+target")
|
||||
local suffix = objectUnit and match(objectUnit or unit, "%w+target")
|
||||
|
||||
object.__elements = {}
|
||||
object.__registeredEvents = {}
|
||||
@@ -331,7 +331,6 @@ local function initObject(unit, style, styleFunc, header, ...)
|
||||
|
||||
styleFunc(object, objectUnit, not header)
|
||||
|
||||
object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
object:SetScript("OnShow", function() onShow(this) end)
|
||||
|
||||
activeElements[object] = {}
|
||||
@@ -359,7 +358,6 @@ local function walkObject(object, unit)
|
||||
-- Check if we should leave the main frame blank.
|
||||
if(object.onlyProcessChildren) then
|
||||
object.hasChildren = true
|
||||
object:SetScript("OnAttributeChanged", onAttributeChanged)
|
||||
return initObject(unit, style, styleFunc, header, object:GetChildren())
|
||||
end
|
||||
|
||||
@@ -542,8 +540,8 @@ do
|
||||
end
|
||||
|
||||
self.menu = togglemenu
|
||||
self:SetAttribute("type1", "target")
|
||||
self:SetAttribute("type2", "menu")
|
||||
--self:SetAttribute("type1", "target")
|
||||
--self:SetAttribute("type2", "menu")
|
||||
self.guessUnit = unit
|
||||
self.unit = "player"
|
||||
-- self.onlyProcessChildren =true
|
||||
@@ -552,18 +550,18 @@ do
|
||||
styleProxy(nil, self:GetName())
|
||||
end
|
||||
|
||||
-- local setAttribute = function(self, name, value)
|
||||
-- if self.attributes[name] ~= value then
|
||||
-- self.attributes[name] = value
|
||||
local setAttribute = function(self, name, value)
|
||||
if self.attributes[name] ~= value then
|
||||
self.attributes[name] = value
|
||||
|
||||
-- if self:IsVisible() then
|
||||
-- SecureGroupHeader_Update(self)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- local getAttribute = function(self, name)
|
||||
-- return self.attributes[name]
|
||||
-- end
|
||||
if self:IsVisible() then
|
||||
SecureGroupHeader_Update(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
local getAttribute = function(self, name)
|
||||
return self.attributes[name]
|
||||
end
|
||||
--[[ oUF:SpawnHeader(overrideName, template, visibility, ...)
|
||||
Used to create a group header and apply the currently active style to it.
|
||||
|
||||
@@ -594,10 +592,10 @@ do
|
||||
header:Hide()
|
||||
|
||||
header.attributes = {}
|
||||
-- header.SetAttribute = SetAttribute
|
||||
-- header.GetAttribute = GetAttribute
|
||||
header.SetAttribute = setAttribute
|
||||
header.GetAttribute = getAttribute
|
||||
|
||||
header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||
--header:SetAttribute("template", "SecureUnitButtonTemplate")
|
||||
for i = 1, getn(arg), 2 do
|
||||
local att, val = select(i, unpack(arg))
|
||||
if(not att) then break end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local pairs = pairs
|
||||
local ipairs = ipairs
|
||||
local upper = string.upper
|
||||
|
||||
local unitExistsWatchers = {}
|
||||
local unitExistsCache = setmetatable({},{
|
||||
@@ -94,7 +95,7 @@ end
|
||||
-- Given a point return the opposite point and which axes the point
|
||||
-- depends on.
|
||||
local function getRelativePointAnchor(point)
|
||||
point = strupper(point)
|
||||
point = upper(point)
|
||||
if point == "TOP" then
|
||||
return "BOTTOM", 0, -1
|
||||
elseif point == "BOTTOM" then
|
||||
@@ -139,7 +140,7 @@ local function fillTable(tbl, ...)
|
||||
for key in pairs(tbl) do
|
||||
tbl[key] = nil
|
||||
end
|
||||
for i = 1, getn(arg), 1 do
|
||||
for i = 1, arg.n, 1 do
|
||||
local key = arg[i]
|
||||
key = tonumber(key) or key
|
||||
tbl[key] = true
|
||||
@@ -150,7 +151,7 @@ end
|
||||
-- the array portion of the table in order
|
||||
local function doubleFillTable(tbl, ...)
|
||||
fillTable(tbl, unpack(arg))
|
||||
for i = 1, getn(arg), 1 do
|
||||
for i = 1, arg.n, 1 do
|
||||
tbl[i] = arg[i]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv
|
||||
local type, unpack, select, pairs = type, unpack, select, pairs
|
||||
local min, random = math.min, math.random
|
||||
local format = string.format
|
||||
local find = string.find
|
||||
--WoW API / Variables
|
||||
local UnitMana = UnitMana
|
||||
local UnitManaMax = UnitManaMax
|
||||
@@ -166,11 +167,10 @@ end
|
||||
function UF:ShowChildUnits(header, ...)
|
||||
header.isForced = true
|
||||
|
||||
for i = 1, getn(args) do
|
||||
local frame = select(i, unpack(args))
|
||||
for i = 1, arg.n do
|
||||
local frame = arg[i]
|
||||
frame:RegisterForClicks(nil)
|
||||
frame:SetID(i)
|
||||
frame.TargetGlow:SetAlpha(0)
|
||||
self:ForceShow(frame)
|
||||
end
|
||||
end
|
||||
@@ -178,10 +178,9 @@ end
|
||||
function UF:UnshowChildUnits(header, ...)
|
||||
header.isForced = nil
|
||||
|
||||
for i = 1, getn(args) do
|
||||
local frame = select(i, unpack(args))
|
||||
for i = 1, arg.n do
|
||||
local frame = arg[i]
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
frame.TargetGlow:SetAlpha(1)
|
||||
self:UnforceShow(frame)
|
||||
end
|
||||
end
|
||||
@@ -218,14 +217,14 @@ function UF:HeaderConfig(header, configMode)
|
||||
end
|
||||
end
|
||||
|
||||
RegisterStateDriver(header, "visibility", "show")
|
||||
--RegisterStateDriver(header, "visibility", "show")
|
||||
else
|
||||
for func, env in pairs(originalEnvs) do
|
||||
setfenv(func, env)
|
||||
originalEnvs[func] = nil
|
||||
end
|
||||
|
||||
RegisterStateDriver(header, "visibility", header.db.visibility)
|
||||
--RegisterStateDriver(header, "visibility", header.db.visibility)
|
||||
|
||||
if header:GetScript("OnEvent") then
|
||||
header:GetScript("OnEvent")(header, "PLAYER_ENTERING_WORLD")
|
||||
@@ -238,7 +237,7 @@ function UF:HeaderConfig(header, configMode)
|
||||
if group:IsShown() then
|
||||
group.forceShow = header.forceShow
|
||||
group.forceShowAuras = header.forceShowAuras
|
||||
HookScript(group, "OnAttributeChanged", OnAttributeChanged)
|
||||
--HookScript(group, "OnAttributeChanged", OnAttributeChanged)
|
||||
if configMode then
|
||||
for key in pairs(attributeBlacklist) do
|
||||
group:SetAttribute(key, nil)
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames");
|
||||
|
||||
local _G = _G
|
||||
local pairs = pairs
|
||||
local select = select
|
||||
local assert = assert
|
||||
local tinsert = table.insert
|
||||
|
||||
local CreateFrame = CreateFrame
|
||||
local UnitIsUnit = UnitIsUnit
|
||||
local UnitReaction = UnitReaction
|
||||
local UnitIsPlayer = UnitIsPlayer
|
||||
local UnitClass = UnitClass
|
||||
local UnitExists = UnitExists
|
||||
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
|
||||
local FACTION_BAR_COLORS = FACTION_BAR_COLORS
|
||||
|
||||
function UF:FrameGlow_MouseOnUnit(frame)
|
||||
if frame and frame:IsVisible() and UnitExists("mouseover") then
|
||||
local unit = frame.unit or (frame.isForced and "player")
|
||||
return unit and UnitIsUnit("mouseover", unit)
|
||||
elseif frame.isHighlight then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function UF:FrameGlow_ElementHook(frame, glow, which)
|
||||
if not (frame and frame.__elements) then return end
|
||||
tinsert(frame.__elements, function()
|
||||
local unit = frame.unit or (frame.isForced and "player")
|
||||
if unit then
|
||||
UF:FrameGlow_SetGlowColor(glow, unit, which)
|
||||
end
|
||||
|
||||
if which == "mouseoverGlow" then
|
||||
UF:FrameGlow_PositionHighlight(frame)
|
||||
UF:FrameGlow_CheckMouseover(frame)
|
||||
else
|
||||
UF:FrameGlow_PositionGlow(frame, glow, glow.powerGlow)
|
||||
end
|
||||
|
||||
if which == "targetGlow" then
|
||||
UF:FrameGlow_CheckTarget(frame)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
|
||||
if (frame and power and powerName and glow and offset) and not glow[powerName.."Hooked"] then
|
||||
glow[powerName.."Hooked"] = true
|
||||
local func = function() UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, true) end
|
||||
HookScript(power, "OnShow", func)
|
||||
HookScript(power, "OnHide", func)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, fromScript)
|
||||
if not (frame and glow and offset) then return end
|
||||
|
||||
local power = powerName and frame[powerName]
|
||||
if not power then return end
|
||||
|
||||
if not fromScript then
|
||||
UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
|
||||
end
|
||||
|
||||
local portrait = (frame.USE_PORTRAIT and not frame.PORTRAIT_WIDTH == 0) and (frame.Portrait and frame.Portrait.backdrop)
|
||||
|
||||
if powerName == "HappinessIndicator" and (power and power.backdrop and power:IsVisible()) then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
glow:SetPoint("TOPLEFT", power.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", portrait or frame.Health.backdrop, offset, offset)
|
||||
else
|
||||
glow:SetPoint("TOPLEFT", portrait or frame.Health.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", power.backdrop, offset, offset)
|
||||
end
|
||||
else
|
||||
if (power and power.backdrop and power:IsVisible()) and (not (frame.CLASSBAR_DETACHED or frame.USE_MINI_CLASSBAR)) then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
glow:SetPoint("TOPLEFT", power.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", portrait or power.backdrop, offset, offset)
|
||||
else
|
||||
glow:SetPoint("TOPLEFT", portrait or power.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", power.backdrop, offset, offset)
|
||||
end
|
||||
elseif frame.Health and frame.Health.backdrop then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
glow:SetPoint("TOPLEFT", frame.Health.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", portrait or frame.Health.backdrop, offset, offset)
|
||||
else
|
||||
glow:SetPoint("TOPLEFT", portrait or frame.Health.backdrop, -offset, offset)
|
||||
glow:SetPoint("TOPRIGHT", frame.Health.backdrop, offset, offset)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_PositionGlow(frame, mainGlow, powerGlow)
|
||||
if not (frame and frame.VARIABLES_SET) then return end
|
||||
|
||||
local infoPanel = frame.InfoPanel
|
||||
local additionalPower = frame.AdditionalPower
|
||||
local runes = frame.Runes
|
||||
local comboPoints = frame.ComboPoints
|
||||
local happiness = frame.HappinessIndicator
|
||||
local power = frame.Power and frame.Power.backdrop
|
||||
local health = frame.Health and frame.Health.backdrop
|
||||
local portrait = (frame.USE_PORTRAIT and not frame.PORTRAIT_WIDTH ~= 0) and (frame.Portrait and frame.Portrait.backdrop)
|
||||
local offset = (E.PixelMode and E.mult*3) or E.mult*4 -- edgeSize is 3
|
||||
|
||||
mainGlow:ClearAllPoints()
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
mainGlow:SetPoint("TOPLEFT", health, -offset, offset)
|
||||
mainGlow:SetPoint("TOPRIGHT", portrait or health, offset, offset)
|
||||
else
|
||||
mainGlow:SetPoint("TOPLEFT", portrait or health, -offset, offset)
|
||||
mainGlow:SetPoint("TOPRIGHT", health, offset, offset)
|
||||
end
|
||||
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
|
||||
mainGlow:SetPoint("BOTTOMLEFT", health, -offset, -offset)
|
||||
mainGlow:SetPoint("BOTTOMRIGHT", health, offset, -offset)
|
||||
else
|
||||
--offset is set because its one pixel off for some reason
|
||||
mainGlow:SetPoint("BOTTOMLEFT", frame, -offset, -(E.PixelMode and offset or offset-1))
|
||||
mainGlow:SetPoint("BOTTOMRIGHT", frame, offset, -(E.PixelMode and offset or offset-1))
|
||||
end
|
||||
|
||||
if powerGlow then
|
||||
powerGlow:ClearAllPoints()
|
||||
powerGlow:SetPoint("TOPLEFT", power, -offset, offset)
|
||||
powerGlow:SetPoint("TOPRIGHT", power, offset, offset)
|
||||
powerGlow:SetPoint("BOTTOMLEFT", power, -offset, -offset)
|
||||
powerGlow:SetPoint("BOTTOMRIGHT", power, offset, -offset)
|
||||
end
|
||||
|
||||
if additionalPower then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "AdditionalPower", mainGlow, offset)
|
||||
elseif runes then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "Runes", mainGlow, offset)
|
||||
elseif comboPoints then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "ComboPoints", mainGlow, offset)
|
||||
elseif happiness then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "HappinessIndicator", mainGlow, offset)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CreateGlow(frame, mouse)
|
||||
-- Main Glow to wrap the health frame to it's best ability
|
||||
E:CreateShadow(frame, "Default")
|
||||
local mainGlow = frame.shadow
|
||||
mainGlow:SetFrameStrata("BACKGROUND")
|
||||
mainGlow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
-- Secondary Glow for power frame when using power offset or mini power
|
||||
E:CreateShadow(frame, "Default")
|
||||
local powerGlow = frame.shadow
|
||||
powerGlow:SetFrameStrata("BACKGROUND")
|
||||
powerGlow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
if mouse then
|
||||
mainGlow:SetFrameLevel(4)
|
||||
powerGlow:SetFrameLevel(4)
|
||||
else
|
||||
mainGlow:SetFrameLevel(3)
|
||||
powerGlow:SetFrameLevel(3)
|
||||
end
|
||||
|
||||
-- Eventing Frame
|
||||
if not frame.Highlight then
|
||||
frame.Highlight = CreateFrame("Frame", nil, frame)
|
||||
frame.Highlight:Hide()
|
||||
HookScript(frame, "OnEnter", function()
|
||||
frame.isHighlight = true
|
||||
UF:FrameGlow_CheckMouseover(frame)
|
||||
end)
|
||||
HookScript(frame, "OnLeave", function()
|
||||
frame.isHighlight = false
|
||||
UF:FrameGlow_CheckMouseover(frame)
|
||||
end)
|
||||
|
||||
HookScript(frame.Highlight, "OnEvent", function()
|
||||
if event == "UPDATE_MOUSEOVER_UNIT" then
|
||||
UF:FrameGlow_CheckMouseover(frame)
|
||||
elseif event == "PLAYER_TARGET_CHANGED" then
|
||||
UF:FrameGlow_CheckTarget(frame)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
mainGlow.powerGlow = powerGlow
|
||||
return mainGlow
|
||||
end
|
||||
|
||||
function UF:FrameGlow_SetGlowColor(glow, unit, which)
|
||||
if not glow then return end
|
||||
local option = E.db.unitframe.colors.frameGlow[which]
|
||||
local r, g, b, a = 1, 1, 1, 1
|
||||
|
||||
if option.color then
|
||||
local color = option.color
|
||||
r, g, b, a = color.r, color.g, color.b, color.a
|
||||
end
|
||||
|
||||
if option.class then
|
||||
local isPlayer = unit and UnitIsPlayer(unit)
|
||||
local reaction = unit and UnitReaction(unit, "player")
|
||||
|
||||
if isPlayer then
|
||||
local _, class = UnitClass(unit)
|
||||
if class then
|
||||
local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
|
||||
if color then
|
||||
r, g, b = color.r, color.g, color.b
|
||||
end
|
||||
end
|
||||
elseif reaction then
|
||||
local color = FACTION_BAR_COLORS[reaction]
|
||||
if color then
|
||||
r, g, b = color.r, color.g, color.b
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if which == "mouseoverGlow" then
|
||||
glow:SetVertexColor(r, g, b, a)
|
||||
else
|
||||
glow:SetBackdropBorderColor(r, g, b, a)
|
||||
if glow.powerGlow then
|
||||
glow.powerGlow:SetBackdropBorderColor(r, g, b, a)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_HideGlow(glow)
|
||||
if not glow then return end
|
||||
if glow:IsShown() then glow:Hide() end
|
||||
if glow.powerGlow and glow.powerGlow:IsShown() then
|
||||
glow.powerGlow:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_ConfigureGlow(frame, unit, dbTexture)
|
||||
if not frame then return end
|
||||
|
||||
if not unit then
|
||||
unit = frame.unit or (frame.isForced and "player")
|
||||
end
|
||||
|
||||
local shouldHide
|
||||
if frame.Highlight and frame.Highlight.texture then
|
||||
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
|
||||
frame.Highlight.texture:SetTexture(dbTexture)
|
||||
UF:FrameGlow_SetGlowColor(frame.Highlight.texture, unit, "mouseoverGlow")
|
||||
else
|
||||
shouldHide = "texture"
|
||||
end
|
||||
end
|
||||
|
||||
if frame.MouseGlow then
|
||||
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
|
||||
UF:FrameGlow_SetGlowColor(frame.MouseGlow, unit, "mainGlow")
|
||||
else
|
||||
UF:FrameGlow_HideGlow(frame.MouseGlow)
|
||||
if shouldHide then
|
||||
shouldHide = "both"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if shouldHide then
|
||||
if shouldHide == "both" and frame.Highlight:IsShown() then
|
||||
frame.Highlight:Hide()
|
||||
elseif shouldHide == "texture" then
|
||||
frame.Highlight.texture:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if frame.TargetGlow then
|
||||
UF:FrameGlow_CheckTarget(frame, true)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CheckTarget(frame, setColor)
|
||||
if not (frame and frame.TargetGlow and frame:IsVisible()) then return end
|
||||
|
||||
local unit = frame.unit or (frame.isForced and "player")
|
||||
if E.db.unitframe.colors.frameGlow.targetGlow.enable and (unit and UnitIsUnit(unit, "target")) and not (frame.db and frame.db.disableTargetGlow) then
|
||||
if setColor then
|
||||
UF:FrameGlow_SetGlowColor(frame.TargetGlow, unit, "targetGlow")
|
||||
end
|
||||
if frame.TargetGlow.powerGlow then
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
|
||||
frame.TargetGlow.powerGlow:Show()
|
||||
elseif frame.TargetGlow.powerGlow:IsShown() then
|
||||
frame.TargetGlow.powerGlow:Hide()
|
||||
end
|
||||
end
|
||||
frame.TargetGlow:Show()
|
||||
else
|
||||
UF:FrameGlow_HideGlow(frame.TargetGlow)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CheckMouseover(frame, onEnter)
|
||||
if not (frame and frame.MouseGlow and frame:IsVisible()) then return end
|
||||
|
||||
local shouldShow
|
||||
if UF:FrameGlow_MouseOnUnit(frame, onEnter) then
|
||||
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
|
||||
shouldShow = "frame"
|
||||
end
|
||||
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
|
||||
shouldShow = (shouldShow and "both") or "texture"
|
||||
end
|
||||
end
|
||||
|
||||
if shouldShow then
|
||||
if frame.Highlight and not frame.Highlight:IsShown() then
|
||||
frame.Highlight:Show()
|
||||
end
|
||||
if (shouldShow == "both" or shouldShow == "frame") then
|
||||
if frame.MouseGlow.powerGlow then
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
|
||||
frame.MouseGlow.powerGlow:Show()
|
||||
elseif frame.MouseGlow.powerGlow:IsShown() then
|
||||
frame.MouseGlow.powerGlow:Hide()
|
||||
end
|
||||
end
|
||||
frame.MouseGlow:Show()
|
||||
|
||||
if (shouldShow == "frame") and frame.Highlight.texture and frame.Highlight.texture:IsShown() then
|
||||
frame.Highlight.texture:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if (shouldShow == "both" or shouldShow == "texture") and frame.Highlight.texture and not frame.Highlight.texture:IsShown() then
|
||||
frame.Highlight.texture:Show()
|
||||
end
|
||||
elseif frame.Highlight and frame.Highlight:IsShown() then
|
||||
frame.Highlight:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_PositionHighlight(frame)
|
||||
if frame.Highlight and frame.Highlight.texture then
|
||||
frame.Highlight.texture:ClearAllPoints()
|
||||
frame.Highlight.texture:SetPoint("TOPLEFT", frame.Health, "TOPLEFT")
|
||||
frame.Highlight.texture:SetPoint("BOTTOMRIGHT", frame.Health.texturePointer, "BOTTOMRIGHT")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Configure_HighlightGlow(frame)
|
||||
if frame.Highlight and frame.Highlight.texture then
|
||||
local dbTexture = UF.LSM:Fetch("statusbar", E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
|
||||
frame.Highlight.texture:SetTexture(dbTexture)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_HighlightGlow(frame, glow)
|
||||
if frame.Health and frame.Highlight then
|
||||
HookScript(frame.Highlight, "OnHide", function()
|
||||
UF:FrameGlow_HideGlow(glow)
|
||||
|
||||
if this.texture and this.texture:IsShown() then
|
||||
this.texture:Hide()
|
||||
end
|
||||
end)
|
||||
|
||||
frame.Highlight:Show()
|
||||
frame.Highlight:SetScript("OnUpdate", function()
|
||||
if this.elapsed and this.elapsed > 0.1 then
|
||||
if not UF:FrameGlow_MouseOnUnit(frame) then
|
||||
this:Hide()
|
||||
end
|
||||
this.elapsed = 0
|
||||
else
|
||||
this.elapsed = (this.elapsed or 0) + arg1
|
||||
end
|
||||
end)
|
||||
|
||||
frame.Highlight.texture = frame.Health:CreateTexture("$parentHighlight", "OVERLAY")
|
||||
frame.Highlight.texture:Hide()
|
||||
|
||||
UF:FrameGlow_ElementHook(frame, frame.Highlight.texture, "mouseoverGlow")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_MouseGlow(frame)
|
||||
local mainGlow = UF:FrameGlow_CreateGlow(frame, true)
|
||||
UF:FrameGlow_ElementHook(frame, mainGlow, "mainGlow")
|
||||
UF:Construct_HighlightGlow(frame, mainGlow)
|
||||
frame.Highlight:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
|
||||
|
||||
return mainGlow
|
||||
end
|
||||
|
||||
function UF:Construct_TargetGlow(frame)
|
||||
local targetGlow = UF:FrameGlow_CreateGlow(frame)
|
||||
UF:FrameGlow_ElementHook(frame, targetGlow, "targetGlow")
|
||||
frame.Highlight:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
return targetGlow
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CheckChildren(frame, dbTexture)
|
||||
if frame.GetName then
|
||||
local pet = _G[frame:GetName().."Pet"]
|
||||
if pet then
|
||||
UF:FrameGlow_ConfigureGlow(pet, pet.unit, dbTexture)
|
||||
end
|
||||
|
||||
local target = _G[frame:GetName().."Target"]
|
||||
if target then
|
||||
UF:FrameGlow_ConfigureGlow(target, target.unit, dbTexture)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_UpdateFrames()
|
||||
local dbTexture = UF.LSM:Fetch("statusbar", E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
|
||||
|
||||
-- focus, focustarget, pet, pettarget, player, target, targettarget, targettargettarget
|
||||
for unit in pairs(self.units) do
|
||||
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
|
||||
end
|
||||
|
||||
-- arena{1-5}, boss{1-5}
|
||||
for unit in pairs(self.groupunits) do
|
||||
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
|
||||
end
|
||||
|
||||
-- assist, tank, party, raid, raid40, raidpet
|
||||
for groupName in pairs(self.headers) do
|
||||
assert(self[groupName], "UF FrameGlow: Invalid group specified.")
|
||||
local group = self[groupName]
|
||||
|
||||
if group.GetNumChildren then
|
||||
for i = 1, group:GetNumChildren() do
|
||||
local frame = select(i, group:GetChildren())
|
||||
if frame and frame.Health then
|
||||
UF:FrameGlow_ConfigureGlow(frame, frame.unit, dbTexture)
|
||||
UF:FrameGlow_CheckChildren(frame, dbTexture)
|
||||
elseif frame then
|
||||
for n = 1, frame:GetNumChildren() do
|
||||
local child = select(n, frame:GetChildren())
|
||||
if child and child.Health then
|
||||
UF:FrameGlow_ConfigureGlow(child, child.unit, dbTexture)
|
||||
UF:FrameGlow_CheckChildren(child, dbTexture)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -176,6 +176,9 @@ function UF:Configure_HealthBar(frame)
|
||||
--Transparency Settings
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, (frame.USE_PORTRAIT and frame.USE_PORTRAIT_OVERLAY) ~= true)
|
||||
|
||||
--Highlight Texture
|
||||
UF:Configure_HighlightGlow(frame)
|
||||
|
||||
frame:UpdateElement("Health")
|
||||
end
|
||||
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
<Script file="RaidIcon.lua"/>
|
||||
<Script file="RaidRoleIcons.lua"/>
|
||||
<Script file="RestingIndicator.lua"/>
|
||||
<Script file="FrameGlow.lua"/>
|
||||
</Ui>
|
||||
@@ -1,14 +1,10 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
local tinsert = table.insert
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames");
|
||||
|
||||
--Cache global variables
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local IsInInstance = IsInInstance
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
|
||||
local ns = oUF
|
||||
local ElvUF = ns.oUF
|
||||
@@ -31,6 +27,8 @@ function UF:Construct_RaidFrames()
|
||||
self.Name = UF:Construct_NameText(self)
|
||||
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
|
||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||
self.MouseGlow = UF:Construct_MouseGlow(self)
|
||||
self.TargetGlow = UF:Construct_TargetGlow(self)
|
||||
|
||||
self.GPS = UF:Construct_GPS(self)
|
||||
self.InfoPanel = UF:Construct_InfoPanel(self)
|
||||
|
||||
@@ -679,7 +679,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
if headerUpdate or not self[group].mover then
|
||||
UF["headerFunctions"][group]:Configure_Groups(self[group])
|
||||
if not self[group].isForced and not self[group].blockVisibilityChanges then
|
||||
RegisterStateDriver(self[group], "visibility", db.visibility)
|
||||
-- RegisterStateDriver(self[group], "visibility", db.visibility)
|
||||
end
|
||||
else
|
||||
UF["headerFunctions"][group]:Configure_Groups(self[group])
|
||||
@@ -693,7 +693,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
E:EnableMover(self[group].mover:GetName())
|
||||
end
|
||||
else
|
||||
UnregisterStateDriver(self[group], "visibility")
|
||||
--UnregisterStateDriver(self[group], "visibility")
|
||||
self[group]:Hide()
|
||||
if self[group].mover then
|
||||
E:DisableMover(self[group].mover:GetName())
|
||||
@@ -707,7 +707,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
|
||||
UF["headerFunctions"][group]["Update"] = function()
|
||||
local db = UF.db["units"][group]
|
||||
if db.enable ~= true then
|
||||
UnregisterStateDriver(UF[group], "visibility")
|
||||
--UnregisterStateDriver(UF[group], "visibility")
|
||||
UF[group]:Hide()
|
||||
if(UF[group].mover) then
|
||||
E:DisableMover(UF[group].mover:GetName())
|
||||
|
||||
@@ -23,6 +23,8 @@ function UF:Construct_PetFrame(frame)
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
|
||||
E:Point(frame, "BOTTOM", E.UIParent, "BOTTOM", 0, 118)
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Pet Frame"], nil, nil, nil, "ALL,SOLO")
|
||||
|
||||
@@ -25,6 +25,8 @@ function UF:Construct_TargetFrame(frame)
|
||||
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
|
||||
frame.GPS = self:Construct_GPS(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
|
||||
E:Point(frame, "BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68)
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Target Frame"], nil, nil, nil, "ALL,SOLO")
|
||||
|
||||
@@ -625,6 +625,24 @@ P["unitframe"] = {
|
||||
[3] = {r = 0.33, g = 0.59, b = 0.33},
|
||||
},
|
||||
},
|
||||
["frameGlow"] = {
|
||||
["mainGlow"] = {
|
||||
["enable"] = false,
|
||||
["class"] = false,
|
||||
["color"] = {r = 1, g = 1, b = 1, a = 1}
|
||||
},
|
||||
["targetGlow"] = {
|
||||
["enable"] = false,
|
||||
["class"] = false,
|
||||
["color"] = {r = 1, g = 1, b = 1, a = 1}
|
||||
},
|
||||
["mouseoverGlow"] = {
|
||||
["enable"] = false,
|
||||
["class"] = false,
|
||||
["texture"] = "ElvUI Blank",
|
||||
["color"] = {r = 1, g = 1, b = 1, a = 0.1}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
["units"] = {
|
||||
@@ -641,6 +659,8 @@ P["unitframe"] = {
|
||||
["threatStyle"] = "GLOW",
|
||||
["smartAuraPosition"] = "DISABLED",
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = false,
|
||||
["health"] = {
|
||||
["text_format"] = "[healthcolor][health:current-percent]",
|
||||
["position"] = "LEFT",
|
||||
@@ -696,9 +716,9 @@ P["unitframe"] = {
|
||||
["scale"] = 1,
|
||||
},
|
||||
["portrait"] = {
|
||||
["enable"] = true,
|
||||
["enable"] = false,
|
||||
["width"] = 45,
|
||||
["overlay"] = true,
|
||||
["overlay"] = false,
|
||||
["style"] = "3D",
|
||||
},
|
||||
["buffs"] = {
|
||||
@@ -800,6 +820,8 @@ P["unitframe"] = {
|
||||
["rangeCheck"] = true,
|
||||
["healPrediction"] = true,
|
||||
["middleClickFocus"] = true,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = true,
|
||||
["health"] = {
|
||||
["text_format"] = "[healthcolor][health:current-percent]",
|
||||
["position"] = "RIGHT",
|
||||
@@ -949,6 +971,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 130,
|
||||
["height"] = 36,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = true,
|
||||
["health"] = {
|
||||
["text_format"] = "",
|
||||
["position"] = "RIGHT",
|
||||
@@ -1034,6 +1058,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 130,
|
||||
["height"] = 36,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = false,
|
||||
["health"] = {
|
||||
["text_format"] = "",
|
||||
["position"] = "RIGHT",
|
||||
@@ -1118,6 +1144,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 130,
|
||||
["height"] = 36,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = true,
|
||||
["healPrediction"] = true,
|
||||
["health"] = {
|
||||
["text_format"] = "",
|
||||
@@ -1215,6 +1243,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 130,
|
||||
["height"] = 26,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = false,
|
||||
["health"] = {
|
||||
["text_format"] = "",
|
||||
["position"] = "RIGHT",
|
||||
@@ -1303,7 +1333,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 184,
|
||||
["height"] = 54,
|
||||
["targetGlow"] = true,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = false,
|
||||
["health"] = {
|
||||
["text_format"] = "[healthcolor][health:current-percent]",
|
||||
["position"] = "LEFT",
|
||||
@@ -1490,7 +1521,8 @@ P["unitframe"] = {
|
||||
["colorOverride"] = "USE_DEFAULT",
|
||||
["width"] = 80,
|
||||
["height"] = 44,
|
||||
["targetGlow"] = true,
|
||||
["disableMouseoverGlow"] = false,
|
||||
["disableTargetGlow"] = false,
|
||||
["health"] = {
|
||||
["text_format"] = "[healthcolor][health:deficit]",
|
||||
["position"] = "BOTTOM",
|
||||
|
||||
Reference in New Issue
Block a user