API:GetQuestData
From RoR Wiki
UI Lua API · Game functions
Version: WAR 1.4.8
Returns the quests in the player's quest log.
quests = GetQuestData()
Arguments
None.
Returns
- quests
table– Array of quest tables, indexed from 1.
Each quest table has these fields:
| Key | Type | Meaning |
|---|---|---|
id |
number |
Quest id. |
name |
wstring |
Quest name. |
area |
wstring |
— |
startDesc |
wstring |
— |
journalDesc |
wstring |
— |
complete |
boolean |
— |
maxTimer |
number |
— |
timeLeft |
number |
Time left on a timed quest. The stock UI counts it down itself and treats 0 as "no timer". |
zones |
table |
Array of tables, indexed from 1, each with id (number) and zoneName (wstring).
|
tracking |
boolean |
true if the quest is in one of the player's 10 quest tracker slots.
|
trackingPin |
boolean |
— |
questTypes |
table |
Table of 7 booleans with keys 0–6.
|
conditions |
table |
Array of conditions, indexed from 1. Each has name (wstring), curCounter (number), maxCounter (number) and failureCondition (boolean).
|
Details
- 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.GetQuests()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Player.questsDirtyis set.DataUtils.GetQuestData(questId)searches that cached list by id.
Errors
None.
Example
From easystem_utils/source/datautils.lua:
function DataUtils.GetQuests()
if( GameData.Player.questsDirty ) then
GameData.Player.questsDirty = false
DataUtilsData.quests = GetQuestData()
end
return DataUtilsData.quests
end
Counting down quest timers, from the same file:
if( questData.timeLeft ~= 0 ) then
questData.timeLeft = questData.timeLeft - timePassed
