API:GetKeepData
From RoR Wiki
UI Lua API · RvR functions
Version: WAR 1.4.8
Returns the status of a keep: owner, attack and defense status, and (for the player's own realm) its siege weapon and skaven counts.
keepData = GetKeepData(keepId)
Arguments
- keepId
number– Keep id, for example theidof a keep map point.
Returns
- keepData
table– Keep table (see below), or nothing if the id is not valid.
| Key | Type | Meaning |
|---|---|---|
attackStatus |
number |
– |
defenseStatus |
number |
– |
realmOwner |
number |
Realm that owns the keep. |
siege |
table |
Only when realmOwner is the player's realm. Array of 4 entries, each with current (number) and max (number).
|
skaven |
table |
Only when realmOwner is the player's realm. Array of 5 entries, each with current (number) and max (number).
|
Details
- The
siegeandskaventables are left out for keeps owned by the other realm. The stock tooltip tests for them before reading. - The stock map tooltip builds one line per
siegeentry with string ids namedTOOLTIP_SIEGE_PAIR_<pairing>_REALM_<realm>_TYPE_<index>. - The error message names the function
GameData.GetKeepData, although it is registered as the globalGetKeepData. - A new table is built on every call.
- The function takes exactly one argument.
Errors
Error in function call 'GameData.GetKeepData': Keep Id %d is not valid.
Example
From default/easystem_tooltips/source/maptooltips.lua (shortened):
local keepData = nil
if( ptData.pointType == SystemData.MapPips.KEEP )
then
keepData = GetKeepData( ptData.id )
end
...
if ( keepData.siege )
then
for index, siegeInfo in ipairs( keepData.siege )
do
local stringId = StringTables.MapSystem["TOOLTIP_SIEGE_PAIR_"..pairing.."_REALM_"..keepData.realmOwner.."_TYPE_"..index]
