View Single Post
12-10-19, 01:58 PM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
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