Thread Tools Display Modes
07-04-11, 11:22 AM   #1
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
Horde/Alliance faction detection

I am looking for a method to detect if a person's name is of the same faction as the "player" so when you are playing an Alliance character when a Horde gets an achievement my addon (Achievement Sounds) won't offer to grat them. UnitIsFriend / UnitIsEnemy / UnitFactionGroup all will not work unless I target the person as they would not be in my party so their unit id can't be their name... (The name is returned when CHAT_MSG_ACHIEVEMENT fires)
  Reply With Quote
07-04-11, 12:38 PM   #2
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
The CHAT_MSG_ACHIEVEMENT event includes a GUID you can use with GetPlayerInfoByGUID. One of that function's return values is the player's race.
  Reply With Quote
07-04-11, 06:33 PM   #3
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
*edit*
I cheated and found it as arg12 they should tell you these things
*/edit*

any idea which arg it is? this is what wowwiki says

"CHAT_MSG_ACHIEVEMENT"

Category: Communication,Guild,Achievements

Fired when a player in your vicinity completes an achievement.
arg1 The full body of the broadcast message.
arg2, arg5 The name of player who has just completed the achievement.
arg7, arg8 Some integer.

Last edited by Billtopia : 07-04-11 at 07:23 PM.
  Reply With Quote
07-04-11, 06:45 PM   #4
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 137
http://www.wowwiki.com/Events/Achievements

CHAT_MSG_GUILD_ACHIEVEMENT seems to be the one that returns the GUID. Saiket could be right though and CHAT_MSG_ACHIEVEMENT may return a GUID.

You could always try capturing achievement text via chat, COMBAT_LOG_EVENT_UNFILTERED and using the GUID to determine if the player is not of your race. So you could use GetPlayerInfoByGUID after getting the GUID from COMBAT_LOG_EVENT_UNFILTERED. Then have the addon determine if the person should be getting a grats or not.

http://www.wowwiki.com/API_COMBAT_LOG_EVENT
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote
07-04-11, 08:37 PM   #5
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
I ran the arg table through a loop and found out that 12 is the GUID even though they dont tell you... it also has other values that they dont care to share what they are... now to log in in the morning to see if my changes work... I will let you know on tues
  Reply With Quote
07-05-11, 07:49 PM   #6
Billtopia
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 110
after much tweaking of my existing code library( because several copies can load) I got it to work... I need to make some tweaks to the addons themselves to better the versioning of my library but the arg[12] does exist even if it is undocumented so I thank you all for the help
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Horde/Alliance faction detection

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