diff --git a/api/config.lua b/api/config.lua index d7cb37d6..62b63153 100644 --- a/api/config.lua +++ b/api/config.lua @@ -149,6 +149,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8") pfUI:UpdateConfig("appearance", "castbar", "texture", "Interface\\AddOns\\pfUI\\img\\bar") pfUI:UpdateConfig("appearance", "infight", "screen", "0") + pfUI:UpdateConfig("appearance", "infight", "aggro", "0") + pfUI:UpdateConfig("appearance", "infight", "health", "1") pfUI:UpdateConfig("appearance", "bags", "unusable", "1") pfUI:UpdateConfig("appearance", "bags", "unusable_color", ".9,.2,.2,1") pfUI:UpdateConfig("appearance", "bags", "borderlimit", "1") diff --git a/modules/gui.lua b/modules/gui.lua index feee4bfe..5bf9db93 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1452,6 +1452,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["nameplates"], T["Nameplate Border Size"], C.appearance.border, "nameplates", "dropdown", pfUI.gui.dropdowns.border) CreateConfig(nil) -- spacer CreateConfig(U["infight"], T["Enable Combat Glow Effects On Screen Edges"], C.appearance.infight, "screen", "checkbox") + CreateConfig(U["infight"], T["Enable Aggro Glow Effects On Screen Edges"], C.appearance.infight, "aggro", "checkbox") + CreateConfig(U["infight"], T["Enable Low Health Glow Effects On Screen Edges"], C.appearance.infight, "health", "checkbox") end) CreateGUIEntry(T["Settings"], T["Cooldown"], function() diff --git a/modules/infight.lua b/modules/infight.lua index 993cad7e..f40d51a8 100644 --- a/modules/infight.lua +++ b/modules/infight.lua @@ -1,6 +1,6 @@ pfUI:RegisterModule("infight", "vanilla:tbc", function () local function OnUpdate() - if this.mode == 0 then return end + if not this.infight and not this.aggro and not this.health then return end if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end if not this.fadeValue then this.fadeValue = 1 end @@ -12,13 +12,17 @@ pfUI:RegisterModule("infight", "vanilla:tbc", function () end this.fadeValue = this.fadeValue + this.fadeModifier - if C.appearance.infight.screen == "1" and this.screen then - if UnitAffectingCombat("player") then - this.screen:Show() - this.screen:SetBackdropBorderColor(1,0.2+this.fadeValue, this.fadeValue, 1-this.fadeValue); - else - this.screen:Hide() - end + local visible = nil + if this.infight and UnitAffectingCombat("player") then visible = true end + if this.aggro and UnitHasAggro("player") > 0 then visible = true end + if this.health and UnitHealth("player")/UnitHealthMax("player")*100 <= 25 then visible = true end + if UnitIsDeadOrGhost("player") then visible = nil end + + if visible then + this.screen:Show() + this.screen:SetBackdropBorderColor(1,0.2+this.fadeValue, this.fadeValue, 1-this.fadeValue) + else + this.screen:Hide() end end @@ -35,7 +39,10 @@ pfUI:RegisterModule("infight", "vanilla:tbc", function () pfUI.infight.screen:Hide() pfUI.infight.UpdateConfig = function(self) - pfUI.infight.mode = tonumber(C.appearance.infight.screen) + pfUI.infight.infight = C.appearance.infight.screen == "1" and true or nil + pfUI.infight.aggro = C.appearance.infight.aggro == "1" and true or nil + pfUI.infight.health = C.appearance.infight.health == "1" and true or nil + pfUI.infight.screen:Hide() end pfUI.infight.UpdateConfig()