Planeshift
psViewItemDescription Class Reference

General Message for sending information about an item to a client. More...

#include <messages.h>

Public Member Functions

 PSF_DECLARE_MSG_FACTORY ()
 
 psViewItemDescription (int containerID, int slotID)
 Requests to the server for an item Description. More...
 
 psViewItemDescription (uint32_t to, const char *itemName, const char *description, const char *icon, uint32_t stackCount)
 Construct a message to go out to a client. More...
 
 psViewItemDescription (MsgEntry *me, NetBase::AccessPointers *accessPointers)
 Crack out the details from the message. More...
 
virtual csString ToString (NetBase::AccessPointers *accessPointers)
 Converts the message into human readable string. More...
 
- Public Member Functions inherited from psMessageCracker
void FireEvent ()
 Publishes the message to the local program. More...
 
virtual csString GetMessageTypeName () const =0
 Gets the name of the message type. More...
 
void Multicast (csArray< PublishDestination > &multi, uint32_t except, float range)
 Multicasts the message to all current connections. More...
 
 psMessageCracker ()
 
void SendMessage ()
 Sends the message to the client/server. More...
 
virtual ~psMessageCracker ()
 

Public Attributes

int containerID
 The container ID for this item. More...
 
int ContainerSlots
 The slots available in this container. More...
 
bool hasContents
 True if this item is a container and has contents. More...
 
const char * itemDescription
 The description of this item or container. More...
 
const char * itemIcon
 The 2D graphic GUI image. More...
 
const char * itemName
 The name of the item or container. More...
 
int msgSize
 Running count of message size. Used for constructing the outgoing message. More...
 
int slotID
 Where this item is in the container. More...
 
uint32_t stackCount
 Stack count of the item. More...
 
int to
 The destination client for this message. More...
 
- Public Attributes inherited from psMessageCracker
int filterNumber
 
csRef< MsgEntrymsg
 
bool valid
 

Additional Inherited Members

- Static Public Attributes inherited from psMessageCracker
static MsgHandlermsghandler
 

Detailed Description

General Message for sending information about an item to a client.

This class can take single items or containers and will send all the data to the client. The client will then pop up the correct window when it gets one of these messages. The item screen for a single item or the container screen if the item is a container.

When sending an item to a client you create this message by giving the name and description of the item ( all items have this )

If it is a container you need to set the container ID and call AddContents() for each item in the container. After that you need to call ConstructMsg() to build the network message.

Definition at line 4240 of file messages.h.

Constructor & Destructor Documentation

psViewItemDescription::psViewItemDescription ( int  containerID,
int  slotID 
)

Requests to the server for an item Description.

Parameters
containerIDWhat container this item is from. Can be one of the special ones like CONTAINER_INVENTORY. If the item is in the world or not in a container then it is the gem id of the item.
slotIDWhere this item is in the container.
psViewItemDescription::psViewItemDescription ( uint32_t  to,
const char *  itemName,
const char *  description,
const char *  icon,
uint32_t  stackCount 
)

Construct a message to go out to a client.

If icContainer is false then the message is constructed right away. If it is true then the data is stored and the message is not constructed (because size is not known ).

Parameters
toThe desitination client.
itemNameThe name of the item requested.
descriptionThe description of the requested item.
iconThe 2D gui image to draw for this item.
stackCountThe numer of items in the stack.
isContainerTrue if this item is a container.
psViewItemDescription::psViewItemDescription ( MsgEntry me,
NetBase::AccessPointers accessPointers 
)

Crack out the details from the message.

This will look at the packet and figure out if it is a single item or a container. If it is a container it will populate it's internal array of data.

Member Function Documentation

psViewItemDescription::PSF_DECLARE_MSG_FACTORY ( )
virtual csString psViewItemDescription::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

int psViewItemDescription::containerID

The container ID for this item.

Definition at line 4297 of file messages.h.

int psViewItemDescription::ContainerSlots

The slots available in this container.

Definition at line 4300 of file messages.h.

bool psViewItemDescription::hasContents

True if this item is a container and has contents.

Definition at line 4309 of file messages.h.

const char* psViewItemDescription::itemDescription

The description of this item or container.

Definition at line 4288 of file messages.h.

const char* psViewItemDescription::itemIcon

The 2D graphic GUI image.

Definition at line 4291 of file messages.h.

const char* psViewItemDescription::itemName

The name of the item or container.

Definition at line 4285 of file messages.h.

int psViewItemDescription::msgSize

Running count of message size. Used for constructing the outgoing message.

Definition at line 4306 of file messages.h.

int psViewItemDescription::slotID

Where this item is in the container.

Definition at line 4303 of file messages.h.

uint32_t psViewItemDescription::stackCount

Stack count of the item.

Definition at line 4294 of file messages.h.

int psViewItemDescription::to

The destination client for this message.

Definition at line 4312 of file messages.h.


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