QtCraft API C++ classes QML types Handbook

QcVillagerParser Namespace

Parses the settings of a villager species (villagers/<name>.json), the professions (professions/<name>.json) and the look of a village style's villagers (decision E-411, E-421). More...

Header: #include <common/content/villages/QcVillagerParser.h>

Functions

QcResult<QcVillagerProfession> parseProfession(const QJsonObject &json, const QString &packNamespace)
QcResult<QcVillagerSettings> parseVillagerSettings(const QJsonObject &json, const QString &packNamespace)
QcVillagerLook readLook(const QString &key, const QString &packNamespace, QcJsonFieldReader &reader)

Detailed Description

All input is untrusted.

Function Documentation

QcResult<QcVillagerProfession> QcVillagerParser::parseProfession(const QJsonObject &json, const QString &packNamespace)

Returns the profession defined by json (a file in professions), names qualified with packNamespace, or the first error.

QcResult<QcVillagerSettings> QcVillagerParser::parseVillagerSettings(const QJsonObject &json, const QString &packNamespace)

Returns the villager species defined by json (a file in villagers), names qualified with packNamespace, or the first error.

QcVillagerLook QcVillagerParser::readLook(const QString &key, const QString &packNamespace, QcJsonFieldReader &reader)

Returns the look at key of the object of reader (outfit, hair and colour lists), names qualified with packNamespace; unset without the key.