QtCraft API C++ classes QML types Handbook

QcAdvancementTree Namespace

The adventure guide as the tree view shows it (decision E-924), without the GUI: which advancements a player sees, how far they are with each, and where each stands, one tree per root. More...

Header: #include <clientcore/player/QcAdvancementTree.h>

Classes

struct Node
struct Tree

Types

enum class State { Open, Partial, Reached }

Functions

QList<qsizetype> parentIndices(const QList<QcAdvancementDefinition> &advancements)
QList<QcAdvancementTree::Tree> trees(const QList<QcAdvancementDefinition> &advancements, const QcAdvancementProgress &progress)
QList<bool> visible(const QList<QcAdvancementDefinition> &advancements, const QcAdvancementProgress &progress)

Detailed Description

Visibility follows the role model: an advancement that is not hidden shows when it is a root or its parent shows; a hidden one, and everything below it, stays out of the tree until it or one of its descendants is reached; a reached advancement always shows, and with it its ancestors, so the lines stay connected. Unreached advancements below a hidden one that has not shown yet stay out as well (their parent is not there to hang from). The places come from QcTidyTreeLayout over the shown advancements only, in the content's order, so the tree closes up around what is hidden.

Classes

class Node

An advancement in the tree: where it stands and how far the player is with it. More...

class Tree

One tree of the guide with its size. More...

Type Documentation

enum class QcAdvancementTree::State

Reached, some requirement groups met (a progress count such as "2/4" shows it), or nothing yet.

ConstantValueDescription
QcAdvancementTree::State::Open0nothing yet
QcAdvancementTree::State::Partial1some requirement groups met
QcAdvancementTree::State::Reached2reached

Function Documentation

QList<qsizetype> QcAdvancementTree::parentIndices(const QList<QcAdvancementDefinition> &advancements)

Returns the parent of each advancement as an index into advancements, -1 for a root or a parent the list does not have.

QList<QcAdvancementTree::Tree> QcAdvancementTree::trees(const QList<QcAdvancementDefinition> &advancements, const QcAdvancementProgress &progress)

Returns the trees of the shown roots of advancements with the player's progress, in the content's order.

QList<bool> QcAdvancementTree::visible(const QList<QcAdvancementDefinition> &advancements, const QcAdvancementProgress &progress)

Returns per advancement of advancements (the content's, resolved: parents name advancements of the list or none) whether the player with progress sees it.