Author SHA1 Message Date
Andreas 5823bf839c Add a status bar for incoming heals
This shows a prediction of incoming direct heals.
2026-11-01 16:34:52 +01:00
Andreas 0569c100a1 Make status colors configurable
The aura based status colors can now be configured in frames.lua. This
is important in TBC where some healers don't care about e.g. magic
debuffs.
2026-10-31 11:59:51 +00:00
Andreas 4567bea3f9 Override role as TANK based on MT assignments
This is particularly helpful in fights like High King Maulgar,
Illidari Council or Kael'Thas where a DPS player is temporarily
made into a tank.
2026-10-29 12:54:24 +01:00
3 changed files with 64 additions and 6 deletions

No files matched your search

+14
View File
@@ -90,3 +90,17 @@ function StatusBar:SetColor(r, g, b)
self.bg:SetVertexColor(0.2 * r, 0.2 * g, 0.2 * b)
end
end
function StatusBar:SetAlpha(alpha)
self.bar:SetAlpha(alpha)
end
function StatusBar:GetColor()
local r, g, b = self.bar:GetStatusBarColor()
return r, g, b
end
function StatusBar:AttachTo(statusBar, point, relativePoint)
self.bar:ClearAllPoints()
self.bar:SetPoint(point, statusBar.bar:GetStatusBarTexture(), relativePoint)
end
+48 -4
View File
@@ -97,14 +97,18 @@ function UnitFrame:Init(unit, config)
self.hp = StatusBar:new(self, width, height, 0, true, texture, texture)
self.power = StatusBar:new(self, width, 6, 2, false, texture, texture)
self.power = StatusBar:new(self, width, 6, 3, false, texture, texture)
self.power:Hide()
self.absorb = StatusBar:new(self, width, height, 1, true, texture_top)
self.incomingHeals = StatusBar:new(self, width, height, 1, true, texture)
self.incomingHeals:AttachTo(self.hp, "TOPLEFT", "TOPRIGHT")
self.incomingHeals:Hide()
self.absorb = StatusBar:new(self, width, height, 2, true, texture_top)
self.absorb:SetColor(unpack(colors.absorb))
self.absorb:SetFillStyle(Enum.StatusBarFillStyle.Reverse)
self.shield = StatusBar:new(self, width, height, 1, true, texture_bot)
self.shield = StatusBar:new(self, width, height, 2, true, texture_bot)
self.shield:SetColor(unpack(colors.shield))
self.shield:SetRange(0, 1)
self.shield:SetValue(0.6)
@@ -444,6 +448,7 @@ function UnitFrame:RegisterEvents()
secure:RegisterUnitEvent("UNIT_NAME_UPDATE", unit)
secure:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", unit)
secure:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unit)
secure:RegisterUnitEvent("UNIT_HEAL_PREDICTION", unit)
end
-- returns whether or not the unit guid has changed since the last call to this
@@ -504,6 +509,7 @@ function UnitFrame:UNIT_HEALTH()
end
self:UpdateHealth()
self:UpdateHealthColor()
self:UpdateIncomingHeals()
end
function UnitFrame:UNIT_MAXHEALTH()
@@ -513,6 +519,15 @@ function UnitFrame:UNIT_MAXHEALTH()
end
self:UpdateHealth()
self:UpdateHealthColor()
self:UpdateIncomingHeals()
end
function UnitFrame:UNIT_HEAL_PREDICTION()
if self:HasUnitChanged() then
self:UpdateAll(true)
return
end
self:UpdateIncomingHeals()
end
function UnitFrame:UNIT_TARGET()
@@ -537,10 +552,20 @@ function UnitFrame:UNIT_POWER_UPDATE()
self:UpdatePower()
end
function UnitFrame:UpdateRole(role)
function UnitFrame:GetRole(role)
if role == nil then
role = UnitGroupRolesAssigned(self.unit)
end
if GetPartyAssignment("MAINTANK", self.unit) then
role = "TANK"
end
return role
end
function UnitFrame:UpdateRole(role)
role = self:GetRole(role)
if role == "HEALER" then
self:EnablePower(Enum.PowerType.Mana)
elseif role == "TANK" and select(3, UnitClass(self.unit)) == 6 then
@@ -593,6 +618,7 @@ function UnitFrame:UpdateAll(unitChanged)
end
self:UpdateHealth()
self:UpdateHealthColor()
self:UpdateIncomingHeals()
self:UpdateAbsorb()
self:UpdateShield()
self:UpdateRange()
@@ -690,3 +716,21 @@ function UnitFrame:UpdateName()
end
self.name:SetText(utf8_truncate((UnitName(self.unit)), 5))
end
function UnitFrame:UpdateIncomingHeals()
local incoming = UnitGetIncomingHeals(self.unit) or 0
local health = UnitHealth(self.unit)
local maxHealth = UnitHealthMax(self.unit)
incoming = math.min(incoming, maxHealth - health)
if incoming <= 0 then
self.incomingHeals:Hide()
else
local r, g, b = self.hp:GetColor()
self.incomingHeals:SetColor(r, g, b)
self.incomingHeals:SetAlpha(0.4)
self.incomingHeals:SetRange(0, maxHealth)
self.incomingHeals:SetValue(incoming)
self.incomingHeals:Show()
end
end
+2 -2
View File
@@ -53,8 +53,8 @@ local function UnitFrameDefaultCompare(lhs, rhs)
end
-- tank < healer < damage < ?
local lrole = RoleValue(UnitGroupRolesAssigned(lunit))
local rrole = RoleValue(UnitGroupRolesAssigned(runit))
local lrole = RoleValue(lhs:GetRole())
local rrole = RoleValue(rhs:GetRole())
if lrole ~= rrole then
return lrole < rrole