WoWInterface - View Single Post - Rune of Power doesn't cast
View Single Post
08-02-19, 09:42 PM   #10
A Warpwood Thunder Caller
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by SDPhantom View Post
Looks like the behavior changed since the last time I looked at it too. This is concerning when the reset timer resets. This is found in the function that's run when the command is executed. I started digging when I didn't see anything referring to the reset timer in the event handler or any of the functions it calls.

Lua Code:
  1. -- Reset the timeout each time the sequence is used
  2. local timeout = strmatch(entry.reset, "(%d+)");
  3. if ( timeout ) then
  4.     entry.timeout = CastSequenceManager.elapsed + tonumber(timeout);
  5. end
Yes. Well, I had a look at the code myself and this is what I noticed:
That snippet you quoted is in function ExecuteCastSequence ( ChatFrame.lua:949 ).

In that function, before the snippet you posted, there is this other snippet:
Lua Code:
  1. -- Don't do anything if this entry is still pending
  2. if ( entry.pending ) then
  3.     return;
  4. end

And in function CastSequenceManager_OnEvent ( ChatFrame.lua:872 ), you have this snippet:
Lua Code:
  1. if ( event == "UNIT_SPELLCAST_SENT" ) then
  2.     entry.pending = castID;
  3. elseif ( entry.pending == castID ) then
  4.     entry.pending = nil;
  5.     if ( event == "UNIT_SPELLCAST_SUCCEEDED" ) then
  6.         SetNextCastSequence(sequence, entry);
  7.     end
  8. end
So, UNIT_SPELLCAST_SENT sets entry.pending to a non-nil value, and any one of the other watched events sets it to nil. And only UNIT_SPELLCAST_SUCCEEDED actually advances the sequence to the next entry.
So what you said earlier about UNIT_SPELLCAST_SENT is at least partially true: Calling the macro when the currently active entry is uncastable should act, as far as the timer reset is concerned, as if the macro had never been recalled, because the function exits before the timer reset snippet you posted.

However, there are other events watched, besides UNIT_SPELLCAST_SENT and UNIT_SPELLCAST_SUCCEEDED, that do clear the value of entry.pending, without advancing the sequence's entry.
These are the events that would do that:
Lua Code:
  2. event == "UNIT_SPELLCAST_FAILED" or
  3. event == "UNIT_SPELLCAST_FAILED_QUIET" ) then
The first two events fire when, after a successful casting-start, the cast doesn't complete. In this case, the timer would be reset, but the entry in the castsequence would remain the same.
The last event, UNIT_SPELLCAST_FAILED_QUIET, I'm unfamiliar with. But I'm thinking this may be the server's response to a UNIT_SPELLCAST_SENT of a spell that is not available to be started. And this would explain why the castsequence timer resets on that Consecrated Flame on-CD.
  Reply With Quote