QtCraft API C++ classes QML types Handbook

QcEnchantmentParser Namespace

Parses an enchantment (enchantments/<name>.json, decision E-864). More...

Header: #include <common/content/items/QcEnchantmentParser.h>

Functions

std::optional<QcEnchantmentEffect> effectOf(const QString &text)
bool isItemKind(const QString &kind)
QcResult<QcEnchantmentDefinition> parseEnchantment(const QJsonObject &json, const QString &packNamespace)

Detailed Description

All input is untrusted.

Function Documentation

std::optional<QcEnchantmentEffect> QcEnchantmentParser::effectOf(const QString &text)

Returns the effect named text ("efficiency", "unbreaking", …); none for an unknown name.

bool QcEnchantmentParser::isItemKind(const QString &kind)

Returns whether kind is one of the item kinds an enchantment may name in items (QcEnchanting::kindsOf).

QcResult<QcEnchantmentDefinition> QcEnchantmentParser::parseEnchantment(const QJsonObject &json, const QString &packNamespace)

Returns the enchantment read from json, its names qualified with packNamespace, or the first failure.