00001 /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 00002 || NoX-Wizard UO Server Emulator (NXW) [http://noxwizard.sourceforge.net] || 00003 || || 00004 || This software is free software released under GPL2 license. || 00005 || You can find detailed license information in nox-wizard.cpp file. || 00006 || || 00007 || For any question post to NoX-Wizard forums. || 00008 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ 00009 00015 #ifndef __CLIENT_H__ 00016 #define __CLIENT_H__ 00017 00018 #include "cmdtable.h" 00019 #include "targeting.h" 00020 #include "target.h" 00021 #include "encryption/clientcrypt.h" 00022 00023 typedef std::vector< std::string > td_cmdparams; 00024 00025 class cNxwClientObj { 00026 public: 00027 NXWSOCKET m_sck; 00028 public: 00029 cNxwClientObj( NXWSOCKET s ); 00030 void setLegacySocket(NXWSOCKET s); 00031 00032 inline NXWSOCKET toLegacySocket() const 00033 { 00034 return m_sck; 00035 } 00036 00037 inline int toInt() const 00038 { 00039 return m_sck; 00040 } 00041 00043 00046 bool isDragging(); 00047 void setDragging(); 00048 void resetDragging(); 00049 bool inGame(); 00050 P_CHAR currChar(); 00051 int currCharIdx(); 00052 int getRealSocket(); 00053 BYTE *getRcvBuffer(); 00055 00057 00060 void send(const void *point, int length); 00061 void sendSpellBook(P_ITEM pi); 00062 void sendSFX(unsigned char a, unsigned char b, bool bIncludeNearby = true); 00063 void sendRemoveObject(P_OBJECT po); 00064 void sysmsg(char* szFormat, ...); 00065 void sysmsg(short color, char* szFormat, ...); 00067 00068 }; 00069 00070 00071 00072 /*typedef std::map< SERIAL, cNxwClientObj > CLIENTS_MAP; 00073 extern CLIENTS_MAP allclients;*/ 00074 00075 typedef std::vector< SERIAL > SOCKETS_VECT; 00076 //extern SOCKETS_VECT currchar; 00077 extern SERIAL currchar[MAXCLIENT]; 00078 00079 00080 00081 00082 00083 00084 00085 class cClient { 00086 00087 private: 00088 P_TARGET target; 00089 ClientCrypt * crypter; 00090 public: 00091 00092 void resetTarget(); 00093 P_TARGET newTarget( P_TARGET newTarget ); 00094 P_TARGET getTarget(); 00095 00096 SERIAL spyTo; 00097 UI32 client_ip; 00098 std::string client_version; 00099 00100 bool compressOut; 00101 bool noweather; 00102 bool lsd; 00103 bool dragging; 00104 bool evilDrag; 00105 bool newclient; 00106 bool firstpacket; 00107 bool ingame; 00108 inline void setCrypter(ClientCrypt * crypt) 00109 { crypter=crypt; } 00110 inline ClientCrypt * getCrypter() const 00111 { return crypter; } 00112 inline void setClientIp(UI32 newIp) 00113 { client_ip= newIp; } 00114 inline const UI32 getClientIp() const 00115 { return client_ip; } 00116 inline void setClientVersion(char *version) 00117 { client_version=std::string(version); } 00118 inline const std::string getClientVersion() const 00119 { return client_version; } 00120 cClient(); 00121 ~cClient(); 00122 00123 }; 00124 00125 00126 00127 00128 #endif