Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:API UnitClass
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{wowapi}} __NOTOC__ Returns the class (Mage, Warrior, etc) of the specified unit. localizedClass, englishClass, classIndex = UnitClass("unit"); == Parameters == === Arguments === :;unit :: String - the [[unitId]] to query, e.g. "player" === Returns === :localizedClass, englishClass, classIndex :;localizedclass :: The localized class of the specified unit as a string. e.g. "Mage", "Warrior", "Guerrier", etc. :;englishclass :: The fully capitalized english class name with no spaces, e.g. "MAGE", "WARRIOR", "DEATHKNIGHT", etc. :;classIndex :: the number index corresponding to the particular class that is returned. Number mapping is as follows: ::None = 0 ::Warrior = 1 ::Paladin = 2 ::Hunter = 3 ::Rogue = 4 ::Priest = 5 ::DeathKnight = 6 ::Shaman = 7 ::Mage = 8 ::Warlock = 9 ::Monk = 10 ::Druid = 11 ::Demon Hunter = 12 == Example == local playerClass, englishClass = UnitClass("player"); ChatFrame1:AddMessage('Your player is a : ' .. playerClass .. '; ' .. englishClass .. '.'); === Result === Prints the player's class to the chat frame, e.g. Your player is a : Warrior; WARRIOR. == Details == For any type of data tracking, use the second parameter, since it is guaranteed to stay the same in different-language clients. This is especially important in europe, where it is not uncommon for people with e.g. german or french client software to play on english servers. You can keep track of mappings for display by remembering the output pairs in a table, e.g.: localizedClass, englishClass = UnitClass("target"); MyAddOn_Classes[englishClass] = localizedClass; ''.. do data tracking stuff with englishClass..''
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Tocright
(
edit
)
Template:Wowapi
(
edit
)