WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Possible to get spell school during casting? (https://www.wowinterface.com/forums/showthread.php?t=57724)

myrroddin 12-09-19 08:38 PM

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.

Ketho 12-10-19 01:58 PM

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

myrroddin 12-10-19 03:15 PM

I missed GetSchoolString() which I now need to look up. Thank you Ketho! :D


All times are GMT -6. The time now is 06:37 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI