forked from wow/OmicronFrames
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99f3a10ede |
No files matched your search
@@ -90,17 +90,3 @@ 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
|
||||
+4
-48
@@ -97,18 +97,14 @@ function UnitFrame:Init(unit, config)
|
||||
|
||||
self.hp = StatusBar:new(self, width, height, 0, true, texture, texture)
|
||||
|
||||
self.power = StatusBar:new(self, width, 6, 3, false, texture, texture)
|
||||
self.power = StatusBar:new(self, width, 6, 2, false, texture, texture)
|
||||
self.power:Hide()
|
||||
|
||||
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 = StatusBar:new(self, width, height, 1, true, texture_top)
|
||||
self.absorb:SetColor(unpack(colors.absorb))
|
||||
self.absorb:SetFillStyle(Enum.StatusBarFillStyle.Reverse)
|
||||
|
||||
self.shield = StatusBar:new(self, width, height, 2, true, texture_bot)
|
||||
self.shield = StatusBar:new(self, width, height, 1, true, texture_bot)
|
||||
self.shield:SetColor(unpack(colors.shield))
|
||||
self.shield:SetRange(0, 1)
|
||||
self.shield:SetValue(0.6)
|
||||
@@ -448,7 +444,6 @@ 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
|
||||
@@ -509,7 +504,6 @@ function UnitFrame:UNIT_HEALTH()
|
||||
end
|
||||
self:UpdateHealth()
|
||||
self:UpdateHealthColor()
|
||||
self:UpdateIncomingHeals()
|
||||
end
|
||||
|
||||
function UnitFrame:UNIT_MAXHEALTH()
|
||||
@@ -519,15 +513,6 @@ 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()
|
||||
@@ -552,20 +537,10 @@ function UnitFrame:UNIT_POWER_UPDATE()
|
||||
self:UpdatePower()
|
||||
end
|
||||
|
||||
function UnitFrame:GetRole(role)
|
||||
function UnitFrame:UpdateRole(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
|
||||
@@ -618,7 +593,6 @@ function UnitFrame:UpdateAll(unitChanged)
|
||||
end
|
||||
self:UpdateHealth()
|
||||
self:UpdateHealthColor()
|
||||
self:UpdateIncomingHeals()
|
||||
self:UpdateAbsorb()
|
||||
self:UpdateShield()
|
||||
self:UpdateRange()
|
||||
@@ -716,21 +690,3 @@ 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
|
||||
@@ -53,8 +53,8 @@ local function UnitFrameDefaultCompare(lhs, rhs)
|
||||
end
|
||||
|
||||
-- tank < healer < damage < ?
|
||||
local lrole = RoleValue(lhs:GetRole())
|
||||
local rrole = RoleValue(rhs:GetRole())
|
||||
local lrole = RoleValue(UnitGroupRolesAssigned(lunit))
|
||||
local rrole = RoleValue(UnitGroupRolesAssigned(runit))
|
||||
|
||||
if lrole ~= rrole then
|
||||
return lrole < rrole
|
||||
|
||||
Reference in new issue
Block a user