<?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%3AGetCityRatingForCityId</id>
	<title>API:GetCityRatingForCityId - 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%3AGetCityRatingForCityId"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetCityRatingForCityId&amp;action=history"/>
	<updated>2026-10-17T13:13:21Z</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:GetCityRatingForCityId&amp;diff=30363&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:GetCityRatingForCityId&amp;diff=30363&amp;oldid=prev"/>
		<updated>2026-10-16T19:43:23Z</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 rating (rank) of a capital city.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rating = GetCityRatingForCityId(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;, &amp;lt;code&amp;gt;GameData.CityId.CHAOS&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;GameData.Player.City.id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;rating : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The stored rating of the city. Nothing if the rating is 0 or the client has no rating for that city.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;A rating of 0 returns nothing&amp;#039;&amp;#039;&amp;#039;, not &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;. Code that compares the result directly with a number, as &amp;lt;code&amp;gt;MapUtils&amp;lt;/code&amp;gt; does (&amp;lt;code&amp;gt;rating &amp;lt;= cityRating&amp;lt;/code&amp;gt;), raises a Lua error in that case. Use &amp;lt;code&amp;gt;local rating = GetCityRatingForCityId(id) or 0&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The value is read from a table the client keeps; nothing is requested from the server.&lt;br /&gt;
* The function takes exactly one argument.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None besides the generic &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; message when the argument is missing or not a number.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/easystem_utils/source/maputils.lua&amp;lt;/code&amp;gt;: one star per city rank:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local cityRating = GetCityRatingForCityId( cityId )&lt;br /&gt;
&lt;br /&gt;
for rating = 1, GameDefs.NUM_CITY_RANKS&lt;br /&gt;
do&lt;br /&gt;
    local showStar = rating &amp;lt;= cityRating&lt;br /&gt;
    WindowSetShowing( windowName..&amp;quot;Star&amp;quot;..rating, showStar )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:GetCampaignCityData|GetCampaignCityData]]&lt;br /&gt;
* [[API:GetCityInstanceId|GetCityInstanceId]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>