HealComm: Add toggle for Absorbs and reduce redundant updates (#94)
* HealComm: Add toggle for Absorbs and reduce redundant updates * HealComm: Throttle updates, cache anchors
This commit is contained in:
@@ -100,6 +100,8 @@ local reversibleBar = setmetatable({
|
|||||||
"Usage: StatusBar:SetMinMaxValues(number, number)"
|
"Usage: StatusBar:SetMinMaxValues(number, number)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if self.MINVALUE == minValue and self.MAXVALUE == maxValue then return end
|
||||||
|
|
||||||
if maxValue > minValue then
|
if maxValue > minValue then
|
||||||
self.MINVALUE = minValue
|
self.MINVALUE = minValue
|
||||||
self.MAXVALUE = maxValue
|
self.MAXVALUE = maxValue
|
||||||
@@ -122,6 +124,7 @@ local reversibleBar = setmetatable({
|
|||||||
SetValue = function(self, value)
|
SetValue = function(self, value)
|
||||||
assert(type(value) == "number", "Usage: StatusBar:SetValue(number)")
|
assert(type(value) == "number", "Usage: StatusBar:SetValue(number)")
|
||||||
if WithinRange(value, self.MINVALUE, self.MAXVALUE) then
|
if WithinRange(value, self.MINVALUE, self.MAXVALUE) then
|
||||||
|
if self.VALUE == value then return end
|
||||||
self.VALUE = value
|
self.VALUE = value
|
||||||
reversibleBar_Update(self)
|
reversibleBar_Update(self)
|
||||||
end
|
end
|
||||||
@@ -131,6 +134,7 @@ local reversibleBar = setmetatable({
|
|||||||
end,
|
end,
|
||||||
SetOrientation = function(self, orientation)
|
SetOrientation = function(self, orientation)
|
||||||
if orientation == "HORIZONTAL" or orientation == "VERTICAL" then
|
if orientation == "HORIZONTAL" or orientation == "VERTICAL" then
|
||||||
|
if self.ORIENTATION == orientation then return end
|
||||||
self.ORIENTATION = orientation
|
self.ORIENTATION = orientation
|
||||||
reversibleBar_Update(self)
|
reversibleBar_Update(self)
|
||||||
end
|
end
|
||||||
@@ -139,14 +143,18 @@ local reversibleBar = setmetatable({
|
|||||||
return self.ORIENTATION
|
return self.ORIENTATION
|
||||||
end,
|
end,
|
||||||
SetRotatesTexture = function(self, rotate)
|
SetRotatesTexture = function(self, rotate)
|
||||||
self.ROTATE = (rotate ~= nil and rotate ~= false)
|
local newRotate = (rotate ~= nil and rotate ~= false)
|
||||||
|
if self.ROTATE == newRotate then return end
|
||||||
|
self.ROTATE = newRotate
|
||||||
reversibleBar_Update(self)
|
reversibleBar_Update(self)
|
||||||
end,
|
end,
|
||||||
GetRotatesTexture = function(self)
|
GetRotatesTexture = function(self)
|
||||||
return self.ROTATE
|
return self.ROTATE
|
||||||
end,
|
end,
|
||||||
SetReverseFill = function(self, reverse)
|
SetReverseFill = function(self, reverse)
|
||||||
self.REVERSE = (reverse == true)
|
local newReverse = (reverse == true)
|
||||||
|
if self.REVERSE == newReverse then return end
|
||||||
|
self.REVERSE = newReverse
|
||||||
reversibleBar_Update(self)
|
reversibleBar_Update(self)
|
||||||
end,
|
end,
|
||||||
GetReverseFill = function(self)
|
GetReverseFill = function(self)
|
||||||
@@ -154,16 +162,16 @@ local reversibleBar = setmetatable({
|
|||||||
end,
|
end,
|
||||||
SetFillStyle = function(self, style)
|
SetFillStyle = function(self, style)
|
||||||
assert(type(style) == "string" or style == nil, "Usage: StatusBar:SetFillStyle(string)")
|
assert(type(style) == "string" or style == nil, "Usage: StatusBar:SetFillStyle(string)")
|
||||||
|
local newStyle = "STANDARD"
|
||||||
if style and style:lower() == "center" then
|
if style and style:lower() == "center" then
|
||||||
self.FILLSTYLE = "CENTER"
|
newStyle = "CENTER"
|
||||||
reversibleBar_Update(self)
|
|
||||||
elseif style and style:lower() == "reverse" then
|
elseif style and style:lower() == "reverse" then
|
||||||
self.FILLSTYLE = "REVERSE"
|
newStyle = "REVERSE"
|
||||||
reversibleBar_Update(self)
|
|
||||||
else
|
|
||||||
self.FILLSTYLE = "STANDARD"
|
|
||||||
reversibleBar_Update(self)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if self.FILLSTYLE == newStyle then return end
|
||||||
|
self.FILLSTYLE = newStyle
|
||||||
|
reversibleBar_Update(self)
|
||||||
end,
|
end,
|
||||||
GetFillStyle = function(self)
|
GetFillStyle = function(self)
|
||||||
return self.FILLSTYLE
|
return self.FILLSTYLE
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ local UnitName = UnitName
|
|||||||
local UnitGetIncomingHeals = UnitGetIncomingHeals
|
local UnitGetIncomingHeals = UnitGetIncomingHeals
|
||||||
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||||
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
||||||
|
local GetTime = GetTime
|
||||||
|
|
||||||
local enabledUF, enabled = {}, nil
|
local enabledUF, enabled = {}, nil
|
||||||
|
|
||||||
@@ -62,6 +63,13 @@ local function Update(self)
|
|||||||
local unit = self.unit
|
local unit = self.unit
|
||||||
local element = self.HealCommBar
|
local element = self.HealCommBar
|
||||||
|
|
||||||
|
local now = GetTime()
|
||||||
|
local lastUpdate = element.lastUpdate or 0
|
||||||
|
if now - lastUpdate < 0.05 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
element.lastUpdate = now
|
||||||
|
|
||||||
--[[ Callback: HealthPrediction:PreUpdate(unit)
|
--[[ Callback: HealthPrediction:PreUpdate(unit)
|
||||||
Called before the element has been updated.
|
Called before the element has been updated.
|
||||||
|
|
||||||
@@ -74,8 +82,8 @@ local function Update(self)
|
|||||||
|
|
||||||
local myIncomingHeal = UnitGetIncomingHeals(unit, UnitName("player")) or 0
|
local myIncomingHeal = UnitGetIncomingHeals(unit, UnitName("player")) or 0
|
||||||
local allIncomingHeal = UnitGetIncomingHeals(unit) or 0
|
local allIncomingHeal = UnitGetIncomingHeals(unit) or 0
|
||||||
local absorb = UnitGetTotalAbsorbs and UnitGetTotalAbsorbs(unit) or 0
|
local absorb = (element.absorbs and UnitGetTotalAbsorbs and UnitGetTotalAbsorbs(unit)) or 0
|
||||||
local healAbsorb = UnitGetTotalHealAbsorbs and UnitGetTotalHealAbsorbs(unit) or 0
|
local healAbsorb = (element.absorbs and UnitGetTotalHealAbsorbs and UnitGetTotalHealAbsorbs(unit)) or 0
|
||||||
local health = UnitHealth(unit)
|
local health = UnitHealth(unit)
|
||||||
local maxHealth = UnitHealthMax(unit)
|
local maxHealth = UnitHealthMax(unit)
|
||||||
local maxOverflowHP = maxHealth * element.maxOverflow
|
local maxOverflowHP = maxHealth * element.maxOverflow
|
||||||
@@ -110,32 +118,48 @@ local function Update(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if element.myBar then
|
if element.myBar then
|
||||||
element.myBar:SetMinMaxValues(0, maxHealth)
|
if element.maxHealth ~= maxHealth then
|
||||||
|
element.myBar:SetMinMaxValues(0, maxHealth)
|
||||||
|
end
|
||||||
element.myBar:SetValue(myIncomingHeal)
|
element.myBar:SetValue(myIncomingHeal)
|
||||||
element.myBar:Show()
|
element.myBar:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.otherBar then
|
if element.otherBar then
|
||||||
element.otherBar:SetMinMaxValues(0, maxHealth)
|
if element.maxHealth ~= maxHealth then
|
||||||
|
element.otherBar:SetMinMaxValues(0, maxHealth)
|
||||||
|
end
|
||||||
element.otherBar:SetValue(otherIncomingHeal)
|
element.otherBar:SetValue(otherIncomingHeal)
|
||||||
element.otherBar:Show()
|
element.otherBar:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.absorbBar then
|
if element.absorbBar then
|
||||||
element.absorbBar:SetMinMaxValues(0, maxHealth)
|
if element.absorbs then
|
||||||
element.absorbBar:SetValue(absorb)
|
if element.maxHealth ~= maxHealth then
|
||||||
if absorb > 0 then
|
element.absorbBar:SetMinMaxValues(0, maxHealth)
|
||||||
element.absorbBar:Show()
|
end
|
||||||
|
element.absorbBar:SetValue(absorb)
|
||||||
|
if absorb > 0 then
|
||||||
|
element.absorbBar:Show()
|
||||||
|
else
|
||||||
|
element.absorbBar:Hide()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
element.absorbBar:Hide()
|
element.absorbBar:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.healAbsorbBar then
|
if element.healAbsorbBar then
|
||||||
element.healAbsorbBar:SetMinMaxValues(0, maxHealth)
|
if element.absorbs then
|
||||||
element.healAbsorbBar:SetValue(healAbsorb)
|
if element.maxHealth ~= maxHealth then
|
||||||
if healAbsorb > 0 then
|
element.healAbsorbBar:SetMinMaxValues(0, maxHealth)
|
||||||
element.healAbsorbBar:Show()
|
end
|
||||||
|
element.healAbsorbBar:SetValue(healAbsorb)
|
||||||
|
if healAbsorb > 0 then
|
||||||
|
element.healAbsorbBar:Show()
|
||||||
|
else
|
||||||
|
element.healAbsorbBar:Hide()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
element.healAbsorbBar:Hide()
|
element.healAbsorbBar:Hide()
|
||||||
end
|
end
|
||||||
@@ -154,6 +178,8 @@ local function Update(self)
|
|||||||
if element.PostUpdate then
|
if element.PostUpdate then
|
||||||
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb)
|
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
element.maxHealth = maxHealth
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Path(self, ...)
|
local function Path(self, ...)
|
||||||
@@ -205,6 +231,14 @@ local function Enable(self)
|
|||||||
element.maxOverflow = 1.05
|
element.maxOverflow = 1.05
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if element.myBar and element.myBar:IsObjectType("StatusBar") and not element.myBar:GetStatusBarTexture() then
|
||||||
|
element.myBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
|
end
|
||||||
|
|
||||||
|
if element.otherBar and element.otherBar:IsObjectType("StatusBar") and not element.otherBar:GetStatusBarTexture() then
|
||||||
|
element.otherBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
|
end
|
||||||
|
|
||||||
if element.absorbBar and element.absorbBar:IsObjectType("StatusBar") and not element.absorbBar:GetStatusBarTexture() then
|
if element.absorbBar and element.absorbBar:IsObjectType("StatusBar") and not element.absorbBar:GetStatusBarTexture() then
|
||||||
element.absorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
element.absorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ end
|
|||||||
function NP:Update_HealComm(nameplate)
|
function NP:Update_HealComm(nameplate)
|
||||||
local db = NP:PlateDB(nameplate)
|
local db = NP:PlateDB(nameplate)
|
||||||
|
|
||||||
if db.health.enable and db.health.healPrediction then
|
if db.health.enable and db.health.healPrediction and db.health.healPrediction.enable then
|
||||||
if not nameplate:IsElementEnabled('HealCommBar') then
|
if not nameplate:IsElementEnabled('HealCommBar') then
|
||||||
nameplate:EnableElement('HealCommBar')
|
nameplate:EnableElement('HealCommBar')
|
||||||
end
|
end
|
||||||
@@ -232,6 +232,15 @@ function NP:Construct_HealComm(frame)
|
|||||||
absorbBar:SetStatusBarTexture(texture)
|
absorbBar:SetStatusBarTexture(texture)
|
||||||
healAbsorbBar:SetStatusBarTexture(texture)
|
healAbsorbBar:SetStatusBarTexture(texture)
|
||||||
|
|
||||||
|
myBar:SetMinMaxValues(0, 1)
|
||||||
|
myBar:SetValue(0)
|
||||||
|
otherBar:SetMinMaxValues(0, 1)
|
||||||
|
otherBar:SetValue(0)
|
||||||
|
absorbBar:SetMinMaxValues(0, 1)
|
||||||
|
absorbBar:SetValue(0)
|
||||||
|
healAbsorbBar:SetMinMaxValues(0, 1)
|
||||||
|
healAbsorbBar:SetValue(0)
|
||||||
|
|
||||||
local healPrediction = {
|
local healPrediction = {
|
||||||
myBar = myBar,
|
myBar = myBar,
|
||||||
otherBar = otherBar,
|
otherBar = otherBar,
|
||||||
@@ -267,6 +276,7 @@ function NP:Configure_HealComm(frame)
|
|||||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||||
healPrediction.overflowHeals = c.overflowHeals
|
healPrediction.overflowHeals = c.overflowHeals
|
||||||
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||||
|
healPrediction.absorbs = frame.db.healPrediction.absorbs
|
||||||
|
|
||||||
if healPrediction.allowClippingUpdate then
|
if healPrediction.allowClippingUpdate then
|
||||||
NP:SetVisibility_HealComm(healPrediction)
|
NP:SetVisibility_HealComm(healPrediction)
|
||||||
@@ -289,6 +299,13 @@ function NP:Configure_HealComm(frame)
|
|||||||
absorbBar:SetOrientation(orientation)
|
absorbBar:SetOrientation(orientation)
|
||||||
healAbsorbBar:SetOrientation(orientation)
|
healAbsorbBar:SetOrientation(orientation)
|
||||||
|
|
||||||
|
healPrediction.cachedOrientation = orientation
|
||||||
|
|
||||||
|
myBar._anchorState = nil
|
||||||
|
otherBar._anchorState = nil
|
||||||
|
absorbBar._anchorState = nil
|
||||||
|
healAbsorbBar._anchorState = nil
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
local p1 = "LEFT"
|
local p1 = "LEFT"
|
||||||
local p2 = "RIGHT"
|
local p2 = "RIGHT"
|
||||||
@@ -364,12 +381,26 @@ function NP:Configure_HealComm(frame)
|
|||||||
frame.HealCommBar.otherBar:SetStatusBarColor(hpc.others.r, hpc.others.g, hpc.others.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.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.healAbsorbBar:SetStatusBarColor(hpc.healAbsorbs.r, hpc.healAbsorbs.g, hpc.healAbsorbs.b, hpc.healAbsorbs.a)
|
||||||
|
|
||||||
|
if not healPrediction.absorbs then
|
||||||
|
absorbBar:Hide()
|
||||||
|
healAbsorbBar:Hide()
|
||||||
|
end
|
||||||
elseif frame:IsElementEnabled('HealComm4') then
|
elseif frame:IsElementEnabled('HealComm4') then
|
||||||
frame:DisableElement('HealComm4')
|
frame:DisableElement('HealComm4')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||||
|
local needsReverse = not overflowMode and not hasEnoughSpace
|
||||||
|
local anchorKey = orientation .. (overflowMode and "O" or (hasEnoughSpace and "E" or "R"))
|
||||||
|
if bar._anchorState == anchorKey and bar._reverseFill == needsReverse then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
bar._anchorState = anchorKey
|
||||||
|
bar._reverseFill = needsReverse
|
||||||
|
|
||||||
bar:ClearAllPoints()
|
bar:ClearAllPoints()
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
@@ -397,8 +428,11 @@ function NP:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, m
|
|||||||
if not self.frame or not self.health then return end
|
if not self.frame or not self.health then return end
|
||||||
|
|
||||||
local health = self.health
|
local health = self.health
|
||||||
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
local healthTexture = self.healthBarTexture
|
||||||
local orientation = health:GetOrientation()
|
if not healthTexture then
|
||||||
|
healthTexture = health:GetStatusBarTexture()
|
||||||
|
self.healthBarTexture = healthTexture
|
||||||
|
end
|
||||||
|
|
||||||
local currentHealth = UnitHealth(unit) or 0
|
local currentHealth = UnitHealth(unit) or 0
|
||||||
local maxHealth = UnitHealthMax(unit) or 1
|
local maxHealth = UnitHealthMax(unit) or 1
|
||||||
@@ -406,6 +440,7 @@ function NP:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, m
|
|||||||
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||||
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
||||||
|
|
||||||
|
local orientation = self.cachedOrientation or health:GetOrientation()
|
||||||
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
||||||
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,15 @@ function UF:Construct_HealComm(frame)
|
|||||||
absorbBar:SetStatusBarTexture(texture)
|
absorbBar:SetStatusBarTexture(texture)
|
||||||
healAbsorbBar:SetStatusBarTexture(texture)
|
healAbsorbBar:SetStatusBarTexture(texture)
|
||||||
|
|
||||||
|
myBar:SetMinMaxValues(0, 1)
|
||||||
|
myBar:SetValue(0)
|
||||||
|
otherBar:SetMinMaxValues(0, 1)
|
||||||
|
otherBar:SetValue(0)
|
||||||
|
absorbBar:SetMinMaxValues(0, 1)
|
||||||
|
absorbBar:SetValue(0)
|
||||||
|
healAbsorbBar:SetMinMaxValues(0, 1)
|
||||||
|
healAbsorbBar:SetValue(0)
|
||||||
|
|
||||||
local healPrediction = {
|
local healPrediction = {
|
||||||
myBar = myBar,
|
myBar = myBar,
|
||||||
otherBar = otherBar,
|
otherBar = otherBar,
|
||||||
@@ -90,6 +99,7 @@ function UF:Configure_HealComm(frame)
|
|||||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||||
healPrediction.overflowHeals = c.overflowHeals
|
healPrediction.overflowHeals = c.overflowHeals
|
||||||
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||||
|
healPrediction.absorbs = frame.db.healPrediction.absorbs
|
||||||
|
|
||||||
if healPrediction.allowClippingUpdate then
|
if healPrediction.allowClippingUpdate then
|
||||||
UF:SetVisibility_HealComm(healPrediction)
|
UF:SetVisibility_HealComm(healPrediction)
|
||||||
@@ -117,6 +127,13 @@ function UF:Configure_HealComm(frame)
|
|||||||
absorbBar:SetOrientation(orientation)
|
absorbBar:SetOrientation(orientation)
|
||||||
healAbsorbBar:SetOrientation(orientation)
|
healAbsorbBar:SetOrientation(orientation)
|
||||||
|
|
||||||
|
healPrediction.cachedOrientation = orientation
|
||||||
|
|
||||||
|
myBar._anchorState = nil
|
||||||
|
otherBar._anchorState = nil
|
||||||
|
absorbBar._anchorState = nil
|
||||||
|
healAbsorbBar._anchorState = nil
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
local p1 = "LEFT"
|
local p1 = "LEFT"
|
||||||
local p2 = "RIGHT"
|
local p2 = "RIGHT"
|
||||||
@@ -192,12 +209,26 @@ function UF:Configure_HealComm(frame)
|
|||||||
otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.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)
|
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)
|
healAbsorbBar:SetStatusBarColor(c.healAbsorbs.r, c.healAbsorbs.g, c.healAbsorbs.b, c.healAbsorbs.a)
|
||||||
|
|
||||||
|
if not healPrediction.absorbs then
|
||||||
|
absorbBar:Hide()
|
||||||
|
healAbsorbBar:Hide()
|
||||||
|
end
|
||||||
elseif frame:IsElementEnabled("HealComm4") then
|
elseif frame:IsElementEnabled("HealComm4") then
|
||||||
frame:DisableElement("HealComm4")
|
frame:DisableElement("HealComm4")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||||
|
local needsReverse = not overflowMode and not hasEnoughSpace
|
||||||
|
local anchorKey = orientation .. (overflowMode and "O" or (hasEnoughSpace and "E" or "R"))
|
||||||
|
if bar._anchorState == anchorKey and bar._reverseFill == needsReverse then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
bar._anchorState = anchorKey
|
||||||
|
bar._reverseFill = needsReverse
|
||||||
|
|
||||||
bar:ClearAllPoints()
|
bar:ClearAllPoints()
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
@@ -225,8 +256,11 @@ function UF:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, m
|
|||||||
if not self.frame or not self.health then return end
|
if not self.frame or not self.health then return end
|
||||||
|
|
||||||
local health = self.health
|
local health = self.health
|
||||||
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
local healthTexture = self.healthBarTexture
|
||||||
local orientation = health:GetOrientation()
|
if not healthTexture then
|
||||||
|
healthTexture = health:GetStatusBarTexture()
|
||||||
|
self.healthBarTexture = healthTexture
|
||||||
|
end
|
||||||
|
|
||||||
local currentHealth = UnitHealth(unit) or 0
|
local currentHealth = UnitHealth(unit) or 0
|
||||||
local maxHealth = UnitHealthMax(unit) or 1
|
local maxHealth = UnitHealthMax(unit) or 1
|
||||||
@@ -234,6 +268,7 @@ function UF:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, m
|
|||||||
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
local otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||||
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
local totalIncomingHeal = myIncomingHeal + otherIncomingHeal
|
||||||
|
|
||||||
|
local orientation = self.cachedOrientation or health:GetOrientation()
|
||||||
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
local p1 = self.anchor1 or (orientation == "HORIZONTAL" and "LEFT" or "BOTTOM")
|
||||||
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
local p2 = self.anchor2 or (orientation == "HORIZONTAL" and "RIGHT" or "TOP")
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,10 @@ local NP_Auras = {
|
|||||||
|
|
||||||
local NP_Health = {
|
local NP_Health = {
|
||||||
enable = true,
|
enable = true,
|
||||||
healPrediction = true,
|
healPrediction = {
|
||||||
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
|
},
|
||||||
height = 10,
|
height = 10,
|
||||||
useClassColor = true,
|
useClassColor = true,
|
||||||
text = {
|
text = {
|
||||||
@@ -1166,7 +1169,8 @@ P.unitframe = {
|
|||||||
height = 54,
|
height = 54,
|
||||||
lowmana = 30,
|
lowmana = 30,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = true,
|
||||||
},
|
},
|
||||||
threatStyle = "GLOW",
|
threatStyle = "GLOW",
|
||||||
smartAuraPosition = "DISABLED",
|
smartAuraPosition = "DISABLED",
|
||||||
@@ -1449,7 +1453,8 @@ P.unitframe = {
|
|||||||
smartAuraPosition = "DISABLED",
|
smartAuraPosition = "DISABLED",
|
||||||
colorOverride = "USE_DEFAULT",
|
colorOverride = "USE_DEFAULT",
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
middleClickFocus = true,
|
middleClickFocus = true,
|
||||||
disableMouseoverGlow = false,
|
disableMouseoverGlow = false,
|
||||||
@@ -1908,7 +1913,8 @@ P.unitframe = {
|
|||||||
width = 190,
|
width = 190,
|
||||||
height = 36,
|
height = 36,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
disableMouseoverGlow = false,
|
disableMouseoverGlow = false,
|
||||||
disableTargetGlow = false,
|
disableTargetGlow = false,
|
||||||
@@ -2208,7 +2214,8 @@ P.unitframe = {
|
|||||||
width = 130,
|
width = 130,
|
||||||
height = 36,
|
height = 36,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
disableMouseoverGlow = false,
|
disableMouseoverGlow = false,
|
||||||
disableTargetGlow = true,
|
disableTargetGlow = true,
|
||||||
@@ -2643,7 +2650,8 @@ P.unitframe = {
|
|||||||
width = 246,
|
width = 246,
|
||||||
height = 47,
|
height = 47,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
colorOverride = "USE_DEFAULT",
|
colorOverride = "USE_DEFAULT",
|
||||||
disableMouseoverGlow = false,
|
disableMouseoverGlow = false,
|
||||||
@@ -2805,7 +2813,8 @@ P.unitframe = {
|
|||||||
startFromCenter = false,
|
startFromCenter = false,
|
||||||
showPlayer = true,
|
showPlayer = true,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
colorOverride = "USE_DEFAULT",
|
colorOverride = "USE_DEFAULT",
|
||||||
width = 184,
|
width = 184,
|
||||||
@@ -3074,7 +3083,8 @@ P.unitframe = {
|
|||||||
sortDir = "ASC",
|
sortDir = "ASC",
|
||||||
showPlayer = true,
|
showPlayer = true,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
colorOverride = "USE_DEFAULT",
|
colorOverride = "USE_DEFAULT",
|
||||||
width = 80,
|
width = 80,
|
||||||
@@ -3271,7 +3281,8 @@ P.unitframe = {
|
|||||||
sortDir = "ASC",
|
sortDir = "ASC",
|
||||||
showPlayer = true,
|
showPlayer = true,
|
||||||
healPrediction = {
|
healPrediction = {
|
||||||
enable = true
|
enable = true,
|
||||||
|
absorbs = false,
|
||||||
},
|
},
|
||||||
colorOverride = "USE_DEFAULT",
|
colorOverride = "USE_DEFAULT",
|
||||||
width = 80,
|
width = 80,
|
||||||
|
|||||||
@@ -76,7 +76,11 @@ local function GetUnitSettings(unit, name)
|
|||||||
group.args.healthGroup.args.enable = ACH:Toggle(L["Enable"], nil, 1, nil, nil, nil, nil, nil, nil, function() return unit == 'PLAYER' end)
|
group.args.healthGroup.args.enable = ACH:Toggle(L["Enable"], nil, 1, nil, nil, nil, nil, nil, nil, function() return unit == 'PLAYER' end)
|
||||||
group.args.healthGroup.args.height = ACH:Range(L["Height"], nil, 3, { min = minHeight, max = MaxHeight(unit), step = 1 })
|
group.args.healthGroup.args.height = ACH:Range(L["Height"], nil, 3, { min = minHeight, max = MaxHeight(unit), step = 1 })
|
||||||
group.args.healthGroup.args.width = ACH:Execute(L["Width"], nil, 4, function() ACD:SelectGroup('ElvUI', 'nameplates', 'generalGroup', 'clickableRange') end)
|
group.args.healthGroup.args.width = ACH:Execute(L["Width"], nil, 4, function() ACD:SelectGroup('ElvUI', 'nameplates', 'generalGroup', 'clickableRange') end)
|
||||||
group.args.healthGroup.args.healPrediction = ACH:Toggle(L["Heal Prediction"], nil, 5)
|
|
||||||
|
group.args.healthGroup.args.healPredictionGroup = ACH:Group(L["Heal Prediction"], nil, 5, nil, function(info) return E.db.nameplates.units[unit].health.healPrediction[info[#info]] end, function(info, value) E.db.nameplates.units[unit].health.healPrediction[info[#info]] = value NP:ConfigureAll() end)
|
||||||
|
group.args.healthGroup.args.healPredictionGroup.inline = true
|
||||||
|
group.args.healthGroup.args.healPredictionGroup.args.enable = ACH:Toggle(L["Enable"], nil, 1)
|
||||||
|
group.args.healthGroup.args.healPredictionGroup.args.absorbs = ACH:Toggle(L["Enable Absorbs"], nil, 2)
|
||||||
|
|
||||||
group.args.healthGroup.args.textGroup = ACH:Group(L["Text"], nil, 200, nil, function(info) return E.db.nameplates.units[unit].health.text[info[#info]] end, function(info, value) E.db.nameplates.units[unit].health.text[info[#info]] = value NP:ConfigureAll() end)
|
group.args.healthGroup.args.textGroup = ACH:Group(L["Text"], nil, 200, nil, function(info) return E.db.nameplates.units[unit].health.text[info[#info]] end, function(info, value) E.db.nameplates.units[unit].health.text[info[#info]] = value NP:ConfigureAll() end)
|
||||||
group.args.healthGroup.args.textGroup.inline = true
|
group.args.healthGroup.args.textGroup.inline = true
|
||||||
|
|||||||
@@ -2349,8 +2349,13 @@ local function GetOptionsTable_HealPrediction(updateFunc, groupName, numGroup)
|
|||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Enable"]
|
name = L["Enable"]
|
||||||
},
|
},
|
||||||
colors = {
|
absorbs = {
|
||||||
order = 3,
|
order = 3,
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Enable Absorbs"]
|
||||||
|
},
|
||||||
|
colors = {
|
||||||
|
order = 4,
|
||||||
type = "execute",
|
type = "execute",
|
||||||
name = L["COLORS"],
|
name = L["COLORS"],
|
||||||
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "healPrediction") end,
|
func = function() ACD:SelectGroup("ElvUI", "unitframe", "generalOptionsGroup", "allColorsGroup", "healPrediction") end,
|
||||||
|
|||||||
Reference in New Issue
Block a user