Thread Tools Display Modes
12-12-10, 09:24 PM   #1
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
How to figure out a character's faction

I'm currently trying to figure out a way to figure out a character's faction NOT based on their race. My reason for this is because some players are on foreign clients where race names aren't going to be able to be matched up since they're in another language.

One way I'm pretty sure would work would to match their racial's based on spellId, the only thing with that would be it'd be a lot of wasted space in my opinion.

My other idea would be to use the command "GetDefaultLanguage()" WoWProgramming says that it:
Code:
Returns the name of the player character's default language.
This is the language used in the chat system (Common or Orcish, as opposed to Taurahe, Darnassian, etc),
not the real-world language of the client or server.
but I'm wondering if "Common" or "Orcish" would come through as something else if it were another language other than English.

Does anyone know if it always comes back as "Common" or something else? And does anyone have any other ideas how to figure out faction for all clients? Thanks in advance!
  Reply With Quote
12-12-10, 09:58 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Like this? http://wowprogramming.com/docs/api/UnitFactionGroup
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-12-10, 10:03 PM   #3
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
Originally Posted by Seerah View Post
Well now I feel stupid... I was looking under the "Faction" section, not "Unit."

Thanks Seerah lol!
  Reply With Quote
12-13-10, 05:21 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Also:

— The second value returned by UnitRace is locale-independent, meaning it will be the same no matter which language client someone is using.

— The return value from GetDefaultLanguage() is localized, as are the language names returned by all other functions.

— Localization isn't really hard.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to figure out a character's faction


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