Revert "Add absorbs, heal absorbs (#90)"
This reverts commit 3d7b873aa9.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
<Script file="Core.lua"/>
|
||||
<Script file="Math.lua"/>
|
||||
<Script file="API.lua"/>
|
||||
<Script file="ReversibleStatusBar.lua"/>
|
||||
<Script file="AprilFools.lua"/>
|
||||
<Script file="Fonts.lua"/>
|
||||
<Script file="Install.lua"/>
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
local E = unpack(select(2, ...))
|
||||
|
||||
local type = type
|
||||
local assert = assert
|
||||
local setmetatable = setmetatable
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local barFrame = CreateFrame("Frame")
|
||||
local reversibleBar_SetScript = barFrame.SetScript
|
||||
|
||||
local function reversibleBar_Update(self, sizeChanged, width, height)
|
||||
local progress = (self.VALUE - self.MINVALUE) / (self.MAXVALUE - self.MINVALUE)
|
||||
|
||||
local align1, align2
|
||||
local TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy
|
||||
local TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_
|
||||
local xprogress, yprogress
|
||||
|
||||
width = width or self:GetWidth()
|
||||
height = height or self:GetHeight()
|
||||
|
||||
if self.ORIENTATION == "HORIZONTAL" then
|
||||
xprogress = width * progress
|
||||
if self.FILLSTYLE == "CENTER" then
|
||||
align1, align2 = "TOP", "BOTTOM"
|
||||
elseif self.REVERSE or self.FILLSTYLE == "REVERSE" then
|
||||
align1, align2 = "TOPRIGHT", "BOTTOMRIGHT"
|
||||
else
|
||||
align1, align2 = "TOPLEFT", "BOTTOMLEFT"
|
||||
end
|
||||
elseif self.ORIENTATION == "VERTICAL" then
|
||||
yprogress = height * progress
|
||||
if self.FILLSTYLE == "CENTER" then
|
||||
align1, align2 = "LEFT", "RIGHT"
|
||||
elseif self.REVERSE or self.FILLSTYLE == "REVERSE" then
|
||||
align1, align2 = "TOPLEFT", "TOPRIGHT"
|
||||
else
|
||||
align1, align2 = "BOTTOMLEFT", "BOTTOMRIGHT"
|
||||
end
|
||||
end
|
||||
|
||||
if self.ROTATE then
|
||||
TLx, TLy = 0.0, 1.0
|
||||
TRx, TRy = 0.0, 0.0
|
||||
BLx, BLy = 1.0, 1.0
|
||||
BRx, BRy = 1.0, 0.0
|
||||
TLx_, TLy_ = TLx, TLy
|
||||
TRx_, TRy_ = TRx, TRy
|
||||
BLx_, BLy_ = BLx * progress, BLy
|
||||
BRx_, BRy_ = BRx * progress, BRy
|
||||
else
|
||||
TLx, TLy = 0.0, 0.0
|
||||
TRx, TRy = 1.0, 0.0
|
||||
BLx, BLy = 0.0, 1.0
|
||||
BRx, BRy = 1.0, 1.0
|
||||
TLx_, TLy_ = TLx, TLy
|
||||
TRx_, TRy_ = TRx * progress, TRy
|
||||
BLx_, BLy_ = BLx, BLy
|
||||
BRx_, BRy_ = BRx * progress, BRy
|
||||
end
|
||||
|
||||
if not sizeChanged then
|
||||
self.bg:ClearAllPoints()
|
||||
self.bg:SetAllPoints()
|
||||
self.bg:SetTexCoord(TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy)
|
||||
|
||||
self.fg:ClearAllPoints()
|
||||
self.fg:SetPoint(align1)
|
||||
self.fg:SetPoint(align2)
|
||||
self.fg:SetTexCoord(TLx_, TLy_, BLx_, BLy_, TRx_, TRy_, BRx_, BRy_)
|
||||
end
|
||||
|
||||
if xprogress then
|
||||
self.fg:SetWidth(xprogress > 0 and xprogress or 0.1)
|
||||
end
|
||||
if yprogress then
|
||||
self.fg:SetHeight(yprogress > 0 and yprogress or 0.1)
|
||||
end
|
||||
end
|
||||
|
||||
local function reversibleBar_OnSizeChanged(self, width, height)
|
||||
reversibleBar_Update(self, true, width, height)
|
||||
end
|
||||
|
||||
local function WithinRange(value, minValue, maxValue)
|
||||
return value >= minValue and value <= maxValue
|
||||
end
|
||||
|
||||
local reversibleBar = setmetatable({
|
||||
MINVALUE = 0.0,
|
||||
MAXVALUE = 1.0,
|
||||
VALUE = 1.0,
|
||||
ROTATE = true,
|
||||
REVERSE = false,
|
||||
ORIENTATION = "HORIZONTAL",
|
||||
FILLSTYLE = "STANDARD",
|
||||
SetMinMaxValues = function(self, minValue, maxValue)
|
||||
assert(
|
||||
(type(minValue) == "number" and type(maxValue) == "number"),
|
||||
"Usage: StatusBar:SetMinMaxValues(number, number)"
|
||||
)
|
||||
|
||||
if maxValue > minValue then
|
||||
self.MINVALUE = minValue
|
||||
self.MAXVALUE = maxValue
|
||||
else
|
||||
self.MINVALUE = 0
|
||||
self.MAXVALUE = 1
|
||||
end
|
||||
|
||||
if not self.VALUE or self.VALUE > self.MAXVALUE then
|
||||
self.VALUE = self.MAXVALUE
|
||||
elseif not self.VALUE or self.VALUE < self.MINVALUE then
|
||||
self.VALUE = self.MINVALUE
|
||||
end
|
||||
|
||||
reversibleBar_Update(self)
|
||||
end,
|
||||
GetMinMaxValues = function(self)
|
||||
return self.MINVALUE, self.MAXVALUE
|
||||
end,
|
||||
SetValue = function(self, value)
|
||||
assert(type(value) == "number", "Usage: StatusBar:SetValue(number)")
|
||||
if WithinRange(value, self.MINVALUE, self.MAXVALUE) then
|
||||
self.VALUE = value
|
||||
reversibleBar_Update(self)
|
||||
end
|
||||
end,
|
||||
GetValue = function(self)
|
||||
return self.VALUE
|
||||
end,
|
||||
SetOrientation = function(self, orientation)
|
||||
if orientation == "HORIZONTAL" or orientation == "VERTICAL" then
|
||||
self.ORIENTATION = orientation
|
||||
reversibleBar_Update(self)
|
||||
end
|
||||
end,
|
||||
GetOrientation = function(self)
|
||||
return self.ORIENTATION
|
||||
end,
|
||||
SetRotatesTexture = function(self, rotate)
|
||||
self.ROTATE = (rotate ~= nil and rotate ~= false)
|
||||
reversibleBar_Update(self)
|
||||
end,
|
||||
GetRotatesTexture = function(self)
|
||||
return self.ROTATE
|
||||
end,
|
||||
SetReverseFill = function(self, reverse)
|
||||
self.REVERSE = (reverse == true)
|
||||
reversibleBar_Update(self)
|
||||
end,
|
||||
GetReverseFill = function(self)
|
||||
return self.REVERSE
|
||||
end,
|
||||
SetFillStyle = function(self, style)
|
||||
assert(type(style) == "string" or style == nil, "Usage: StatusBar:SetFillStyle(string)")
|
||||
if style and style:lower() == "center" then
|
||||
self.FILLSTYLE = "CENTER"
|
||||
reversibleBar_Update(self)
|
||||
elseif style and style:lower() == "reverse" then
|
||||
self.FILLSTYLE = "REVERSE"
|
||||
reversibleBar_Update(self)
|
||||
else
|
||||
self.FILLSTYLE = "STANDARD"
|
||||
reversibleBar_Update(self)
|
||||
end
|
||||
end,
|
||||
GetFillStyle = function(self)
|
||||
return self.FILLSTYLE
|
||||
end,
|
||||
SetStatusBarTexture = function(self, texture)
|
||||
self.fg:SetTexture(texture)
|
||||
self.bg:SetTexture(texture)
|
||||
end,
|
||||
GetStatusBarTexture = function(self)
|
||||
return self.fg
|
||||
end,
|
||||
SetStatusBarColor = function(self, r, g, b, a)
|
||||
self.fg:SetVertexColor(r, g, b, a)
|
||||
end,
|
||||
GetStatusBarColor = function(self)
|
||||
return self.fg:GetVertexColor()
|
||||
end,
|
||||
SetVertexColor = function(self, r, g, b, a)
|
||||
self.fg:SetVertexColor(r, g, b, a)
|
||||
end,
|
||||
GetVertexColor = function(self)
|
||||
return self.fg:GetVertexColor()
|
||||
end,
|
||||
GetObjectType = function(self)
|
||||
return "StatusBar"
|
||||
end,
|
||||
IsObjectType = function(self, otype)
|
||||
return (otype == "StatusBar") and 1 or nil
|
||||
end,
|
||||
SetScript = function(self, event, callback)
|
||||
reversibleBar_SetScript(self, event, callback)
|
||||
end,
|
||||
Show = function(self)
|
||||
self:SetAlpha(1)
|
||||
end,
|
||||
Hide = function(self)
|
||||
self:SetAlpha(0)
|
||||
end,
|
||||
SetAlpha = function(self, alpha)
|
||||
self:GetParent().SetAlpha(self, alpha)
|
||||
end
|
||||
}, {__index = barFrame})
|
||||
|
||||
local reversibleBar_mt = {__index = reversibleBar}
|
||||
|
||||
function E:CreateReversibleStatusBar(name, parent)
|
||||
local bar = setmetatable(CreateFrame("Frame", name, parent), reversibleBar_mt)
|
||||
bar.fg = bar.fg or bar:CreateTexture(name and "$parent.Texture", "ARTWORK")
|
||||
bar.bg = bar.bg or bar:CreateTexture(name and "$parent.Background", "BACKGROUND")
|
||||
bar.bg:Hide()
|
||||
|
||||
bar:HookScript("OnSizeChanged", reversibleBar_OnSizeChanged)
|
||||
bar:SetRotatesTexture(false)
|
||||
return bar
|
||||
end
|
||||
@@ -59,8 +59,6 @@ local UnitPVPName = UnitPVPName
|
||||
local UnitPVPRank = UnitPVPRank
|
||||
local UnitReaction = UnitReaction
|
||||
local UnitSex = UnitSex
|
||||
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
||||
|
||||
local C_QuestLog_GetTitleForQuestID = GetTitleForQuestID
|
||||
local C_QuestLog_GetQuestDifficultyLevel = function(questID)
|
||||
@@ -443,34 +441,6 @@ E:AddTag('health:deficit-percent:name', 'UNIT_HEALTH UNIT_MAXHEALTH UNIT_NAME_UP
|
||||
end
|
||||
end)
|
||||
|
||||
E:AddTag('health:absorb', 'UNIT_ABSORB_AMOUNT_CHANGED', function(unit)
|
||||
local absorb = UnitGetTotalAbsorbs(unit) or 0
|
||||
if absorb > 0 then
|
||||
return E:GetFormattedText('CURRENT', absorb, UnitHealthMax(unit))
|
||||
end
|
||||
end)
|
||||
|
||||
E:AddTag('health:absorb:shortvalue', 'UNIT_ABSORB_AMOUNT_CHANGED', function(unit)
|
||||
local absorb = UnitGetTotalAbsorbs(unit) or 0
|
||||
if absorb > 0 then
|
||||
return E:GetFormattedText('CURRENT', absorb, UnitHealthMax(unit), nil, true)
|
||||
end
|
||||
end)
|
||||
|
||||
E:AddTag('health:healAbsorb', 'UNIT_HEAL_ABSORB_AMOUNT_CHANGED', function(unit)
|
||||
local healAbsorb = UnitGetTotalHealAbsorbs(unit) or 0
|
||||
if healAbsorb > 0 then
|
||||
return E:GetFormattedText('CURRENT', healAbsorb, UnitHealthMax(unit))
|
||||
end
|
||||
end)
|
||||
|
||||
E:AddTag('health:healAbsorb:shortvalue', 'UNIT_HEAL_ABSORB_AMOUNT_CHANGED', function(unit)
|
||||
local healAbsorb = UnitGetTotalHealAbsorbs(unit) or 0
|
||||
if healAbsorb > 0 then
|
||||
return E:GetFormattedText('CURRENT', healAbsorb, UnitHealthMax(unit), nil, true)
|
||||
end
|
||||
end)
|
||||
|
||||
E:AddTag('power:max', 'UNIT_DISPLAYPOWER UNIT_MAXPOWER', function(unit)
|
||||
local powerType = UnitPowerType(unit)
|
||||
local max = UnitPowerMax(unit, powerType)
|
||||
@@ -1374,10 +1344,6 @@ E.TagInfo = {
|
||||
['health:deficit'] = { category = 'Health', description = "Displays the health of the unit as a deficit (Total Health - Current Health = -Deficit)" },
|
||||
['health:max:shortvalue'] = { category = 'Health', description = "Shortvalue of the unit's maximum health" },
|
||||
['health:max'] = { category = 'Health', description = "Displays the maximum health of the unit" },
|
||||
['health:absorb'] = { category = 'Health', description = "Displays the amount of damage absorbed by shields on the unit" },
|
||||
['health:absorb:shortvalue'] = { category = 'Health', description = "Shortvalue of the amount of damage absorbed by shields on the unit" },
|
||||
['health:healAbsorb'] = { category = 'Health', description = "Displays the amount of healing absorbed by debuffs on the unit" },
|
||||
['health:healAbsorb:shortvalue'] = { category = 'Health', description = "Shortvalue of the amount of healing absorbed by debuffs on the unit" },
|
||||
['health:percent-nostatus'] = { category = 'Health', description = "Displays the unit's current health as a percentage, without status" },
|
||||
['health:percent'] = { category = 'Health', description = "Displays the current health of the unit as a percentage" },
|
||||
['maxhp'] = { category = 'Health', description = "Displays max HP without decimals" },
|
||||
|
||||
@@ -53,8 +53,6 @@ local UnitHealth = UnitHealth
|
||||
local UnitHealthMax = UnitHealthMax
|
||||
local UnitName = UnitName
|
||||
local UnitGetIncomingHeals = UnitGetIncomingHeals
|
||||
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
||||
|
||||
local enabledUF, enabled = {}, nil
|
||||
|
||||
@@ -74,39 +72,19 @@ local function Update(self)
|
||||
|
||||
local myIncomingHeal = UnitGetIncomingHeals(unit, UnitName("player")) or 0
|
||||
local allIncomingHeal = UnitGetIncomingHeals(unit) or 0
|
||||
local absorb = UnitGetTotalAbsorbs and UnitGetTotalAbsorbs(unit) or 0
|
||||
local healAbsorb = UnitGetTotalHealAbsorbs and UnitGetTotalHealAbsorbs(unit) or 0
|
||||
local health = UnitHealth(unit)
|
||||
local maxHealth = UnitHealthMax(unit)
|
||||
local maxOverflowHP = maxHealth * element.maxOverflow
|
||||
local otherIncomingHeal = 0
|
||||
|
||||
if healAbsorb > allIncomingHeal then
|
||||
healAbsorb = healAbsorb - allIncomingHeal
|
||||
allIncomingHeal = 0
|
||||
myIncomingHeal = 0
|
||||
else
|
||||
allIncomingHeal = allIncomingHeal - healAbsorb
|
||||
healAbsorb = 0
|
||||
|
||||
if element.overflowHeals then
|
||||
if health + allIncomingHeal > maxOverflowHP then
|
||||
allIncomingHeal = maxOverflowHP - health
|
||||
end
|
||||
end
|
||||
|
||||
if allIncomingHeal < myIncomingHeal then
|
||||
myIncomingHeal = allIncomingHeal
|
||||
else
|
||||
otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||
end
|
||||
if health + allIncomingHeal > maxOverflowHP then
|
||||
allIncomingHeal = maxOverflowHP - health
|
||||
end
|
||||
|
||||
if element.overflowAbsorbs then
|
||||
local maxAbsorb = maxOverflowHP - health
|
||||
if absorb > maxAbsorb then
|
||||
absorb = maxAbsorb > 0 and maxAbsorb or 0
|
||||
end
|
||||
if allIncomingHeal < myIncomingHeal then
|
||||
myIncomingHeal = allIncomingHeal
|
||||
else
|
||||
otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
||||
end
|
||||
|
||||
if element.myBar then
|
||||
@@ -121,38 +99,16 @@ local function Update(self)
|
||||
element.otherBar:Show()
|
||||
end
|
||||
|
||||
if element.absorbBar then
|
||||
element.absorbBar:SetMinMaxValues(0, maxHealth)
|
||||
element.absorbBar:SetValue(absorb)
|
||||
if absorb > 0 then
|
||||
element.absorbBar:Show()
|
||||
else
|
||||
element.absorbBar:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if element.healAbsorbBar then
|
||||
element.healAbsorbBar:SetMinMaxValues(0, maxHealth)
|
||||
element.healAbsorbBar:SetValue(healAbsorb)
|
||||
if healAbsorb > 0 then
|
||||
element.healAbsorbBar:Show()
|
||||
else
|
||||
element.healAbsorbBar:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
--[[ Callback: HealthPrediction:PostUpdate(unit, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb)
|
||||
--[[ Callback: HealthPrediction:PostUpdate(unit, myIncomingHeal, otherIncomingHeal)
|
||||
Called after the element has been updated.
|
||||
|
||||
* self - the HealthPrediction element
|
||||
* unit - the unit for which the update has been triggered (string)
|
||||
* myIncomingHeal - the amount of incoming healing done by the player (number)
|
||||
* otherIncomingHeal - the amount of incoming healing done by others (number)
|
||||
* absorb - the amount of damage the unit can absorb without losing health (number)
|
||||
* healAbsorb - the amount of healing the unit can absorb without gaining health (number)
|
||||
--]]
|
||||
if element.PostUpdate then
|
||||
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb)
|
||||
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -198,19 +154,17 @@ local function Enable(self)
|
||||
self:RegisterEvent("UNIT_HEALTH", Path)
|
||||
self:RegisterEvent("UNIT_MAXHEALTH", Path)
|
||||
self:RegisterEvent("UNIT_HEAL_PREDICTION", Path)
|
||||
self:RegisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", Path)
|
||||
self:RegisterEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", Path)
|
||||
|
||||
if not element.maxOverflow then
|
||||
element.maxOverflow = 1.05
|
||||
end
|
||||
|
||||
if element.absorbBar and element.absorbBar:IsObjectType("StatusBar") and not element.absorbBar:GetStatusBarTexture() then
|
||||
element.absorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||
if element.myBar and element.myBar:IsObjectType("StatusBar") and not element.myBar:GetStatusBarTexture() then
|
||||
element.myBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||
end
|
||||
|
||||
if element.healAbsorbBar and element.healAbsorbBar:IsObjectType("StatusBar") and not element.healAbsorbBar:GetStatusBarTexture() then
|
||||
element.healAbsorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||
if element.otherBar and element.otherBar:IsObjectType("StatusBar") and not element.otherBar:GetStatusBarTexture() then
|
||||
element.otherBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||
end
|
||||
|
||||
enabledUF[#enabledUF + 1] = self
|
||||
@@ -230,19 +184,9 @@ local function Disable(self)
|
||||
element.otherBar:Hide()
|
||||
end
|
||||
|
||||
if element.absorbBar then
|
||||
element.absorbBar:Hide()
|
||||
end
|
||||
|
||||
if element.healAbsorbBar then
|
||||
element.healAbsorbBar:Hide()
|
||||
end
|
||||
|
||||
self:UnregisterEvent("UNIT_HEALTH", Path)
|
||||
self:UnregisterEvent("UNIT_MAXHEALTH", Path)
|
||||
self:UnregisterEvent("UNIT_HEAL_PREDICTION", Path)
|
||||
self:UnregisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", Path)
|
||||
self:UnregisterEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", Path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -541,10 +541,6 @@ P.nameplates = {
|
||||
healPrediction = {
|
||||
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
||||
others = {r = 0, g = 1, b = 0, a = 0.25},
|
||||
absorbs = {r = 1, g = 1, b = 1, a = 0.35},
|
||||
healAbsorbs = {r = 1, g = 0, b = 0, a = 0.35},
|
||||
overflowHeals = false,
|
||||
overflowAbsorbs = false,
|
||||
},
|
||||
threat = {
|
||||
goodColor = {r = 0.20, g = 0.71, b = 0.00},
|
||||
@@ -1111,11 +1107,7 @@ P.unitframe = {
|
||||
healPrediction = {
|
||||
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
||||
others = {r = 0, g = 1, b = 0, a = 0.25},
|
||||
absorbs = {r = 1, g = 1, b = 1, a = 0.35},
|
||||
healAbsorbs = {r = 1, g = 0, b = 0, a = 0.35},
|
||||
maxOverflow = 0,
|
||||
overflowHeals = false,
|
||||
overflowAbsorbs = false,
|
||||
maxOverflow = 0
|
||||
},
|
||||
classResources = {
|
||||
comboPoints = {
|
||||
|
||||
@@ -1404,9 +1404,3 @@ L["Allows Raid Members to send you Map Markers"] = true
|
||||
L["MAP_MARKER_DISCRIPTION"] = "Allows Map Markers to be created by middle clicking (Mouse3) on the world map.\nMarkers are automatically shared with raid members."
|
||||
L["Ranged"] = "Ranged"
|
||||
L["Melee"] = "Melee"
|
||||
L["Absorbs"] = true
|
||||
L["Heal Absorbs"] = true
|
||||
L["Overflow Heals"] = true
|
||||
L["Overflow Absorbs"] = true
|
||||
L["When enabled, incoming heals overflow past the health bar, otherwise bar is reverse filled."] = true
|
||||
L["When enabled, absorb shields overflow past the health bar, otherwise bar is reverse filled."] = true
|
||||
@@ -3901,20 +3901,8 @@ E.Options.args.unitframe = {
|
||||
name = L["Others"],
|
||||
hasAlpha = true
|
||||
},
|
||||
absorbs = {
|
||||
order = 4,
|
||||
type = "color",
|
||||
name = L["Absorbs"],
|
||||
hasAlpha = true
|
||||
},
|
||||
healAbsorbs = {
|
||||
order = 5,
|
||||
type = "color",
|
||||
name = L["Heal Absorbs"],
|
||||
hasAlpha = true
|
||||
},
|
||||
maxOverflow = {
|
||||
order = 6,
|
||||
order = 4,
|
||||
type = "range",
|
||||
name = L["Max Overflow"],
|
||||
desc = L["Max amount of overflow allowed to extend past the end of the health bar."],
|
||||
@@ -3922,22 +3910,6 @@ E.Options.args.unitframe = {
|
||||
min = 0, max = 1, step = 0.01,
|
||||
get = function(info) return E.db.unitframe.colors.healPrediction.maxOverflow end,
|
||||
set = function(info, value) E.db.unitframe.colors.healPrediction.maxOverflow = value UF:Update_AllFrames() end
|
||||
},
|
||||
overflowHeals = {
|
||||
order = 7,
|
||||
type = "toggle",
|
||||
name = L["Overflow Heals"],
|
||||
desc = L["When enabled, incoming heals overflow past the health bar, otherwise bar is reverse filled."],
|
||||
get = function(info) return E.db.unitframe.colors.healPrediction.overflowHeals end,
|
||||
set = function(info, value) E.db.unitframe.colors.healPrediction.overflowHeals = value UF:Update_AllFrames() end
|
||||
},
|
||||
overflowAbsorbs = {
|
||||
order = 8,
|
||||
type = "toggle",
|
||||
name = L["Overflow Absorbs"],
|
||||
desc = L["When enabled, absorb shields overflow past the health bar, otherwise bar is reverse filled."],
|
||||
get = function(info) return E.db.unitframe.colors.healPrediction.overflowAbsorbs end,
|
||||
set = function(info, value) E.db.unitframe.colors.healPrediction.overflowAbsorbs = value UF:Update_AllFrames() end
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user