WoW:API GetFactionInfo: Difference between revisions

→‎Headers: removed wrong statement about hidden factions
(Corrected spelling/grammar)
(→‎Headers: removed wrong statement about hidden factions)
Line 34: Line 34:
   name, description, standingId, bottomValue, topValue, earnedValue, atWarWith,
   name, description, standingId, bottomValue, topValue, earnedValue, atWarWith,
     canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex)
     canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex)
   if isHeader == nil then
   if isHeader == nil then
       DEFAULT_CHAT_FRAME:AddMessage("Faction: " .. name .. " - " .. earnedValue)
       DEFAULT_CHAT_FRAME:AddMessage("Faction: " .. name .. " - " .. earnedValue)
Line 45: Line 44:
  Faction: Argent Dawn - 405
  Faction: Argent Dawn - 405
  Faction: Thunder Bluff - 15042
  Faction: Thunder Bluff - 15042
=== looping over all factions ===
The above code will only loop over those factions visible in the faction panel and thus not include those in collapsed headers.
To loop over all factions, including the hidden ones, you can use the following code.
local factionIndex = 1
local lastFactionName
repeat
  local name, description, standingId, bottomValue, topValue, earnedValue, atWarWith,
    canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex)
  if name == lastFactionName then break end
  lastFactionName  = name
  -- YOUR CODE HERE --
  factionIndex = factionIndex + 1
until factionIndex > 200


== Reputation Information ==
== Reputation Information ==
Line 91: Line 105:
=== Headers ===
=== Headers ===
*Headers (or Header Rows) are the titles presented on top of your reputation groups as titles, such as "Shattrath City", "Horde" and "Steamwheedle Cartel". If you do not wish to use these values, you can use isHeader to filter them out.
*Headers (or Header Rows) are the titles presented on top of your reputation groups as titles, such as "Shattrath City", "Horde" and "Steamwheedle Cartel". If you do not wish to use these values, you can use isHeader to filter them out.
*Any faction placed within a collapsed header will not be present when GetFactionInfo() is used. Factions hidden from the reputation tab have no index and as such will not appear when searched for.
[[Category:World of Warcraft API]]
[[Category:World of Warcraft API]]
Anonymous user