API:TomeGetAchievementsTOC
From RoR Wiki
UI Lua API · Tome functions
Version: WAR 1.4.8
Returns the table of contents of the Tome of Knowledge achievements section: every achievement type with its subtypes.
types = TomeGetAchievementsTOC()
Arguments
None.
Returns
- types
table– Array of achievement types. The stock UI sorts the subtypes by name itself.
Each type table:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Type id. |
name |
wstring |
Type name. |
subtypes |
table |
Array of the type's subtypes (see below). |
Each subtype table in subtypes:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Subtype id, as used by TomeGetAchievementsSubTypeData. 0 for a locked subtype.
|
name |
wstring |
Subtype name. L"???" for a locked subtype.
|
isUnlocked |
boolean |
Whether the subtype is unlocked (see TomeIsAchievementsSubTypeUnlocked). |
numUnlocks |
number |
Number of unlocked entries in the subtype. |
Details
- All types and subtypes are listed, including locked ones.
- If the name tables are not loaded, names are empty wide strings.
Errors
None.
Example
From default/ea_tomeofknowledge/source/tomewindow_achievements.lua:
TomeWindow.Achievements.TOCData = TomeGetAchievementsTOC()
...
for subTypeIndex, subTypeData in ipairs( typeData.subtypes ) do
...
local killText = L""..subTypeData.numUnlocks
TomeWindow.SetTOCItemText( subTypeWindowName, subTypeData.id, subTypeData.name, killText )
ButtonSetDisabledFlag( subTypeWindowName.."Text", subTypeData.isUnlocked == false )
end
