From 2a39ef63022a714653c3f92edeb9da754119cc1e Mon Sep 17 00:00:00 2001 From: Buds Date: Fri, 29 Sep 2023 03:25:09 +0200 Subject: [PATCH] Fix remaining time condition with modRate < 1 If modRate is > 1 (time is slow down) checks at L151, L377 & L383 may skip the reschedule --- WeakAuras/Conditions.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index dbf8846a2d..8fb4be86af 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -371,9 +371,15 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta -- If adding a new condition type, don't forget to adjust the validator in the options code if (cType == "timer" and value) then - recheckCode = " nextTime = state[" .. trigger .. "] and not state[" .. trigger .. "].paused" - .. " and state[" .. trigger .. "]" .. string.format("[%q]", variable) - .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n" + if useModRate then + recheckCode = " nextTime = state[" .. trigger .. "] and not state[" .. trigger .. "].paused" + .. " and state[" .. trigger .. "]" .. string.format("[%q]", variable) + .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. " * (state[" .. trigger .. "].modRate or 1.0))\n" + else + recheckCode = " nextTime = state[" .. trigger .. "] and not state[" .. trigger .. "].paused" + .. " and state[" .. trigger .. "]" .. string.format("[%q]", variable) + .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n" + end recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" recheckCode = recheckCode .. " recheckTime = nextTime\n"; recheckCode = recheckCode .. " end\n"