QcServerAdvancements Class
The adventure guide on the server (decision E-923): tracks per player which criteria of the content's advancements are met (QcServerClient::advancements) and tells the client. More...
| Header: | #include <server/advancements/QcServerAdvancements.h> |
Public Functions
| quint64 | comparisons() const |
| bool | grant(QcServerClient &client, const QString &advancement) |
| void | inventoryChanged(QcServerClient &client) |
| quint64 | locationChecks() const |
| bool | revoke(QcServerClient &client, const QString &advancement) |
| void | sendAll(QcServerClient &client) const |
| void | tick() |
| void | trigger(QcServerClient &client, const QcAdvancementEvent &event) |
Static Public Members
| const int | announcementsPerTick |
| const quint64 | locationInterval |
Detailed Description
The gameplay reports events through trigger() at the places they happen (crafting, mining, combat, trading …); only the criteria of that trigger are looked at, so an event costs a few comparisons and nothing scans the world. The inventory criteria are checked when the inventory is sent (inventoryChanged), the location criteria in tick() for each player once per locationInterval ticks and only after they moved to another block. tick() also sends the clients what changed: the whole progress once after joining, then deltas. A newly reached advancement is announced to the other players in the chat (decision E-924) when the advancement and the game rule announceAdvancements allow it, at most announcementsPerTick lines per player and tick; the rest of that tick (/advancement grant … everything) becomes one line "… has made N more".
Member Function Documentation
quint64 QcServerAdvancements::comparisons() const
Returns the criteria compared with an event or the inventory since the start.
bool QcServerAdvancements::grant(QcServerClient &client, const QString &advancement)
Meets every criterion of advancement for client. Returns whether anything changed; false for a name the content does not know.
void QcServerAdvancements::inventoryChanged(QcServerClient &client)
The inventory of client changed (QcServerInventory::send).
quint64 QcServerAdvancements::locationChecks() const
Returns the places looked at by the location criteria since the start (tests check the cost per tick).
bool QcServerAdvancements::revoke(QcServerClient &client, const QString &advancement)
Meets no criterion of advancement for client any more. Returns whether anything changed; false for an advancement without met criteria.
void QcServerAdvancements::sendAll(QcServerClient &client) const
Sends the whole progress to client now (also done by tick() after joining).
void QcServerAdvancements::tick()
Location criteria of the players due this tick, then the changes to the clients.
void QcServerAdvancements::trigger(QcServerClient &client, const QcAdvancementEvent &event)
Reports event of the player client: the criteria of its trigger are looked at.
Member Variable Documentation
const int QcServerAdvancements::announcementsPerTick
Chat lines announcing advancements per player and tick at most.
const quint64 QcServerAdvancements::locationInterval
Ticks between two looks of the location criteria at a player.