Quests Progress Entity
The quests_progress entity stores the quests and one-time events each player completed, and the global flags shared by all the players.
How the quests feature uses it
The quests feature (the quests row in Features, enabled by default) is a tracking layer for your own game logic: the game code saves a row with a quest_key when a player completes something, and the feature sends those keys to the player when the player joins a room, so the server and the client know what was already done.
- A row with a player_id belongs to that player.
- A row without player_id is a global flag, sent to every player.
- The customData JSON is available for any extra progress data your code needs.
The sample treasure chest (chest_forest_1, see Timed Objects) is the reference example: the first time a player opens it, it gives a coin and saves a row with quest_key chest_forest_1 for that player; when the row exists the chest is empty for that player.
Managing quests progress in the admin panel
Quests progress is in the Quests section of the admin sidebar, under Quests Progress (/reldens-admin/quests-progress). Delete a row to let a player repeat that quest (for example to open the chest again), or use Create New to mark a quest as done for a player or, leaving Player ID empty, for everyone.
When the guests cleanup deletes an old guest user, the quests progress rows of the guest players are deleted too (see Guest System).
Key Properties
- player_id: The player, empty for the global flags
- quest_key: The quest identifier (required)
- customData: JSON with any extra quest progress data
Code integration (advanced)
- Server: QuestsPlugin (lib/quests/server/plugin.js) listens to reldens.createPlayerAfter, loads the rows of the player plus the global ones and sends {act: 'playerQuestsData', quests: [quest keys]} to the client.
- Client: QuestsClientPlugin (lib/quests/client/plugin.js) stores the keys in gameManager.playerQuestsData and emits reldens.playerQuestsLoaded with the keys and the game manager, so your client code can update objects or UI from it.
- Saving progress is done by your server code through the questsProgress entity, as the treasure chest does:
let questsProgress = this.dataServer.getEntity('questsProgress');
let questModel = await questsProgress.loadOne({quest_key: this.key, player_id: playerSchema.player_id});
if(!questModel){
await questsProgress.create({quest_key: this.key, player_id: playerSchema.player_id});
}
Database Relations
None (the player is stored by ID without a foreign key).
reldens