Libraries Update

This commit is contained in:
Tercio Jose
2022-12-19 12:56:38 -03:00
parent 6ef2b67c58
commit bcc968b306
4 changed files with 126 additions and 106 deletions
+8 -7
View File
@@ -701,12 +701,13 @@ end
--@spellId: the spellId to check for cooldown
--return timeLeft, charges, startTimeOffset, duration, buffDuration
function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
--check if is a charge spell
--get the cooldown info from the cooldowns database of the lib
local cooldownInfo = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId]
if (cooldownInfo) then
local buffDuration = getAuraDuration(spellId)
local chargesAvailable, chargesTotal, start, duration = GetSpellCharges(spellId)
if chargesAvailable then
if (chargesAvailable) then
if (chargesAvailable == chargesTotal) then
return 0, chargesTotal, 0, 0, 0 --all charges are ready to use
else
@@ -716,13 +717,13 @@ function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
return ceil(timeLeft), chargesAvailable, startTimeOffset, duration, buffDuration --time left, charges, startTime, duration, buffDuration
end
else
local start, duration = GetSpellCooldown(spellId)
if (start == 0) then --cooldown is ready
local startTime, cooldownDuration = GetSpellCooldown(spellId)
if (startTime == 0) then --cooldown is ready
return 0, 1, 0, 0, 0 --time left, charges, startTime
else
local timeLeft = start + duration - GetTime()
local startTimeOffset = start - GetTime()
return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration
local timeLeft = startTime + cooldownDuration - GetTime()
local startTimeOffset = startTime - GetTime()
return ceil(timeLeft), 0, ceil(startTimeOffset), cooldownDuration, buffDuration --time left, charges, startTime, duration, buffDuration
end
end
else