There are two functions for retrieving faction information: GetFactionInfo and GetFactionInfoByID
The first one uses an index in the reputation window, which (I assume) can change anytime a player discovers a new faction. The second uses a unique ID which won't change.
Both functions return exactly the same results, however I fail to find a (good) way to convert an index to a factionID.
Obviously I can iterate all indices and factionIDs to do so.
But is there any better way?
Motivation (Or: What I want to do)
In an addon I develop I want to track faction reputation. Obviously storing those by the index is risky, as that may change. Storing by name would be an option, but this is ugly (in particular if someone changes client language as I tend to do sometimes), If some factions have the same name (unlikely), or get renamed (unlikely aswell).
Tanks for your suggestions.
Some questions though:
Is there some particular reason for an upper bound of 2000? Or is it just some large number?
I have not yet found a suitable event for new factions besides CHAT_MSG_COMBAT_FACTION_CHANGE and UPDATE_FACTION.
The first one would require me to parse the combat log for a string I do not yet know.
The second fires everytime something changes. Probably an overhead but might be worth.