Commit 8feac020 authored by Blazeflack's avatar Blazeflack

Added compatibility with latest changes in ElvUI dev branch

This fixes #11
parent 4755753a
......@@ -67,14 +67,21 @@ function VAT:CreateBar(button)
local isOnBottom = pos == 'BOTTOM' and true or false;
local isOnLeft = pos == 'LEFT' and true or false;
local isOnRight = pos == 'RIGHT' and true or false;
-- Border
local BarHolder = CreateFrame('Frame', nil, button)
BarHolder:Width((isOnTop or isOnBottom) and width or (E.db.VAT.barWidth + (E.PixelMode and 0 or 2)))
BarHolder:Height((isOnLeft or isOnRight) and height or (E.db.VAT.barHeight + (E.PixelMode and 0 or 2)))
BarHolder:Point(inversePoints[pos], button, pos, (isOnTop or isOnBottom) and 0 or ((isOnLeft and -((E.PixelMode and 1 or 3) + spacing)) or ((E.PixelMode and 1 or 3) + spacing)), (isOnLeft or isOnRight) and 0 or ((isOnTop and ((E.PixelMode and 1 or 3) + spacing) or -((E.PixelMode and 1 or 3) + spacing))))
BarHolder:SetTemplate('Default', nil, true)
BarHolder.backdropTexture:SetTexture(E.db.VAT.useBackdropTexture and LSM:Fetch("statusbar", E.db['VAT'].backdropTexture) or E['media'].blankTex)
if E.db.VAT.useBackdropTexture then --deprecated
local texture = LSM:Fetch("statusbar", E.db['VAT'].backdropTexture)
if BarHolder.backdropTexture then
BarHolder.backdropTexture:SetTexture(texture)
else
BarHolder:GetBackdrop().bgFile = texture
end
end
button.Holder = BarHolder
-- Statusbar
......@@ -123,9 +130,9 @@ function VAT:UpdateAura(button, index)
else
button.timeLeft_ = nil
button.time:SetText("")
button:SetScript("OnUpdate", nil)
button:SetScript("OnUpdate", nil)
end
if filter == 'HARMFUL' then
isDebuff = true
local color = DebuffTypeColor[dtype or ""]
......@@ -152,7 +159,11 @@ function VAT:UpdateAura(button, index)
end
end
local color = E.db.VAT.backdropColor
button.Holder.backdropTexture:SetVertexColor(color.r, color.g, color.b)
if button.Holder.backdropTexture then --deprecated
button.Holder.backdropTexture:SetVertexColor(color.r, color.g, color.b)
else
button.Holder:SetBackdropColor(color.r, color.g, color.b)
end
end
-- Toggle Visual Timer and Text Timer
......@@ -313,7 +324,7 @@ function VAT:UpdateTempEnchant(button, index)
button.Holder:Hide()
button.time:Show()
end
-- Set color and value of statusbar and match color of statusbar border to color of the aura border
local r, g, b
button.Bar:SetValue(timeLeft)
......@@ -338,12 +349,12 @@ end
function VAT:UpdateHeader(header)
if (not E.private.auras.enable) then return end
local db = A.db.debuffs
if header:GetAttribute('filter') == 'HELPFUL' then
db = A.db.buffs
end
local width = db.size;
local height = db.size;
local pos = E.db.VAT.position;
......@@ -352,7 +363,7 @@ function VAT:UpdateHeader(header)
local isOnBottom = pos == 'BOTTOM' and true or false;
local isOnLeft = pos == 'LEFT' and true or false;
local isOnRight = pos == 'RIGHT' and true or false;
local index = 1
local child = select(index, header:GetChildren())
while (child) do
......@@ -362,8 +373,15 @@ function VAT:UpdateHeader(header)
child.Holder:ClearAllPoints()
child.Holder:Point(inversePoints[pos], child, pos, (isOnTop or isOnBottom) and 0 or ((isOnLeft and -((E.PixelMode and 1 or 3) + spacing)) or ((E.PixelMode and 1 or 3) + spacing)), (isOnLeft or isOnRight) and 0 or ((isOnTop and ((E.PixelMode and 1 or 3) + spacing) or -((E.PixelMode and 1 or 3) + spacing))))
child.Holder:SetTemplate('Default', nil, true)
child.Holder.backdropTexture:SetTexture(E.db.VAT.useBackdropTexture and LSM:Fetch("statusbar", E.db['VAT'].backdropTexture) or E['media'].blankTex)
if E.db.VAT.useBackdropTexture then
local texture = LSM:Fetch("statusbar", E.db['VAT'].backdropTexture)
if child.Holder.backdropTexture then --deprecated
child.Holder.backdropTexture:SetTexture(texture)
else
child.Holder:GetBackdrop().bgFile = texture
end
end
child.Bar:SetStatusBarTexture(E.db.VAT.useStatusbarTexture and LSM:Fetch("statusbar", E.db['VAT'].statusbarTexture) or E['media'].blankTex)
if isOnLeft or isOnRight then
child.Bar:SetOrientation('VERTICAL')
......@@ -425,17 +443,17 @@ function VAT:UpdateTimerColors()
c, c2 = E.db.VAT.colors.expire, E.db.VAT.colors.expireIndicator
VAT.TimeColors[4] = E:RGBToHex(c.r, c.g, c.b)
VAT.IndicatorColors[4] = E:RGBToHex(c2.r, c2.g, c2.b)
-- colors for timers that have seconds remaining
c, c2 = E.db.VAT.colors.seconds, E.db.VAT.colors.secondsIndicator
VAT.TimeColors[3] = E:RGBToHex(c.r, c.g, c.b)
VAT.IndicatorColors[3] = E:RGBToHex(c2.r, c2.g, c2.b)
-- colors for timers that have minutes remaining
c, c2 = E.db.VAT.colors.minutes, E.db.VAT.colors.minutesIndicator
VAT.TimeColors[2] = E:RGBToHex(c.r, c.g, c.b)
VAT.IndicatorColors[2] = E:RGBToHex(c2.r, c2.g, c2.b)
-- color for timers that have hours remaining
c, c2 = E.db.VAT.colors.hours, E.db.VAT.colors.hoursIndicator
VAT.TimeColors[1] = E:RGBToHex(c.r, c.g, c.b)
......@@ -453,7 +471,7 @@ function VAT:Initialize()
--ElvUI Auras are not enabled, stop right here!
if E.private.auras.enable ~= true then return; end
self:UpdateTimerColors()
hooksecurefunc(A, 'UpdateTime', VAT.UpdateTime)
......
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