-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bossmod Timer fix #4584
Bossmod Timer fix #4584
Conversation
… not shown when remainingTime + extendTimer would start a bar after non modified timer has expired
WeakAuras/BossMods.lua
Outdated
@@ -471,6 +478,9 @@ Private.event_prototypes["DBM Timer"] = { | |||
end | |||
end | |||
if remainingTime >= triggerRemaining and not bar.paused then | |||
if extendTimer >= triggerRemaining then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because RecheckTimers can run at any time (due to it being triggered also by boss mod events), and RecheckTimers needs to know whether to keep a bar alive or not, I think we need to write scheduledScanExpiresAt regardless of any triggerRemainingCheck, and this check should be extendTimer > 0.
So this code should probably use extendTimer > 0, and we also need to move it out of the remainingTime check and it needs to be duplicated in the else branch ~7 lines below.
@@ -127,7 +127,9 @@ Private.ExecEnv.BossMods.DBM = { | |||
for timerId, bar in pairs(self.bars) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- For the nextExpire we should also take scheduleScanExpire into account, that is I think we should add:
if self.nextExpire == nil then
self.nextExpire = bar.scheduledScanExpireAt
elseif bar.scheduledScanExpireAt and bar.scheduledScanExpireAt > GetTime() and bar.scheduledScanExpireAt< self.nextExpire
self.nextExpire= self.scheduledScanExpireAt
end
So that, at scheduledScanExpireAt the bar is actually removed.
-
For extended timers, we end up sending a TimerStop event everytime RecheckTimers is called. That doesn't sound too bad, though it's bit unfortunate.
-
Another point to consider is that this changes GetTimer/GetAllTimers beahviour in that they can and will now return expired bars (if they are kept alive via an extension). Looking at the code I think some callers of that need adjustment to not consider expired timers. In general GetTimer/GetAllTimers returning expired bars is correct, in so far as we explictly want to keep them around. But we need to add checks for auras that aren't responsible for the extension.
That is consider two auras:
Aura a: Shows 'foo', extends timers by 5s
Aura b: Shows all bars, no extension.
Then if a bar 'foo' expires (for which aura a matches), the bar is kept alive via the scheduledScanExpireAt code.
If in those 5s a DBM_TimerUpdate is fired for an unrelated timer, e.g. bar 'baz'
Then for Aura b, that will result in WeakAuras.ScanEvents('BossMod_TimerUpdate'), then the code (in useClone) will use:
- TimerMatchesGeneric, which doesn't care that the bar is expired
- copyAndSchedule, which again doesn't check that remainingTime is negative, to
- CopyBarToState, which doesn't check either.
So Aura b shows a dead timer.
else | ||
if self.nextExpire == nil then | ||
self.nextExpire = bar.scheduledScanExpireAt | ||
elseif bar.scheduledScanExpireAt < self.nextExpire then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't bar.scheduledScanExpireAt
be nil here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No if it is nil (or <= GetTime()) we would be in line 130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed sorry
your changes are good, i did only tests with auto-clone and didn't think enough about nextExpire
fix #4583