unitframes: add option for timeleft on indicators

This commit is contained in:
shagu
2020-05-01 20:23:20 +02:00
parent 0f07e2c41f
commit b85f04da4e
3 changed files with 14 additions and 3 deletions
+1
View File
@@ -205,6 +205,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "all_procs", "0")
pfUI:UpdateConfig("unitframes", nil, "debuffs_class", "0")
pfUI:UpdateConfig("unitframes", nil, "indicator_size", "10")
pfUI:UpdateConfig("unitframes", nil, "indicator_time", "1")
pfUI:UpdateConfig("unitframes", nil, "clickcast", "")
pfUI:UpdateConfig("unitframes", nil, "clickcast_shift", "")
+12 -3
View File
@@ -1689,8 +1689,10 @@ function pfUI.uf:ClickAction(button)
end
end
function pfUI.uf:AddIcon(frame, pos, icon, timeleft)
function pfUI.uf:AddIcon(frame, pos, icon, timeleft, stacks)
local showtime = C.unitframes.indicator_time == "1" and true or nil
local iconsize = tonumber(C.unitframes.indicator_size)
if not frame.hp then return end
local frame = frame.hp.bar
if pos > 6 or pos > ceil(frame:GetWidth() / iconsize) then return end
@@ -1711,11 +1713,18 @@ function pfUI.uf:AddIcon(frame, pos, icon, timeleft)
frame.icon[i].cd = CreateFrame(COOLDOWN_FRAME_TYPE, nil, frame.icon[i])
frame.icon[i].cd.pfCooldownType = "ALL"
frame.icon[i].cd:SetAlpha(0)
CreateBackdrop(frame.icon[i], nil, true)
end
end
frame.icon[pos].tex:SetTexture(icon)
CooldownFrame_SetTimer(frame.icon[pos].cd, GetTime(), (timeleft and timeleft < 100 and iconsize > 9 and timeleft or 0), 1)
pfUI.api.CreateBackdrop(frame.icon[pos], nil, true)
-- show remaining time if config is set
if showtime and timeleft and timeleft < 100 and iconsize > 9 then
CooldownFrame_SetTimer(frame.icon[pos].cd, GetTime(), timeleft, 1)
else
CooldownFrame_SetTimer(frame.icon[pos].cd, GetTime(), 0, 1)
end
frame.icon[pos]:Show()
end
+1
View File
@@ -1499,6 +1499,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["Show Procs as Buff Indicators"], C.unitframes, "show_procs", "checkbox")
CreateConfig(nil, T["Show Totems as Buff Indicators"], C.unitframes, "show_totems", "checkbox")
CreateConfig(nil, T["Show Procs of all Classes"], C.unitframes, "all_procs", "checkbox")
CreateConfig(nil, T["Buff Indicator Show Time"], C.unitframes, "indicator_time", "checkbox")
CreateConfig(nil, T["Buff Indicator Size"], C.unitframes, "indicator_size")
CreateConfig(nil, T["Only Show Indicators for Dispellable Debuffs"], C.unitframes, "debuffs_class", "checkbox")