WoW:API GetFactionInfo: Difference between revisions
(Corrected spelling/grammar) |
m (Move page script moved page API GetFactionInfo to API GetFactionInfo without leaving a redirect) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 12: | Line 12: | ||
:(factionIndex) | :(factionIndex) | ||
:;factionIndex : Integer - The row of the faction display to request information from. The rows start from the top of your reputation tab as 1 and move down, includes headers but not hidden reputations. | :;factionIndex | ||
:: Integer - The row of the faction display to request information from. The rows start from the top of your reputation tab as 1 and move down, includes headers but not hidden reputations. | |||
=== Returns === | === Returns === | ||
:name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, isWatched | :name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, isWatched | ||
:;name : String - The display name/label for this row. | :;name | ||
:;description : String - Returns the small description from the reputation tab. | :: String - The display name/label for this row. | ||
:;standingId : Integer [[API TYPE StandingId|StandingId]] - Numeric representation of standing(Neutral, friendly etc) with faction, is always between 0 and 8 (present for header rows, though its significance is unknown) | :;description | ||
:;bottomValue : Integer - Numeric representation of the minimum reputation earned with this faction at the current standing, ex. Neutral is 0, Friendly is 3000 (Present for header rows, but significance of value is unknown). | :: String - Returns the small description from the reputation tab. | ||
:;topValue : Integer - Numeric representation of the maximum reputation that can be earned with this faction at the current standing, ex. Neutral is 3000, Friendly is 9000 (Present for header rows, but significance of value is unknown). | :;standingId | ||
:;earnedValue : Integer - Numeric representation of the TOTAL reputation earned with this faction, ex. 1500/3000 Neutral is 1500, 2500/6000 Friendly is 5500 (Present for header rows, but significance of value is unknown). | :: Integer [[API TYPE StandingId|StandingId]] - Numeric representation of standing(Neutral, friendly etc) with faction, is always between 0 and 8 (present for header rows, though its significance is unknown) | ||
:;atWarWith : Flag - 1 if player is at war with the faction, nil otherwise. | :;bottomValue | ||
:;canToggleAtWar : Flag - 1 if player can toggle the 'At War' flag for this faction, nil otherwise. | :: Integer - Numeric representation of the minimum reputation earned with this faction at the current standing, ex. Neutral is 0, Friendly is 3000 (Present for header rows, but significance of value is unknown). | ||
:;isHeader : Flag - 1 if this row is a header row, nil otherwise. | :;topValue | ||
:;isCollapsed : Flag - 1 if this row is a collapsed header row, nil otherwise. | :: Integer - Numeric representation of the maximum reputation that can be earned with this faction at the current standing, ex. Neutral is 3000, Friendly is 9000 (Present for header rows, but significance of value is unknown). | ||
:;hasRep ''(New in 3.0.2)'' : Flag - 1 indicates when a faction that's otherwise a header should show its own reputation bar.(Currently used for Horde Expedition / Alliance Vanguard.) | :;earnedValue | ||
:;isWatched : Flag - 1 if this faction is being watched (Show as experience bar in default UI), nil otherwise. | :: Integer - Numeric representation of the TOTAL reputation earned with this faction, ex. 1500/3000 Neutral is 1500, 2500/6000 Friendly is 5500 (Present for header rows, but significance of value is unknown). | ||
:;isChild ''(New in 3.0.2)'': Flag - 1 is used in conjunction with isHeader to create the new 3-level faction tree structure. | :;atWarWith | ||
:: Flag - 1 if player is at war with the faction, nil otherwise. | |||
:;canToggleAtWar | |||
:: Flag - 1 if player can toggle the 'At War' flag for this faction, nil otherwise. | |||
:;isHeader | |||
:: Flag - 1 if this row is a header row, nil otherwise. | |||
:;isCollapsed | |||
:: Flag - 1 if this row is a collapsed header row, nil otherwise. | |||
:;hasRep ''(New in 3.0.2)'' | |||
:: Flag - 1 indicates when a faction that's otherwise a header should show its own reputation bar.(Currently used for Horde Expedition / Alliance Vanguard.) | |||
:;isWatched | |||
:: Flag - 1 if this faction is being watched (Show as experience bar in default UI), nil otherwise. | |||
:;isChild ''(New in 3.0.2)'' | |||
:: Flag - 1 is used in conjunction with isHeader to create the new 3-level faction tree structure. | |||
== Example == | == Example == | ||
Line 34: | Line 48: | ||
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 58: | ||
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 54: | Line 82: | ||
{|class="darktable" | {|class="darktable" | ||
|- | |- | ||
! Game Value | ! Game Value | ||
Line 62: | Line 90: | ||
|- | |- | ||
| align="center"| 1/3000 | | align="center"| 1/3000 | ||
| {{ | | {{reputation|Neutral}} | ||
| align="center"|1 | | align="center"|1 | ||
| 1 | | 1 | ||
|- | |- | ||
| align="center"| 1600/6000 | | align="center"| 1600/6000 | ||
| {{ | | {{reputation|Friendly}} | ||
| align="center"|4600 | | align="center"|4600 | ||
| 3000 + 1600 | | 3000 + 1600 | ||
|- | |- | ||
| align="center"| 11000/12000 | | align="center"| 11000/12000 | ||
| {{ | | {{reputation|Honored}} | ||
| align="center"| 20000 | | align="center"| 20000 | ||
| 3000 + 6000 + 11000 | | 3000 + 6000 + 11000 | ||
|- | |- | ||
| align="center"| 1400/3000 | | align="center"| 1400/3000 | ||
| {{ | | {{reputation|Unfriendly}} | ||
| align="center"| -1600 | | align="center"| -1600 | ||
| -1600 | | -1600 | ||
|- | |- | ||
| align="center"| 2500/3000 | | align="center"| 2500/3000 | ||
| {{ | | {{reputation|Hostile}} | ||
| align="center"| -3500 | | align="center"| -3500 | ||
| -3000 + -500 | | -3000 + -500 | ||
Line 91: | Line 119: | ||
=== 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. | ||
* | |||
== See also == | |||
* {{api|GetFriendshipReputation}} | |||
* {{api|GetFriendshipReputationRanks}} | |||
[[Category:World of Warcraft API]] | [[Category:World of Warcraft API]] |
Latest revision as of 04:45, 15 August 2023
This function was updated in patch 3.0.2
Get's details for a specific faction/faction header, you can only view information on factions you have already encountered.
name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex)
Parameters[edit]
Arguments[edit]
- (factionIndex)
- factionIndex
- Integer - The row of the faction display to request information from. The rows start from the top of your reputation tab as 1 and move down, includes headers but not hidden reputations.
Returns[edit]
- name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, isWatched
- name
- String - The display name/label for this row.
- description
- String - Returns the small description from the reputation tab.
- standingId
- Integer StandingId - Numeric representation of standing(Neutral, friendly etc) with faction, is always between 0 and 8 (present for header rows, though its significance is unknown)
- bottomValue
- Integer - Numeric representation of the minimum reputation earned with this faction at the current standing, ex. Neutral is 0, Friendly is 3000 (Present for header rows, but significance of value is unknown).
- topValue
- Integer - Numeric representation of the maximum reputation that can be earned with this faction at the current standing, ex. Neutral is 3000, Friendly is 9000 (Present for header rows, but significance of value is unknown).
- earnedValue
- Integer - Numeric representation of the TOTAL reputation earned with this faction, ex. 1500/3000 Neutral is 1500, 2500/6000 Friendly is 5500 (Present for header rows, but significance of value is unknown).
- atWarWith
- Flag - 1 if player is at war with the faction, nil otherwise.
- canToggleAtWar
- Flag - 1 if player can toggle the 'At War' flag for this faction, nil otherwise.
- isHeader
- Flag - 1 if this row is a header row, nil otherwise.
- isCollapsed
- Flag - 1 if this row is a collapsed header row, nil otherwise.
- hasRep (New in 3.0.2)
- Flag - 1 indicates when a faction that's otherwise a header should show its own reputation bar.(Currently used for Horde Expedition / Alliance Vanguard.)
- isWatched
- Flag - 1 if this faction is being watched (Show as experience bar in default UI), nil otherwise.
- isChild (New in 3.0.2)
- Flag - 1 is used in conjunction with isHeader to create the new 3-level faction tree structure.
Example[edit]
for factionIndex = 1, GetNumFactions() do name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex) if isHeader == nil then DEFAULT_CHAT_FRAME:AddMessage("Faction: " .. name .. " - " .. earnedValue) end end
Result[edit]
- Prints each faction's name and earned value.
Faction: Cenarion Circle - 2785 Faction: Argent Dawn - 405 Faction: Thunder Bluff - 15042
looping over all factions[edit]
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[edit]
Within the game reputation is shown as a formatted value of XXXX/YYYYY (ex:1234/12000) but outside of the reputation tab these values are not avaliable directly. The game uses a flat value for reputation.
Earned Value[edit]
The earnedValue returned by GetFactionInfo( ) is NOT the value on your reputation bars, but instead the distance your reputation has moved from 0 (1/3000 Neutral). All reputations given by the game are simply the number of reputation points from the 0 point, Neutral and above are positive reputations, anything below Neutral is a negative value and must be treated as such for any reputation calculations.
Game Value | Standing | Earned Value | Breakdown |
---|---|---|---|
1/3000 | Template:Reputation | 1 | 1 |
1600/6000 | Template:Reputation | 4600 | 3000 + 1600 |
11000/12000 | Template:Reputation | 20000 | 3000 + 6000 + 11000 |
1400/3000 | Template:Reputation | -1600 | -1600 |
2500/3000 | Template:Reputation | -3500 | -3000 + -500 |
Notice that for negative reputation that the Earned value is how far below 0 your reputation is, not how far till Hated or Exalted.
Headers[edit]
- 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.