QtCraft API C++ classes QML types Handbook

QcCharacterProfile Namespace

The player's character profile apart from the look itself: the colours the character screen offers, the built-in presets, random looks, and how look and presets are stored in settings.ini (decision E-231). More...

Header: #include <clientcore/settings/QcCharacterProfile.h>

Variables

const qsizetype maxPresetNameLength
const int maxPresets

Functions

const QList<QcCharacterPreset> &builtInPresets()
QString cleanPresetName(const QString &name)
const QList<quint32> &clothColors()
const QList<quint32> &hairColors()
QString hex(quint32 rgb)
QcAppearance loadAppearance(const QSettings &file, const QString &group)
QList<QcCharacterPreset> loadPresets(const QSettings &file)
QVariantMap lookMap(const QcAppearance &appearance)
QcAppearance random(const QStringList &outfits, const QStringList &hairStyles, const QStringList &capes, quint32 seed)
void saveAppearance(QSettings &file, const QString &group, const QcAppearance &appearance)
void savePresets(QSettings &file, const QList<QcCharacterPreset> &presets)
const QList<quint32> &skinColors()

Detailed Description

GUI-free; the server checks every look again (QcProfileValidation).

Variable Documentation

const qsizetype QcCharacterProfile::maxPresetNameLength

In Unicode code points (QcNameText).

const int QcCharacterProfile::maxPresets

Presets the player can save at most.

Function Documentation

const QList<QcCharacterPreset> &QcCharacterProfile::builtInPresets()

Returns the presets of the base game; their names are English texts translated in the context "QcCharacterProfile".

QString QcCharacterProfile::cleanPresetName(const QString &name)

Returns name without unpaired surrogates, control and format characters, trimmed, at most maxPresetNameLength code points cut between graphemes (QcNameText::clean).

const QList<quint32> &QcCharacterProfile::clothColors()

Returns the colours offered for shirt and pants, as 0xRRGGBB.

const QList<quint32> &QcCharacterProfile::hairColors()

Returns the hair colours offered, as 0xRRGGBB.

QString QcCharacterProfile::hex(quint32 rgb)

Returns rgb (0xRRGGBB) as "#rrggbb".

QcAppearance QcCharacterProfile::loadAppearance(const QSettings &file, const QString &group)

Returns the look in group ("character") of the settings file; names longer than QcAppearance::maxNameLength and colours that are not "#rrggbb" fall back to the default look's.

QList<QcCharacterPreset> QcCharacterProfile::loadPresets(const QSettings &file)

Returns the player's presets ("characterPresets/<n>/...") in the settings file; at most maxPresets, nameless ones skipped.

QVariantMap QcCharacterProfile::lookMap(const QcAppearance &appearance)

Returns appearance as QML sees a look: {outfit, hair, skin, hairColor, shirt, pants, cape} with "#rrggbb" colours.

QcAppearance QcCharacterProfile::random(const QStringList &outfits, const QStringList &hairStyles, const QStringList &capes, quint32 seed)

Returns a random look: an outfit of outfits (the default outfit when empty), a hair style of hairStyles or none, a cape of capes or none, and colours from the offered ones. The same seed gives the same look.

void QcCharacterProfile::saveAppearance(QSettings &file, const QString &group, const QcAppearance &appearance)

Stores appearance in group of file.

void QcCharacterProfile::savePresets(QSettings &file, const QList<QcCharacterPreset> &presets)

Stores presets in file ("characterPresets/<n>/...").

const QList<quint32> &QcCharacterProfile::skinColors()

Returns the skin colours offered, as 0xRRGGBB; the settings file may hold any other colour.