Revert "Add absorbs, heal absorbs (#90)"
This reverts commit 3d7b873aa9.
This commit is contained in:
@@ -140,25 +140,8 @@ function NP:Update_HealComm(nameplate)
|
||||
nameplate:EnableElement('HealCommBar')
|
||||
end
|
||||
|
||||
local c = NP.db.colors.healPrediction
|
||||
nameplate.HealCommBar.myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b)
|
||||
nameplate.HealCommBar.otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b)
|
||||
|
||||
if nameplate.HealCommBar.absorbBar then
|
||||
nameplate.HealCommBar.absorbBar:SetStatusBarColor(c.absorbs.r, c.absorbs.g, c.absorbs.b, c.absorbs.a)
|
||||
end
|
||||
|
||||
if nameplate.HealCommBar.healAbsorbBar then
|
||||
nameplate.HealCommBar.healAbsorbBar:SetStatusBarColor(c.healAbsorbs.r, c.healAbsorbs.g, c.healAbsorbs.b, c.healAbsorbs.a)
|
||||
end
|
||||
|
||||
if nameplate.HealCommBar.overAbsorb then
|
||||
nameplate.HealCommBar.overAbsorb:SetVertexColor(c.overAbsorbs.r, c.overAbsorbs.g, c.overAbsorbs.b, c.overAbsorbs.a)
|
||||
end
|
||||
|
||||
if nameplate.HealCommBar.overHealAbsorb then
|
||||
nameplate.HealCommBar.overHealAbsorb:SetVertexColor(c.overHealAbsorbs.r, c.overHealAbsorbs.g, c.overHealAbsorbs.b, c.overHealAbsorbs.a)
|
||||
end
|
||||
nameplate.HealCommBar.myBar:SetStatusBarColor(NP.db.colors.healPrediction.personal.r, NP.db.colors.healPrediction.personal.g, NP.db.colors.healPrediction.personal.b)
|
||||
nameplate.HealCommBar.otherBar:SetStatusBarColor(NP.db.colors.healPrediction.others.r, NP.db.colors.healPrediction.others.g, NP.db.colors.healPrediction.others.b)
|
||||
elseif nameplate:IsElementEnabled('HealCommBar') then
|
||||
nameplate:DisableElement('HealCommBar')
|
||||
end
|
||||
@@ -175,12 +158,6 @@ end
|
||||
function NP:SetAlpha_HealComm(obj, show)
|
||||
obj.myBar:SetAlpha(show and 1 or 0)
|
||||
obj.otherBar:SetAlpha(show and 1 or 0)
|
||||
if obj.absorbBar then
|
||||
obj.absorbBar:SetAlpha(show and 1 or 0)
|
||||
end
|
||||
if obj.healAbsorbBar then
|
||||
obj.healAbsorbBar:SetAlpha(show and 1 or 0)
|
||||
end
|
||||
end
|
||||
|
||||
function NP:SetVisibility_HealComm(obj)
|
||||
@@ -194,21 +171,9 @@ function NP:SetVisibility_HealComm(obj)
|
||||
if obj.maxOverflow > 1 then
|
||||
obj.myBar:SetParent(obj.health)
|
||||
obj.otherBar:SetParent(obj.health)
|
||||
if obj.absorbBar then
|
||||
obj.absorbBar:SetParent(obj.health)
|
||||
end
|
||||
if obj.healAbsorbBar then
|
||||
obj.healAbsorbBar:SetParent(obj.health)
|
||||
end
|
||||
else
|
||||
obj.myBar:SetParent(obj.parent)
|
||||
obj.otherBar:SetParent(obj.parent)
|
||||
if obj.absorbBar then
|
||||
obj.absorbBar:SetParent(obj.parent)
|
||||
end
|
||||
if obj.healAbsorbBar then
|
||||
obj.healAbsorbBar:SetParent(obj.parent)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -216,27 +181,18 @@ function NP:Construct_HealComm(frame)
|
||||
local health = frame.Health
|
||||
local parent = health.ClipFrame
|
||||
|
||||
local myBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local otherBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local absorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local healAbsorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local myBar = CreateFrame("StatusBar", nil, parent)
|
||||
local otherBar = CreateFrame("StatusBar", nil, parent)
|
||||
|
||||
myBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||
otherBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||
absorbBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||
healAbsorbBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||
myBar:SetFrameLevel(health:GetFrameLevel()+1)
|
||||
otherBar:SetFrameLevel(health:GetFrameLevel()+1)
|
||||
|
||||
local texture = health:GetStatusBarTexture() or E.media.blankTex
|
||||
myBar:SetStatusBarTexture(texture)
|
||||
otherBar:SetStatusBarTexture(texture)
|
||||
absorbBar:SetStatusBarTexture(texture)
|
||||
healAbsorbBar:SetStatusBarTexture(texture)
|
||||
NP.StatusBars[myBar] = true
|
||||
NP.StatusBars[otherBar] = true
|
||||
|
||||
local healPrediction = {
|
||||
myBar = myBar,
|
||||
otherBar = otherBar,
|
||||
absorbBar = absorbBar,
|
||||
healAbsorbBar = healAbsorbBar,
|
||||
PostUpdate = NP.UpdateHealComm,
|
||||
maxOverflow = 1,
|
||||
health = health,
|
||||
@@ -258,15 +214,8 @@ function NP:Configure_HealComm(frame)
|
||||
end
|
||||
|
||||
local healPrediction = frame.HealCommBar
|
||||
local myBar = healPrediction.myBar
|
||||
local otherBar = healPrediction.otherBar
|
||||
local absorbBar = healPrediction.absorbBar
|
||||
local healAbsorbBar = healPrediction.healAbsorbBar
|
||||
local c = db.colors.healPrediction
|
||||
|
||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||
healPrediction.overflowHeals = c.overflowHeals
|
||||
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||
|
||||
if healPrediction.allowClippingUpdate then
|
||||
NP:SetVisibility_HealComm(healPrediction)
|
||||
@@ -274,146 +223,84 @@ function NP:Configure_HealComm(frame)
|
||||
|
||||
local health = frame.Health
|
||||
local orientation = health:GetOrientation()
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
local width = health:GetWidth()
|
||||
width = (width > 0 and width) or health.WIDTH
|
||||
local height = health:GetHeight()
|
||||
height = (height > 0 and height) or health.HEIGHT
|
||||
|
||||
healPrediction.healthBarTexture = healthTexture
|
||||
healPrediction.myBarTexture = myBar:GetStatusBarTexture()
|
||||
healPrediction.otherBarTexture = otherBar:GetStatusBarTexture()
|
||||
|
||||
local myBar = healPrediction.myBar
|
||||
local otherBar = healPrediction.otherBar
|
||||
|
||||
myBar:SetOrientation(orientation)
|
||||
otherBar:SetOrientation(orientation)
|
||||
absorbBar:SetOrientation(orientation)
|
||||
healAbsorbBar:SetOrientation(orientation)
|
||||
|
||||
if orientation == "HORIZONTAL" then
|
||||
local p1 = "LEFT"
|
||||
local p2 = "RIGHT"
|
||||
local width = health:GetWidth()
|
||||
width = (width > 0 and width) or health.WIDTH
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
healPrediction.anchor1 = p1
|
||||
healPrediction.anchor2 = p2
|
||||
|
||||
myBar:SetSize(width, height)
|
||||
myBar:Size(width, 0)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("TOP", health)
|
||||
myBar:Point("BOTTOM", health)
|
||||
myBar:Point(p1, healthTexture, p2)
|
||||
myBar:SetReverseFill(false)
|
||||
myBar:Point("TOP", health, "TOP")
|
||||
myBar:Point("BOTTOM", health, "BOTTOM")
|
||||
myBar:Point("LEFT", healthTexture, "RIGHT")
|
||||
|
||||
otherBar:SetSize(width, height)
|
||||
otherBar:Size(width, 0)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("TOP", health)
|
||||
otherBar:Point("BOTTOM", health)
|
||||
otherBar:Point(p1, healPrediction.myBarTexture, p2)
|
||||
otherBar:SetReverseFill(false)
|
||||
otherBar:Point("TOP", health, "TOP")
|
||||
otherBar:Point("BOTTOM", health, "BOTTOM")
|
||||
otherBar:Point("LEFT", myBar:GetStatusBarTexture(), "RIGHT")
|
||||
else
|
||||
local height = health:GetHeight()
|
||||
height = (height > 0 and height) or health.HEIGHT
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
absorbBar:SetSize(width, height)
|
||||
absorbBar:ClearAllPoints()
|
||||
absorbBar:Point("TOP", health)
|
||||
absorbBar:Point("BOTTOM", health)
|
||||
absorbBar:Point(p1, healthTexture, p2)
|
||||
absorbBar:SetReverseFill(false)
|
||||
|
||||
healAbsorbBar:SetSize(width, height)
|
||||
healAbsorbBar:ClearAllPoints()
|
||||
healAbsorbBar:Point("TOP", health)
|
||||
healAbsorbBar:Point("BOTTOM", health)
|
||||
healAbsorbBar:Point(p2, healthTexture, p2)
|
||||
healAbsorbBar:SetReverseFill(true)
|
||||
else -- VERTICAL
|
||||
local p1 = "BOTTOM"
|
||||
local p2 = "TOP"
|
||||
|
||||
healPrediction.anchor1 = p1
|
||||
healPrediction.anchor2 = p2
|
||||
|
||||
myBar:SetSize(width, height)
|
||||
myBar:Size(0, height)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("LEFT", health)
|
||||
myBar:Point("RIGHT", health)
|
||||
myBar:Point(p1, healthTexture, p2)
|
||||
myBar:SetReverseFill(false)
|
||||
myBar:Point("LEFT", health, "LEFT")
|
||||
myBar:Point("RIGHT", health, "RIGHT")
|
||||
myBar:Point("BOTTOM", healthTexture, "TOP")
|
||||
|
||||
otherBar:SetSize(width, height)
|
||||
otherBar:Size(0, height)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("LEFT", health)
|
||||
otherBar:Point("RIGHT", health)
|
||||
otherBar:Point(p1, healPrediction.myBarTexture, p2)
|
||||
otherBar:SetReverseFill(false)
|
||||
|
||||
absorbBar:SetSize(width, height)
|
||||
absorbBar:ClearAllPoints()
|
||||
absorbBar:Point("LEFT", health)
|
||||
absorbBar:Point("RIGHT", health)
|
||||
absorbBar:Point(p1, healthTexture, p2)
|
||||
absorbBar:SetReverseFill(false)
|
||||
|
||||
healAbsorbBar:SetSize(width, height)
|
||||
healAbsorbBar:ClearAllPoints()
|
||||
healAbsorbBar:Point("LEFT", health)
|
||||
healAbsorbBar:Point("RIGHT", health)
|
||||
healAbsorbBar:Point(p2, healthTexture, p2)
|
||||
healAbsorbBar:SetReverseFill(true)
|
||||
otherBar:Point("LEFT", health, "LEFT")
|
||||
otherBar:Point("RIGHT", health, "RIGHT")
|
||||
otherBar:Point("BOTTOM", myBar:GetStatusBarTexture(), "TOP")
|
||||
end
|
||||
|
||||
local hpc = NP.db.colors.healPrediction
|
||||
frame.HealCommBar.myBar:SetStatusBarColor(hpc.personal.r, hpc.personal.g, hpc.personal.b)
|
||||
frame.HealCommBar.otherBar:SetStatusBarColor(hpc.others.r, hpc.others.g, hpc.others.b)
|
||||
frame.HealCommBar.absorbBar:SetStatusBarColor(hpc.absorbs.r, hpc.absorbs.g, hpc.absorbs.b, hpc.absorbs.a)
|
||||
frame.HealCommBar.healAbsorbBar:SetStatusBarColor(hpc.healAbsorbs.r, hpc.healAbsorbs.g, hpc.healAbsorbs.b, hpc.healAbsorbs.a)
|
||||
frame.HealCommBar.myBar:SetStatusBarColor(NP.db.colors.healPrediction.personal.r, NP.db.colors.healPrediction.personal.g, NP.db.colors.healPrediction.personal.b)
|
||||
frame.HealCommBar.otherBar:SetStatusBarColor(NP.db.colors.healPrediction.others.r, NP.db.colors.healPrediction.others.g, NP.db.colors.healPrediction.others.b)
|
||||
elseif frame:IsElementEnabled('HealComm4') then
|
||||
frame:DisableElement('HealComm4')
|
||||
end
|
||||
end
|
||||
|
||||
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||
local function UpdateFillBar(frame, previousTexture, bar, amount)
|
||||
if amount == 0 then
|
||||
bar:Hide()
|
||||
return previousTexture
|
||||
end
|
||||
|
||||
local orientation = frame:GetOrientation()
|
||||
bar:ClearAllPoints()
|
||||
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:Point("TOP", health)
|
||||
bar:Point("BOTTOM", health)
|
||||
else -- VERTICAL
|
||||
bar:Point("LEFT", health)
|
||||
bar:Point("RIGHT", health)
|
||||
bar:SetPoint("TOPLEFT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "BOTTOMRIGHT")
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "TOPLEFT")
|
||||
end
|
||||
|
||||
if overflowMode then
|
||||
bar:Point(p1, anchorTexture, p2)
|
||||
bar:SetReverseFill(false)
|
||||
elseif hasEnoughSpace then
|
||||
bar:Point(p1, anchorTexture, p2)
|
||||
bar:SetReverseFill(false)
|
||||
local totalWidth, totalHeight = frame:GetSize()
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:Width(totalWidth)
|
||||
else
|
||||
local reverseAnchor = reverseAnchorTexture or health
|
||||
bar:Point(p2, reverseAnchor, p2)
|
||||
bar:SetReverseFill(true)
|
||||
bar:Height(totalHeight)
|
||||
end
|
||||
|
||||
return bar:GetStatusBarTexture()
|
||||
end
|
||||
|
||||
function NP:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, myCurrentHealAbsorb, allHealAbsorb)
|
||||
if not self.frame or not self.health then return end
|
||||
|
||||
function NP:UpdateHealComm(_, myIncomingHeal, allIncomingHeal)
|
||||
local health = self.health
|
||||
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
||||
local orientation = health:GetOrientation()
|
||||
local previousTexture = health:GetStatusBarTexture()
|
||||
|
||||
local currentHealth = UnitHealth(unit) or 0
|
||||
local maxHealth = UnitHealthMax(unit) or 1
|
||||
local missingHealth = maxHealth - currentHealth
|
||||
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
||||
|
||||
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
||||
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
||||
|
||||
local overflowHeals = self.overflowHeals or false
|
||||
local overflowAbsorbs = self.overflowAbsorbs or false
|
||||
|
||||
AnchorPredictionBar(self.myBar, health, orientation, healthTexture, missingHealth >= myIncomingHeal, overflowHeals, p1, p2)
|
||||
AnchorPredictionBar(self.otherBar, health, orientation, self.myBarTexture, missingHealth >= totalIncomingHeal, overflowHeals, p1, p2)
|
||||
AnchorPredictionBar(self.absorbBar, health, orientation, healthTexture, missingHealth >= totalAbsorb, overflowAbsorbs, p1, p2)
|
||||
AnchorPredictionBar(self.healAbsorbBar, health, orientation, healthTexture, false, false, p1, p2, healthTexture)
|
||||
end
|
||||
previousTexture = UpdateFillBar(health, previousTexture, self.myBar, myIncomingHeal)
|
||||
UpdateFillBar(health, previousTexture, self.otherBar, allIncomingHeal)
|
||||
end
|
||||
|
||||
@@ -16,8 +16,6 @@ end
|
||||
function UF:SetAlpha_HealComm(obj, show)
|
||||
obj.myBar:SetAlpha(show and 1 or 0)
|
||||
obj.otherBar:SetAlpha(show and 1 or 0)
|
||||
obj.absorbBar:SetAlpha(show and 1 or 0)
|
||||
obj.healAbsorbBar:SetAlpha(show and 1 or 0)
|
||||
end
|
||||
|
||||
function UF:SetVisibility_HealComm(obj)
|
||||
@@ -31,13 +29,9 @@ function UF:SetVisibility_HealComm(obj)
|
||||
if obj.maxOverflow > 1 then
|
||||
obj.myBar:SetParent(obj.health)
|
||||
obj.otherBar:SetParent(obj.health)
|
||||
obj.absorbBar:SetParent(obj.health)
|
||||
obj.healAbsorbBar:SetParent(obj.health)
|
||||
else
|
||||
obj.myBar:SetParent(obj.parent)
|
||||
obj.otherBar:SetParent(obj.parent)
|
||||
obj.absorbBar:SetParent(obj.parent)
|
||||
obj.healAbsorbBar:SetParent(obj.parent)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,27 +39,22 @@ function UF:Construct_HealComm(frame)
|
||||
local health = frame.Health
|
||||
local parent = health.ClipFrame
|
||||
|
||||
local myBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local otherBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local absorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local healAbsorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||
local myBar = CreateFrame("StatusBar", nil, parent)
|
||||
local otherBar = CreateFrame("StatusBar", nil, parent)
|
||||
|
||||
myBar:SetFrameLevel(12)
|
||||
otherBar:SetFrameLevel(12)
|
||||
absorbBar:SetFrameLevel(12)
|
||||
healAbsorbBar:SetFrameLevel(12)
|
||||
myBar:SetFrameLevel(11)
|
||||
otherBar:SetFrameLevel(11)
|
||||
|
||||
UF.statusbars[myBar] = true
|
||||
UF.statusbars[otherBar] = true
|
||||
|
||||
local texture = (not health.isTransparent and health:GetStatusBarTexture()) or E.media.blankTex
|
||||
myBar:SetStatusBarTexture(texture)
|
||||
otherBar:SetStatusBarTexture(texture)
|
||||
absorbBar:SetStatusBarTexture(texture)
|
||||
healAbsorbBar:SetStatusBarTexture(texture)
|
||||
UF:Update_StatusBar(myBar, texture)
|
||||
UF:Update_StatusBar(otherBar, texture)
|
||||
|
||||
local healPrediction = {
|
||||
myBar = myBar,
|
||||
otherBar = otherBar,
|
||||
absorbBar = absorbBar,
|
||||
healAbsorbBar = healAbsorbBar,
|
||||
PostUpdate = UF.UpdateHealComm,
|
||||
maxOverflow = 1,
|
||||
health = health,
|
||||
@@ -83,13 +72,8 @@ function UF:Configure_HealComm(frame)
|
||||
local healPrediction = frame.HealCommBar
|
||||
local myBar = healPrediction.myBar
|
||||
local otherBar = healPrediction.otherBar
|
||||
local absorbBar = healPrediction.absorbBar
|
||||
local healAbsorbBar = healPrediction.healAbsorbBar
|
||||
local c = self.db.colors.healPrediction
|
||||
|
||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||
healPrediction.overflowHeals = c.overflowHeals
|
||||
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||
|
||||
if healPrediction.allowClippingUpdate then
|
||||
UF:SetVisibility_HealComm(healPrediction)
|
||||
@@ -102,146 +86,82 @@ function UF:Configure_HealComm(frame)
|
||||
if frame.db.health then
|
||||
local health = frame.Health
|
||||
local orientation = frame.db.health.orientation or health:GetOrientation()
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
local width = health:GetWidth()
|
||||
width = (width > 0 and width) or health.WIDTH
|
||||
local height = health:GetHeight()
|
||||
height = (height > 0 and height) or health.HEIGHT
|
||||
|
||||
healPrediction.healthBarTexture = healthTexture
|
||||
healPrediction.myBarTexture = myBar:GetStatusBarTexture()
|
||||
healPrediction.otherBarTexture = otherBar:GetStatusBarTexture()
|
||||
|
||||
myBar:SetOrientation(orientation)
|
||||
otherBar:SetOrientation(orientation)
|
||||
absorbBar:SetOrientation(orientation)
|
||||
healAbsorbBar:SetOrientation(orientation)
|
||||
|
||||
if orientation == "HORIZONTAL" then
|
||||
local p1 = "LEFT"
|
||||
local p2 = "RIGHT"
|
||||
local width = health:GetWidth()
|
||||
width = (width > 0 and width) or health.WIDTH
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
healPrediction.anchor1 = p1
|
||||
healPrediction.anchor2 = p2
|
||||
|
||||
myBar:SetSize(width, height)
|
||||
myBar:Size(width, 0)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("TOP", health)
|
||||
myBar:Point("BOTTOM", health)
|
||||
myBar:Point(p1, healthTexture, p2)
|
||||
myBar:SetReverseFill(false)
|
||||
myBar:Point("TOP", health, "TOP")
|
||||
myBar:Point("BOTTOM", health, "BOTTOM")
|
||||
myBar:Point("LEFT", healthTexture, "RIGHT")
|
||||
|
||||
otherBar:SetSize(width, height)
|
||||
otherBar:Size(width, 0)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("TOP", health)
|
||||
otherBar:Point("BOTTOM", health)
|
||||
otherBar:Point(p1, healPrediction.myBarTexture, p2)
|
||||
otherBar:SetReverseFill(false)
|
||||
|
||||
absorbBar:SetSize(width, height)
|
||||
absorbBar:ClearAllPoints()
|
||||
absorbBar:Point("TOP", health)
|
||||
absorbBar:Point("BOTTOM", health)
|
||||
absorbBar:Point(p1, healthTexture, p2)
|
||||
absorbBar:SetReverseFill(false)
|
||||
|
||||
healAbsorbBar:SetSize(width, height)
|
||||
healAbsorbBar:ClearAllPoints()
|
||||
healAbsorbBar:Point("TOP", health)
|
||||
healAbsorbBar:Point("BOTTOM", health)
|
||||
healAbsorbBar:Point(p2, healthTexture, p2)
|
||||
healAbsorbBar:SetReverseFill(true)
|
||||
otherBar:Point("TOP", health, "TOP")
|
||||
otherBar:Point("BOTTOM", health, "BOTTOM")
|
||||
otherBar:Point("LEFT", myBar:GetStatusBarTexture(), "RIGHT")
|
||||
else
|
||||
local p1 = "BOTTOM"
|
||||
local p2 = "TOP"
|
||||
local height = health:GetHeight()
|
||||
height = (height > 0 and height) or health.HEIGHT
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
healPrediction.anchor1 = p1
|
||||
healPrediction.anchor2 = p2
|
||||
|
||||
myBar:SetSize(width, height)
|
||||
myBar:Size(0, height)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("LEFT", health)
|
||||
myBar:Point("RIGHT", health)
|
||||
myBar:Point(p1, healthTexture, p2)
|
||||
myBar:SetReverseFill(false)
|
||||
myBar:Point("LEFT", health, "LEFT")
|
||||
myBar:Point("RIGHT", health, "RIGHT")
|
||||
myBar:Point("BOTTOM", healthTexture, "TOP")
|
||||
|
||||
otherBar:SetSize(width, height)
|
||||
otherBar:Size(0, height)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("LEFT", health)
|
||||
otherBar:Point("RIGHT", health)
|
||||
otherBar:Point(p1, healPrediction.myBarTexture, p2)
|
||||
otherBar:SetReverseFill(false)
|
||||
|
||||
absorbBar:SetSize(width, height)
|
||||
absorbBar:ClearAllPoints()
|
||||
absorbBar:Point("LEFT", health)
|
||||
absorbBar:Point("RIGHT", health)
|
||||
absorbBar:Point(p1, healthTexture, p2)
|
||||
absorbBar:SetReverseFill(false)
|
||||
|
||||
healAbsorbBar:SetSize(width, height)
|
||||
healAbsorbBar:ClearAllPoints()
|
||||
healAbsorbBar:Point("LEFT", health)
|
||||
healAbsorbBar:Point("RIGHT", health)
|
||||
healAbsorbBar:Point(p2, healthTexture, p2)
|
||||
healAbsorbBar:SetReverseFill(true)
|
||||
otherBar:Point("LEFT", health, "LEFT")
|
||||
otherBar:Point("RIGHT", health, "RIGHT")
|
||||
otherBar:Point("BOTTOM", myBar:GetStatusBarTexture(), "TOP")
|
||||
end
|
||||
end
|
||||
|
||||
myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a)
|
||||
otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.a)
|
||||
absorbBar:SetStatusBarColor(c.absorbs.r, c.absorbs.g, c.absorbs.b, c.absorbs.a)
|
||||
healAbsorbBar:SetStatusBarColor(c.healAbsorbs.r, c.healAbsorbs.g, c.healAbsorbs.b, c.healAbsorbs.a)
|
||||
elseif frame:IsElementEnabled("HealComm4") then
|
||||
frame:DisableElement("HealComm4")
|
||||
end
|
||||
end
|
||||
|
||||
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||
local function UpdateFillBar(frame, previousTexture, bar, amount)
|
||||
if amount == 0 then
|
||||
bar:Hide()
|
||||
return previousTexture
|
||||
end
|
||||
|
||||
local orientation = frame:GetOrientation()
|
||||
bar:ClearAllPoints()
|
||||
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:Point("TOP", health)
|
||||
bar:Point("BOTTOM", health)
|
||||
else -- VERTICAL
|
||||
bar:Point("LEFT", health)
|
||||
bar:Point("RIGHT", health)
|
||||
bar:SetPoint("TOPLEFT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "BOTTOMRIGHT")
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "TOPLEFT")
|
||||
end
|
||||
|
||||
if overflowMode then
|
||||
bar:Point(p1, anchorTexture, p2)
|
||||
bar:SetReverseFill(false)
|
||||
elseif hasEnoughSpace then
|
||||
bar:Point(p1, anchorTexture, p2)
|
||||
bar:SetReverseFill(false)
|
||||
local totalWidth, totalHeight = frame:GetSize()
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:Width(totalWidth)
|
||||
else
|
||||
local reverseAnchor = reverseAnchorTexture or health
|
||||
bar:Point(p2, reverseAnchor, p2)
|
||||
bar:SetReverseFill(true)
|
||||
bar:Height(totalHeight)
|
||||
end
|
||||
|
||||
return bar:GetStatusBarTexture()
|
||||
end
|
||||
|
||||
function UF:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, myCurrentHealAbsorb, allHealAbsorb)
|
||||
if not self.frame or not self.health then return end
|
||||
|
||||
function UF:UpdateHealComm(_, myIncomingHeal, allIncomingHeal)
|
||||
local health = self.health
|
||||
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
||||
local orientation = health:GetOrientation()
|
||||
local previousTexture = health:GetStatusBarTexture()
|
||||
|
||||
local currentHealth = UnitHealth(unit) or 0
|
||||
local maxHealth = UnitHealthMax(unit) or 1
|
||||
local missingHealth = maxHealth - currentHealth
|
||||
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
||||
|
||||
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
||||
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
||||
|
||||
local overflowHeals = self.overflowHeals or false
|
||||
local overflowAbsorbs = self.overflowAbsorbs or false
|
||||
|
||||
AnchorPredictionBar(self.myBar, health, orientation, healthTexture, missingHealth >= myIncomingHeal, overflowHeals, p1, p2)
|
||||
AnchorPredictionBar(self.otherBar, health, orientation, self.myBarTexture, missingHealth >= totalIncomingHeal, overflowHeals, p1, p2)
|
||||
AnchorPredictionBar(self.absorbBar, health, orientation, healthTexture, missingHealth >= totalAbsorb, overflowAbsorbs, p1, p2)
|
||||
AnchorPredictionBar(self.healAbsorbBar, health, orientation, healthTexture, false, false, p1, p2, healthTexture)
|
||||
previousTexture = UpdateFillBar(health, previousTexture, self.myBar, myIncomingHeal)
|
||||
UpdateFillBar(health, previousTexture, self.otherBar, allIncomingHeal)
|
||||
end
|
||||
Reference in New Issue
Block a user