QtCraft API C++ classes QML types Handbook

QcServerInventory Class

Inventories of the players: moving items between the inventory, the crafting grid, armour slots and an open machine or chest or the input slot of the open stonecutter (decision E-785), throwing and dropping items, armour worn and taken off. More...

Header: #include <server/gameplay/QcServerInventory.h>

Public Functions

void closeHeldScreen(QcServerClient &client)
void dropAll(QcServerClient &client)
void dropItem(QcServerClient &client, QcMsg::DropItem message)
void equipHeld(QcServerClient &client)
void equipmentWorn(QcServerClient &client, const QcEquipment &equipment, bool broke)
void exchangeHeld(QcServerClient &client, const QString &item)
void giveOrThrow(QcServerClient &client, const QcItemStack &stack)
void moveItem(QcServerClient &client, QcMsg::MoveInventoryItem move)
void quickMove(QcServerClient &client, QcMsg::QuickMoveItem move)
void returnScreenInputs(QcServerClient &client)
void send(QcServerClient &client)
void setEquipment(QcServerClient &client, const QcEquipment &equipment)
void throwFromPlayer(const QcServerClient &client, const QcItemStack &stack)
void wearHeld(QcServerClient &client)

Static Public Members

const int craftingGridSlot
const int equipmentSlot
const int machineSlot
const double throwSpeed

Detailed Description

Crafting itself is QcServerCrafting's.

Member Function Documentation

void QcServerInventory::closeHeldScreen(QcServerClient &client)

Closes the screen of a backpack open in the hand of client (decision E-833), for the player too; no other screen. The item in the locked slot keeps its contents, nothing else is touched.

void QcServerInventory::dropAll(QcServerClient &client)

Drops everything the player client carries (death without keepInventory), the open stonecutter's input and the open enchanting table's slots included.

void QcServerInventory::dropItem(QcServerClient &client, QcMsg::DropItem message)

Throws out what message of client asks for.

void QcServerInventory::equipHeld(QcServerClient &client)

Right click of client with armour: puts the held piece on, the one worn there goes into the hand.

void QcServerInventory::equipmentWorn(QcServerClient &client, const QcEquipment &equipment, bool broke)

Takes over the equipment of client worn down by a hit (QcArmour::wear; broke: a piece broke) and tells the player and those who see them.

void QcServerInventory::exchangeHeld(QcServerClient &client, const QString &item)

Turns one item of the selected stack of client into item (filled bucket, firefly in a bottle); what does not fit into the inventory is thrown.

void QcServerInventory::giveOrThrow(QcServerClient &client, const QcItemStack &stack)

Adds stack to the inventory of client; what does not fit is thrown (sending is left to the caller).

void QcServerInventory::moveItem(QcServerClient &client, QcMsg::MoveInventoryItem move)

Carries out move of client between slots.

void QcServerInventory::quickMove(QcServerClient &client, QcMsg::QuickMoveItem move)

Carries out the shift-click move of client: moves the whole stack to where it belongs (QcQuickMove).

void QcServerInventory::returnScreenInputs(QcServerClient &client)

Gives the open stonecutter's input and the open enchanting table's item and lapis (decision E-864) back to the player client like the crafting grid's items (what does not fit is thrown; catalogue items that do not fit are gone); the screen stays open and nothing is sent.

void QcServerInventory::send(QcServerClient &client)

Sends client its inventory, crafting grid and armour; with a stonecutter open also its slots.

void QcServerInventory::setEquipment(QcServerClient &client, const QcEquipment &equipment)

Changes what the player client wears to equipment (sending is left to the caller); others that see them get it with the next sync.

void QcServerInventory::throwFromPlayer(const QcServerClient &client, const QcItemStack &stack)

Spawns stack as an item entity thrown from the eyes of client along the view direction.

void QcServerInventory::wearHeld(QcServerClient &client)

Wears the held tool of client by one use (a hoe tilling, flint and steel lighting fire), except in creative mode; a tool used up breaks. Tells the player.

Member Variable Documentation

const double QcServerInventory::throwSpeed

Speed of items thrown by a player.