From 9f2920a4a4d1f14f73d0823b744687c0a091d1f4 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 24 Nov 2016 22:07:24 +0100 Subject: [PATCH] raid: show debuffs on raidframes --- modules/config.lua | 2 + modules/gui.lua | 2 + modules/raid.lua | 92 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/modules/config.lua b/modules/config.lua index e146d8a1..370c677b 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -49,6 +49,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", "raid", "buffs_hots", "0") pfUI:UpdateConfig("unitframes", "raid", "buffs_procs", "0") pfUI:UpdateConfig("unitframes", "raid", "buffs_classonly", "0") + pfUI:UpdateConfig("unitframes", "raid", "debuffs_enable", "0") + pfUI:UpdateConfig("unitframes", "raid", "debuffs_class", "0") pfUI:UpdateConfig("bars", nil, "icon_size", "18") pfUI:UpdateConfig("panel", "left", "left", "guild") pfUI:UpdateConfig("panel", "left", "center", "durability") diff --git a/modules/gui.lua b/modules/gui.lua index cffaa906..c6f8a819 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -660,6 +660,8 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.uf, "Show Hots on Raidframes", pfUI_config.unitframes.raid, "buffs_hots", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.uf, "Show Procs on Raidframes", pfUI_config.unitframes.raid, "buffs_procs", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.uf, "Only display Hots of my class", pfUI_config.unitframes.raid, "buffs_classonly", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Show Debuff indicators on Raidframes", pfUI_config.unitframes.raid, "debuffs_enable", "checkbox") + pfUI.gui:CreateConfig(pfUI.gui.uf, "Only display Debuffs for my class", pfUI_config.unitframes.raid, "debuffs_class", "checkbox") -- actionbar pfUI.gui.bar = pfUI.gui:CreateConfigTab("ActionBar") diff --git a/modules/raid.lua b/modules/raid.lua index 344c0b40..23d86ef7 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -45,6 +45,30 @@ pfUI:RegisterModule("raid", function () end end + function pfUI.uf.raid:SetupDebuffFilter() + if pfUI.uf.raid.debuffs then return end + + local _, myclass = UnitClass("player") + pfUI.uf.raid.debuffs = {} + if pfUI_config.unitframes.raid.debuffs_enable == "1" then + if myclass == "PALADIN" or myclass == "PRIEST" or pfUI_config.unitframes.raid.debuffs_class ~= "1" then + table.insert(pfUI.uf.raid.debuffs, "magic") + end + + if myclass == "DRUID" or myclass == "PALADIN" or myclass == "SHAMAN" or pfUI_config.unitframes.raid.debuffs_class ~= "1" then + table.insert(pfUI.uf.raid.debuffs, "poison") + end + + if myclass == "PRIEST" or myclass == "PALADIN" or myclass == "SHAMAN" or pfUI_config.unitframes.raid.debuffs_class ~= "1" then + table.insert(pfUI.uf.raid.debuffs, "disease") + end + + if myclass == "DRUID" or myclass == "MAGE" or pfUI_config.unitframes.raid.debuffs_class ~= "1" then + table.insert(pfUI.uf.raid.debuffs, "curse") + end + end + end + function pfUI.uf.raid:SetupBuffFilter() if pfUI.uf.raid.buffs then return end @@ -138,6 +162,74 @@ pfUI:RegisterModule("raid", function () unit.hp.bar:SetMinMaxValues(0, unit.cache.hpmax) unit.power.bar:SetMinMaxValues(0, unit.cache.powermax) + pfUI.uf.raid:SetupDebuffFilter() + if table.getn(pfUI.uf.raid.debuffs) > 0 then + local infected = false + for i=1,32 do + local _,_,dtype = UnitDebuff("raid" .. unit.id, i) + if dtype then + for _, filter in pairs(pfUI.uf.raid.debuffs) do + if filter == string.lower(dtype) then + if dtype == "Magic" then + if not unit.hp.bar.magic then + unit.hp.bar.magic = CreateFrame("Frame", unit.hp.bar) + unit.hp.bar.magic:SetAllPoints(unit) + unit.hp.bar.magic:SetParent(unit.hp.bar) + unit.hp.bar.magic.tex = unit.hp.bar.magic:CreateTexture("OVERLAY") + unit.hp.bar.magic.tex:SetAllPoints(unit.hp.bar.magic) + unit.hp.bar.magic.tex:SetTexture(.2,.8,.8,.4) + end + unit.hp.bar.magic:Show() + infected = true + + elseif dtype == "Poison" then + if not unit.hp.bar.poison then + unit.hp.bar.poison = CreateFrame("Frame", unit.hp.bar) + unit.hp.bar.poison:SetAllPoints(unit) + unit.hp.bar.poison:SetParent(unit.hp.bar) + unit.hp.bar.poison.tex = unit.hp.bar.poison:CreateTexture("OVERLAY") + unit.hp.bar.poison.tex:SetAllPoints(unit.hp.bar.poison) + unit.hp.bar.poison.tex:SetTexture(.2,.8,.2,.4) + end + unit.hp.bar.poison:Show() + infected = true + + elseif dtype == "Curse" then + if not unit.hp.bar.curse then + unit.hp.bar.curse = CreateFrame("Frame", unit.hp.bar) + unit.hp.bar.curse:SetAllPoints(unit) + unit.hp.bar.curse:SetParent(unit.hp.bar) + unit.hp.bar.curse.tex = unit.hp.bar.curse:CreateTexture("OVERLAY") + unit.hp.bar.curse.tex:SetAllPoints(unit.hp.bar.curse) + unit.hp.bar.curse.tex:SetTexture(.8,.2,.8,.4) + end + unit.hp.bar.curse:Show() + infected = true + + elseif dtype == "Disease" then + if not unit.hp.bar.disease then + unit.hp.bar.disease = CreateFrame("Frame", unit.hp.bar) + unit.hp.bar.disease:SetAllPoints(unit) + unit.hp.bar.disease:SetParent(unit.hp.bar) + unit.hp.bar.disease.tex = unit.hp.bar.disease:CreateTexture("OVERLAY") + unit.hp.bar.disease.tex:SetAllPoints(unit.hp.bar.disease) + unit.hp.bar.disease.tex:SetTexture(.8,.8,.2,.4) + end + unit.hp.bar.disease:Show() + infected = true + end + end + end + end + end + if infected == false then + if unit.hp.bar.magic then unit.hp.bar.magic:Hide() end + if unit.hp.bar.poison then unit.hp.bar.poison:Hide() end + if unit.hp.bar.curse then unit.hp.bar.curse:Hide() end + if unit.hp.bar.disease then unit.hp.bar.disease:Hide() end + end + end + pfUI.uf.raid:SetupBuffFilter() if table.getn(pfUI.uf.raid.buffs) > 0 then local active = {}