00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef OBJSERIAL_H
00026 #define OBJSERIAL_H 1
00027
00028 #include <string>
00029 #include "utils.h"
00030 #include "servemsg.h"
00031
00032 class Serial_out
00033 {
00034 unsigned char *& buf;
00035 public:
00036 Serial_out(unsigned char *& b) : buf(b)
00037 { }
00038 Serial_out& operator<<(int v)
00039 { Write4(buf, v); return *this; }
00040 Serial_out& operator<<(unsigned long v)
00041 { Write4(buf, v); return *this; }
00042 Serial_out& operator<<(short v)
00043 { Write2(buf, v); return *this; }
00044 Serial_out& operator<<(bool v)
00045 { *buf++ = (v ? 1 : 0); return *this; }
00046 Serial_out& operator<<(unsigned char c)
00047 { *buf++ = c; return *this; }
00048 Serial_out& operator<<(std::string& s);
00049 };
00050
00051
00052
00053
00054 class Serial_in
00055 {
00056 unsigned char *& buf;
00057 public:
00058 Serial_in(unsigned char *& b) : buf(b)
00059 { }
00060 Serial_in& operator<<(int& v)
00061 { v = Read4(buf); return *this; }
00062 Serial_in& operator<<(unsigned long& v)
00063 { v = Read4(buf); return *this; }
00064 Serial_in& operator<<(short& v)
00065 { v = Read2(buf); return *this; }
00066 Serial_in& operator<<(bool &v)
00067 { v = *buf++ ? true : false; return *this; }
00068 Serial_in& operator<<(unsigned char &c)
00069 { c = *buf++; return *this; }
00070 Serial_in& operator<<(std::string& s);
00071 };
00072
00073
00074 extern int Object_out
00075 (
00076 int fd,
00077 Exult_server::Msg_type id,
00078 unsigned long addr,
00079 int tx, int ty, int tz,
00080 int shape, int frame,
00081 int quality,
00082 std::string name
00083 );
00084 extern int Object_in
00085 (
00086 unsigned char *data,
00087 int datalen,
00088 unsigned long& addr,
00089 int& tx, int& ty, int& tz,
00090 int& shape, int& frame,
00091 int& quality,
00092 std::string& name
00093 );
00094
00095 extern int Egg_object_out
00096 (
00097 int fd,
00098 unsigned long addr,
00099 int tx, int ty, int tz,
00100 int shape, int frame,
00101 int type,
00102 int criteria,
00103 int probability,
00104 int distance,
00105 bool nocturnal,
00106 bool once,
00107 bool hatched,
00108 bool auto_reset,
00109 int data1, int data2
00110 );
00111 extern int Egg_object_in
00112 (
00113 unsigned char *data,
00114 int datalen,
00115 unsigned long& addr,
00116 int& tx, int& ty, int& tz,
00117 int& shape, int& frame,
00118 int& type,
00119 int& criteria,
00120 int& probability,
00121 int& distance,
00122 bool& nocturnal,
00123 bool& once,
00124 bool& hatched,
00125 bool& auto_reset,
00126 int& data1, int& data2
00127 );
00128
00129 struct Serial_schedule
00130 {
00131 short time;
00132 short type;
00133 int tx, ty;
00134 };
00135
00136 int Npc_actor_out
00137 (
00138 int fd,
00139 unsigned long addr,
00140 int tx, int ty, int tz,
00141 int shape, int frame, int face,
00142 std::string name,
00143 short npc_num,
00144 short ident,
00145 int usecode,
00146 int *properties,
00147 short attack_mode,
00148 short alignment,
00149 unsigned long oflags,
00150 unsigned long siflags,
00151 unsigned long type_flags,
00152 short num_schedules,
00153 Serial_schedule *schedules
00154 );
00155 int Npc_actor_in
00156 (
00157 unsigned char *data,
00158 int datalen,
00159 unsigned long& addr,
00160 int& tx, int& ty, int& tz,
00161 int& shape, int& frame, int& face,
00162 std::string& name,
00163 short& npc_num,
00164 short& ident,
00165 int& usecode,
00166 int *properties,
00167 short& attack_mode,
00168 short& alignment,
00169 unsigned long& oflags,
00170 unsigned long& siflags,
00171 unsigned long& type_flags,
00172 short& num_schedules,
00173 Serial_schedule *schedules
00174 );
00175
00176 extern int Game_info_out
00177 (
00178 int fd,
00179 int version,
00180 int edit_lift,
00181 int hide_lift,
00182 bool map_editing,
00183 bool tile_grid,
00184 bool map_modified,
00185 int edit_mode
00186 );
00187 extern int Game_info_in
00188 (
00189 unsigned char *data,
00190 int datalen,
00191 int& version,
00192 int& edit_lift,
00193 int& hide_lift,
00194 bool& map_editing,
00195 bool& tile_grid,
00196 bool& map_modified,
00197 int& edit_mode
00198 );
00199
00200 #endif
00201
00202
00203
00204