Commit 4a3a6fd5 authored by Azilroka's avatar Azilroka
Browse files

Heal & Power Prediction |Health.bg Option (WIP)

parent 5cce178d
......@@ -8,19 +8,19 @@ local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
function UF:Construct_HealComm(frame)
local myBar = CreateFrame('StatusBar', nil, frame.Health)
myBar:SetStatusBarTexture(E["media"].blankTex)
UF['statusbars'][myBar] = true
myBar:Hide()
local otherBar = CreateFrame('StatusBar', nil, frame.Health)
otherBar:SetStatusBarTexture(E["media"].blankTex)
UF['statusbars'][otherBar] = true
otherBar:Hide()
local absorbBar = CreateFrame('StatusBar', nil, frame.Health)
absorbBar:SetStatusBarTexture(E["media"].blankTex)
UF['statusbars'][absorbBar] = true
absorbBar:Hide()
local healAbsorbBar = CreateFrame('StatusBar', nil, frame.Health)
healAbsorbBar:SetStatusBarTexture(E["media"].blankTex)
UF['statusbars'][healAbsorbBar] = true
healAbsorbBar:Hide()
local overAbsorb = frame.Health:CreateTexture(nil, "ARTWORK")
......@@ -52,6 +52,7 @@ function UF:Configure_HealComm(frame)
local absorbBar = healPrediction.absorbBar
local healAbsorbBar = healPrediction.healAbsorbBar
local c = self.db.colors.healPrediction
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
if not frame:IsElementEnabled('HealthPrediction') then
frame:EnableElement('HealthPrediction')
......@@ -74,8 +75,6 @@ function UF:Configure_HealComm(frame)
local reverseFill = not not frame.db.health.reverseFill
local showAbsorbAmount = frame.db.healPrediction.showAbsorbAmount
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
myBar:SetOrientation(orientation)
otherBar:SetOrientation(orientation)
absorbBar:SetOrientation(orientation)
......@@ -133,7 +132,7 @@ function UF:Configure_HealComm(frame)
healPrediction.overAbsorb:Point("TOP", frame.Health, "TOP")
healPrediction.overAbsorb:Point("BOTTOM", frame.Health, "BOTTOM")
healPrediction.overAbsorb:Point(p1, frame.Health, p2)
healPrediction.overAbsorb:Size(healPrediction.maxOverflow, 0)
healPrediction.overAbsorb:Size(1, 0)
end
if healPrediction.overHealAbsorb then
......@@ -141,7 +140,7 @@ function UF:Configure_HealComm(frame)
healPrediction.overHealAbsorb:Point("TOP", frame.Health, "TOP")
healPrediction.overHealAbsorb:Point("BOTTOM", frame.Health, "BOTTOM")
healPrediction.overHealAbsorb:Point(p2, frame.Health, p1)
healPrediction.overHealAbsorb:Size(healPrediction.maxOverflow, 0)
healPrediction.overHealAbsorb:Size(1, 0)
end
else
local height = frame.Health:GetHeight()
......@@ -183,7 +182,7 @@ function UF:Configure_HealComm(frame)
healPrediction.overAbsorb:Point("LEFT", frame.Health, "LEFT")
healPrediction.overAbsorb:Point("RIGHT", frame.Health, "RIGHT")
healPrediction.overAbsorb:Point(p1, frame.Health, p2)
healPrediction.overAbsorb:Size(0, healPrediction.maxOverflow)
healPrediction.overAbsorb:Size(0, 1)
end
if healPrediction.overHealAbsorb then
......@@ -191,7 +190,7 @@ function UF:Configure_HealComm(frame)
healPrediction.overHealAbsorb:Point("LEFT", frame.Health, "LEFT")
healPrediction.overHealAbsorb:Point("RIGHT", frame.Health, "RIGHT")
healPrediction.overHealAbsorb:Point(p2, frame.Health, p1)
healPrediction.overHealAbsorb:Size(0, healPrediction.maxOverflow)
healPrediction.overHealAbsorb:Size(0, 1)
end
end
......
......@@ -145,8 +145,6 @@ function UF:Configure_HealthBar(frame)
health.bg:SetParent(frame.Portrait.overlay)
end
health.bg:SetTexture(E.LSM:Fetch('statusbar', E.private.general.normTex))
if db.health then
if db.health.reverseFill then
health:SetReverseFill(true)
......@@ -163,6 +161,10 @@ function UF:Configure_HealthBar(frame)
if db.health.frequentUpdates then
health.frequentUpdates = db.health.frequentUpdates
end
if db.health.bgUseBarTexture then
health.bg:SetTexture(E.LSM:Fetch('statusbar', E.private.general.normTex))
end
end
--Transparency Settings
......
......@@ -6,8 +6,8 @@ local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_PowerPrediction(frame)
local mainBar = CreateFrame('StatusBar', nil, frame.Power)
mainBar:SetStatusBarTexture(E["media"].blankTex)
local mainBar = CreateFrame('StatusBar', '$parentPP', frame.Power)
UF['statusbars'][mainBar] = true
mainBar:Hide()
local PowerPrediction = {
......@@ -16,8 +16,8 @@ function UF:Construct_PowerPrediction(frame)
}
if frame.AdditionalPower then
local altBar = CreateFrame('StatusBar', nil, frame.AdditionalPower)
altBar:SetStatusBarTexture(E["media"].blankTex)
local altBar = CreateFrame('StatusBar', '$parentAP', frame.AdditionalPower)
UF['statusbars'][altBar] = true
altBar:Hide()
PowerPrediction.altBar = altBar
......@@ -35,35 +35,52 @@ function UF:Configure_PowerPrediction(frame)
end
local mainBar, altBar = powerPrediction.mainBar, powerPrediction.altBar
local reverseFill = frame.db.power.reverseFill
local orientation = frame.db.power.orientation or frame.Power:GetOrientation()
local reverseFill = not not frame.db.power.reverseFill
local r, g, b = frame.Power:GetStatusBarColor()
mainBar:SetPoint('TOP')
mainBar:SetPoint('BOTTOM')
mainBar:SetWidth(frame.Power:GetWidth())
mainBar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
if reverseFill then
mainBar:SetReverseFill(false)
mainBar:SetPoint('LEFT', frame.Power:GetStatusBarTexture(), 'LEFT')
else
mainBar:SetReverseFill(true)
mainBar:SetPoint('RIGHT', frame.Power:GetStatusBarTexture(), 'RIGHT')
end
mainBar:SetReverseFill(not reverseFill)
if altBar then
r, g, b = frame.AdditionalPower:GetStatusBarColor()
altBar:SetPoint('TOP')
altBar:SetPoint('BOTTOM')
altBar:SetWidth(frame.AdditionalPower:GetWidth())
altBar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
altBar:SetReverseFill(not reverseFill)
end
if orientation == "HORIZONTAL" then
local width = frame.Power:GetWidth()
local point = reverseFill and "LEFT" or "RIGHT"
mainBar:ClearAllPoints()
mainBar:Point("TOP", frame.Power, "TOP")
mainBar:Point("BOTTOM", frame.Power, "BOTTOM")
mainBar:Point(point, frame.Power:GetStatusBarTexture(), point)
mainBar:Size(width, 0)
if altBar then
altBar:ClearAllPoints()
altBar:Point("TOP", frame.AdditionalPower, "TOP")
altBar:Point("BOTTOM", frame.AdditionalPower, "BOTTOM")
altBar:Point(point, frame.AdditionalPower:GetStatusBarTexture(), point)
altBar:Size(width, 0)
end
else
local height = frame.Power:GetHeight()
local point = reverseFill and "BOTTOM" or "TOP"
mainBar:ClearAllPoints()
mainBar:Point("LEFT", frame.Power, "LEFT")
mainBar:Point("RIGHT", frame.Power, "RIGHT")
mainBar:Point(point, frame.Power:GetStatusBarTexture(), point)
mainBar:Size(0, height)
if reverseFill then
altBar:SetReverseFill(false)
altBar:SetPoint('LEFT', frame.AdditionalPower:GetStatusBarTexture(), 'LEFT')
else
altBar:SetReverseFill(true)
altBar:SetPoint('RIGHT', frame.AdditionalPower:GetStatusBarTexture(), 'RIGHT')
if altBar then
altBar:ClearAllPoints()
altBar:Point("LEFT", frame.AdditionalPower, "LEFT")
altBar:Point("RIGHT", frame.AdditionalPower, "RIGHT")
altBar:Point(point, frame.AdditionalPower:GetStatusBarTexture(), point)
altBar:Size(0, height)
end
end
else
......
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