Planeshift
Classes | Public Types | Public Member Functions | Public Attributes

psGUIInventoryMessage Class Reference

This message class deals with the inventory messages. More...

#include <messages.h>

List of all members.

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< ItemDescriptionitems
float maxWeight
 The total max weight the player can carry.
psMoney money
size_t totalEmptiedSlots
size_t totalItems
uint32 version

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
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.


Constructor & Destructor Documentation

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.

Parameters:
commandThe type that this inventory message is. Should be one of the defined enums. Default is request for inventory.
sizeThe 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.

Parameters:
clientNumClient destination.
commandShould be LIST.
totalItemsThe total items or item stacks.
totalEmptiedSlotsThe total number of slots been emptied.
maxWeightThe max weight the player can carry.
cache_versionInventory cache version we're gonna build in this message.
msgsizeThe 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.


Member Function Documentation

void psGUIInventoryMessage::AddEmptySlot ( int  containerID,
int  slotID 
)

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.

Parameters:
accessPointersA struct to a number of access pointers.
Returns:
Return a human readable string for the message.

Implements psMessageCracker.


Member Data Documentation

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.


The documentation for this class was generated from the following file: