Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:TomeGetBestiarySpeciesData

From RoR Wiki

UI Lua API · Tome functions
Version: WAR 1.4.8

Returns the bestiary page of a creature species: kill count, lore texts and kill tasks with their rewards.

speciesData = TomeGetBestiarySpeciesData(speciesId)

Arguments

speciesId
number – Species id, as in the species list of TomeGetBestiarySubTypeData.

Returns

speciesData
table – The species' data, or nothing if the id is invalid or the species is still locked.
Key Type Meaning
id number Species id.
name wstring Species name.
killCount number The player's kill count for the species.
tasks table Array of the species' tasks (see below).
text1, text2, text3 wstring The three lore texts. They can be empty wide strings; the stock UI hides text2 and text3 when they are empty.

Each task table in tasks:

Key Type Meaning
isComplete boolean Whether the player has completed the task.
unlockEventId number Only for completed tasks: id of the unlock event. The stock UI uses it for the "bragging rights" context menu.
cardId number Id of the Tome card for the task, or 0. The stock UI passes it to TomeGetCardData.
text wstring The task text.
desc wstring Longer description; may be empty.
rewards table Array of reward tables with rewardType (number, a GameData.Tome.REWARD_* value) and rewardId (number).

Details

Errors

These are written to the UI log, and the function returns nothing.

  • Error in function call 'TomeGetBestiarySpeciesData': %d is not a valid bestiary species id.
  • Error in function call 'TomeGetBestiarySpeciesData': You have not yet unlocked any species # %d.

Example

From ea_tomeofknowledge/source/tomewindow_bestiary.lua:

TomeWindow.Bestiary.CurSpeciesData  = TomeGetBestiarySpeciesData( id )
local data = TomeWindow.Bestiary.CurSpeciesData

LabelSetText( "BestiarySpeciesInfoName",  wstring.upper( data.name ) )
TomeSetBestiarySpeciesImage( id )
...
for index, taskData in ipairs( data.tasks ) do
    ButtonSetPressedFlag( taskWindowName.."CompletedBtn", taskData.isComplete )
    LabelSetText( taskWindowName.."Text", taskData.text )
    TomeWindow.SetTomeReward( taskWindowName.."Reward1", taskData.rewards[1] )
    TomeWindow.SetTomeReward( taskWindowName.."Reward2", taskData.rewards[2] )
end

See also