Skip to content

Commit

Permalink
BT2: Treat Auras with expirationTime == 0 as having an unknown time
Browse files Browse the repository at this point in the history
Meaning remaing time checks against them always return false.

Fixes: #5515
  • Loading branch information
InfusOnWoW committed Nov 6, 2024
1 parent a013935 commit 76e1400
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
36 changes: 24 additions & 12 deletions WeakAuras/BuffTrigger2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,14 @@ local function FindBestMatchData(time, id, triggernum, triggerInfo, matchedUnits
for index, auraData in pairs(unitData) do
local remCheck = true
if triggerInfo.remainingFunc and auraData.expirationTime then
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
if auraData.duration == 0 then
remCheck = false
else
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
end
end

if remCheck then
Expand Down Expand Up @@ -679,10 +683,14 @@ local function FindBestMatchDataForUnit(time, id, triggernum, triggerInfo, unit)
for index, auraData in pairs(matchDataByTrigger[id][triggernum][unit]) do
local remCheck = true
if triggerInfo.remainingFunc and auraData.expirationTime then
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
if auraData.expirationTime == 0 then
remCheck = false
else
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
end
end

if remCheck then
Expand Down Expand Up @@ -1578,10 +1586,14 @@ local function UpdateTriggerState(time, id, triggernum)
for index, auraData in pairs(unitData) do
local remCheck = true
if triggerInfo.remainingFunc and auraData.expirationTime then
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
if auraData.expirationTime == 0 then
remCheck = false
else
local modRate = auraData.modRate or 1
local remaining = (auraData.expirationTime - time) / modRate
remCheck = triggerInfo.remainingFunc(remaining)
nextCheck = calculateNextCheck(triggerInfo.remainingCheck, remaining, auraData.expirationTime, modRate, nextCheck)
end
end

if remCheck then
Expand Down
4 changes: 2 additions & 2 deletions WeakAuras/Conditions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@ local function CreateTestForCondition(data, input, allConditionsTemplate, usedSt
or ""

if (op == "==") then
check = stateCheck .. stateVariableCheck .. "abs((" .. remainingTime .. "-" .. value .. ")" .. divideModRate .. ") < 0.05"
check = stateCheck .. stateVariableCheck .. varString .. "~= 0 and " .. "abs((" .. remainingTime .. "-" .. value .. ")" .. divideModRate .. ") < 0.05"
else
check = stateCheck .. stateVariableCheck .. remainingTime .. divideModRate .. op .. value
check = stateCheck .. stateVariableCheck .. varString .. "~= 0 and " .. remainingTime .. divideModRate .. op .. value
end
elseif (cType == "elapsedTimer" and value and op) then
if (op == "==") then
Expand Down

0 comments on commit 76e1400

Please sign in to comment.