API:TomeGetCardData
From RoR Wiki
UI Lua API · Tome functions
Version: WAR 1.4.8
Returns the data of a Tome of Knowledge card, including where it is unlocked.
cardData = TomeGetCardData(cardId)
Arguments
- cardId
number– Card id, for example thecardIdfield of entries from TomeGetAchievementsSubTypeData or TomeGetCardList.
Returns
- cardData
table– The card's data. For an unknown id an error is logged and an empty table is returned.
| Key | Type | Meaning |
|---|---|---|
cardId |
number |
Card id. |
valueName |
wstring |
Name of the card's value. L"???" for a locked card.
|
suitName |
wstring |
Name of the card's suit. L"???" for a locked card.
|
iconNum |
number |
Icon id for GetIconData. 0 for a locked card.
|
suit |
number |
Suit number. 0 for a locked card.
|
value |
number |
Value number. 0 for a locked card.
|
rarity |
number |
Rarity number. 2 for a locked card.
|
unlockInfo |
table |
Where the card is unlocked (see below). Filled for locked cards too. |
Fields of unlockInfo:
| Key | Type | Meaning |
|---|---|---|
section |
number |
Tome section of the unlocking entry, a GameData.Tome.SECTION_* value; 0 if none.
|
entry |
number |
Id of the unlocking entry in that section; 0 if none.
|
name |
wstring |
Name of the unlocking entry. |
text |
wstring |
– |
Details
- The stock UI opens the Tome at
unlockInfo.section/unlockInfo.entrywhen a card is clicked, unless both are0. - Exactly one argument must be passed.
Errors
Written to the UI log; the function still returns a table.
Error in function call 'TomeGetCardData': %d is not a valid card id.
Example
From default/ea_tomeofknowledge/source/tomewindow_rewards.lua:
local cardData = TomeGetCardData( cardId )
...
if( cardData.unlockInfo.section == 0 and cardData.unlockInfo.entry == 0 ) then
...
TomeWindow.OpenTomeToEntry( cardData.unlockInfo.section, cardData.unlockInfo.entry )
From default/ea_tomeofknowledge/source/tomewindow.lua:
local texture, x, y = GetIconData( cardData.iconNum )
...
local cardName = GetFormatStringFromTable( "Default", StringTables.Default.TEXT_CARD_NAME, { cardData.valueName, cardData.suitName } )
