unitframes: display duration for own buffs on tbc

This commit is contained in:
shagu
2019-11-24 13:15:33 +01:00
parent 298d0d89ce
commit 59f9b5c0ba
+11 -1
View File
@@ -15,11 +15,19 @@ local glow2 = {
}
local function BuffOnUpdate()
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .4 end
local timeleft = GetPlayerBuffTimeLeft(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,"HELPFUL"))
CooldownFrame_SetTimer(this.cd, GetTime(), timeleft, 1)
end
local function TargetBuffOnUpdate()
local name, rank, icon, count, duration, timeleft = _G.UnitBuff("target", this.id)
if duration and timeleft then
CooldownFrame_SetTimer(this.cd, GetTime() + timeleft - duration, duration, 1)
else
CooldownFrame_SetTimer(this.cd, 0, 0, 0)
end
end
local function BuffOnEnter()
local parent = this:GetParent()
if not parent.label then return end
@@ -587,6 +595,8 @@ function pfUI.uf:UpdateConfig()
if f:GetName() == "pfPlayer" then
f.buffs[i]:SetScript("OnUpdate", BuffOnUpdate)
elseif f:GetName() == "pfTarget" and pfUI.expansion == "tbc" then
f.buffs[i]:SetScript("OnUpdate", TargetBuffOnUpdate)
end
f.buffs[i]:SetScript("OnEnter", BuffOnEnter)