Thread Tools Display Modes
06-20-13, 04:14 PM   #1
Nandchan
A Murloc Raider
Join Date: May 2013
Posts: 6
GetSpellInfo returns no castTime for channeled spells

Hey,

I'm trying to figure out the cast times of spells as I cast them, which works for the most part by simply querying the spells I cast using GetSpellInfo, but it doesn't work correctly for channeled spells because the API returns a cast time of 0. I tried using UnitChannelInfo but this doesn't always update in time. Isn't there some simple way of determining whether or not some spell has a channel time?

My ultimate goal is to figure out whether or not a spell is instant cast or not.
  Reply With Quote
06-20-13, 04:42 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
UnitChannelInfo and UnitCastingInfo are the functions used by the ui to render the casting bar, so I'm not sure why they aren't fast enough for you.

It's possible you may need to change what events you're watching, check CastingBarFrame.lua in the framexml for how blizzard does it.
Lua Code:
  1. self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED");
  2. self:RegisterEvent("UNIT_SPELLCAST_DELAYED");
  3. self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START");
  4. self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE");
  5. self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
  6. self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
  7. self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
  8. self:RegisterEvent("PLAYER_ENTERING_WORLD");
  9. self:RegisterUnitEvent("UNIT_SPELLCAST_START", unit);
  10. self:RegisterUnitEvent("UNIT_SPELLCAST_STOP", unit);
  11. self:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", unit);
  Reply With Quote
06-20-13, 05:04 PM   #3
Nandchan
A Murloc Raider
Join Date: May 2013
Posts: 6
Not sure either, the problem seemed to occur most often when chain-channeling. The addon was listening to UNIT_SPELLCAST_START and UNIT_SPELLCAST_SUCCEEDED, and on either of them, showed a GCD bar if the cast spell has no cast time and the unit is not currently channeling.

I've added UNIT_SPELLCAST_CHANNEL_START to the list of registered events and made sure to hide the bar if UnitChannelInfo returns something on any of them, and it seems to be working fine now. Possibly one of those three events was being triggered before UNIT_SPELLCAST_CHANNEL_START, and before UnitChannelInfo updated itself, but with the correct spell as parameter.

Edit: After some testing, I've narrowed the exact event down to UNIT_SPELLCAST_SUCCEEDED, which triggers with Arcane Missiles as parameter at a time when UnitChannelInfo returns nothing. Upon further inspection, it seems that UNIT_SPELLCAST_SUCCEEDED triggers for every single tick of Arcane Missiles, which is what my function was mistakenly picking up as an actual spellcast.

Last edited by Nandchan : 06-20-13 at 05:13 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » GetSpellInfo returns no castTime for channeled spells


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