API:GetCampaignCityData
From RoR Wiki
UI Lua API · RvR functions
Version: WAR 1.4.8
Returns the RvR campaign state of a capital city.
cityData = GetCampaignCityData(cityId)
Arguments
- cityId
number– City id, for exampleGameData.CityId.EMPIREorGameData.CityId.CHAOS.
Returns
- cityData
table– City table (see below), or nothing if the id is invalid.
| Key | Type | Meaning |
|---|---|---|
cityId |
number |
City id. |
initialRealm |
number |
– |
controllingRealm |
number |
– |
cityState |
number |
State of the city. The stock map code compares city states with SystemData.CityStates values.
|
numFortressesCaptured |
number |
Number of captured fortresses. The stock world map shows its city locks from it. |
Details
- When the client has no campaign data at all, the function returns nothing without an error (and without checking the argument).
- A new table is built on every call.
- The function takes exactly one argument.
Errors
Error in function call 'GetCampaignCityData': Paring %d is not a valid campaign city id.(sic, "Paring"; only the low 16 bits of the id are printed)
Example
From default/ea_worldmapwindow/source/campaignview.lua:
if( GameDefs.ZoneCityIds[zoneId] ~= nil )
then
local cityData = GetCampaignCityData( GameDefs.ZoneCityIds[zoneId] )
WindowSetShowing( zoneWindowName.."Lock1", cityData.numFortressesCaptured <= 1 )
WindowSetShowing( zoneWindowName.."Lock2", cityData.numFortressesCaptured == 0 )
