libpredict: calculate timeleft in GetHotDuration

This commit is contained in:
shagu
2024-11-04 15:19:40 +01:00
parent 3d3e550ee0
commit 4cec209e4d
2 changed files with 19 additions and 25 deletions
+7 -16
View File
@@ -1739,28 +1739,19 @@ function pfUI.uf:RefreshUnit(unit, component)
-- match filter
for _, filter in pairs(unit.indicators) do
if filter == string.lower(texture) then
if string.lower(texture) == "interface\\icons\\spell_nature_rejuvenation" then --I'd like to do all 3 hots in one if statement later. TODO: check TBC compatibility
local start, duration = libpredict:getHoTTime(unitstr, "Reju") --get rejuv start and runtime
if start and duration then --show the buff even if time is unknown, important as pfUI seems to see the buff before healcomm/libpredict processing is done
timeleft = (start + duration) - GetTime()
end
pfUI.uf:AddIcon(unit, pos, texture, timeleft, count)
if string.lower(texture) == "interface\\icons\\spell_nature_rejuvenation" then
local start, duration, prediction = libpredict:GetHotDuration(unitstr, "Reju")
pfUI.uf:AddIcon(unit, pos, texture, timeleft or prediction, count)
pos = pos + 1
break
elseif string.lower(texture) == "interface\\icons\\spell_holy_renew" then
local start, duration = libpredict:getHoTTime(unitstr, "Renew")
if start and duration then
timeleft = (start + duration) - GetTime()
end
pfUI.uf:AddIcon(unit, pos, texture, timeleft, count)
local start, duration, prediction = libpredict:GetHotDuration(unitstr, "Renew")
pfUI.uf:AddIcon(unit, pos, texture, timeleft or prediction, count)
pos = pos + 1
break
elseif string.lower(texture) == "interface\\icons\\spell_nature_resistnature" then
local start, duration = libpredict:getHoTTime(unitstr, "Regr")
if start and duration then
timeleft = (start + duration) - GetTime()
end
pfUI.uf:AddIcon(unit, pos, texture, timeleft, count)
local start, duration, prediction = libpredict:GetHotDuration(unitstr, "Regr")
pfUI.uf:AddIcon(unit, pos, texture, timeleft or prediction, count)
pos = pos + 1
break
else