diff --git a/api/config.lua b/api/config.lua index b3a3b3d0..d7cb37d6 100644 --- a/api/config.lua +++ b/api/config.lua @@ -379,6 +379,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("unitframes", unit, "verticalbar", "0") pfUI:UpdateConfig("unitframes", unit, "buff_indicator", "0") pfUI:UpdateConfig("unitframes", unit, "debuff_indicator", "0") + pfUI:UpdateConfig("unitframes", unit, "custom_indicator", "") + pfUI:UpdateConfig("unitframes", unit, "debuff_ind_pos", "CENTER") pfUI:UpdateConfig("unitframes", unit, "debuff_ind_size", ".65") pfUI:UpdateConfig("unitframes", unit, "debuff_ind_class", "1") diff --git a/api/unitframes.lua b/api/unitframes.lua index 1b59a853..d0078357 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -14,6 +14,7 @@ end) pfUI.uf.frames = {} pfUI.uf.delayed = {} +local scanner local glow = { edgeFile = pfUI.media["img:glow"], edgeSize = 8, insets = {left = 0, right = 0, top = 0, bottom = 0}, @@ -332,6 +333,7 @@ function pfUI.uf:UpdateConfig() f.dispellable = nil f.indicators = nil + f.indicator_custom = nil f.alpha_visible = tonumber(f.config.alpha_visible) f.alpha_outrange = tonumber(f.config.alpha_outrange) @@ -1446,6 +1448,15 @@ function pfUI.uf:RefreshUnit(unit, component) unit.indicators = {} end + if not unit.indicator_custom and unit.config.buff_indicator == "1" then + unit.indicator_custom = {} + for k, v in pairs({strsplit("#", unit.config.custom_indicator)}) do + unit.indicator_custom[k] = string.lower(v) + end + elseif not unit.indicator_custom then + unit.indicator_custom = {} + end + local pos = 1 if table.getn(unit.indicators) > 0 then for i=1,32 do @@ -1468,6 +1479,54 @@ function pfUI.uf:RefreshUnit(unit, component) end end + if table.getn(unit.indicator_custom) > 0 then + scanner = scanner or libtipscan:GetScanner("unitframes") + + for i=1,32 do -- scan for custom buffs + local texture, count = UnitBuff(unitstr, i) + if texture then + local timeleft, name, _ + if pfUI.client > 11200 then + name, _, texture, _, _, timeleft = _G.UnitBuff(unitstr, i) + else + scanner:SetUnitBuff(unitstr, i) + name = scanner:Line(1) or "" + end + + -- match filter + for _, filter in pairs(unit.indicator_custom) do + if filter == string.lower(name) then + pfUI.uf:AddIcon(unit, pos, texture, timeleft, count) + pos = pos + 1 + break + end + end + end + end + + for i=1,32 do -- scan for custom debuffs + local texture, count = UnitDebuff(unitstr, i) + if texture then + local timeleft, name, _ + if libdebuff then + name, _, texture, _, _, _, timeleft = libdebuff:UnitDebuff(unitstr, i) + else + scanner:SetUnitDebuff(unitstr, i) + name = scanner:Line(1) or "" + end + + -- match filter + for _, filter in pairs(unit.indicator_custom) do + if filter == string.lower(name) then + pfUI.uf:AddIcon(unit, pos, texture, timeleft, count) + pos = pos + 1 + break + end + end + end + end + end + -- hide unused icon slots for pos=pos, 6 do pfUI.uf:HideIcon(unit, pos) end end diff --git a/modules/gui.lua b/modules/gui.lua index e37f4102..ecc11d27 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1651,6 +1651,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U[c], T["Show Time Left"], C.unitframes[c], "indicator_time", "checkbox") CreateConfig(U[c], T["Show Stacks"], C.unitframes[c], "indicator_stacks", "checkbox") CreateConfig(U[c], T["Indicator Size"], C.unitframes[c], "indicator_size") + CreateConfig(U[c], T["Show Custom Indicators"], C.unitframes[c], "custom_indicator", "list") CreateConfig(U[c], T["Show Buff Indicators"], C.unitframes[c], "show_buffs", "checkbox") CreateConfig(U[c], T["Show Hots Indicators"], C.unitframes[c], "show_hots", "checkbox") CreateConfig(U[c], T["Show Hots of all Classes"], C.unitframes[c], "all_hots", "checkbox")