Skip to content

Return of Reckoning

Wiki

RoR Wiki

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 the id of 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 siege and skaven tables 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 siege entry with string ids named TOOLTIP_SIEGE_PAIR_<pairing>_REALM_<realm>_TYPE_<index>.
  • The error message names the function GameData.GetKeepData, although it is registered as the global GetKeepData.
  • 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]

See also