Add absorbs, heal absorbs (#90)
* HealComm - Absorb, HealAbsorb * HealComm - Unify all bars
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
<Script file="Core.lua"/>
|
<Script file="Core.lua"/>
|
||||||
<Script file="Math.lua"/>
|
<Script file="Math.lua"/>
|
||||||
<Script file="API.lua"/>
|
<Script file="API.lua"/>
|
||||||
|
<Script file="ReversibleStatusBar.lua"/>
|
||||||
<Script file="AprilFools.lua"/>
|
<Script file="AprilFools.lua"/>
|
||||||
<Script file="Fonts.lua"/>
|
<Script file="Fonts.lua"/>
|
||||||
<Script file="Install.lua"/>
|
<Script file="Install.lua"/>
|
||||||
|
|||||||
@@ -0,0 +1,221 @@
|
|||||||
|
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,6 +59,8 @@ local UnitPVPName = UnitPVPName
|
|||||||
local UnitPVPRank = UnitPVPRank
|
local UnitPVPRank = UnitPVPRank
|
||||||
local UnitReaction = UnitReaction
|
local UnitReaction = UnitReaction
|
||||||
local UnitSex = UnitSex
|
local UnitSex = UnitSex
|
||||||
|
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||||
|
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
||||||
|
|
||||||
local C_QuestLog_GetTitleForQuestID = GetTitleForQuestID
|
local C_QuestLog_GetTitleForQuestID = GetTitleForQuestID
|
||||||
local C_QuestLog_GetQuestDifficultyLevel = function(questID)
|
local C_QuestLog_GetQuestDifficultyLevel = function(questID)
|
||||||
@@ -441,6 +443,34 @@ E:AddTag('health:deficit-percent:name', 'UNIT_HEALTH UNIT_MAXHEALTH UNIT_NAME_UP
|
|||||||
end
|
end
|
||||||
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)
|
E:AddTag('power:max', 'UNIT_DISPLAYPOWER UNIT_MAXPOWER', function(unit)
|
||||||
local powerType = UnitPowerType(unit)
|
local powerType = UnitPowerType(unit)
|
||||||
local max = UnitPowerMax(unit, powerType)
|
local max = UnitPowerMax(unit, powerType)
|
||||||
@@ -1344,6 +1374,10 @@ E.TagInfo = {
|
|||||||
['health:deficit'] = { category = 'Health', description = "Displays the health of the unit as a deficit (Total Health - Current Health = -Deficit)" },
|
['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:shortvalue'] = { category = 'Health', description = "Shortvalue of the unit's maximum health" },
|
||||||
['health:max'] = { category = 'Health', description = "Displays the maximum health of the unit" },
|
['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-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" },
|
['health:percent'] = { category = 'Health', description = "Displays the current health of the unit as a percentage" },
|
||||||
['maxhp'] = { category = 'Health', description = "Displays max HP without decimals" },
|
['maxhp'] = { category = 'Health', description = "Displays max HP without decimals" },
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ local UnitHealth = UnitHealth
|
|||||||
local UnitHealthMax = UnitHealthMax
|
local UnitHealthMax = UnitHealthMax
|
||||||
local UnitName = UnitName
|
local UnitName = UnitName
|
||||||
local UnitGetIncomingHeals = UnitGetIncomingHeals
|
local UnitGetIncomingHeals = UnitGetIncomingHeals
|
||||||
|
local UnitGetTotalAbsorbs = UnitGetTotalAbsorbs
|
||||||
|
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
|
||||||
|
|
||||||
local enabledUF, enabled = {}, nil
|
local enabledUF, enabled = {}, nil
|
||||||
|
|
||||||
@@ -72,19 +74,39 @@ 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 healAbsorb = 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
|
||||||
local otherIncomingHeal = 0
|
local otherIncomingHeal = 0
|
||||||
|
|
||||||
if health + allIncomingHeal > maxOverflowHP then
|
if healAbsorb > allIncomingHeal then
|
||||||
allIncomingHeal = maxOverflowHP - health
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
if allIncomingHeal < myIncomingHeal then
|
if element.overflowAbsorbs then
|
||||||
myIncomingHeal = allIncomingHeal
|
local maxAbsorb = maxOverflowHP - health
|
||||||
else
|
if absorb > maxAbsorb then
|
||||||
otherIncomingHeal = allIncomingHeal - myIncomingHeal
|
absorb = maxAbsorb > 0 and maxAbsorb or 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.myBar then
|
if element.myBar then
|
||||||
@@ -99,16 +121,38 @@ local function Update(self)
|
|||||||
element.otherBar:Show()
|
element.otherBar:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ Callback: HealthPrediction:PostUpdate(unit, myIncomingHeal, otherIncomingHeal)
|
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)
|
||||||
Called after the element has been updated.
|
Called after the element has been updated.
|
||||||
|
|
||||||
* self - the HealthPrediction element
|
* self - the HealthPrediction element
|
||||||
* unit - the unit for which the update has been triggered (string)
|
* unit - the unit for which the update has been triggered (string)
|
||||||
* myIncomingHeal - the amount of incoming healing done by the player (number)
|
* myIncomingHeal - the amount of incoming healing done by the player (number)
|
||||||
* otherIncomingHeal - the amount of incoming healing done by others (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
|
if element.PostUpdate then
|
||||||
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal)
|
return element:PostUpdate(unit, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -154,17 +198,19 @@ local function Enable(self)
|
|||||||
self:RegisterEvent("UNIT_HEALTH", Path)
|
self:RegisterEvent("UNIT_HEALTH", Path)
|
||||||
self:RegisterEvent("UNIT_MAXHEALTH", Path)
|
self:RegisterEvent("UNIT_MAXHEALTH", Path)
|
||||||
self:RegisterEvent("UNIT_HEAL_PREDICTION", 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
|
if not element.maxOverflow then
|
||||||
element.maxOverflow = 1.05
|
element.maxOverflow = 1.05
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.myBar and element.myBar:IsObjectType("StatusBar") and not element.myBar:GetStatusBarTexture() then
|
if element.absorbBar and element.absorbBar:IsObjectType("StatusBar") and not element.absorbBar:GetStatusBarTexture() then
|
||||||
element.myBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
element.absorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
end
|
end
|
||||||
|
|
||||||
if element.otherBar and element.otherBar:IsObjectType("StatusBar") and not element.otherBar:GetStatusBarTexture() then
|
if element.healAbsorbBar and element.healAbsorbBar:IsObjectType("StatusBar") and not element.healAbsorbBar:GetStatusBarTexture() then
|
||||||
element.otherBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
element.healAbsorbBar:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]])
|
||||||
end
|
end
|
||||||
|
|
||||||
enabledUF[#enabledUF + 1] = self
|
enabledUF[#enabledUF + 1] = self
|
||||||
@@ -184,9 +230,19 @@ local function Disable(self)
|
|||||||
element.otherBar:Hide()
|
element.otherBar:Hide()
|
||||||
end
|
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_HEALTH", Path)
|
||||||
self:UnregisterEvent("UNIT_MAXHEALTH", Path)
|
self:UnregisterEvent("UNIT_MAXHEALTH", Path)
|
||||||
self:UnregisterEvent("UNIT_HEAL_PREDICTION", Path)
|
self:UnregisterEvent("UNIT_HEAL_PREDICTION", Path)
|
||||||
|
self:UnregisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", Path)
|
||||||
|
self:UnregisterEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", Path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,25 @@ function NP:Update_HealComm(nameplate)
|
|||||||
nameplate:EnableElement('HealCommBar')
|
nameplate:EnableElement('HealCommBar')
|
||||||
end
|
end
|
||||||
|
|
||||||
nameplate.HealCommBar.myBar:SetStatusBarColor(NP.db.colors.healPrediction.personal.r, NP.db.colors.healPrediction.personal.g, NP.db.colors.healPrediction.personal.b)
|
local c = NP.db.colors.healPrediction
|
||||||
nameplate.HealCommBar.otherBar:SetStatusBarColor(NP.db.colors.healPrediction.others.r, NP.db.colors.healPrediction.others.g, NP.db.colors.healPrediction.others.b)
|
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
|
||||||
elseif nameplate:IsElementEnabled('HealCommBar') then
|
elseif nameplate:IsElementEnabled('HealCommBar') then
|
||||||
nameplate:DisableElement('HealCommBar')
|
nameplate:DisableElement('HealCommBar')
|
||||||
end
|
end
|
||||||
@@ -158,6 +175,12 @@ end
|
|||||||
function NP:SetAlpha_HealComm(obj, show)
|
function NP:SetAlpha_HealComm(obj, show)
|
||||||
obj.myBar:SetAlpha(show and 1 or 0)
|
obj.myBar:SetAlpha(show and 1 or 0)
|
||||||
obj.otherBar: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
|
end
|
||||||
|
|
||||||
function NP:SetVisibility_HealComm(obj)
|
function NP:SetVisibility_HealComm(obj)
|
||||||
@@ -171,9 +194,21 @@ function NP:SetVisibility_HealComm(obj)
|
|||||||
if obj.maxOverflow > 1 then
|
if obj.maxOverflow > 1 then
|
||||||
obj.myBar:SetParent(obj.health)
|
obj.myBar:SetParent(obj.health)
|
||||||
obj.otherBar: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
|
else
|
||||||
obj.myBar:SetParent(obj.parent)
|
obj.myBar:SetParent(obj.parent)
|
||||||
obj.otherBar: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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -181,18 +216,27 @@ function NP:Construct_HealComm(frame)
|
|||||||
local health = frame.Health
|
local health = frame.Health
|
||||||
local parent = health.ClipFrame
|
local parent = health.ClipFrame
|
||||||
|
|
||||||
local myBar = CreateFrame("StatusBar", nil, parent)
|
local myBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
local otherBar = CreateFrame("StatusBar", nil, parent)
|
local otherBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
local absorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
local healAbsorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
|
||||||
myBar:SetFrameLevel(health:GetFrameLevel()+1)
|
myBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||||
otherBar:SetFrameLevel(health:GetFrameLevel()+1)
|
otherBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||||
|
absorbBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||||
|
healAbsorbBar:SetFrameLevel(health:GetFrameLevel()+2)
|
||||||
|
|
||||||
NP.StatusBars[myBar] = true
|
local texture = health:GetStatusBarTexture() or E.media.blankTex
|
||||||
NP.StatusBars[otherBar] = true
|
myBar:SetStatusBarTexture(texture)
|
||||||
|
otherBar:SetStatusBarTexture(texture)
|
||||||
|
absorbBar:SetStatusBarTexture(texture)
|
||||||
|
healAbsorbBar:SetStatusBarTexture(texture)
|
||||||
|
|
||||||
local healPrediction = {
|
local healPrediction = {
|
||||||
myBar = myBar,
|
myBar = myBar,
|
||||||
otherBar = otherBar,
|
otherBar = otherBar,
|
||||||
|
absorbBar = absorbBar,
|
||||||
|
healAbsorbBar = healAbsorbBar,
|
||||||
PostUpdate = NP.UpdateHealComm,
|
PostUpdate = NP.UpdateHealComm,
|
||||||
maxOverflow = 1,
|
maxOverflow = 1,
|
||||||
health = health,
|
health = health,
|
||||||
@@ -214,8 +258,15 @@ function NP:Configure_HealComm(frame)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local healPrediction = frame.HealCommBar
|
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
|
local c = db.colors.healPrediction
|
||||||
|
|
||||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||||
|
healPrediction.overflowHeals = c.overflowHeals
|
||||||
|
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||||
|
|
||||||
if healPrediction.allowClippingUpdate then
|
if healPrediction.allowClippingUpdate then
|
||||||
NP:SetVisibility_HealComm(healPrediction)
|
NP:SetVisibility_HealComm(healPrediction)
|
||||||
@@ -223,84 +274,146 @@ function NP:Configure_HealComm(frame)
|
|||||||
|
|
||||||
local health = frame.Health
|
local health = frame.Health
|
||||||
local orientation = health:GetOrientation()
|
local orientation = health:GetOrientation()
|
||||||
|
local healthTexture = health:GetStatusBarTexture()
|
||||||
local myBar = healPrediction.myBar
|
local width = health:GetWidth()
|
||||||
local otherBar = healPrediction.otherBar
|
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)
|
myBar:SetOrientation(orientation)
|
||||||
otherBar:SetOrientation(orientation)
|
otherBar:SetOrientation(orientation)
|
||||||
|
absorbBar:SetOrientation(orientation)
|
||||||
|
healAbsorbBar:SetOrientation(orientation)
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
local width = health:GetWidth()
|
local p1 = "LEFT"
|
||||||
width = (width > 0 and width) or health.WIDTH
|
local p2 = "RIGHT"
|
||||||
local healthTexture = health:GetStatusBarTexture()
|
|
||||||
|
|
||||||
myBar:Size(width, 0)
|
healPrediction.anchor1 = p1
|
||||||
|
healPrediction.anchor2 = p2
|
||||||
|
|
||||||
|
myBar:SetSize(width, height)
|
||||||
myBar:ClearAllPoints()
|
myBar:ClearAllPoints()
|
||||||
myBar:Point("TOP", health, "TOP")
|
myBar:Point("TOP", health)
|
||||||
myBar:Point("BOTTOM", health, "BOTTOM")
|
myBar:Point("BOTTOM", health)
|
||||||
myBar:Point("LEFT", healthTexture, "RIGHT")
|
myBar:Point(p1, healthTexture, p2)
|
||||||
|
myBar:SetReverseFill(false)
|
||||||
|
|
||||||
otherBar:Size(width, 0)
|
otherBar:SetSize(width, height)
|
||||||
otherBar:ClearAllPoints()
|
otherBar:ClearAllPoints()
|
||||||
otherBar:Point("TOP", health, "TOP")
|
otherBar:Point("TOP", health)
|
||||||
otherBar:Point("BOTTOM", health, "BOTTOM")
|
otherBar:Point("BOTTOM", health)
|
||||||
otherBar:Point("LEFT", myBar:GetStatusBarTexture(), "RIGHT")
|
otherBar:Point(p1, healPrediction.myBarTexture, p2)
|
||||||
else
|
otherBar:SetReverseFill(false)
|
||||||
local height = health:GetHeight()
|
|
||||||
height = (height > 0 and height) or health.HEIGHT
|
|
||||||
local healthTexture = health:GetStatusBarTexture()
|
|
||||||
|
|
||||||
myBar:Size(0, height)
|
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:ClearAllPoints()
|
myBar:ClearAllPoints()
|
||||||
myBar:Point("LEFT", health, "LEFT")
|
myBar:Point("LEFT", health)
|
||||||
myBar:Point("RIGHT", health, "RIGHT")
|
myBar:Point("RIGHT", health)
|
||||||
myBar:Point("BOTTOM", healthTexture, "TOP")
|
myBar:Point(p1, healthTexture, p2)
|
||||||
|
myBar:SetReverseFill(false)
|
||||||
|
|
||||||
otherBar:Size(0, height)
|
otherBar:SetSize(width, height)
|
||||||
otherBar:ClearAllPoints()
|
otherBar:ClearAllPoints()
|
||||||
otherBar:Point("LEFT", health, "LEFT")
|
otherBar:Point("LEFT", health)
|
||||||
otherBar:Point("RIGHT", health, "RIGHT")
|
otherBar:Point("RIGHT", health)
|
||||||
otherBar:Point("BOTTOM", myBar:GetStatusBarTexture(), "TOP")
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
frame.HealCommBar.myBar:SetStatusBarColor(NP.db.colors.healPrediction.personal.r, NP.db.colors.healPrediction.personal.g, NP.db.colors.healPrediction.personal.b)
|
local hpc = NP.db.colors.healPrediction
|
||||||
frame.HealCommBar.otherBar:SetStatusBarColor(NP.db.colors.healPrediction.others.r, NP.db.colors.healPrediction.others.g, NP.db.colors.healPrediction.others.b)
|
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)
|
||||||
elseif frame:IsElementEnabled('HealComm4') then
|
elseif frame:IsElementEnabled('HealComm4') then
|
||||||
frame:DisableElement('HealComm4')
|
frame:DisableElement('HealComm4')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function UpdateFillBar(frame, previousTexture, bar, amount)
|
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||||
if amount == 0 then
|
|
||||||
bar:Hide()
|
|
||||||
return previousTexture
|
|
||||||
end
|
|
||||||
|
|
||||||
local orientation = frame:GetOrientation()
|
|
||||||
bar:ClearAllPoints()
|
bar:ClearAllPoints()
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
bar:SetPoint("TOPLEFT", previousTexture, "TOPRIGHT")
|
bar:Point("TOP", health)
|
||||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "BOTTOMRIGHT")
|
bar:Point("BOTTOM", health)
|
||||||
else
|
else -- VERTICAL
|
||||||
bar:SetPoint("BOTTOMRIGHT", previousTexture, "TOPRIGHT")
|
bar:Point("LEFT", health)
|
||||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "TOPLEFT")
|
bar:Point("RIGHT", health)
|
||||||
end
|
end
|
||||||
|
|
||||||
local totalWidth, totalHeight = frame:GetSize()
|
if overflowMode then
|
||||||
if orientation == "HORIZONTAL" then
|
bar:Point(p1, anchorTexture, p2)
|
||||||
bar:Width(totalWidth)
|
bar:SetReverseFill(false)
|
||||||
|
elseif hasEnoughSpace then
|
||||||
|
bar:Point(p1, anchorTexture, p2)
|
||||||
|
bar:SetReverseFill(false)
|
||||||
else
|
else
|
||||||
bar:Height(totalHeight)
|
local reverseAnchor = reverseAnchorTexture or health
|
||||||
|
bar:Point(p2, reverseAnchor, p2)
|
||||||
|
bar:SetReverseFill(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
return bar:GetStatusBarTexture()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function NP:UpdateHealComm(_, myIncomingHeal, allIncomingHeal)
|
function NP:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, myCurrentHealAbsorb, allHealAbsorb)
|
||||||
|
if not self.frame or not self.health then return end
|
||||||
|
|
||||||
local health = self.health
|
local health = self.health
|
||||||
local previousTexture = health:GetStatusBarTexture()
|
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
||||||
|
local orientation = health:GetOrientation()
|
||||||
|
|
||||||
previousTexture = UpdateFillBar(health, previousTexture, self.myBar, myIncomingHeal)
|
local currentHealth = UnitHealth(unit) or 0
|
||||||
UpdateFillBar(health, previousTexture, self.otherBar, allIncomingHeal)
|
local maxHealth = UnitHealthMax(unit) or 1
|
||||||
end
|
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
|
||||||
@@ -16,6 +16,8 @@ end
|
|||||||
function UF:SetAlpha_HealComm(obj, show)
|
function UF:SetAlpha_HealComm(obj, show)
|
||||||
obj.myBar:SetAlpha(show and 1 or 0)
|
obj.myBar:SetAlpha(show and 1 or 0)
|
||||||
obj.otherBar: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
|
end
|
||||||
|
|
||||||
function UF:SetVisibility_HealComm(obj)
|
function UF:SetVisibility_HealComm(obj)
|
||||||
@@ -29,9 +31,13 @@ function UF:SetVisibility_HealComm(obj)
|
|||||||
if obj.maxOverflow > 1 then
|
if obj.maxOverflow > 1 then
|
||||||
obj.myBar:SetParent(obj.health)
|
obj.myBar:SetParent(obj.health)
|
||||||
obj.otherBar:SetParent(obj.health)
|
obj.otherBar:SetParent(obj.health)
|
||||||
|
obj.absorbBar:SetParent(obj.health)
|
||||||
|
obj.healAbsorbBar:SetParent(obj.health)
|
||||||
else
|
else
|
||||||
obj.myBar:SetParent(obj.parent)
|
obj.myBar:SetParent(obj.parent)
|
||||||
obj.otherBar:SetParent(obj.parent)
|
obj.otherBar:SetParent(obj.parent)
|
||||||
|
obj.absorbBar:SetParent(obj.parent)
|
||||||
|
obj.healAbsorbBar:SetParent(obj.parent)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,22 +45,27 @@ function UF:Construct_HealComm(frame)
|
|||||||
local health = frame.Health
|
local health = frame.Health
|
||||||
local parent = health.ClipFrame
|
local parent = health.ClipFrame
|
||||||
|
|
||||||
local myBar = CreateFrame("StatusBar", nil, parent)
|
local myBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
local otherBar = CreateFrame("StatusBar", nil, parent)
|
local otherBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
local absorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
local healAbsorbBar = E:CreateReversibleStatusBar(nil, parent)
|
||||||
|
|
||||||
myBar:SetFrameLevel(11)
|
myBar:SetFrameLevel(12)
|
||||||
otherBar:SetFrameLevel(11)
|
otherBar:SetFrameLevel(12)
|
||||||
|
absorbBar:SetFrameLevel(12)
|
||||||
UF.statusbars[myBar] = true
|
healAbsorbBar:SetFrameLevel(12)
|
||||||
UF.statusbars[otherBar] = true
|
|
||||||
|
|
||||||
local texture = (not health.isTransparent and health:GetStatusBarTexture()) or E.media.blankTex
|
local texture = (not health.isTransparent and health:GetStatusBarTexture()) or E.media.blankTex
|
||||||
UF:Update_StatusBar(myBar, texture)
|
myBar:SetStatusBarTexture(texture)
|
||||||
UF:Update_StatusBar(otherBar, texture)
|
otherBar:SetStatusBarTexture(texture)
|
||||||
|
absorbBar:SetStatusBarTexture(texture)
|
||||||
|
healAbsorbBar:SetStatusBarTexture(texture)
|
||||||
|
|
||||||
local healPrediction = {
|
local healPrediction = {
|
||||||
myBar = myBar,
|
myBar = myBar,
|
||||||
otherBar = otherBar,
|
otherBar = otherBar,
|
||||||
|
absorbBar = absorbBar,
|
||||||
|
healAbsorbBar = healAbsorbBar,
|
||||||
PostUpdate = UF.UpdateHealComm,
|
PostUpdate = UF.UpdateHealComm,
|
||||||
maxOverflow = 1,
|
maxOverflow = 1,
|
||||||
health = health,
|
health = health,
|
||||||
@@ -72,8 +83,13 @@ function UF:Configure_HealComm(frame)
|
|||||||
local healPrediction = frame.HealCommBar
|
local healPrediction = frame.HealCommBar
|
||||||
local myBar = healPrediction.myBar
|
local myBar = healPrediction.myBar
|
||||||
local otherBar = healPrediction.otherBar
|
local otherBar = healPrediction.otherBar
|
||||||
|
local absorbBar = healPrediction.absorbBar
|
||||||
|
local healAbsorbBar = healPrediction.healAbsorbBar
|
||||||
local c = self.db.colors.healPrediction
|
local c = self.db.colors.healPrediction
|
||||||
|
|
||||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||||
|
healPrediction.overflowHeals = c.overflowHeals
|
||||||
|
healPrediction.overflowAbsorbs = c.overflowAbsorbs
|
||||||
|
|
||||||
if healPrediction.allowClippingUpdate then
|
if healPrediction.allowClippingUpdate then
|
||||||
UF:SetVisibility_HealComm(healPrediction)
|
UF:SetVisibility_HealComm(healPrediction)
|
||||||
@@ -86,82 +102,146 @@ function UF:Configure_HealComm(frame)
|
|||||||
if frame.db.health then
|
if frame.db.health then
|
||||||
local health = frame.Health
|
local health = frame.Health
|
||||||
local orientation = frame.db.health.orientation or health:GetOrientation()
|
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)
|
myBar:SetOrientation(orientation)
|
||||||
otherBar:SetOrientation(orientation)
|
otherBar:SetOrientation(orientation)
|
||||||
|
absorbBar:SetOrientation(orientation)
|
||||||
|
healAbsorbBar:SetOrientation(orientation)
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
local width = health:GetWidth()
|
local p1 = "LEFT"
|
||||||
width = (width > 0 and width) or health.WIDTH
|
local p2 = "RIGHT"
|
||||||
local healthTexture = health:GetStatusBarTexture()
|
|
||||||
|
|
||||||
myBar:Size(width, 0)
|
healPrediction.anchor1 = p1
|
||||||
|
healPrediction.anchor2 = p2
|
||||||
|
|
||||||
|
myBar:SetSize(width, height)
|
||||||
myBar:ClearAllPoints()
|
myBar:ClearAllPoints()
|
||||||
myBar:Point("TOP", health, "TOP")
|
myBar:Point("TOP", health)
|
||||||
myBar:Point("BOTTOM", health, "BOTTOM")
|
myBar:Point("BOTTOM", health)
|
||||||
myBar:Point("LEFT", healthTexture, "RIGHT")
|
myBar:Point(p1, healthTexture, p2)
|
||||||
|
myBar:SetReverseFill(false)
|
||||||
|
|
||||||
otherBar:Size(width, 0)
|
otherBar:SetSize(width, height)
|
||||||
otherBar:ClearAllPoints()
|
otherBar:ClearAllPoints()
|
||||||
otherBar:Point("TOP", health, "TOP")
|
otherBar:Point("TOP", health)
|
||||||
otherBar:Point("BOTTOM", health, "BOTTOM")
|
otherBar:Point("BOTTOM", health)
|
||||||
otherBar:Point("LEFT", myBar:GetStatusBarTexture(), "RIGHT")
|
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)
|
||||||
else
|
else
|
||||||
local height = health:GetHeight()
|
local p1 = "BOTTOM"
|
||||||
height = (height > 0 and height) or health.HEIGHT
|
local p2 = "TOP"
|
||||||
local healthTexture = health:GetStatusBarTexture()
|
|
||||||
|
|
||||||
myBar:Size(0, height)
|
healPrediction.anchor1 = p1
|
||||||
|
healPrediction.anchor2 = p2
|
||||||
|
|
||||||
|
myBar:SetSize(width, height)
|
||||||
myBar:ClearAllPoints()
|
myBar:ClearAllPoints()
|
||||||
myBar:Point("LEFT", health, "LEFT")
|
myBar:Point("LEFT", health)
|
||||||
myBar:Point("RIGHT", health, "RIGHT")
|
myBar:Point("RIGHT", health)
|
||||||
myBar:Point("BOTTOM", healthTexture, "TOP")
|
myBar:Point(p1, healthTexture, p2)
|
||||||
|
myBar:SetReverseFill(false)
|
||||||
|
|
||||||
otherBar:Size(0, height)
|
otherBar:SetSize(width, height)
|
||||||
otherBar:ClearAllPoints()
|
otherBar:ClearAllPoints()
|
||||||
otherBar:Point("LEFT", health, "LEFT")
|
otherBar:Point("LEFT", health)
|
||||||
otherBar:Point("RIGHT", health, "RIGHT")
|
otherBar:Point("RIGHT", health)
|
||||||
otherBar:Point("BOTTOM", myBar:GetStatusBarTexture(), "TOP")
|
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)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a)
|
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)
|
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
|
elseif frame:IsElementEnabled("HealComm4") then
|
||||||
frame:DisableElement("HealComm4")
|
frame:DisableElement("HealComm4")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function UpdateFillBar(frame, previousTexture, bar, amount)
|
local function AnchorPredictionBar(bar, health, orientation, anchorTexture, hasEnoughSpace, overflowMode, p1, p2, reverseAnchorTexture)
|
||||||
if amount == 0 then
|
|
||||||
bar:Hide()
|
|
||||||
return previousTexture
|
|
||||||
end
|
|
||||||
|
|
||||||
local orientation = frame:GetOrientation()
|
|
||||||
bar:ClearAllPoints()
|
bar:ClearAllPoints()
|
||||||
|
|
||||||
if orientation == "HORIZONTAL" then
|
if orientation == "HORIZONTAL" then
|
||||||
bar:SetPoint("TOPLEFT", previousTexture, "TOPRIGHT")
|
bar:Point("TOP", health)
|
||||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "BOTTOMRIGHT")
|
bar:Point("BOTTOM", health)
|
||||||
else
|
else -- VERTICAL
|
||||||
bar:SetPoint("BOTTOMRIGHT", previousTexture, "TOPRIGHT")
|
bar:Point("LEFT", health)
|
||||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "TOPLEFT")
|
bar:Point("RIGHT", health)
|
||||||
end
|
end
|
||||||
|
|
||||||
local totalWidth, totalHeight = frame:GetSize()
|
if overflowMode then
|
||||||
if orientation == "HORIZONTAL" then
|
bar:Point(p1, anchorTexture, p2)
|
||||||
bar:Width(totalWidth)
|
bar:SetReverseFill(false)
|
||||||
|
elseif hasEnoughSpace then
|
||||||
|
bar:Point(p1, anchorTexture, p2)
|
||||||
|
bar:SetReverseFill(false)
|
||||||
else
|
else
|
||||||
bar:Height(totalHeight)
|
local reverseAnchor = reverseAnchorTexture or health
|
||||||
|
bar:Point(p2, reverseAnchor, p2)
|
||||||
|
bar:SetReverseFill(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
return bar:GetStatusBarTexture()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function UF:UpdateHealComm(_, myIncomingHeal, allIncomingHeal)
|
function UF:UpdateHealComm(unit, myIncomingHeal, allIncomingHeal, totalAbsorb, myCurrentHealAbsorb, allHealAbsorb)
|
||||||
local health = self.health
|
if not self.frame or not self.health then return end
|
||||||
local previousTexture = health:GetStatusBarTexture()
|
|
||||||
|
|
||||||
previousTexture = UpdateFillBar(health, previousTexture, self.myBar, myIncomingHeal)
|
local health = self.health
|
||||||
UpdateFillBar(health, previousTexture, self.otherBar, allIncomingHeal)
|
local healthTexture = self.healthBarTexture or health:GetStatusBarTexture()
|
||||||
|
local orientation = health:GetOrientation()
|
||||||
|
|
||||||
|
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
|
end
|
||||||
@@ -541,6 +541,10 @@ P.nameplates = {
|
|||||||
healPrediction = {
|
healPrediction = {
|
||||||
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
||||||
others = {r = 0, g = 1, b = 0, 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 = {
|
threat = {
|
||||||
goodColor = {r = 0.20, g = 0.71, b = 0.00},
|
goodColor = {r = 0.20, g = 0.71, b = 0.00},
|
||||||
@@ -1107,7 +1111,11 @@ P.unitframe = {
|
|||||||
healPrediction = {
|
healPrediction = {
|
||||||
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
personal = {r = 0, g = 1, b = 0.5, a = 0.25},
|
||||||
others = {r = 0, g = 1, b = 0, a = 0.25},
|
others = {r = 0, g = 1, b = 0, a = 0.25},
|
||||||
maxOverflow = 0
|
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,
|
||||||
},
|
},
|
||||||
classResources = {
|
classResources = {
|
||||||
comboPoints = {
|
comboPoints = {
|
||||||
|
|||||||
@@ -1404,3 +1404,9 @@ 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["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["Ranged"] = "Ranged"
|
||||||
L["Melee"] = "Melee"
|
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,8 +3901,20 @@ E.Options.args.unitframe = {
|
|||||||
name = L["Others"],
|
name = L["Others"],
|
||||||
hasAlpha = true
|
hasAlpha = true
|
||||||
},
|
},
|
||||||
maxOverflow = {
|
absorbs = {
|
||||||
order = 4,
|
order = 4,
|
||||||
|
type = "color",
|
||||||
|
name = L["Absorbs"],
|
||||||
|
hasAlpha = true
|
||||||
|
},
|
||||||
|
healAbsorbs = {
|
||||||
|
order = 5,
|
||||||
|
type = "color",
|
||||||
|
name = L["Heal Absorbs"],
|
||||||
|
hasAlpha = true
|
||||||
|
},
|
||||||
|
maxOverflow = {
|
||||||
|
order = 6,
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Max Overflow"],
|
name = L["Max Overflow"],
|
||||||
desc = L["Max amount of overflow allowed to extend past the end of the health bar."],
|
desc = L["Max amount of overflow allowed to extend past the end of the health bar."],
|
||||||
@@ -3910,6 +3922,22 @@ E.Options.args.unitframe = {
|
|||||||
min = 0, max = 1, step = 0.01,
|
min = 0, max = 1, step = 0.01,
|
||||||
get = function(info) return E.db.unitframe.colors.healPrediction.maxOverflow end,
|
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
|
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