API:GetTomeAlertsData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the player's pending Tome of Knowledge alerts (new Tome entries).
alerts = GetTomeAlertsData()
Arguments
None.
Returns
- alerts
table– Array of alert tables, indexed from 1. Empty if there are no alerts.
Each alert table has these fields:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Alert id. The stock UI passes it to RemoveTomeAlert. |
alertType |
number |
— |
section |
number |
Tome section, compared with GameData.Tome.SECTION_* values.
|
entry |
number |
Entry within the section. |
subEntry |
number |
Sub-entry within the entry. |
name |
wstring |
Title of the alert. |
desc |
wstring |
Description text. |
xp |
number |
Experience reward. |
rewardType |
number |
— |
rewardId |
number |
— |
suppressPopup |
boolean |
true if no pop-up should be shown for this alert.
|
Details
- The client holds up to 20 alerts. The list ends at the first empty slot, so the table has at most 20 entries.
- If there is no player object, or the Lua state is not available, the function returns nothing.
- A new table is built on every call. The stock UI caches it in
DataUtils.GetTomeAlerts()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Player.tomeAlertsDirtyis set.
Errors
None.
Example
From easystem_utils/source/datautils.lua:
function DataUtils.GetTomeAlerts()
if( GameData.Player.tomeAlertsDirty ) then
DataUtilsData.tomeAlerts = GetTomeAlertsData()
GameData.Player.tomeAlertsDirty = false
end
return DataUtilsData.tomeAlerts
end
Using the fields, from ea_tomealertwindow/source/tomealertwindow.lua:
local alert = NewAlertData( tomeAlerts[1].section,
tomeAlerts[1].entry,
tomeAlerts[1].subEntry,
tomeAlerts[1].name,
tomeAlerts[1].desc,
tomeAlerts[1].xp )
-- Don't queue the alert for invalid sections or if the suppression flag is set
if( tomeAlerts[1].section ~= 0 and tomeAlerts[1].suppressPopup == false )
then
TomeAlertWindow.QueueAlert( alert )
end
