Planeshift
|
This message class deals with the inventory messages. More...
#include <messages.h>
Classes | |
struct | ItemDescription |
A small struct to hold item info after read out of message. More... | |
Public Types | |
enum | commands { LIST, REQUEST, UPDATE_REQUEST, UPDATE_LIST } |
Public Member Functions | |
void | AddEmptySlot (int containerID, int slotID) |
Add a newly emptied slot to output message buffer. | |
void | AddItem (const char *name, const char *meshName, const char *materialName, int containerID, int slot, int stackcount, float weight, float size, const char *icon, int purifyStatus, csStringSet *msgstrings) |
Add an item to the output message buffer. | |
void | AddMoney (const psMoney &money) |
Add money to the output message buffer. | |
PSF_DECLARE_MSG_FACTORY () | |
psGUIInventoryMessage (uint32_t clientNum, uint8_t command, uint32_t totalItems, uint32_t totalEmptiedSlots, float maxWeight, uint32_t cache_version, size_t msgsize) | |
Create a new message that will be used for an inventory list. | |
psGUIInventoryMessage (uint8_t command=REQUEST, uint32_t size=0) | |
Creates a message with a command and max size. | |
psGUIInventoryMessage (MsgEntry *message, NetBase::AccessPointers *accessPointers) | |
Crack open the message. | |
virtual csString | ToString (NetBase::AccessPointers *accessPointers) |
Converts the message into human readable string. | |
Public Attributes | |
uint8_t | command |
csArray< ItemDescription > | items |
float | maxWeight |
The total max weight the player can carry. | |
psMoney | money |
size_t | totalEmptiedSlots |
size_t | totalItems |
uint32 | version |
This message class deals with the inventory messages.
This deals with all the requests/incomming information that the player may need for the inventory screen. When the message is cracked open it fills some public data members with data from the message based on what the command is, so you should be aware of which data is valid for which commands.
When building the message the usual flow is:
When reading the message the usual flow is:
Definition at line 1672 of file messages.h.
LIST |
This is a list of items. |
REQUEST |
This is a request for entire inventory. |
UPDATE_REQUEST |
This is a request for inventory updates. |
UPDATE_LIST |
This is a list-update of items. |
Definition at line 1675 of file messages.h.
psGUIInventoryMessage::psGUIInventoryMessage | ( | uint8_t | command = REQUEST , |
uint32_t | size = 0 |
||
) |
Creates a message with a command and max size.
The default message constructed is a request for inventory which should normally be only done on the client.
command | The type that this inventory message is. Should be one of the defined enums. Default is request for inventory. |
size | The max size of this message. Can be clipped when sent on the network. |
psGUIInventoryMessage::psGUIInventoryMessage | ( | uint32_t | clientNum, |
uint8_t | command, | ||
uint32_t | totalItems, | ||
uint32_t | totalEmptiedSlots, | ||
float | maxWeight, | ||
uint32_t | cache_version, | ||
size_t | msgsize | ||
) |
Create a new message that will be used for an inventory list.
This is usually done by the server to create a message to be sent to the client about the player's inventory. It needs to know totalItems so it can write that to the message first.
clientNum | Client destination. |
command | Should be LIST. |
totalItems | The total items or item stacks. |
totalEmptiedSlots | The total number of slots been emptied. |
maxWeight | The max weight the player can carry. |
cache_version | Inventory cache version we're gonna build in this message. |
msgsize | The size. |
psGUIInventoryMessage::psGUIInventoryMessage | ( | MsgEntry * | message, |
NetBase::AccessPointers * | accessPointers | ||
) |
Crack open the message.
This is a switch statement that fills in particular data members depending on the command that is given.
Add a newly emptied slot to output message buffer.
void psGUIInventoryMessage::AddItem | ( | const char * | name, |
const char * | meshName, | ||
const char * | materialName, | ||
int | containerID, | ||
int | slot, | ||
int | stackcount, | ||
float | weight, | ||
float | size, | ||
const char * | icon, | ||
int | purifyStatus, | ||
csStringSet * | msgstrings | ||
) |
Add an item to the output message buffer.
void psGUIInventoryMessage::AddMoney | ( | const psMoney & | money | ) |
Add money to the output message buffer.
psGUIInventoryMessage::PSF_DECLARE_MSG_FACTORY | ( | ) |
virtual csString psGUIInventoryMessage::ToString | ( | NetBase::AccessPointers * | accessPointers | ) | [virtual] |
Converts the message into human readable string.
accessPointers | A struct to a number of access pointers. |
Implements psMessageCracker.
uint8_t psGUIInventoryMessage::command |
Definition at line 1684 of file messages.h.
Definition at line 1777 of file messages.h.
The total max weight the player can carry.
Definition at line 1780 of file messages.h.
Definition at line 1781 of file messages.h.
Definition at line 1779 of file messages.h.
Definition at line 1778 of file messages.h.
Definition at line 1782 of file messages.h.