API:GameData.GetScenarioPlayers
From RoR Wiki
UI Lua API · Scenario functions
Version: WAR 1.4.8
Returns the scoreboard of the current scenario (or city siege instance): one entry per player with their stats.
players = GameData.GetScenarioPlayers()
Arguments
None.
Returns
- players
table– Array of player tables, indexed from 1, or nothing if the client has no scenario data.
Each player table has these fields:
| Key | Type | Meaning |
|---|---|---|
name |
wstring |
Character name. |
career |
wstring |
Career name. |
careerId |
number |
Career id. The stock UI turns it into an icon with Icons.GetCareerIconIDFromCareerNamesID.
|
rank |
number |
Character rank. |
realm |
number |
Realm of the player. |
solokills |
number |
– |
groupkills |
number |
– |
deathblows |
number |
– |
deaths |
number |
– |
damagedealt |
number |
– |
healingdealt |
number |
– |
renown |
number |
– |
renownbonus |
number |
– |
experience |
number |
– |
experiencebonus |
number |
– |
isplayer |
boolean |
true for the local player's own entry.
|
Details
- Players of both realms are included.
- When
GameData.Player.isInSiegeis true the client reads the city instance's player list; otherwise it reads the scenario's list. If the list it needs does not exist, the function returns nothing. - The stat keys are all lower case.
- A new table is built on every call. The stock scenario summary window rebuilds its data from it on the
SCENARIO_PLAYERS_LIST_UPDATEDandSCENARIO_PLAYERS_LIST_STATS_UPDATEDevents.
Errors
None.
Example
From default/ea_scenariosummarywindow/scenariosummarywindow.lua (shortened):
local interimPlayerData = GameData.GetScenarioPlayers()
if( interimPlayerData ~= nil ) then
for key, value in ipairs( interimPlayerData ) do
ScenarioSummaryWindow.playersData[key] = {}
ScenarioSummaryWindow.playersData[key].name = value.name
ScenarioSummaryWindow.playersData[key].solokills = value.solokills
ScenarioSummaryWindow.playersData[key].isplayer = value.isplayer
ScenarioSummaryWindow.playersData[key].careerIcon = Icons.GetCareerIconIDFromCareerNamesID(value.careerId)
end
end
