View Single Post
02-24-15, 10:38 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
The function is UnitClass() and classFileName is usually the English name in all caps. The function also has a 3rd return since MoP that returns an index number related to what class the unit is.

On another note, if the entire addon is in one file, you could use return to stop execution of the file if in the main chunk.

Lua Code:
  1. local _,class,id=UnitClass("Player");
  2.  
  3. --  You can use either of these, they both point to the same class
  4. if class=="PRIEST" then return; end
  5. if id==5 then return; end

Class ID is documented here.



PS: I don't know if glyph data is available immediately at login or if you need to wait for PLAYER_LOGIN to fire.
You should still load even if you don't detect the glyph initially as glyphs can be changed by the player while logged in. Perhaps put the addon into a sleep state until it sees the glyph by login, spec change, or glyph swap.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 02-24-15 at 10:49 AM.
  Reply With Quote