Thread Tools Display Modes
06-10-10, 07:22 PM   #1
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Identifying Faction Names?

i am trying to parse faction names out of Blizzard unit tooltips (canonically, the faction of a unit seems to occur right after the unit level, if it exists, and if it does not indicate the unit is flagged for PvP). however, it seems that the default tooltip also includes quest information, and perhaps other things, in that location. so my parsing is identifying "false positives".

i am looking for a way to determine whether a generic string contains a valid faction name. i see the GetFactionInfo() API, and i could cycle through all of that for the factions that the player "knows" about. but i doubt that covers everything.

can anyone suggest another API-oriented approach, or know of a global variable containing localized faction strings, or some such? all i need is a "quick" true/false test (basically a set membership test): does a given string contain a faction name? or, a reliable way to construct such a set.

i rummaged the MPQ lua without success.

thanks in advance.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
06-11-10, 12:24 PM   #2
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by acapela View Post
i see the GetFactionInfo() API, and i could cycle through all of that for the factions that the player "knows" about. but i doubt that covers everything.
That's the way I've seen people doing so far. Seems far too inefficient for me though so I didn't bother touching it.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
06-11-10, 01:24 PM   #3
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
I don't see any efficiency problems. You only need to scan when the faction list changes otherwise you just use a cache. In most play sessions this is one iteration of the faction list and a simple hash table lookup when you need the information.

There's a babble library for this though.

http://www.wowace.com/addons/libbabble-faction-3-0/
  Reply With Quote
06-11-10, 09:45 PM   #4
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Waverian View Post
I don't see any efficiency problems. You only need to scan when the faction list changes otherwise you just use a cache. In most play sessions this is one iteration of the faction list and a simple hash table lookup when you need the information.

There's a babble library for this though.

http://www.wowace.com/addons/libbabble-faction-3-0/
yeah, i had planned to cycle through the GetFactionInfo() list, once on addon load, and store names in a table for lookup. my concern is that a list from this source would not be "complete".

libbabble-faction-3.0 would be a good option (though it adds a library dependency, and presumably consumes memory at runtime, etc, though presumably no more than any other comprehensive list of faction names would).

i was hoping Blizzard already had a LUA-accessible list squirreled away in some novel location, but i suppose the existence of libbabble-faction is proof that they do not... anyway, i will try implementing with that.

thanks much for the help.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"

Last edited by acapela : 06-11-10 at 10:01 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Identifying Faction Names?

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