Planeshift

cmdusers.h

Go to the documentation of this file.
00001 /*
00002  * cmdusers.h - Author: Keith Fulton
00003  *
00004  * Copyright (C) 2001 Atomic Blue ([email protected], http://www.atomicblue.org) 
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef __CMDUSERS_H__
00021 #define __CMDUSERS_H__
00022 //=============================================================================
00023 // Crystal Space Includes
00024 //=============================================================================
00025 
00026 //=============================================================================
00027 // Project Includes
00028 //=============================================================================
00029 #include "net/cmdbase.h"
00030 
00031 //=============================================================================
00032 // Local Includes
00033 //=============================================================================
00034 
00035 
00036 class MsgHandler;
00037 class GEMClientObject;
00038 
00039 // Maximum range for the nearby target searches.  NOTE: If you change this,
00040 // update the command documentation in the constructor.
00041 #define NEARBY_TARGET_MAX_RANGE 50
00042 
00045 class psUserCommands : public psCmdBase
00046 {
00047 
00048 public:
00049     psUserCommands(ClientMsgHandler* mh,CmdHandler *ch,iObjectRegistry* obj);
00050     virtual ~psUserCommands();
00051 
00052     static void HandleSlay(bool answeredYes, void *data);
00053 
00054     // Load emotes from xml.
00055     bool LoadEmotes();
00056 
00057     // iCmdSubscriber interface
00058     virtual const char *HandleCommand(const char *cmd);
00059 
00060     // iNetSubscriber interface
00061     virtual void HandleMessage(MsgEntry *msg);
00062 
00063     
00064 protected:
00065  // Directions for a search.
00066     enum SearchDirection
00067     {
00068         SEARCH_FORWARD,
00069         SEARCH_BACK,
00070         SEARCH_NONE
00071     };
00072         
00073     enum EntityTypes
00074     {
00075         PSENTITYTYPE_PLAYER_CHARACTER,
00076         PSENTITYTYPE_NON_PLAYER_CHARACTER,
00077         PSENTITYTYPE_ALIVE_CHARACTER,
00078         PSENTITYTYPE_DEAD_CHARACTER,
00079         PSENTITYTYPE_ITEM,
00080         PSENTITYTYPE_NAME,
00081         PSENTITYTYPE_NO_TARGET
00082     };
00083 
00084     GEMClientObject* FindEntityWithName(const char *name);
00085 
00097     csString FormatTarget(const csString& target = "target");
00098 
00099     void UpdateTarget(SearchDirection searchDirection,
00100                       EntityTypes entityType,
00101                       const char* name);
00102 
00103 
00105     struct EMOTE 
00106     {
00107         csString command;
00108         csString general;
00109         csString specific;
00110         csString anim;
00111         bool enabled; 
00112     };
00113 
00114     csArray<EMOTE> emoteList;
00115 
00116     void AskToSlayBeforeSending(psMessageCracker *msg);    
00117 };
00118 
00119 #endif