<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetCampaignCityData</id>
	<title>API:GetCampaignCityData - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AGetCampaignCityData"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetCampaignCityData&amp;action=history"/>
	<updated>2026-10-17T04:19:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:GetCampaignCityData&amp;diff=30353&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetCampaignCityData&amp;diff=30353&amp;oldid=prev"/>
		<updated>2026-10-16T19:43:13Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=RvR}}&lt;br /&gt;
Returns the RvR campaign state of a capital city.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cityData = GetCampaignCityData(cityId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;cityId : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – City id, for example &amp;lt;code&amp;gt;GameData.CityId.EMPIRE&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GameData.CityId.CHAOS&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;cityData : &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; – City table (see below), or nothing if the id is invalid.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cityId&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || City id.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;initialRealm&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;controllingRealm&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || –&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cityState&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || State of the city. The stock map code compares city states with &amp;lt;code&amp;gt;SystemData.CityStates&amp;lt;/code&amp;gt; values.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;numFortressesCaptured&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Number of captured fortresses. The stock world map shows its city locks from it.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* When the client has no campaign data at all, the function returns nothing without an error (and without checking the argument).&lt;br /&gt;
* A new table is built on every call.&lt;br /&gt;
* The function takes exactly one argument.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;GetCampaignCityData&amp;#039;: Paring %d is not a valid campaign city id.&amp;lt;/code&amp;gt; (sic, &amp;quot;Paring&amp;quot;; only the low 16 bits of the id are printed)&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/ea_worldmapwindow/source/campaignview.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if( GameDefs.ZoneCityIds[zoneId] ~= nil )&lt;br /&gt;
then&lt;br /&gt;
    local cityData = GetCampaignCityData( GameDefs.ZoneCityIds[zoneId] )&lt;br /&gt;
    WindowSetShowing(  zoneWindowName..&amp;quot;Lock1&amp;quot;, cityData.numFortressesCaptured &amp;lt;= 1 )&lt;br /&gt;
    WindowSetShowing(  zoneWindowName..&amp;quot;Lock2&amp;quot;, cityData.numFortressesCaptured == 0 )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:GetCityRatingForCityId|GetCityRatingForCityId]]&lt;br /&gt;
* [[API:GetCampaignPairingData|GetCampaignPairingData]]&lt;br /&gt;
* [[API:GetFortressStatuses|GetFortressStatuses]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>