From 1e749832d202ac94597244f89d207b380a5f506f Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 12 Dec 2016 22:23:43 +0100 Subject: [PATCH] buff: add option to hide blizzard buffs --- modules/buff.lua | 115 ++++++++++++++++++++++++--------------------- modules/config.lua | 2 + modules/gui.lua | 2 + 3 files changed, 66 insertions(+), 53 deletions(-) diff --git a/modules/buff.lua b/modules/buff.lua index 6851ffb4..2f88234c 100644 --- a/modules/buff.lua +++ b/modules/buff.lua @@ -46,66 +46,75 @@ pfUI:RegisterModule("buff", function () TemporaryEnchantFrame:ClearAllPoints() TemporaryEnchantFrame:SetPoint("TOPRIGHT", pfUI.minimap or Minimap, "TOPLEFT", -25,0) - -- weapon enchants - for _,buff in pairs ({TempEnchant1,TempEnchant2}) do - local icon = getglobal(buff:GetName().."Icon") - local border = getglobal(buff:GetName().."Border") - local _, _, mainhand, _, _, offhand = GetWeaponEnchantInfo() - if buff then - pfUI.utils:CreateBackdrop(buff) - icon:SetTexCoord(.08, .92, .08, .92) - border:Hide() - end - - if buff:GetID() == 16 then - local link = GetInventoryItemLink("player", 16) - if not link then break end - local _, _, itemLink = string.find(link, "(item:%d+:%d+:%d+:%d+)") - local _, _, itemRarity, itemLevel, _, _, _, itemEquipLoc, _ = GetItemInfo(itemLink) - if itemRarity then buff.backdrop:SetBackdropBorderColor(GetItemQualityColor(itemRarity)) end - - if mainhand and mainhand > 0 then - buff.stacks:SetText(mainhand) - buff.stacks:Show() - else - buff.stacks:Hide() + if pfUI_config.global.hidewbuff == "1" then + TemporaryEnchantFrame:Hide() + BuffFrame:SetPoint("TOPRIGHT", pfUI.minimap or Minimap, "TOPLEFT", -25,0) + else + -- weapon enchants + for _,buff in pairs ({TempEnchant1,TempEnchant2}) do + local icon = getglobal(buff:GetName().."Icon") + local border = getglobal(buff:GetName().."Border") + local _, _, mainhand, _, _, offhand = GetWeaponEnchantInfo() + if buff then + pfUI.utils:CreateBackdrop(buff) + icon:SetTexCoord(.08, .92, .08, .92) + border:Hide() end - elseif buff:GetID() == 17 then - local link = GetInventoryItemLink("player", 17) - if not link then break end - local _, _, itemLink = string.find(link, "(item:%d+:%d+:%d+:%d+)") - local _, _, itemRarity, itemLevel, _, _, _, itemEquipLoc, _ = GetItemInfo(itemLink) - if itemRarity then buff.backdrop:SetBackdropBorderColor(GetItemQualityColor(itemRarity)) end - if offhand and offhand > 0 then - buff.stacks:SetText(offhand) - buff.stacks:Show() - else - buff.stacks:Hide() + + if buff:GetID() == 16 then + local link = GetInventoryItemLink("player", 16) + if not link then break end + local _, _, itemLink = string.find(link, "(item:%d+:%d+:%d+:%d+)") + local _, _, itemRarity, itemLevel, _, _, _, itemEquipLoc, _ = GetItemInfo(itemLink) + if itemRarity then buff.backdrop:SetBackdropBorderColor(GetItemQualityColor(itemRarity)) end + + if mainhand and mainhand > 0 then + buff.stacks:SetText(mainhand) + buff.stacks:Show() + else + buff.stacks:Hide() + end + elseif buff:GetID() == 17 then + local link = GetInventoryItemLink("player", 17) + if not link then break end + local _, _, itemLink = string.find(link, "(item:%d+:%d+:%d+:%d+)") + local _, _, itemRarity, itemLevel, _, _, _, itemEquipLoc, _ = GetItemInfo(itemLink) + if itemRarity then buff.backdrop:SetBackdropBorderColor(GetItemQualityColor(itemRarity)) end + if offhand and offhand > 0 then + buff.stacks:SetText(offhand) + buff.stacks:Show() + else + buff.stacks:Hide() + end end end end - -- buffs - for i=0,32 do - local buff = getglobal("BuffButton" .. i) - if buff then - local icon = getglobal(buff:GetName().."Icon") - local border = getglobal(buff:GetName().."Border") - local text = getglobal(buff:GetName().."Duration") + if pfUI_config.global.hidebuff == "1" then + BuffFrame:Hide() + else + -- buffs + for i=0,32 do + local buff = getglobal("BuffButton" .. i) + if buff then + local icon = getglobal(buff:GetName().."Icon") + local border = getglobal(buff:GetName().."Border") + local text = getglobal(buff:GetName().."Duration") - if i < 8 and i > 0 then - buff:SetPoint("TOPRIGHT", getglobal("BuffButton" .. i-1), "TOPLEFT", -7, 0) - elseif i < 16 and i > 8 then + if i < 8 and i > 0 then buff:SetPoint("TOPRIGHT", getglobal("BuffButton" .. i-1), "TOPLEFT", -7, 0) - elseif i > 16 then - buff:SetPoint("TOPRIGHT", getglobal("BuffButton" .. i-1), "TOPLEFT", -7, 0) - end - pfUI.utils:CreateBackdrop(buff) - text:SetPoint("TOP", buff, "BOTTOM", 0 , -pfUI_config.appearance.border.default*2) - icon:SetTexCoord(.08, .92, .08, .92) - if border then - buff.backdrop:SetBackdropBorderColor(border:GetVertexColor()) - border:Hide() + elseif i < 16 and i > 8 then + buff:SetPoint("TOPRIGHT", getglobal("BuffButton" .. i-1), "TOPLEFT", -7, 0) + elseif i > 16 then + buff:SetPoint("TOPRIGHT", getglobal("BuffButton" .. i-1), "TOPLEFT", -7, 0) + end + pfUI.utils:CreateBackdrop(buff) + text:SetPoint("TOP", buff, "BOTTOM", 0 , -pfUI_config.appearance.border.default*2) + icon:SetTexCoord(.08, .92, .08, .92) + if border then + buff.backdrop:SetBackdropBorderColor(border:GetVertexColor()) + border:Hide() + end end end end diff --git a/modules/config.lua b/modules/config.lua index c3ba51d6..d15f563c 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -10,6 +10,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("global", nil, "font_combat", "diediedie") pfUI:UpdateConfig("global", nil, "errors_limit", "1") 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") diff --git a/modules/gui.lua b/modules/gui.lua index 3cad3d22..29daf40c 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -657,6 +657,8 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.global, "Combat Font", pfUI_config.global, "font_combat", "dropdown", values) pfUI.gui:CreateConfig(pfUI.gui.global, "Limit UIErrors to one line", pfUI_config.global, "errors_limit", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.global, "Disable UIErrors", pfUI_config.global, "errors_hide", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.global, "Hide Buffs", pfUI_config.global, "hidebuff", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.global, "Hide Weapon Buffs", pfUI_config.global, "hidewbuff", "checkbox") -- appearance pfUI.gui.appearance = pfUI.gui:CreateConfigTab("Appearance")