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
+5
View File
@@ -409,6 +409,11 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", unit, "alpha_visible", "1")
pfUI:UpdateConfig("unitframes", unit, "alpha_outrange", ".50")
pfUI:UpdateConfig("unitframes", unit, "alpha_offline", ".25")
pfUI:UpdateConfig("unitframes", unit, "squareaggro", "0")
pfUI:UpdateConfig("unitframes", unit, "squarecombat", "0")
pfUI:UpdateConfig("unitframes", unit, "squaresize", "8")
pfUI:UpdateConfig("unitframes", unit, "squarepos", "TOPLEFT")
pfUI:UpdateConfig("unitframes", unit, "glowaggro", "1")
pfUI:UpdateConfig("unitframes", unit, "glowcombat", "1")
pfUI:UpdateConfig("unitframes", unit, "showtooltip", "1")
+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")
+7 -1
View File
@@ -1696,7 +1696,13 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U[c], T["Show Timer Text"], C.unitframes[c], "cooldown_text", "checkbox")
CreateConfig(U[c], T["Show Timer Animation"], C.unitframes[c], "cooldown_anim", "checkbox")
CreateConfig(U[c], T["Indicators"], nil, nil, "header")
CreateConfig(U[c], T["Combat/Aggro Indicators"], nil, nil, "header")
CreateConfig(U[c], T["Display Aggro Indicator"], C.unitframes[c], "squareaggro", "checkbox")
CreateConfig(U[c], T["Display Combat Indicator"], C.unitframes[c], "squarecombat", "checkbox")
CreateConfig(U[c], T["Indicator Position"], C.unitframes[c], "squarepos", "dropdown", pfUI.gui.dropdowns.positions)
CreateConfig(U[c], T["Indicator Size"], C.unitframes[c], "squaresize")
CreateConfig(U[c], T["Buff/Debuff Indicators"], nil, nil, "header")
CreateConfig(U[c], T["Enable Indicators"], C.unitframes[c], "buff_indicator", "checkbox")
CreateConfig(U[c], T["Show Time Left"], C.unitframes[c], "indicator_time", "checkbox")
CreateConfig(U[c], T["Show Stacks"], C.unitframes[c], "indicator_stacks", "checkbox")