From 9ddcbc70a27423b7f2336d24588fba57790fa930 Mon Sep 17 00:00:00 2001 From: gallantron Date: Fri, 27 May 2022 20:43:53 +0200 Subject: [PATCH] fix an edge case bug with cooldown scanning; closes #7 --- PallyPower.lua | 20 +++++++++----------- PallyPowerValues.lua | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/PallyPower.lua b/PallyPower.lua index 33d6fa0..d5b6005 100644 --- a/PallyPower.lua +++ b/PallyPower.lua @@ -1300,17 +1300,15 @@ function PallyPower:ScanCooldowns() local CooldownInfo = AllPallys[self.player].CooldownInfo for cd, spells in pairs(self.Cooldowns) do for _, spell in pairs(spells) do - if not CooldownInfo[cd] then - return - end - if GetSpellCooldown(spell) then - CooldownInfo[cd].start = GetSpellCooldown(spell) - CooldownInfo[cd].duration = select(2, GetSpellCooldown(spell)) - CooldownInfo[cd].remaining = CooldownInfo[cd].start + CooldownInfo[cd].duration - GetTime() - if CooldownInfo[cd].remaining < 0 then - CooldownInfo[cd].remaining = 0 - end - end + if CooldownInfo[cd] then + local start, duration = GetSpellCooldown(spell) + if start then + CooldownInfo[cd].start = start + CooldownInfo[cd].duration = duration + CooldownInfo[cd].remaining = math.max(start + duration - GetTime(), 0) + break + end + end end end end diff --git a/PallyPowerValues.lua b/PallyPowerValues.lua index f56d2b8..83848ba 100644 --- a/PallyPowerValues.lua +++ b/PallyPowerValues.lua @@ -332,7 +332,7 @@ PallyPower.Auras = { } PallyPower.Cooldowns = { - [1] = {633, 2800, 10310, 27154}, -- Improved Lay On Hands + [1] = {633, 2800, 10310, 27154}, -- Lay On Hands [2] = {19752}, -- Divine Intervention }