Verified Commit df03b86b authored by Repooc's avatar Repooc
Browse files

Some workaround to play nicely with dajovas wa

parent 248a162b
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local SUF = SLE:GetModule('UnitFrames');
local SUF = SLE:GetModule('UnitFrames')
function SUF:Configure_Health(frame)
local health = frame.Health
if not health then return end
local db = E.db.sle.shadows
local r, g, b = db.shadowcolor.r, db.shadowcolor.g, db.shadowcolor.b
local offset = (E.PixelMode and db.size) or (db.size + 1)
if frame.SLHEALTH_ENHSHADOW then
if not health.backdrop.enhshadow then
health.backdrop.enhshadow = frame:CreateShadow(4, true)
end
health.backdrop.enhshadow:SetFrameLevel(health.backdrop:GetFrameLevel())
if frame.SLLEGACY_ENHSHADOW then
health.backdrop.enhshadow:SetFrameStrata('BACKGROUND')
else
health.backdrop.enhshadow:SetFrameStrata(health.backdrop:GetFrameStrata())
end
if not SUF.CreatedShadows[health.backdrop.enhshadow] then
health.backdrop.enhshadow = frame:CreateShadow(4, true)
SUF.CreatedShadows[health.backdrop.enhshadow] = true
end
health.backdrop.enhshadow:SetOutside(frame.TargetGlow, offset-E.Border-3, offset-E.Border-3, nil, true)
health.backdrop.enhshadow:SetBackdrop({
edgeFile = E.LSM:Fetch('border', 'ElvUI GlowBorder'), edgeSize = db.size > 2 and db.size or 2,
-- insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}, --! Don't see a need for this
})
health.backdrop.enhshadow:SetBackdropColor(r, g, b, 0)
health.backdrop.enhshadow:SetBackdropBorderColor(r, g, b, 0.9)
health.backdrop.enhshadow:Hide()
elseif not frame.SLHEALTH_ENHSHADOW then
if health.backdrop.enhshadow then
health.backdrop.enhshadow:Kill()
health.backdrop.enhshadow = nil
end
health.backdrop.enhshadow:SetFrameLevel(health.backdrop:GetFrameLevel())
if frame.SLLEGACY_ENHSHADOW then
health.backdrop.enhshadow:SetFrameStrata('BACKGROUND')
else
health.backdrop.enhshadow:SetFrameStrata(health.backdrop:GetFrameStrata())
end
health.backdrop.enhshadow:SetOutside(frame.TargetGlow, offset-E.Border-3, offset-E.Border-3, nil, true)
health.backdrop.enhshadow:SetBackdrop({
edgeFile = E.LSM:Fetch('border', 'ElvUI GlowBorder'), edgeSize = db.size > 2 and db.size or 2,
-- insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}, --! Don't see a need for this
})
SUF:UpdateShadowColor(health.backdrop.enhshadow)
if frame.SLHEALTH_ENHSHADOW then
health.backdrop.enhshadow:Show()
else
health.backdrop.enhshadow:Hide()
end
end
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local SUF = SLE:GetModule('UnitFrames');
local SUF = SLE:GetModule('UnitFrames')
function SUF:Configure_Power(frame)
local power = frame.Power
if not power then return end
local db = E.db.sle.shadows
local r, g, b = db.shadowcolor.r, db.shadowcolor.g, db.shadowcolor.b
local offset = (E.PixelMode and db.size) or (db.size + 1)
if frame.SLPOWER_ENHSHADOW then
if not power.backdrop.enhshadow then
power.backdrop.enhshadow = power.backdrop:CreateShadow(4, true)
end
power.backdrop.enhshadow:SetFrameLevel(power.backdrop:GetFrameLevel())
if frame.SLLEGACY_ENHSHADOW then
power.backdrop.enhshadow:SetFrameStrata('BACKGROUND')
else
power.backdrop.enhshadow:SetFrameStrata(power.backdrop:GetFrameStrata())
end
if not SUF.CreatedShadows[power.backdrop.enhshadow] then
power.backdrop.enhshadow = power.backdrop:CreateShadow(4, true)
SUF.CreatedShadows[power.backdrop.enhshadow] = true
end
power.backdrop.enhshadow:SetOutside(power.backdrop.enhshadow:GetParent(), offset, offset, nil, true)
power.backdrop.enhshadow:SetBackdrop({
edgeFile = E.LSM:Fetch('border', 'ElvUI GlowBorder'), edgeSize = db.size > 3 and db.size or 3,
-- insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}, --! Don't see a need for this
})
power.backdrop.enhshadow:SetBackdropColor(r, g, b, 0)
power.backdrop.enhshadow:SetBackdropBorderColor(r, g, b, 0.9)
power.backdrop.enhshadow:Hide()
elseif not frame.SLPOWER_ENHSHADOW then
if power.backdrop.enhshadow then
power.backdrop.enhshadow:Kill()
power.backdrop.enhshadow = nil
end
power.backdrop.enhshadow:SetFrameLevel(power.backdrop:GetFrameLevel())
if frame.SLLEGACY_ENHSHADOW then
power.backdrop.enhshadow:SetFrameStrata('BACKGROUND')
else
power.backdrop.enhshadow:SetFrameStrata(power.backdrop:GetFrameStrata())
end
power.backdrop.enhshadow:SetOutside(power.backdrop.enhshadow:GetParent(), offset, offset, nil, true)
power.backdrop.enhshadow:SetBackdrop({
edgeFile = E.LSM:Fetch('border', 'ElvUI GlowBorder'), edgeSize = db.size > 3 and db.size or 3,
-- insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}, --! Don't see a need for this
})
SUF:UpdateShadowColor(power.backdrop.enhshadow)
if frame.USE_POWERBAR and frame.SLPOWER_ENHSHADOW then
if frame.POWERBAR_DETACHED then
power.backdrop.enhshadow:Show()
......@@ -47,5 +39,7 @@ function SUF:Configure_Power(frame)
power.backdrop.enhshadow:Hide()
end
end
elseif not frame.SLPOWER_ENHSHADOW then
power.backdrop.enhshadow:Hide()
end
end
......@@ -16,7 +16,7 @@ function SUF:ArrangeArena()
for i = 1, 5 do
local frame = _G["ElvUF_Arena"..i]
local db = E.db.sle.shadows.unitframes[frame.unitframeType]
local db = E.db.sle.shadows.unitframes.arena
do
frame.SLLEGACY_ENHSHADOW = enableState and db.legacy or false
......@@ -30,7 +30,7 @@ function SUF:ArrangeArena()
-- Power
SUF:Configure_Power(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
end
......
......@@ -16,7 +16,7 @@ function SUF:ArrangeBoss()
for i = 1, 5 do
local frame = _G["ElvUF_Boss"..i]
local db = E.db.sle.shadows.unitframes[frame.unitframeType]
local db = E.db.sle.shadows.unitframes.boss
do
frame.SLLEGACY_ENHSHADOW = enableState and db.legacy or false
......@@ -30,7 +30,7 @@ function SUF:ArrangeBoss()
-- Power
SUF:Configure_Power(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
end
......
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local SUF = SLE:GetModule("UnitFrames")
local UF = E:GetModule('UnitFrames');
local UF = E:GetModule('UnitFrames')
--GLOBALS: hooksecurefunc
local _G = _G
......@@ -20,7 +20,7 @@ function SUF:ArrangeParty()
for j = 1, group:GetNumChildren() do
local frame = select(j, group:GetChildren())
local db = E.db.sle.shadows.unitframes[frame.unitframeType]
local db = E.db.sle.shadows.unitframes.party
do
frame.SLLEGACY_ENHSHADOW = enableState and db.legacy or false
......@@ -34,7 +34,7 @@ function SUF:ArrangeParty()
-- Power
SUF:Configure_Power(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
end
end
......@@ -42,7 +42,7 @@ end
function SUF:InitParty()
SUF:Construct_PartyFrame()
hooksecurefunc(UF, "Update_PartyFrames", function(_, frame)
if frame.unitframeType == 'party' then SUF:ArrangeParty() end
hooksecurefunc(UF, "CreateAndUpdateHeaderGroup", function(_, frame)
if frame == 'party' then SUF:ArrangeParty() end
end)
end
......@@ -20,7 +20,7 @@ function SUF:ArrangeRaid()
for j = 1, group:GetNumChildren() do
local frame = select(j, group:GetChildren())
local db = E.db.sle.shadows.unitframes[frame.unitframeType]
local db = E.db.sle.shadows.unitframes.raid
if frame then
do
......@@ -35,7 +35,7 @@ function SUF:ArrangeRaid()
-- Power
SUF:Configure_Power(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
end
end
......@@ -44,7 +44,7 @@ end
function SUF:InitRaid()
SUF:Construct_RaidFrame()
hooksecurefunc(UF, "Update_RaidFrames", function(_, frame)
if frame.unitframeType == 'raid' then SUF:ArrangeRaid() end
hooksecurefunc(UF, "CreateAndUpdateHeaderGroup", function(_, frame)
if frame == 'raid' then SUF:ArrangeRaid() end
end)
end
......@@ -20,7 +20,7 @@ function SUF:ArrangeRaid40()
for j = 1, group:GetNumChildren() do
local frame = select(j, group:GetChildren())
local db = E.db.sle.shadows.unitframes[frame.unitframeType]
local db = E.db.sle.shadows.unitframes.raid40
if frame then
do
......@@ -35,7 +35,7 @@ function SUF:ArrangeRaid40()
-- Power
SUF:Configure_Power(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
end
end
......@@ -44,7 +44,7 @@ end
function SUF:InitRaid40()
SUF:Construct_Raid40Frame()
hooksecurefunc(UF, "Update_Raid40Frames", function(_, frame)
if frame.unitframeType == 'raid40' then SUF:ArrangeRaid40() end
hooksecurefunc(UF, "CreateAndUpdateHeaderGroup", function(_, frame)
if frame == 'raid40' then SUF:ArrangeRaid40() end
end)
end
local SLE, T, E, L, V, P, G = unpack(select(2, ...))
local UF = E:GetModule('UnitFrames');
local SUF = SLE:NewModule('UnitFrames', 'AceHook-3.0', 'AceEvent-3.0', 'AceTimer-3.0')
SUF.CreatedShadows = {}
--GLOBALS: hooksecurefunc, CreateFrame
local function UpdateAuraTimer(self, elapsed)
......@@ -47,6 +47,22 @@ function SUF:UpdateUnitFrames()
SUF:InitTargetTargetTarget()
end
function SUF:UpdateShadows()
if UnitAffectingCombat('player') then SUF:RegisterEvent('PLAYER_REGEN_ENABLED', SUF.UpdateShadows) return end
SUF:UnregisterEvent('PLAYER_ENTERING_WORLD')
for frame, _ in pairs(SUF.CreatedShadows) do
SUF:UpdateShadowColor(frame)
end
end
function SUF:UpdateShadowColor(shadow)
local db = E.db.sle.shadows
local r, g, b = db.shadowcolor.r, db.shadowcolor.g, db.shadowcolor.b
shadow:SetBackdropColor(r, g, b, 0)
shadow:SetBackdropBorderColor(r, g, b, 0.9)
end
function SUF:Initialize()
if not SLE.initialized or not E.private.unitframe.enable then return end
--DB convert
......
......@@ -14,7 +14,7 @@ end
function SUF:ArrangePlayer()
local enableState = E.db.unitframe.units.player.enable
local frame = _G["ElvUF_Player"]
local db = E.db.sle.shadows.unitframes[frame.unit]
local db = E.db.sle.shadows.unitframes.player
do
frame.SLLEGACY_ENHSHADOW = enableState and db.legacy or false
......@@ -32,7 +32,7 @@ function SUF:ArrangePlayer()
-- ClassBar shadows
SUF:Configure_ClassBar(frame)
frame:UpdateAllElements("SLE_UpdateAllElements")
-- frame:UpdateAllElements("SLE_UpdateAllElements")
end
function SUF:InitPlayer()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment