Planeshift
cmdusers.h
Go to the documentation of this file.
1
/*
2
* cmdusers.h - Author: Keith Fulton
3
*
4
* Copyright (C) 2001 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5
*
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation (version 2 of the License)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*
18
*/
19
20
#ifndef __CMDUSERS_H__
21
#define __CMDUSERS_H__
22
//=============================================================================
23
// Crystal Space Includes
24
//=============================================================================
25
26
//=============================================================================
27
// Project Includes
28
//=============================================================================
29
#include "
net/cmdbase.h
"
30
31
//=============================================================================
32
// Local Includes
33
//=============================================================================
34
35
36
class
MsgHandler
;
37
class
GEMClientObject
;
38
39
// Maximum range for the nearby target searches. NOTE: If you change this,
40
// update the command documentation in the constructor.
41
#define NEARBY_TARGET_MAX_RANGE 50
42
45
class
psUserCommands
:
public
psCmdBase
46
{
47
48
public
:
49
psUserCommands
(
ClientMsgHandler
* mh,
CmdHandler
*ch,iObjectRegistry* obj);
50
virtual
~psUserCommands
();
51
52
static
void
HandleSlay
(
bool
answeredYes,
void
*data);
53
54
// Load emotes from xml.
55
bool
LoadEmotes
();
56
57
// iCmdSubscriber interface
58
virtual
const
char
*
HandleCommand
(
const
char
*cmd);
59
60
// iNetSubscriber interface
61
virtual
void
HandleMessage
(
MsgEntry
*msg);
62
63
64
protected
:
65
// Directions for a search.
66
enum
SearchDirection
67
{
68
SEARCH_FORWARD
,
69
SEARCH_BACK
,
70
SEARCH_NONE
71
};
72
73
enum
EntityTypes
74
{
75
PSENTITYTYPE_PLAYER_CHARACTER
,
76
PSENTITYTYPE_NON_PLAYER_CHARACTER
,
77
PSENTITYTYPE_ALIVE_CHARACTER
,
78
PSENTITYTYPE_DEAD_CHARACTER
,
79
PSENTITYTYPE_ITEM
,
80
PSENTITYTYPE_NAME
,
81
PSENTITYTYPE_NO_TARGET
82
};
83
84
GEMClientObject
*
FindEntityWithName
(
const
char
*name);
85
97
csString
FormatTarget
(
const
csString& target =
"target"
);
98
99
void
UpdateTarget
(
SearchDirection
searchDirection,
100
EntityTypes
entityType,
101
const
char
* name);
102
103
105
struct
EMOTE
106
{
107
csString
command
;
108
csString
general
;
109
csString
specific
;
110
csString
anim
;
111
bool
enabled
;
112
};
113
114
csArray<EMOTE>
emoteList
;
115
116
void
AskToSlayBeforeSending
(
psMessageCracker
*msg);
117
};
118
119
#endif
psUserCommands::HandleMessage
virtual void HandleMessage(MsgEntry *msg)
psUserCommands::PSENTITYTYPE_NON_PLAYER_CHARACTER
Definition:
cmdusers.h:76
psUserCommands::FormatTarget
csString FormatTarget(const csString &target="target")
Returns a target string formatted to be sent in a message.
psUserCommands::PSENTITYTYPE_ITEM
Definition:
cmdusers.h:79
psUserCommands::PSENTITYTYPE_PLAYER_CHARACTER
Definition:
cmdusers.h:75
psUserCommands::SEARCH_FORWARD
Definition:
cmdusers.h:68
psUserCommands::~psUserCommands
virtual ~psUserCommands()
CmdHandler
Definition:
cmdhandler.h:54
psUserCommands::UpdateTarget
void UpdateTarget(SearchDirection searchDirection, EntityTypes entityType, const char *name)
psUserCommands::EMOTE::anim
csString anim
Definition:
cmdusers.h:110
MsgEntry
The structure of 1 queue entry (pointer to a message)
Definition:
message.h:143
ClientMsgHandler
Handles messages to be sent out, connects to server and send those.
Definition:
clientmsghandler.h:38
psUserCommands::HandleCommand
virtual const char * HandleCommand(const char *cmd)
Interprets a received message and executes the command.
psUserCommands::PSENTITYTYPE_NO_TARGET
Definition:
cmdusers.h:81
cmdbase.h
psUserCommands::PSENTITYTYPE_NAME
Definition:
cmdusers.h:80
psUserCommands
Manages different commands that are player based in nature.
Definition:
cmdusers.h:45
psUserCommands::SEARCH_NONE
Definition:
cmdusers.h:70
psUserCommands::EntityTypes
EntityTypes
Definition:
cmdusers.h:73
psMessageCracker
All net messages inherit from this class.
Definition:
messages.h:343
psUserCommands::EMOTE::general
csString general
Definition:
cmdusers.h:108
psUserCommands::SEARCH_BACK
Definition:
cmdusers.h:69
psUserCommands::emoteList
csArray< EMOTE > emoteList
Definition:
cmdusers.h:114
GEMClientObject
An object that the client knows about.
Definition:
pscelclient.h:373
MsgHandler
This class is the client's and server's main interface for either sending network messages out or get...
Definition:
msghandler.h:106
psUserCommands::EMOTE::enabled
bool enabled
changed type of enabled from csString to bool
Definition:
cmdusers.h:111
psUserCommands::psUserCommands
psUserCommands(ClientMsgHandler *mh, CmdHandler *ch, iObjectRegistry *obj)
psUserCommands::AskToSlayBeforeSending
void AskToSlayBeforeSending(psMessageCracker *msg)
psUserCommands::PSENTITYTYPE_ALIVE_CHARACTER
Definition:
cmdusers.h:77
psUserCommands::SearchDirection
SearchDirection
Definition:
cmdusers.h:66
psUserCommands::EMOTE
Struct to hold our emote data.
Definition:
cmdusers.h:105
psUserCommands::PSENTITYTYPE_DEAD_CHARACTER
Definition:
cmdusers.h:78
psUserCommands::FindEntityWithName
GEMClientObject * FindEntityWithName(const char *name)
psUserCommands::LoadEmotes
bool LoadEmotes()
psUserCommands::EMOTE::specific
csString specific
Definition:
cmdusers.h:109
psCmdBase
Definition:
cmdbase.h:42
psUserCommands::HandleSlay
static void HandleSlay(bool answeredYes, void *data)
psUserCommands::EMOTE::command
csString command
Definition:
cmdusers.h:107
client
cmdusers.h
Generated on Sat Jun 19 2021 05:00:22 for Planeshift by
1.8.11