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
+12 -9
View File
@@ -541,16 +541,19 @@ libpredict.sender:SetScript("OnEvent", function()
end
end)
function libpredict:getHoTTime(unit, spell)
if unit == UNKNOWNOBJECT or unit == UNKOWNBEING then
return
end
local dbUnit = hots[UnitName(unit)]
if dbUnit and dbUnit[spell] and (dbUnit[spell].start + dbUnit[spell].duration) > GetTime() then
return dbUnit[spell].start, dbUnit[spell].duration
else
return
function libpredict:GetHotDuration(unit, spell)
if unit == UNKNOWNOBJECT or unit == UNKOWNBEING then return end
local start, duration, timeleft
local unitdata = hots[UnitName(unit)]
if unitdata and unitdata[spell] and (unitdata[spell].start + unitdata[spell].duration) > GetTime() - 1 then
start = unitdata[spell].start
duration = unitdata[spell].duration
timeleft = (start + duration) - GetTime()
end
return start, duration, timeleft
end
pfUI.api.libpredict = libpredict