Thread Tools Display Modes
03-15-11, 07:09 AM   #1
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
UNIT_SPELLCAST_INTERRUPTIBLE erratic behaviour

I want to implement UNIT_SPELLCAST_INTERRUPTIBLE and UNIT_SPELLCAST_NOT_INTERRUPTIBLE into my addon.

The issue I'm having is that these events never trigger when a cast becomes interruptible/uninterruptible. Instead they will occasionally trigger off other things.

The code involved is extremely simple:

Code:
function ezInterrupt:UpdateCombatLogParsing()
self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE")
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE")
end
Code:
function ezInterrupt:UNIT_SPELLCAST_INTERRUPTIBLE(event, unitID)
print(event.." for "..unitID)
end
Code:
function ezInterrupt:UNIT_SPELLCAST_NOT_INTERRUPTIBLE(event, unitID)
print(event.." for "..unitID)
end

I'm stumped. Obviously it works in other addons but I can't figure out what they do differently to have these events working correctly. My addon has several events registered and used in the same way as in the above example and everything works fine. What makes UNIT_SPELLCAST_NOT_INTERRUPTIBLE etc unique?

Last edited by daylesan : 03-15-11 at 10:52 AM.
  Reply With Quote
03-15-11, 03:16 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,322
Strictly from the code you posted, I see no frame created to listen for these events, or a script handler to call these functions. A lot of people have been assuming is to have a framework library like Ace3 loaded and omitting discussion about it.

I'm not sure what your code is trying to do, but to make it functional, this is modified to include what it needs to in order to run.
lua Code:
  1. --  Setup frame and event handler
  2. ezInterrupt=CreateFrame("Frame");
  3. ezInterrupt:SetScript("OnEvent",function(self,event,...)
  4.     local func=self[event];
  5.     if func then func(self,event,...); end
  6. end);
  7.  
  8. function ezInterrupt:UpdateCombatLogParsing()
  9.     self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
  10.     self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
  11. end
  12.  
  13. function ezInterrupt:UNIT_SPELLCAST_INTERRUPTIBLE(event, unitID)
  14.     print(event.." for "..unitID);
  15. end
  16.  
  17. function ezInterrupt:UNIT_SPELLCAST_NOT_INTERRUPTIBLE(event, unitID)
  18.     print(event.." for "..unitID);
  19. end
  20.  
  21. --  Register events
  22. ezInterrupt:UpdateCombatLogParsing();

Personally, I use the following code structure, less unnecessary function calls means lower CPU usage in most cases.
lua Code:
  1. ezInterrupt=CreateFrame("Frame");
  2. ezInterrupt:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
  3. ezInterrupt:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
  4. ezInterrupt:SetScript("OnEvent",function(self,event,...)
  5.     if event=="UNIT_SPELLCAST_INTERRUPTIBLE" then
  6. --      Do interruptible stuff here
  7.         print(event,"for",...);
  8.     elseif event=="UNIT_SPELLCAST_NOT_INTERRUPTIBLE" then
  9. --      Do uninterruptible stuff here
  10.         print(event,"for",...);
  11.     end
  12. end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 03-15-11 at 03:18 PM.
  Reply With Quote
03-15-11, 04:06 PM   #3
Akkorian
A Flamescale Wyrmkin
 
Akkorian's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 111
You should make your frame reference local:

lua Code:
  1. local ezInterrupt=CreateFrame("Frame");

Anyway, I think UNIT_SPELLCAST_INTERRUPTIBLE and UNIT_SPELLCAST_NOT_INTERRUPTIBLE only fire when the interruptible state changes, not necessarily when you start casting a spell. You should probably watch for the UNIT_SPELLCAST_START event, and check the ninth value returned by UnitCastingInfo to see if the spell the unit started casting is interruptible or not.

We could probably be more helpful if you were more specific about what you want your addon to do, too.
__________________
“Be humble, for you are made of earth. Be noble, for you are made of stars.”
  Reply With Quote
03-15-11, 04:17 PM   #4
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
Apologies for not being clear on that. The above is an Ace way of registering for events and handling them, which works fine for my other events. I'm not concerned about the code per se though, for the following reasons:

I tried both the regular and the Ace way of handling the UNIT_SPELLCAST_INTERRUPTIBLE event but both produce the same results.

So yes, UNIT_SPELLCAST_INTERRUPTIBLE and its sister event do trigger with my code. Just not when they should.

Where they should trigger but never haven't in my tests:
- On Kael'thas heroic in Magister's Terrace when http://www.wowhead.com/spell=46165 is broken.
- On the Ironstar dwarf before Atramedes when http://www.wowhead.com/spell=80747 is broken.
- On my priest with http://www.wowhead.com/spell=89489/strength-of-soul when it runs out mid-cast.
- When Aura Mastery with Concentration Aura cast by a friendly paladin runs out

Where they sometimes trigger instead:
- When elemental shamans are in my 5 man groups
- Sometimes on my priest a few casts *after* Strength of Soul has worn off.
- A guild mate who was using my addon also told me he was constantly getting these debug messages on Al'akir.
- At other random times where I'm pretty sure that no interrupt immunity is involved.

This leads me to believe that the issue does not lie in the code but in me not understanding some of the quirks of these events. Thus I didn't focus on code in my original post.

Last edited by daylesan : 03-15-11 at 04:26 PM.
  Reply With Quote
03-15-11, 04:24 PM   #5
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
As for the purpose of my addon: it shows an icon and plays a sound when a cast *can* be interrupted. That should include when casts become interruptible/uninterruptible halfway through as well.

It is pretty much complete at this point and working fine, except for the part dealing with the two aforementioned events.

Last edited by daylesan : 03-15-11 at 04:30 PM.
  Reply With Quote
03-15-11, 09:20 PM   #6
Akkorian
A Flamescale Wyrmkin
 
Akkorian's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 111
I’d still do what I suggested in my last post, since that will always tell you if the spell is interruptible when it starts casting, and keep the other two events registered in case they do work.

Since you mentioned that they sometimes fire at the wrong time, I’d recommend checking UnitCastingInfo again when they fire, to see if the unit is really casting something and if it’s really interruptible, instead of relying on the event itself to tell you what’s going on.

Also, have you checked the default UI to see if its cast bars (like the one on the default target frame) show the right state of interruptibility in the specific situations you mentioned? It might just be a Blizzard bug.
__________________
“Be humble, for you are made of earth. Be noble, for you are made of stars.”
  Reply With Quote
03-16-11, 03:42 AM   #7
Morsker
A Fallenroot Satyr
 
Morsker's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 22
Originally Posted by Akkorian View Post
Since you mentioned that they sometimes fire at the wrong time, I’d recommend checking UnitCastingInfo again when they fire, to see if the unit is really casting something and if it’s really interruptible, instead of relying on the event itself to tell you what’s going on.
I have my own personal mod similar to the OP's, and it uses the same implementation you recommend here, but it still behaves oddly at times just like the OP says. It's been a while since I kept track of specifics, but I remember early in Cata it used to report Throne of the Tides trash casts as uninterruptable, when it was definitely interruptable. I suspect it's a real bug with certain mobs not reporting their state correctly, something we'd have to work around by keeping a list of exceptional NPC and spell IDs.

Last edited by Morsker : 03-16-11 at 03:49 AM.
  Reply With Quote
03-16-11, 03:49 AM   #8
daylesan
A Fallenroot Satyr
Join Date: Feb 2011
Posts: 22
I did some testing with this:

Code:
function OnEvent(self, ...)
	local args = {...}
	local msg = GetTime()
	for i,v in ipairs(args) do
		msg = msg.."   "..tostring(v) 
	end
	print(msg)
end

local EventTest = CreateFrame("Frame")
EventTest:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
EventTest:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
-- EventTest:RegisterEvent("UNIT_TARGET"); -- used for testing if the code was working properly
EventTest:SetScript("OnEvent", OnEvent);
On Kael'thas, it never triggered when he gained or lost his Shock Barrier.
On my priest, Strength of Soul never triggered anything. However UNIT_SPELLCAST_INTERRUPTIBLE triggered twice when spells finished casting as long as:
a) I was targeting myself
b) The cast was started when I had the Strength of Soul buff

... which doesn't make any sense because it also triggered while Strength of Soul was still up.

Oh and
Code:
/script local immune = select(9, UnitCastingInfo("target")) print(tostring(immune))
never showed any of my casts as immune to interrupts. I guess it only returns true on spells that are hardcoded to be uninterruptible.

Last edited by daylesan : 03-16-11 at 03:53 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » UNIT_SPELLCAST_INTERRUPTIBLE erratic behaviour

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off