Quantcast Possible to get spell school during casting? - WoWInterface
Thread Tools Display Modes
12-09-19, 08:38 PM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,101
Possible to get spell school during casting?

I've been all over the API to see if spells being cast can have their school be discovered. The best I could find is the _DAMAGE subevent in CLEU but that is after the spell is finished and has done damage. What about during the cast?

I want to colourize my cast bars based on the school of the spell. After that, flash the cast bars for boss, arena, target, etc if the spell can be interrupted. I can figure out if the spell is interruptable easily enough. But I can't figure out how to find the school or make the cast bar flash or strobe or blink.

The casting and unit APIs for casting don't return the school as far as I can see.
  Reply With Quote
12-10-19, 01:58 PM   #2
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 902
I would have expected GetSpellInfo() to return the school of a spell but I was wrong

You can still get it from listening to CLEU
(this example does not take channeling spells into account)
Lua Code:
  1. local playerGUID = UnitGUID("player")
  2.  
  3. local f = CreateFrame("Frame")
  4. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  5. f:SetScript("OnEvent", function(self, event)
  6.     self:OnEvent(event, CombatLogGetCurrentEventInfo())
  7. end)
  8.  
  9. function f:OnEvent(event, ...)
  10.     local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
  11.  
  12.     if subevent == "SPELL_CAST_START" and sourceGUID == playerGUID then
  13.         local spellId, spellName, spellSchool = select(12, ...)
  14.         print(format("Casting %s (%s)", GetSpellLink(spellId), GetSchoolString(spellSchool)))
  15.     end
  16. end
  Reply With Quote
12-10-19, 03:15 PM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,101
I missed GetSchoolString() which I now need to look up. Thank you Ketho!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Possible to get spell school during casting?

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