QtCraft API C++ classes QML types Handbook

QcVillagerRecord Struct

What is saved of a villager (decisions E-411, E-414): the village it lives in, its bed (head) and workstation (claimed there under its creature's persistent id, QcCreature::uid, decision E-420), its profession with level and experience, the state of its offers and when it last restocked, the seed and village style of its look, the crops it brought in (food for breeding, stage 37.3) and when it last slept (decision E-470). More...

Header: #include <server/villages/QcVillager.h>
Inherited By:

QcVillager

Public Variables

int experience
std::optional<QcBlockPos> home
double lastRestock
int level
quint32 look
QList<QcVillagerOffer> offers
int produce
QString profession
int restocks
double sleptAt
QString style
qint64 village
std::optional<QcBlockPos> work

Static Public Members

const int maxExperience
const int maxLevel
const int maxOffers
const int maxProduce
const double maxRestockTime

Detailed Description

Member Variable Documentation

int QcVillagerRecord::experience

Its trading experience.

std::optional<QcBlockPos> QcVillagerRecord::home

Its bed (the head), if it has one.

double QcVillagerRecord::lastRestock

World time of the last restock (negative: never).

int QcVillagerRecord::level

Its trading level (1 to maxLevel).

quint32 QcVillagerRecord::look

The seed of its look.

const int QcVillagerRecord::maxExperience

The most experience a saved villager may have.

const int QcVillagerRecord::maxLevel

The highest level.

const int QcVillagerRecord::maxOffers

The most offers a saved villager may have.

const int QcVillagerRecord::maxProduce

The most crops a saved villager may have brought in.

const double QcVillagerRecord::maxRestockTime

The latest world time a restock may lie at (about 30 million years of play); a saved time beyond it is refused as damaged.

QList<QcVillagerOffer> QcVillagerRecord::offers

In the order of QcVillagerTrades::offersOf; aligned with it by QcVillagerTrades::sync.

int QcVillagerRecord::produce

The crops it brought in (food for breeding).

QString QcVillagerRecord::profession

Its profession; empty for none.

int QcVillagerRecord::restocks

The restocks on the day of lastRestock.

double QcVillagerRecord::sleptAt

World time it last lay in its bed (negative: never): villagers that slept within a day summon iron golems (QcVillageGolems, decision E-470).

QString QcVillagerRecord::style

The village style of its look.

qint64 QcVillagerRecord::village

QcVillage::id; 0 for a villager without a village (summoned), which only strolls.

std::optional<QcBlockPos> QcVillagerRecord::work

Its workstation, if it has one.