Reply
 
Thread Tools Display Modes
Unread 09-04-12, 11:28 AM   #1
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,030
Faction from GetPlayerInfoByGUID()

It would be nice to have faction as a return from GetPlayerInfoByGUID(). Currently, lack of this information hinders the default language set support for addons that add custom languages. For now, this specifically applies to Pandaren since both factions share the same racial language.
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
SDPhantom is offline   Reply With Quote
Unread 09-04-12, 07:58 PM   #2
myrroddin
Premium Member
 
myrroddin's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 384
http://wowprogramming.com/docs/api/UnitFactionGroup

Converting between GUID and unit is up to you.
myrroddin is offline   Reply With Quote
Unread 09-05-12, 02:13 AM   #3
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,437
If you're using GetPlayerInfoByGUID, it's probably because you're dealing with people who are talking in chat, or doing something else where no UnitID is available.

If a UnitID was available, there'd be no reason to use GetPlayerInfoByGUID, because all of the information it provides -- class, race, gender, name, server -- is available through other, more specific, UnitID-based API functions.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 11-30-12, 08:37 AM   #4
Billtopia
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 94
I remember asking for this ability during the beta... One of my addons needs to be able to tell if a person is of the same faction from only the guid... and there is no way for me that doesn't introduce some sort of lag... I could try a search but then I have to make the addon wait for the who list update event... and then users would see I did it... If SendAddonChatMessage had a return value instead of printing the error to chat that could help too
Billtopia is offline   Reply With Quote
Unread 11-30-12, 05:14 PM   #5
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,437
If you're getting GUIDs from chat (the usual reason for calling GetPlayerInfoByGUID) then you can determine the faction based on the message language.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 12-01-12 at 01:56 AM.
Phanx is offline   Reply With Quote
Unread 11-30-12, 05:51 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,030
Originally Posted by Phanx View Post
If you're using GetPlayerInfoByGUID, it's probably because you're dealing with people who are talking in chat, or doing something else where no UnitID is available.
Yes, this is for code responding to chat events where there are no valid UnitIDs. An example is for a custom language addon like Tongues to be able to tell an Alliance Pandaren from a Horde one and act accordingly. Both factions use the [Pandaren] language tag for their racial languages. More specifically, this request was to add faction-specific icons for ChatLinkIcons in order to differentiate the same problem with the same race being available to both factions. Even though the character creation screen shows one button for Pandaren, there are actually two icons in the game files (one set of texcoords is the horizontal flipped image of the other set).
__________________
"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 : 11-30-12 at 06:02 PM.
SDPhantom is offline   Reply With Quote
Unread 12-01-12, 01:55 AM   #7
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,437
Can't you use ChatFrame_AddMessageEventFilter and just catch the language argument (arg3) passed with the chat message? I can't recall the last time I saw anyone /say or /yell anything in a language other than their faction's default language, so just checking for Orcish or Common should catch 99% of cases.

Another option would be to do what BadBoy_Levels does to check levels, and attempt to add the player to your friends list and catch the result message. If it's successful, the player is part of your faction; if it failed, the player is of the opposing faction. This wouldn't work for cross-realm players, but I think the chances of someone of the opposite faction from another server /saying or /yelling anything in a non-default language are pretty slim.

Finally, SendAddonMessage doesn't need a return value, as it's trivial to catch the message printed to the chat frame when sending fails, and hide it from the user.
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addon Turn any code into an addon More addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please dont PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 12-01-12 at 01:59 AM.
Phanx is offline   Reply With Quote
Unread 12-01-12, 10:31 AM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,030
Originally Posted by Phanx View Post
Can't you use ChatFrame_AddMessageEventFilter and just catch the language argument (arg3) passed with the chat message? I can't recall the last time I saw anyone /say or /yell anything in a language other than their faction's default language, so just checking for Orcish or Common should catch 99% of cases.
As mentioned, even with the slim chance of it ever happening, the language passed isn't specific enough when dealing with the Pandaren racial language. This was one of the first solutions I checked out previously.



Originally Posted by Phanx View Post
Another option would be to do what BadBoy_Levels does to check levels, and attempt to add the player to your friends list and catch the result message. If it's successful, the player is part of your faction; if it failed, the player is of the opposing faction. This wouldn't work for cross-realm players, but I think the chances of someone of the opposite faction from another server /saying or /yelling anything in a non-default language are pretty slim.
This method is similar to what GAOA does to check if a player is online, the only difference is it uses the addon channel to ping the chat server (not the player, resulting in an addon that works one-sided). If the server comes back with a player offline message, the addon reacts accordingly. Otherwise, it waits a timeout period before assuming the player is online. There may be better methods for that addon, but that's irrelevant at this moment.

As for the other addon examples, this may be an option, but for ChatLinkIcons, requesting additional data from the servers costs additional time that doesn't fit the time restraint I feel is appropriate.



Originally Posted by Phanx View Post
Finally, SendAddonMessage doesn't need a return value, as it's trivial to catch the message printed to the chat frame when sending fails, and hide it from the user.
Did this get posted on the wrong thread?
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
SDPhantom is offline   Reply With Quote
Unread 12-01-12, 10:31 AM   #9
Billtopia
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 94
I, myself, am using the guid from achievements and as such, I get no information that can tell me what faction besides race... now with the Pandaren, I am out of luck... There is no valid unit for me to check the affiliation with... I mean if Blizz is going to classify them as 3 different races then they should return 3 different race returns or supply some method for distinguishing from guid or something besides by units.
Billtopia is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Wish List » Faction from GetPlayerInfoByGUID()

Thread Tools
Display Modes

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