Unable detect interrupts caused by silence effects
I've been working on some addon-related code to detect spell interrupts for me and have run into kind of a major problem.
I noticed that it was working fine when I would pummel a spell, but if I had Gag Order glyphed it failed. The problem was that it changes it from an interrupt to a silence. Normally, pummel triggers a SPELL_INTERRUPT event in COMBAT_LOG_UNFILTERED. However, as it turns out, silence effects don't appear to produce *anything*. Like, at all. From what I'm seeing, the mob starts casting (SPELL_CAST_START), I apply a silence and see SPELL_AURA_APPLIED for the silence as expected. Then... nothing. There is no SPELL_CAST_STOP, SPELL_CAST_FAILED, or SPELL_INTERRUPT to catch. The inconsistency is really driving me nuts. Is there any way at all to detect when a spell has been interrupted because of a silence effect? Edit: Derped the title. Unable *TO* detect interrupts... |
Maybe SPELL_AURA_APPLIED can only happen if you interrupt the enemy?
As far as I know since the patch the enemy dosen't get a debuff so all interrupts are without a length. |
Quote:
I tried checking the unit's casting info at the time of the aura being applied, but it appears that by the time I can catch the event in the combat log, the silence has already kicked in and the unit is no longer casting. Hm.. Maybe UNIT_AURA would trigger early enough? |
Use /etrace, and try not to do too many unrelated actions if you value your sanity.
|
Quote:
Turns out the magic event was UNIT_SPELLCAST_FAILED_QUIET. Thanks! Edit: Or, apparently, just UNIT_SPELLCAST_INTERRUPTED. Can't believe I didn't do that already. Note to self: COMBAT_LOG_EVENT_UNFILTERED is not very useful for this kind of thing. Edit2 : And... just realized there's no way to figure out which unit *caused* the interrupt from that event.. =\ |
I've been meaning to write an addon to make the /etrace window more user-friendly, but I generally reduce the spam a bit by opening it, doing some irrelevant actions (open the map, mouse over some units, press a modifier key, etc.) and then removing all the events they generated from the window (hover and press the "X"). It's tedious, but fortunately not required that often... which is also why I've never gotten around to writing that addon. :p
|
The point of this thing was to get proper interrupt announcement for my warrior's Gag Order silence. I simply wanted to announce when a spell was interrupted by my Gag Order's silence debuff.
I did it, but... I had to do some things I'm not proud of. I could catch silences with UNIT_SPELLCAST_INTERRUPTED - but I couldn't tell WHO silenced the spell or HOW - the spellcast is interrupted before the silence aura is ever actually applied to the mob. Hence, this wasn't every useful - I can't tell if I interrupted it with Gag Order, or if the Rogue beside me kicked it. I can look at UNIT_AURA and then check for my silence debuff - but, by then it's too late. The spell has already been interrupted. I have no way to tell what it was casting before the debuff was applied. I... I could use a macro so that, just before I cast Pummel, I check the spell my silence target is casting (and whether it's interruptible) with UnitCastingInfo and save it to a global variable. And then, when I catch UNIT_AURA, I check for my silence debuff and, if I find it, I look to see if the global variable is set and, if it is, then I know that the silence debuff caused a spell to be interrupted. But.. eww... it feels so dirty. But, wait, I can't make a spell link to announce with with just the spell name... and UnitCastingInfo doesn't return the spellId, so I can't make one. Unless I also catch UNIT_SPELLCAST_INTERRUPTED, see if the casting unit was the unit that I cast my Pummel upon from my macro, and whether the previous global variable was set... then I can set ANOTHER global variable with the real spell id taken from the parameters passed to the event. Then, I could use the spell ID in my UNIT_AURA hook to form a proper spell link. Ughh... I think I just threw up a little. It's a tremendously dirty hack and it makes me feel bad. |
That's not really a hack, though it is a bit inefficient. You really only need to keep track of the unique ID for the cast. Assuming that the relevant UNIT_SPELLCAST_INTERRUPTED event always fires after the UNIT_SPELLCAST_SUCCEEDED event for your Pummel, something like this is fairly straightforward and should get the job done:
Code:
local pummelCast |
Tried to make it work with focus as well as target, but try as I might I couldnt manage to get the unitId of the pummel target. UNIT_SPELLCAST_SENT can get you the name (i.e., the full name of the mob), but that's ambiguous - doesn't seem like we can determine whether the target of the successful interrupt is a target or focus. You could look at both units and make an educated guess, but nothing that I can think of will work 100% of the time.
Regardless, I extended it a little, fixed a couple small oversights, and it seems to work great. This is my new event handler: Code:
function(event, sourceUnit, spellName, _, castId, spellId) If you happen to think of a way to handle focus targets, I'd love to hear it. Thanks for the pointers, this is much more elegant than my previous iteration. |
This is probably the easiest way to get the actual unit token for your spellcast target:
Code:
hooksecurefunc("CastSpellByName", function(spellName, unit) 1. CastSpellByName - check spell name, store unit 2. UNIT_SPELLCAST_SUCCEEDED "player" - check spell name, store cast ID 3. UNIT_SPELLCAST_INTERRUPTED - check unit and cast ID Quote:
Additionally, using the CastSpellByName hook to catch the unit, you'd want to register for UNIT_SPELLCAST_INTERRUPTED this way: Code:
frame:RegisterUnitEvent("UNIT_SPELLCAST_INTERRUPTED", "target", "focus") Quote:
Code:
addon:RegisterForEvent("PLAYER_LOGIN") |
I'm using the hook to CastSpellByName to figure out what the target of my interrupt is and it's working like a charm. Thanks a ton for all the help.
(Can you tell I'm not too familiar with the WoW API? =p ) |
Well crap.
Just discovered a major flaw while running some randoms tonight. Sometimes, the castId just comes back as zero for whatever reason when logically it shouldn't. When this happens, you can wind up announcing every time a mob with your last interrupt's unitId has a cast fail for *any* reason - including other player's interrupts and the mob's death. The only way I can find to work around it is to add in another event handler for UNIT_AURA and start looking for the silence debuff again. Oh well. Now it looks something more like: CastSpellByName Hook: Code:
function(spellName, unit) UNIT_SPELLCAST_ Handler: Code:
function(event, sourceUnit, spellName, _, castId, spellId) Code:
function(event, unit) |
All times are GMT -6. The time now is 06:57 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI