diff --git a/WeakAuras/Conditions.lua b/WeakAuras/Conditions.lua index dbf8846a2d..768bfd947f 100644 --- a/WeakAuras/Conditions.lua +++ b/WeakAuras/Conditions.lua @@ -144,7 +144,7 @@ function Private.ExecEnv.CancelConditionCheck(uid, cloneId) end end -function Private.ExecEnv.ScheduleConditionCheck(time, uid, cloneId) +function Private.ExecEnv.ScheduleConditionCheck(time, uid, cloneId, modRate) conditionChecksTimers.recheckTime[uid] = conditionChecksTimers.recheckTime[uid] or {} conditionChecksTimers.recheckHandle[uid] = conditionChecksTimers.recheckHandle[uid] or {}; @@ -162,7 +162,7 @@ function Private.ExecEnv.ScheduleConditionCheck(time, uid, cloneId) checkConditions[uid](region); Private.ActivateAuraEnvironment() end - end, time - GetTime()) + end, (time - GetTime()) / (modRate or 1.0)) conditionChecksTimers.recheckTime[uid][cloneId] = time; end end @@ -375,11 +375,13 @@ local function CreateTestForCondition(uid, input, allConditionsTemplate, usedSta .. " and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " - " .. value .. ")\n" recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" + recheckCode = recheckCode .. " modRate = (state[" .. trigger .. "].modRate or 1.0)\n"; recheckCode = recheckCode .. " recheckTime = nextTime\n"; recheckCode = recheckCode .. " end\n" elseif (cType == "elapsedTimer" and value) then recheckCode = " nextTime = state[" .. trigger .. "] and state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " and (state[" .. trigger .. "]" .. string.format("[%q]", variable) .. " +" .. value .. ")\n"; recheckCode = recheckCode .. " if (nextTime and (not recheckTime or nextTime < recheckTime) and nextTime >= now) then\n" + recheckCode = recheckCode .. " modRate = (state[" .. trigger .. "].modRate or 1.0)\n"; recheckCode = recheckCode .. " recheckTime = nextTime\n"; recheckCode = recheckCode .. " end\n" end @@ -675,7 +677,7 @@ local function ConstructConditionFunction(data) ret = ret .. " local state = region.states\n" ret = ret .. " local activatedConditions = WeakAuras.GetActiveConditions(id, cloneId)\n"; ret = ret .. " wipe(newActiveConditions)\n"; - ret = ret .. " local recheckTime;\n" + ret = ret .. " local recheckTime, modRate;\n" ret = ret .. " local now = GetTime();\n" -- First Loop gather which conditions are active @@ -696,7 +698,7 @@ local function ConstructConditionFunction(data) ret = ret .. " end\n"; ret = ret .. " if (recheckTime) then\n" - ret = ret .. " Private.ExecEnv.ScheduleConditionCheck(recheckTime, uid, cloneId);\n" + ret = ret .. " Private.ExecEnv.ScheduleConditionCheck(recheckTime, uid, cloneId, modRate);\n" ret = ret .. " else\n" ret = ret .. " Private.ExecEnv.CancelConditionCheck(uid, cloneId)" ret = ret .. " end\n"