unitframes: add aggro and combat indicator

This commit is contained in:
shagu
2020-12-04 15:41:12 +01:00
parent a849f6bd78
commit 8d9a66c68d
3 changed files with 31 additions and 2 deletions
+19 -1
View File
@@ -379,6 +379,12 @@ function pfUI.uf:UpdateConfig()
f.glow:SetScript("OnUpdate", pfUI.uf.glow.UpdateGlowAnimation)
f.glow:Hide()
f.combat:SetWidth(tonumber(f.config.squaresize))
f.combat:SetHeight(tonumber(f.config.squaresize))
f.combat:ClearAllPoints()
f.combat:SetPoint(f.config.squarepos, 0, 0)
f.combat:Hide()
f.hp:ClearAllPoints()
f.hp:SetPoint("TOP", 0, 0)
@@ -929,10 +935,19 @@ function pfUI.uf.OnUpdate()
this.glow:SetBackdropBorderColor(1,1,.2)
this.glow:Show()
else
this.glow:SetBackdropBorderColor(1,1,1)
this.glow:Hide()
end
if this.config.squareaggro == "1" and pfUI.api.UnitHasAggro(this.label .. this.id) > 0 then
this.combat.tex:SetTexture(1,.2,0)
this.combat:Show()
elseif this.config.squarecombat == "1" and UnitAffectingCombat(this.label .. this.id) then
this.combat.tex:SetTexture(1,1,.2)
this.combat:Show()
else
this.combat:Hide()
end
-- update everything on eventless frames (targettarget, etc)
if this.tick then
pfUI.uf:RefreshUnit(this, "all")
@@ -1091,6 +1106,9 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
f.power.bar = CreateStatusBar(nil, f.power)
f.glow = CreateFrame("Frame", nil, f)
f.combat = CreateFrame("Frame", nil, f.hp.bar)
f.combat.tex = f.combat:CreateTexture(nil, "OVERLAY")
f.combat.tex:SetAllPoints()
f.hpLeftText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall")
f.hpRightText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall")