Planeshift
psUserCommands Class Reference

Manages different commands that are player based in nature. More...

#include <cmdusers.h>

Classes

struct  EMOTE
 Struct to hold our emote data. More...
 

Public Member Functions

virtual const char * HandleCommand (const char *cmd)
 Interprets a received message and executes the command. More...
 
virtual void HandleMessage (MsgEntry *msg)
 
bool LoadEmotes ()
 
 psUserCommands (ClientMsgHandler *mh, CmdHandler *ch, iObjectRegistry *obj)
 
virtual ~psUserCommands ()
 
- Public Member Functions inherited from psCmdBase
virtual void HandleMessage (MsgEntry *msg, Client *)
 Interprets a received message and executes the command. More...
 
 psCmdBase (ClientMsgHandler *mh, CmdHandler *ch, iObjectRegistry *obj)
 
void Report (int severity, const char *msgtype, const char *description,...)
 
virtual bool Setup (ClientMsgHandler *mh, CmdHandler *ch)
 
virtual bool Verify (MsgEntry *, unsigned int, Client *&)
 
virtual ~psCmdBase ()
 

Static Public Member Functions

static void HandleSlay (bool answeredYes, void *data)
 

Protected Types

enum  EntityTypes {
  PSENTITYTYPE_PLAYER_CHARACTER, PSENTITYTYPE_NON_PLAYER_CHARACTER, PSENTITYTYPE_ALIVE_CHARACTER, PSENTITYTYPE_DEAD_CHARACTER,
  PSENTITYTYPE_ITEM, PSENTITYTYPE_NAME, PSENTITYTYPE_NO_TARGET
}
 
enum  SearchDirection { SEARCH_FORWARD, SEARCH_BACK, SEARCH_NONE }
 

Protected Member Functions

void AskToSlayBeforeSending (psMessageCracker *msg)
 
GEMClientObjectFindEntityWithName (const char *name)
 
csString FormatTarget (const csString &target="target")
 Returns a target string formatted to be sent in a message. More...
 
void UpdateTarget (SearchDirection searchDirection, EntityTypes entityType, const char *name)
 

Protected Attributes

csArray< EMOTEemoteList
 
- Protected Attributes inherited from psCmdBase
CmdHandlercmdsource
 
ClientMsgHandlermsgqueue
 
iObjectRegistry * objreg
 

Detailed Description

Manages different commands that are player based in nature.

Definition at line 45 of file cmdusers.h.

Member Enumeration Documentation

Enumerator
PSENTITYTYPE_PLAYER_CHARACTER 
PSENTITYTYPE_NON_PLAYER_CHARACTER 
PSENTITYTYPE_ALIVE_CHARACTER 
PSENTITYTYPE_DEAD_CHARACTER 
PSENTITYTYPE_ITEM 
PSENTITYTYPE_NAME 
PSENTITYTYPE_NO_TARGET 

Definition at line 73 of file cmdusers.h.

Enumerator
SEARCH_FORWARD 
SEARCH_BACK 
SEARCH_NONE 

Definition at line 66 of file cmdusers.h.

Constructor & Destructor Documentation

psUserCommands::psUserCommands ( ClientMsgHandler mh,
CmdHandler ch,
iObjectRegistry *  obj 
)
virtual psUserCommands::~psUserCommands ( )
virtual

Member Function Documentation

void psUserCommands::AskToSlayBeforeSending ( psMessageCracker msg)
protected
GEMClientObject* psUserCommands::FindEntityWithName ( const char *  name)
protected
csString psUserCommands::FormatTarget ( const csString &  target = "target")
protected

Returns a target string formatted to be sent in a message.

This function would be called on a target input by the player, and will return a string indicating the same target, formatted to be sent in a net message to the server. If this can't be done, it will send back an empty string (error)

Parameters
targetThe target to be formatted
Returns
Returns the formatted target, or an empty string
virtual const char* psUserCommands::HandleCommand ( const char *  cmd)
virtual

Interprets a received message and executes the command.

char * returned can be an error message to display.

Implements psCmdBase.

virtual void psUserCommands::HandleMessage ( MsgEntry msg)
virtual

Implements psCmdBase.

static void psUserCommands::HandleSlay ( bool  answeredYes,
void *  data 
)
static
bool psUserCommands::LoadEmotes ( )
void psUserCommands::UpdateTarget ( SearchDirection  searchDirection,
EntityTypes  entityType,
const char *  name 
)
protected

Member Data Documentation

csArray<EMOTE> psUserCommands::emoteList
protected

Definition at line 114 of file cmdusers.h.


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