diff --git a/img/glow.tga b/img/glow.tga new file mode 100644 index 00000000..abf6b818 Binary files /dev/null and b/img/glow.tga differ diff --git a/img/glow2.tga b/img/glow2.tga new file mode 100644 index 00000000..c40b8850 Binary files /dev/null and b/img/glow2.tga differ diff --git a/modules/config.lua b/modules/config.lua index 9f077cbe..ca816ceb 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -12,6 +12,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("global", nil, "errors_hide", "0") pfUI:UpdateConfig("global", nil, "hidebuff", "0") pfUI:UpdateConfig("global", nil, "hidewbuff", "0") + pfUI:UpdateConfig("appearance", "border", "background", "0,0,0,1") pfUI:UpdateConfig("appearance", "border", "color", "0.3,0.3,0.3,1") pfUI:UpdateConfig("appearance", "border", "default", "3") @@ -29,6 +30,9 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8") pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8") pfUI:UpdateConfig("appearance", "loot", "autoresize", "1") + pfUI:UpdateConfig("appearance", "infight", "screen", "0") + pfUI:UpdateConfig("appearance", "infight", "common", "1") + pfUI:UpdateConfig("appearance", "infight", "group", "0") pfUI:UpdateConfig("unitframes", nil, "disable", "0") pfUI:UpdateConfig("unitframes", nil, "pastel", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 522af02d..b52c33f2 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -688,7 +688,10 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.appearance, "Cooldown text threshold", pfUI_config.appearance.cd, "threshold") pfUI.gui:CreateConfig(pfUI.gui.appearance, "Castbar color", pfUI_config.appearance.castbar, "castbarcolor", "color") pfUI.gui:CreateConfig(pfUI.gui.appearance, "Castbar color (Channeling)", pfUI_config.appearance.castbar, "channelcolor", "color") - pfUI.gui:CreateConfig(pfUI.gui.appearance, "Auto-resize Lootframe)", pfUI_config.appearance.loot, "autoresize", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.appearance, "Auto-resize Lootframe", pfUI_config.appearance.loot, "autoresize", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on screen edges", pfUI_config.appearance.infight, "screen", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on common unit frames", pfUI_config.appearance.infight, "common", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.appearance, "Show combat glow effect on group frames", pfUI_config.appearance.infight, "group", "checkbox") -- modules pfUI.gui.modules = pfUI.gui:CreateConfigTab("Modules") diff --git a/modules/infight.lua b/modules/infight.lua new file mode 100644 index 00000000..35b33783 --- /dev/null +++ b/modules/infight.lua @@ -0,0 +1,88 @@ +pfUI:RegisterModule("loot", function () + local default_border = pfUI_config.appearance.border.default + if pfUI_config.appearance.border.unitframes ~= "-1" then + default_border = pfUI_config.appearance.border.unitframes + end + + -- build the frame + pfUI.infight = CreateFrame("Frame", "pfUICombat", UIParent) + + pfUI.infight.backdrop = { + edgeFile = "Interface\\AddOns\\pfUI\\img\\glow", edgeSize = 8, + 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 + pfUI.infight.clock = GetTime() + + if not pfUI.infight.fadeValue then pfUI.infight.fadeValue = 1 end + if pfUI.infight.fadeValue >= 0.3 then + pfUI.infight.fadeModifier = -0.1 + end + if pfUI.infight.fadeValue <= 0 then + pfUI.infight.fadeModifier = 0.1 + 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 pfUI_config.appearance.infight.screen == "1" and pfUI.infight.screen then + if UnitAffectingCombat("player") then + pfUI.infight.screen:Show() + pfUI.infight.screen:SetBackdropBorderColor(1,0.2+pfUI.infight.fadeValue, pfUI.infight.fadeValue, 1-pfUI.infight.fadeValue); + else + pfUI.infight.screen:Hide() + end + end + end + end) + + if pfUI_config.appearance.infight.screen == "1" then + pfUI.infight.screen = CreateFrame("Frame", "pfUICombatScreen", UIParent) + pfUI.infight.screen:SetFrameStrata("BACKGROUND") + pfUI.infight.screen:SetBackdrop(pfUI.infight.backdrop) + pfUI.infight.screen:SetAllPoints(WorldFrame) + pfUI.infight.screen:Hide() + end + + if pfUI_config.appearance.infight.common == "1" then + pfUI.infight:CreateGlow("player") + pfUI.infight:CreateGlow("target") + pfUI.infight:CreateGlow("targettarget") + pfUI.infight:CreateGlow("pet") + end + + if pfUI_config.appearance.infight.group == "1" then + for i=1,4 do + pfUI.infight:CreateGlow("party" .. i, getglobal("pfGroup" .. i)) + end + end +end) diff --git a/pfUI.toc b/pfUI.toc index fda967b2..d8b0d54c 100644 --- a/pfUI.toc +++ b/pfUI.toc @@ -51,3 +51,4 @@ modules\thirdparty.lua modules\buff.lua modules\nameplates.lua modules\loot.lua +modules\infight.lua