<?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%3AGetKeepData</id>
	<title>API:GetKeepData - 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%3AGetKeepData"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:GetKeepData&amp;action=history"/>
	<updated>2026-10-17T16:13:09Z</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:GetKeepData&amp;diff=30419&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:GetKeepData&amp;diff=30419&amp;oldid=prev"/>
		<updated>2026-10-16T19:44:18Z</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 status of a keep: owner, attack and defense status, and (for the player&amp;#039;s own realm) its siege weapon and skaven counts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
keepData = GetKeepData(keepId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;keepId : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Keep id, for example the &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; of a keep map point.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;keepData : &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; – Keep table (see below), or nothing if the id is not valid.&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;attackStatus&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;defenseStatus&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;realmOwner&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || Realm that owns the keep.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;siege&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; || Only when &amp;lt;code&amp;gt;realmOwner&amp;lt;/code&amp;gt; is the player&amp;#039;s realm. Array of 4 entries, each with &amp;lt;code&amp;gt;current&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;max&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;skaven&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;table&amp;lt;/code&amp;gt; || Only when &amp;lt;code&amp;gt;realmOwner&amp;lt;/code&amp;gt; is the player&amp;#039;s realm. Array of 5 entries, each with &amp;lt;code&amp;gt;current&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt;) and &amp;lt;code&amp;gt;max&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt;).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The &amp;lt;code&amp;gt;siege&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;skaven&amp;lt;/code&amp;gt; tables are left out for keeps owned by the other realm. The stock tooltip tests for them before reading.&lt;br /&gt;
* The stock map tooltip builds one line per &amp;lt;code&amp;gt;siege&amp;lt;/code&amp;gt; entry with string ids named &amp;lt;code&amp;gt;TOOLTIP_SIEGE_PAIR_&amp;lt;pairing&amp;gt;_REALM_&amp;lt;realm&amp;gt;_TYPE_&amp;lt;index&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The error message names the function &amp;lt;code&amp;gt;GameData.GetKeepData&amp;lt;/code&amp;gt;, although it is registered as the global &amp;lt;code&amp;gt;GetKeepData&amp;lt;/code&amp;gt;.&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;GameData.GetKeepData&amp;#039;: Keep Id %d is not valid.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/easystem_tooltips/source/maptooltips.lua&amp;lt;/code&amp;gt; (shortened):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local keepData = nil&lt;br /&gt;
if( ptData.pointType == SystemData.MapPips.KEEP )&lt;br /&gt;
then&lt;br /&gt;
    keepData = GetKeepData( ptData.id )&lt;br /&gt;
end&lt;br /&gt;
...&lt;br /&gt;
if ( keepData.siege )&lt;br /&gt;
then&lt;br /&gt;
    for index, siegeInfo in ipairs( keepData.siege )&lt;br /&gt;
    do&lt;br /&gt;
        local stringId = StringTables.MapSystem[&amp;quot;TOOLTIP_SIEGE_PAIR_&amp;quot;..pairing..&amp;quot;_REALM_&amp;quot;..keepData.realmOwner..&amp;quot;_TYPE_&amp;quot;..index]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:GetFortressStatuses|GetFortressStatuses]]&lt;br /&gt;
* [[API:GetMapPointData|GetMapPointData]]&lt;br /&gt;
* [[API:PurchaseKeepUpgrade|PurchaseKeepUpgrade]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>