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. |
Quote:
|
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/ |
Quote:
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. |
All times are GMT -6. The time now is 06:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI