mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-29 18:56:02 +00:00
unitframes: include aggro and combat glow
This commit is contained in:
+42
-2
@@ -63,8 +63,6 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8")
|
||||
pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8")
|
||||
pfUI:UpdateConfig("appearance", "infight", "screen", "0")
|
||||
pfUI:UpdateConfig("appearance", "infight", "common", "1")
|
||||
pfUI:UpdateConfig("appearance", "infight", "group", "0")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1")
|
||||
pfUI:UpdateConfig("appearance", "bags", "borderonlygear", "0")
|
||||
pfUI:UpdateConfig("appearance", "minimap", "mouseoverzone", "0")
|
||||
@@ -130,6 +128,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "player", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "player", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "player", "powercolor", "1")
|
||||
@@ -169,6 +169,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "target", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "target", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "target", "powercolor", "1")
|
||||
@@ -205,6 +207,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "focus", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "focus", "powercolor", "1")
|
||||
@@ -240,6 +244,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "group", "debuff_indicator", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "faderange", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "glowcombat", "0")
|
||||
pfUI:UpdateConfig("unitframes", "group", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "group", "powercolor", "1")
|
||||
@@ -276,6 +282,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "faderange", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "glowcombat", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouptarget", "powercolor", "1")
|
||||
@@ -311,6 +319,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "faderange", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "glowcombat", "0")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "grouppet", "powercolor", "1")
|
||||
@@ -346,6 +356,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "raid", "debuff_indicator", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "faderange", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "glowcombat", "0")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "raid", "powercolor", "1")
|
||||
@@ -381,6 +393,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "ttarget", "powercolor", "1")
|
||||
@@ -416,6 +430,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "pet", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "pet", "powercolor", "1")
|
||||
@@ -451,6 +467,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "debuff_indicator", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "clickcast", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "faderange", "0")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "glowaggro", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "glowcombat", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "showtooltip", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "healthcolor", "1")
|
||||
pfUI:UpdateConfig("unitframes", "fallback", "powercolor", "1")
|
||||
@@ -757,5 +775,27 @@ function pfUI:MigrateConfig()
|
||||
end
|
||||
end
|
||||
|
||||
-- migrating glow settings (> 3.5.1)
|
||||
if checkversion(3, 5, 0) then
|
||||
local common = { "player", "target", "ttarget", "pet" }
|
||||
for _, unitframe in pairs(common) do
|
||||
if pfUI_config.appearance.infight.group == "1" then
|
||||
pfUI_config.unitframes[unitframe].glowcombat = "1"
|
||||
pfUI_config.unitframes[unitframe].glowaggro = "1"
|
||||
else
|
||||
pfUI_config.unitframes[unitframe].glowcombat = "0"
|
||||
pfUI_config.unitframes[unitframe].glowaggro = "0"
|
||||
end
|
||||
end
|
||||
|
||||
if pfUI_config.appearance.infight.group == "1" then
|
||||
pfUI_config.unitframes["group"].glowcombat = "1"
|
||||
pfUI_config.unitframes["group"].glowaggro = "1"
|
||||
else
|
||||
pfUI_config.unitframes["group"].glowcombat = "0"
|
||||
pfUI_config.unitframes["group"].glowaggro = "0"
|
||||
end
|
||||
end
|
||||
|
||||
pfUI_config.version = pfUI.version.string
|
||||
end
|
||||
|
||||
+60
-1
@@ -39,6 +39,24 @@ function pfUI.api.UnitHasAggro(unit)
|
||||
return aggrodata[unit] and aggrodata[unit].state or 0
|
||||
end
|
||||
|
||||
pfUI.uf.glow = CreateFrame("Frame")
|
||||
pfUI.uf.glow:SetScript("OnUpdate", function()
|
||||
local fpsmod = GetFramerate() / 30
|
||||
if not this.val or this.val >= .9 then
|
||||
this.mod = -0.01 / fpsmod
|
||||
elseif this.val <= .6 then
|
||||
this.mod = 0.01 / fpsmod
|
||||
end
|
||||
this.val = this.val + this.mod
|
||||
end)
|
||||
|
||||
pfUI.uf.glow.mod = 0
|
||||
pfUI.uf.glow.val = 0
|
||||
|
||||
function pfUI.uf.glow.UpdateGlowAnimation()
|
||||
this:SetAlpha(pfUI.uf.glow.val)
|
||||
end
|
||||
|
||||
function pfUI.uf:UpdateFrameSize()
|
||||
local default_border = pfUI_config.appearance.border.default
|
||||
if pfUI_config.appearance.border.unitframes ~= "-1" then
|
||||
@@ -86,6 +104,17 @@ function pfUI.uf:UpdateConfig()
|
||||
if tonumber(f.config.height) < 0 then f.hp:Hide() end
|
||||
pfUI.api.CreateBackdrop(f.hp, default_border)
|
||||
|
||||
f.hp.glow:SetFrameStrata("BACKGROUND")
|
||||
f.hp.glow:SetFrameLevel(0)
|
||||
f.hp.glow:SetBackdrop({
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\glow2", edgeSize = 8,
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
||||
})
|
||||
f.hp.glow:SetPoint("TOPLEFT", f.hp, "TOPLEFT", -6 - default_border,6 + default_border)
|
||||
f.hp.glow:SetPoint("BOTTOMRIGHT", f.hp, "BOTTOMRIGHT", 6 + default_border,-6 - default_border)
|
||||
f.hp.glow:SetScript("OnUpdate", pfUI.uf.glow.UpdateGlowAnimation)
|
||||
f.hp.glow:Hide()
|
||||
|
||||
f.hp.bar:SetStatusBarTexture(f.config.bartexture)
|
||||
f.hp.bar:SetAllPoints(f.hp)
|
||||
if f.config.verticalbar == "1" then
|
||||
@@ -110,6 +139,17 @@ function pfUI.uf:UpdateConfig()
|
||||
f.power.bar:SetStatusBarTexture(f.config.bartexture)
|
||||
f.power.bar:SetAllPoints(f.power)
|
||||
|
||||
f.power.glow:SetFrameStrata("BACKGROUND")
|
||||
f.power.glow:SetFrameLevel(0)
|
||||
f.power.glow:SetBackdrop({
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\glow2", edgeSize = 8,
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
||||
})
|
||||
f.power.glow:SetPoint("TOPLEFT", f.power, "TOPLEFT", -6 - default_border,6 + default_border)
|
||||
f.power.glow:SetPoint("BOTTOMRIGHT", f.power, "BOTTOMRIGHT", 6 + default_border,-6 - default_border)
|
||||
f.power.glow:SetScript("OnUpdate", pfUI.uf.glow.UpdateGlowAnimation)
|
||||
f.power.glow:Hide()
|
||||
|
||||
f.portrait:SetFrameStrata("LOW")
|
||||
f.portrait.tex:SetAllPoints(f.portrait)
|
||||
f.portrait.tex:SetTexCoord(.1, .9, .1, .9)
|
||||
@@ -249,7 +289,6 @@ function pfUI.uf:UpdateConfig()
|
||||
f.lootIcon:SetWidth(10)
|
||||
f.lootIcon:SetHeight(10)
|
||||
f.lootIcon:SetPoint("CENTER", f, "LEFT", 0, 0)
|
||||
|
||||
f.lootIcon.texture:SetTexture("Interface\\GROUPFRAME\\UI-Group-MasterLooter")
|
||||
f.lootIcon.texture:SetAllPoints(f.lootIcon)
|
||||
f.lootIcon:Hide()
|
||||
@@ -511,6 +550,23 @@ function pfUI.uf:EnableScripts()
|
||||
this.lastTick = GetTime() + (this.tick or .2)
|
||||
pfUI.uf:RefreshUnitState(this)
|
||||
|
||||
if this.config.glowaggro == "1" and pfUI.api.UnitHasAggro(this.label .. this.id) > 0 then
|
||||
this.hp.glow:SetBackdropBorderColor(1,.2,0)
|
||||
this.power.glow:SetBackdropBorderColor(1,.2,0)
|
||||
this.hp.glow:Show()
|
||||
this.power.glow:Show()
|
||||
elseif this.config.glowcombat == "1" and UnitAffectingCombat(this.label .. this.id) then
|
||||
this.hp.glow:SetBackdropBorderColor(1,1,.2)
|
||||
this.power.glow:SetBackdropBorderColor(1,1,.2)
|
||||
this.hp.glow:Show()
|
||||
this.power.glow:Show()
|
||||
else
|
||||
this.hp.glow:SetBackdropBorderColor(1,1,1)
|
||||
this.power.glow:SetBackdropBorderColor(1,1,1)
|
||||
this.hp.glow:Hide()
|
||||
this.power.glow:Hide()
|
||||
end
|
||||
|
||||
-- update everything on eventless frames (targettarget, etc)
|
||||
if this.tick then
|
||||
pfUI.uf:RefreshUnit(this, "all")
|
||||
@@ -580,9 +636,12 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
|
||||
end
|
||||
|
||||
f.hp = CreateFrame("Frame",nil, f)
|
||||
f.hp.glow = CreateFrame("Frame", nil, f.hp)
|
||||
f.hp.bar = CreateFrame("StatusBar", nil, f.hp)
|
||||
f.power = CreateFrame("Frame",nil, f)
|
||||
f.power.glow = CreateFrame("Frame", nil, f.power)
|
||||
f.power.bar = CreateFrame("StatusBar", nil, f.power)
|
||||
|
||||
f.hpLeftText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall")
|
||||
f.hpRightText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall")
|
||||
f.hpCenterText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall")
|
||||
|
||||
@@ -819,6 +819,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
CreateConfig(update[c], this, T["Enable Mouseover Tooltip"], C.unitframes[c], "showtooltip", "checkbox")
|
||||
CreateConfig(update[c], this, T["Enable Clickcast"], C.unitframes[c], "clickcast", "checkbox")
|
||||
CreateConfig(update[c], this, T["Enable Range Fading"], C.unitframes[c], "faderange", "checkbox")
|
||||
CreateConfig(update[c], this, T["Enable Aggro Glow"], C.unitframes[c], "glowaggro")
|
||||
CreateConfig(update[c], this, T["Enable Combat Glow"], C.unitframes[c], "glowcombat")
|
||||
CreateConfig(update[c], this, T["Portrait Position"], C.unitframes[c], "portrait", "dropdown", pfUI.gui.dropdowns.uf_portrait_position)
|
||||
CreateConfig(update[c], this, T["Status Bar Texture"], C.unitframes[c], "bartexture", "dropdown", pfUI.gui.dropdowns.uf_bartexture)
|
||||
CreateConfig(update[c], this, T["UnitFrame Spacing"], C.unitframes[c], "pspace")
|
||||
|
||||
@@ -12,25 +12,6 @@ pfUI:RegisterModule("infight", function ()
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
||||
}
|
||||
|
||||
pfUI.infight.backdrop_outline = {
|
||||
edgeFile = "Interface\\AddOns\\pfUI\\img\\glow2", edgeSize = 8,
|
||||
insets = {left = 0, right = 0, top = 0, bottom = 0},
|
||||
}
|
||||
|
||||
pfUI.infight.elements = {}
|
||||
|
||||
function pfUI.infight:CreateGlow(unit, frame)
|
||||
local anchor = pfUI.uf[unit]
|
||||
if not pfUI.uf[unit] then anchor = frame end
|
||||
pfUI.infight[unit] = CreateFrame("Frame", "pfUICombat" .. unit, anchor)
|
||||
pfUI.infight[unit]:SetFrameStrata("BACKGROUND")
|
||||
pfUI.infight[unit]:SetBackdrop(pfUI.infight.backdrop_outline)
|
||||
pfUI.infight[unit]:SetPoint("TOPLEFT", anchor, "TOPLEFT", -7 - default_border,7 + default_border)
|
||||
pfUI.infight[unit]:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 7 + default_border,-7 - default_border)
|
||||
pfUI.infight[unit]:Hide()
|
||||
table.insert(pfUI.infight.elements, unit)
|
||||
end
|
||||
|
||||
pfUI.infight:SetScript("OnUpdate",function(s,e)
|
||||
if not pfUI.infight.clock then pfUI.infight.clock = GetTime() -0.1 end
|
||||
if GetTime() >= pfUI.infight.clock + 0.1 then
|
||||
@@ -45,15 +26,6 @@ pfUI:RegisterModule("infight", function ()
|
||||
end
|
||||
pfUI.infight.fadeValue = pfUI.infight.fadeValue + pfUI.infight.fadeModifier
|
||||
|
||||
for _,unit in pairs (pfUI.infight.elements) do
|
||||
if UnitAffectingCombat(unit) then
|
||||
pfUI.infight[unit]:Show()
|
||||
pfUI.infight[unit]:SetBackdropBorderColor(1,0.2+pfUI.infight.fadeValue, pfUI.infight.fadeValue, 1-pfUI.infight.fadeValue);
|
||||
else
|
||||
pfUI.infight[unit]:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if C.appearance.infight.screen == "1" and pfUI.infight.screen then
|
||||
if UnitAffectingCombat("player") then
|
||||
pfUI.infight.screen:Show()
|
||||
@@ -72,28 +44,4 @@ pfUI:RegisterModule("infight", function ()
|
||||
pfUI.infight.screen:SetAllPoints(WorldFrame)
|
||||
pfUI.infight.screen:Hide()
|
||||
end
|
||||
|
||||
if C.appearance.infight.common == "1" then
|
||||
if pfUI.uf.player and pfUI.uf.player:IsShown() then
|
||||
pfUI.infight:CreateGlow("player")
|
||||
end
|
||||
|
||||
if pfUI.uf.target and pfUI.uf.target:IsShown() then
|
||||
pfUI.infight:CreateGlow("target")
|
||||
end
|
||||
|
||||
if pfUI.uf.targettarget and pfUI.uf.targettarget:IsShown() then
|
||||
pfUI.infight:CreateGlow("targettarget")
|
||||
end
|
||||
|
||||
if pfUI.uf.pet and pfUI.uf.pet:IsShown() then
|
||||
pfUI.infight:CreateGlow("pet")
|
||||
end
|
||||
end
|
||||
|
||||
if C.appearance.infight.group == "1" then
|
||||
for i=1,4 do
|
||||
pfUI.infight:CreateGlow("party" .. i, _G["pfGroup" .. i])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user