API:TomeGetItemRewardData
From RoR Wiki
UI Lua API · Tome functions
Version: WAR 1.4.8
Returns the item behind a Tome of Knowledge item reward, and where in the Tome it is unlocked.
itemData = TomeGetItemRewardData(rewardId)
Arguments
- rewardId
number– Reward id: therewardIdof an item reward (reward typeGameData.Tome.REWARD_ITEMorREWARD_ITEM_NO_AUTOCREATE), or of an entry from TomeGetItemRewardsList.
Returns
- itemData
table– Always a table (possibly empty) when the argument is a number.
| Key | Type | Meaning |
|---|---|---|
unlockInfo |
table |
Where the reward is unlocked (see below). |
| item fields | various | When the client knows the item, the table also holds the item's data, in the same layout as other item tables (for example name and iconNum, which the stock UI reads).
|
unlockInfo:
| Key | Type | Meaning |
|---|---|---|
section |
number |
Tome section of the unlocking entry, or 0.
|
entry |
number |
Id of the unlocking entry in that section, or 0.
|
name |
wstring |
Name of the unlocking entry. |
text |
wstring |
Text describing the unlocking entry. |
Details
sectionandentryare both0when the reward has no unlocking entry. The stock UI then does not offer a link to it.- If the id is not a valid item reward, an error is logged and an empty table is returned.
- The error message carries the name
TomeGetPlayerItemRewardData.
Errors
These are written to the UI log; the call returns normally.
Error in function call 'TomeGetPlayerItemRewardData': %d is not a valid item reward id.
Example
From ea_tomeofknowledge/source/tomewindow.lua:
local itemData = TomeGetItemRewardData( rewardData.rewardId ) iconNum = itemData.iconNum
From ea_tomeofknowledge/source/tomewindow_rewards.lua:
local itemData = TomeGetItemRewardData( itemId )
if( itemData == nil ) then
return
end
if( itemData.unlockInfo.section == 0 and itemData.unlockInfo.entry == 0 ) then
return
end
TomeWindow.OpenTomeToEntry( itemData.unlockInfo.section, itemData.unlockInfo.entry )
