| 1 |
/*
|
| 2 |
* Copyright (C) 2000,2001 Onlyer (onlyer@263.net)
|
| 3 |
*
|
| 4 |
* This program is free software; you can redistribute it and/or
|
| 5 |
* modify it under the terms of the GNU General Public License
|
| 6 |
* as published by the Free Software Foundation; either version 2
|
| 7 |
* of the License, or (at your option) any later version.
|
| 8 |
*
|
| 9 |
* This program is distributed in the hope that it will be useful,
|
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
* GNU General Public License for more details.
|
| 13 |
*
|
| 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 |
#ifndef INCLUDED_D2CS_PROTOCOL_H
|
| 19 |
#define INCLUDED_D2CS_PROTOCOL_H
|
| 20 |
|
| 21 |
#include "common/bn_type.h"
|
| 22 |
|
| 23 |
typedef struct
|
| 24 |
{
|
| 25 |
bn_short size;
|
| 26 |
bn_byte type;
|
| 27 |
} t_d2cs_client_header;
|
| 28 |
|
| 29 |
typedef struct
|
| 30 |
{
|
| 31 |
t_d2cs_client_header h;
|
| 32 |
} t_d2cs_client_generic;
|
| 33 |
|
| 34 |
#define CLIENT_D2CS_LOGINREQ 0x01
|
| 35 |
typedef struct
|
| 36 |
{
|
| 37 |
t_d2cs_client_header h;
|
| 38 |
bn_int seqno;
|
| 39 |
bn_int u1;
|
| 40 |
bn_int bncs_addr1;
|
| 41 |
bn_int sessionnum;
|
| 42 |
bn_int sessionkey; /* always zero,self define */
|
| 43 |
bn_int cdkey_id;
|
| 44 |
bn_int u5;
|
| 45 |
bn_int clienttag;
|
| 46 |
bn_int bnversion;
|
| 47 |
bn_int bncs_addr2;
|
| 48 |
bn_int u6; /* zero */
|
| 49 |
bn_int secret_hash[5];
|
| 50 |
/* account name */
|
| 51 |
} t_client_d2cs_loginreq;
|
| 52 |
|
| 53 |
#define D2CS_CLIENT_LOGINREPLY 0x01
|
| 54 |
typedef struct
|
| 55 |
{
|
| 56 |
t_d2cs_client_header h;
|
| 57 |
bn_int reply;
|
| 58 |
} t_d2cs_client_loginreply;
|
| 59 |
#define D2CS_CLIENT_LOGINREPLY_SUCCEED 0x00
|
| 60 |
#define D2CS_CLIENT_LOGINREPLY_BADPASS 0x0c
|
| 61 |
|
| 62 |
#define CLIENT_D2CS_CREATECHARREQ 0x02
|
| 63 |
typedef struct
|
| 64 |
{
|
| 65 |
t_d2cs_client_header h;
|
| 66 |
bn_short class; /* character class */
|
| 67 |
bn_short u1; /* always zero */
|
| 68 |
bn_short status; /* same as in .d2s file */
|
| 69 |
/* character name */
|
| 70 |
} t_client_d2cs_createcharreq;
|
| 71 |
|
| 72 |
#define D2CS_CLIENT_CREATECHARREPLY 0x02
|
| 73 |
typedef struct
|
| 74 |
{
|
| 75 |
t_d2cs_client_header h;
|
| 76 |
bn_int reply;
|
| 77 |
} t_d2cs_client_createcharreply;
|
| 78 |
#define D2CS_CLIENT_CREATECHARREPLY_SUCCEED 0x00
|
| 79 |
#define D2CS_CLIENT_CREATECHARREPLY_FAILED 0x01
|
| 80 |
#define D2CS_CLIENT_CREATECHARREPLY_ALREADY_EXIST 0x14
|
| 81 |
#define D2CS_CLIENT_CREATECHARREPLY_NAME_REJECT 0x15
|
| 82 |
|
| 83 |
|
| 84 |
#define CLIENT_D2CS_CREATEGAMEREQ 0x03
|
| 85 |
typedef struct
|
| 86 |
{
|
| 87 |
t_d2cs_client_header h;
|
| 88 |
bn_short seqno;
|
| 89 |
bn_int gameflag; /* just difficulty is set here */
|
| 90 |
bn_byte u1; /* always 1 */
|
| 91 |
bn_byte leveldiff; /* Only allow people of +/- n level to join */
|
| 92 |
bn_byte maxchar; /* Maximum number of chars allowed in game */
|
| 93 |
/* game name */
|
| 94 |
/* game pass */
|
| 95 |
/* game desc */
|
| 96 |
} t_client_d2cs_creategamereq;
|
| 97 |
|
| 98 |
#define D2CS_CLIENT_CREATEGAMEREPLY 0x03
|
| 99 |
typedef struct
|
| 100 |
{
|
| 101 |
t_d2cs_client_header h;
|
| 102 |
bn_short seqno;
|
| 103 |
bn_short gameid;
|
| 104 |
bn_short u1; /* always zero */
|
| 105 |
bn_int reply;
|
| 106 |
} t_d2cs_client_creategamereply;
|
| 107 |
#define D2CS_CLIENT_CREATEGAMEREPLY_SUCCEED 0x00
|
| 108 |
#define D2CS_CLIENT_CREATEGAMEREPLY_FAILED 0x01
|
| 109 |
#define D2CS_CLIENT_CREATEGAMEREPLY_INVALID_NAME 0x1e
|
| 110 |
#define D2CS_CLIENT_CREATEGAMEREPLY_NAME_EXIST 0x1f
|
| 111 |
#define D2CS_CLIENT_CREATEGAMEREPLY_SERVER_DOWN 0x20
|
| 112 |
#define D2CS_CLIENT_CREATEGAMEREPLY_NOT_AVAILABLE 0x32
|
| 113 |
#define D2CS_CLIENT_CREATEGAMEREPLY_U1 0x33
|
| 114 |
|
| 115 |
#define CLIENT_D2CS_JOINGAMEREQ 0x04
|
| 116 |
typedef struct
|
| 117 |
{
|
| 118 |
t_d2cs_client_header h;
|
| 119 |
bn_short seqno;
|
| 120 |
/* game name */
|
| 121 |
/* game pass */
|
| 122 |
} t_client_d2cs_joingamereq;
|
| 123 |
|
| 124 |
#define D2CS_CLIENT_JOINGAMEREPLY 0x04
|
| 125 |
typedef struct
|
| 126 |
{
|
| 127 |
t_d2cs_client_header h;
|
| 128 |
bn_short seqno;
|
| 129 |
bn_short gameid;
|
| 130 |
bn_short u1; /* always zero */
|
| 131 |
bn_int addr;
|
| 132 |
bn_int token;
|
| 133 |
bn_int reply;
|
| 134 |
} t_d2cs_client_joingamereply;
|
| 135 |
#define D2CS_CLIENT_JOINGAMEREPLY_SUCCEED 0x00
|
| 136 |
#define D2CS_CLIENT_JOINGAMEREPLY_BAD_PASS 0x29
|
| 137 |
#define D2CS_CLIENT_JOINGAMEREPLY_NOT_EXIST 0x2a
|
| 138 |
#define D2CS_CLIENT_JOINGAMEREPLY_GAME_FULL 0x2b
|
| 139 |
#define D2CS_CLIENT_JOINGAMEREPLY_LEVEL_LIMIT 0x2c
|
| 140 |
#define D2CS_CLIENT_JOINGAMEREPLY_HARDCORE_SOFTCORE 0x71
|
| 141 |
#define D2CS_CLIENT_JOINGAMEREPLY_NORMAL_NIGHTMARE 0x73
|
| 142 |
#define D2CS_CLIENT_JOINGAMEREPLY_NIGHTMARE_HELL 0x74
|
| 143 |
#define D2CS_CLIENT_JOINGAMEREPLY_CLASSIC_EXPANSION 0x78
|
| 144 |
#define D2CS_CLIENT_JOINGAMEREPLY_EXPANSION_CLASSIC 0x79
|
| 145 |
#define D2CS_CLIENT_JOINGAMEREPLY_NORMAL_LADDER 0x7D
|
| 146 |
#define D2CS_CLIENT_JOINGAMEREPLY_FAILED 0x01
|
| 147 |
|
| 148 |
#define CLIENT_D2CS_GAMELISTREQ 0x05
|
| 149 |
typedef struct
|
| 150 |
{
|
| 151 |
t_d2cs_client_header h;
|
| 152 |
bn_short seqno;
|
| 153 |
bn_int gameflag; /* only hardcore is set here */
|
| 154 |
/* bn_byte u1; string game name to search? */
|
| 155 |
} t_client_d2cs_gamelistreq;
|
| 156 |
|
| 157 |
#define D2CS_CLIENT_GAMELISTREPLY 0x05
|
| 158 |
typedef struct
|
| 159 |
{
|
| 160 |
t_d2cs_client_header h;
|
| 161 |
bn_short seqno;
|
| 162 |
bn_int token;
|
| 163 |
bn_byte currchar; /* current number of characters in game */
|
| 164 |
bn_int gameflag; /* 0x04 is always set here */
|
| 165 |
/* game name */
|
| 166 |
/* game desc */
|
| 167 |
} t_d2cs_client_gamelistreply;
|
| 168 |
|
| 169 |
#define CLIENT_D2CS_GAMEINFOREQ 0x06
|
| 170 |
typedef struct
|
| 171 |
{
|
| 172 |
t_d2cs_client_header h;
|
| 173 |
bn_short seqno;
|
| 174 |
/* game name */
|
| 175 |
} t_client_d2cs_gameinforeq;
|
| 176 |
|
| 177 |
#define D2CS_CLIENT_GAMEINFOREPLY 0x06
|
| 178 |
typedef struct
|
| 179 |
{
|
| 180 |
t_d2cs_client_header h;
|
| 181 |
bn_short seqno;
|
| 182 |
bn_int gameflag;
|
| 183 |
bn_int etime;
|
| 184 |
bn_byte charlevel;
|
| 185 |
bn_byte leveldiff;
|
| 186 |
bn_byte maxchar;
|
| 187 |
bn_byte currchar;
|
| 188 |
bn_byte class[16]; /* 16 character class */
|
| 189 |
bn_byte level[16]; /* 16 character level */
|
| 190 |
/* game description */
|
| 191 |
/* currchar number of character names */
|
| 192 |
} t_d2cs_client_gameinforeply;
|
| 193 |
|
| 194 |
#define CLIENT_D2CS_CHARLOGINREQ 0x07
|
| 195 |
typedef struct
|
| 196 |
{
|
| 197 |
t_d2cs_client_header h;
|
| 198 |
/* character name */
|
| 199 |
} t_client_d2cs_charloginreq;
|
| 200 |
|
| 201 |
#define D2CS_CLIENT_CHARLOGINREPLY 0x07
|
| 202 |
typedef struct
|
| 203 |
{
|
| 204 |
t_d2cs_client_header h;
|
| 205 |
bn_int reply;
|
| 206 |
} t_d2cs_client_charloginreply;
|
| 207 |
#define D2CS_CLIENT_CHARLOGINREPLY_SUCCEED 0x00
|
| 208 |
#define D2CS_CLIENT_CHARLOGINREPLY_FAILED 0x01
|
| 209 |
#define D2CS_CLIENT_CHARLOGINREPLY_NOT_FOUND 0x46
|
| 210 |
#define D2CS_CLIENT_CHARLOGINREPLY_EXPIRED 0x7b
|
| 211 |
|
| 212 |
#define CLIENT_D2CS_DELETECHARREQ 0x0a
|
| 213 |
typedef struct
|
| 214 |
{
|
| 215 |
t_d2cs_client_header h;
|
| 216 |
bn_short u1; /* always zero */
|
| 217 |
/* character name */
|
| 218 |
} t_client_d2cs_deletecharreq;
|
| 219 |
|
| 220 |
#define D2CS_CLIENT_DELETECHARREPLY 0x0a
|
| 221 |
typedef struct
|
| 222 |
{
|
| 223 |
t_d2cs_client_header h;
|
| 224 |
bn_short u1; /* always zero */
|
| 225 |
bn_int reply;
|
| 226 |
} t_d2cs_client_deletecharreply;
|
| 227 |
#define D2CS_CLIENT_DELETECHARREPLY_SUCCEED 0x00
|
| 228 |
#define D2CS_CLIENT_DELETECHARREPLY_FAILED 0x01
|
| 229 |
|
| 230 |
|
| 231 |
#define CLIENT_D2CS_LADDERREQ 0x11
|
| 232 |
typedef struct
|
| 233 |
{
|
| 234 |
t_d2cs_client_header h;
|
| 235 |
bn_byte type; /* jadder type request */
|
| 236 |
bn_short start_pos; /* list ladder from what position */
|
| 237 |
} t_client_d2cs_ladderreq;
|
| 238 |
|
| 239 |
#define D2CS_CLIENT_LADDERREPLY 0x11
|
| 240 |
typedef struct
|
| 241 |
{
|
| 242 |
t_d2cs_client_header h;
|
| 243 |
bn_byte type; /* ladder type request */
|
| 244 |
bn_short total_len; /* total length of the ladder data */
|
| 245 |
|
| 246 |
bn_short curr_len; /* length of ladder data in this packet */
|
| 247 |
bn_short cont_len; /* length of ladder data in previous packets */
|
| 248 |
/* length here include the header but
|
| 249 |
exclude this packet */
|
| 250 |
} t_d2cs_client_ladderreply;
|
| 251 |
|
| 252 |
typedef struct
|
| 253 |
{
|
| 254 |
bn_short start_pos; /* start position of ladder */
|
| 255 |
bn_short u1; /* always zero */
|
| 256 |
bn_int count1; /* always 0x10 */
|
| 257 |
} t_d2cs_client_ladderheader;
|
| 258 |
|
| 259 |
typedef struct
|
| 260 |
{
|
| 261 |
bn_int count2; /* 0x10 for first packet or 0x0 for continue */
|
| 262 |
} t_d2cs_client_ladderinfoheader;
|
| 263 |
|
| 264 |
typedef struct
|
| 265 |
{
|
| 266 |
bn_int explow;
|
| 267 |
bn_int exphigh; /* always zero */
|
| 268 |
bn_short status;
|
| 269 |
bn_byte level;
|
| 270 |
bn_byte u1; /* always zero */
|
| 271 |
char charname[16];
|
| 272 |
} t_d2cs_client_ladderinfo;
|
| 273 |
#define LADDERSTATUS_FLAG_DEAD 0x10
|
| 274 |
#define LADDERSTATUS_FLAG_HARDCORE 0x20
|
| 275 |
#define LADDERSTATUS_FLAG_EXPANSION 0x40
|
| 276 |
#define LADDERSTATUS_FLAG_DIFFICULTY 0x0f00
|
| 277 |
|
| 278 |
#define CLIENT_D2CS_MOTDREQ 0x12
|
| 279 |
typedef struct
|
| 280 |
{
|
| 281 |
t_d2cs_client_header h;
|
| 282 |
} t_client_d2cs_motdreq;
|
| 283 |
|
| 284 |
#define D2CS_CLIENT_MOTDREPLY 0x12
|
| 285 |
typedef struct
|
| 286 |
{
|
| 287 |
t_d2cs_client_header h;
|
| 288 |
bn_byte u1;
|
| 289 |
/* message */
|
| 290 |
} t_d2cs_client_motdreply;
|
| 291 |
|
| 292 |
#define CLIENT_D2CS_CANCELCREATEGAME 0x13
|
| 293 |
typedef struct
|
| 294 |
{
|
| 295 |
t_d2cs_client_header h;
|
| 296 |
} t_client_d2cs_cancelcreategame;
|
| 297 |
|
| 298 |
#define D2CS_CLIENT_CREATEGAMEWAIT 0x14
|
| 299 |
typedef struct
|
| 300 |
{
|
| 301 |
t_d2cs_client_header h;
|
| 302 |
bn_int position;
|
| 303 |
} t_d2cs_client_creategamewait;
|
| 304 |
|
| 305 |
#define D2CS_CLIENT_CHARLADDERREQ 0x16
|
| 306 |
typedef struct
|
| 307 |
{
|
| 308 |
t_d2cs_client_header h;
|
| 309 |
bn_int hardcore;
|
| 310 |
bn_int expansion;
|
| 311 |
/* character name */
|
| 312 |
} t_client_d2cs_charladderreq;
|
| 313 |
/* use 0x11 LADDER reply for this request */
|
| 314 |
|
| 315 |
#define CLIENT_D2CS_CHARLISTREQ 0x17
|
| 316 |
typedef struct
|
| 317 |
{
|
| 318 |
t_d2cs_client_header h;
|
| 319 |
bn_short maxchar;
|
| 320 |
bn_short u1;
|
| 321 |
} t_client_d2cs_charlistreq;
|
| 322 |
|
| 323 |
#define D2CS_CLIENT_CHARLISTREPLY 0x17
|
| 324 |
typedef struct
|
| 325 |
{
|
| 326 |
t_d2cs_client_header h;
|
| 327 |
bn_short maxchar;
|
| 328 |
bn_short currchar;
|
| 329 |
bn_short u1; /* always zero */
|
| 330 |
bn_short currchar2;
|
| 331 |
/* character name */
|
| 332 |
/* character portrait blocks */
|
| 333 |
/* each block is 0x22 bytes static length */
|
| 334 |
} t_d2cs_client_charlistreply;
|
| 335 |
|
| 336 |
#define CLIENT_D2CS_CONVERTCHARREQ 0x18
|
| 337 |
typedef struct
|
| 338 |
{
|
| 339 |
t_d2cs_client_header h;
|
| 340 |
/* character name */
|
| 341 |
} t_client_d2cs_convertcharreq;
|
| 342 |
|
| 343 |
#define D2CS_CLIENT_CONVERTCHARREPLY 0x18
|
| 344 |
typedef struct
|
| 345 |
{
|
| 346 |
t_d2cs_client_header h;
|
| 347 |
bn_int reply;
|
| 348 |
} t_d2cs_client_convertcharreply;
|
| 349 |
#define D2CS_CLIENT_CONVERTCHARREPLY_SUCCEED 0x00
|
| 350 |
#define D2CS_CLIENT_CONVERTCHARREPLY_FAILED 0x01
|
| 351 |
|
| 352 |
#define CLIENT_D2CS_CHARLISTREQ_110 0x19
|
| 353 |
typedef struct
|
| 354 |
{
|
| 355 |
t_d2cs_client_header h;
|
| 356 |
bn_short maxchar;
|
| 357 |
bn_short u1;
|
| 358 |
} t_client_d2cs_charlistreq_110;
|
| 359 |
|
| 360 |
|
| 361 |
#define D2CS_CLIENT_CHARLISTREPLY_110 0x19
|
| 362 |
typedef struct
|
| 363 |
{
|
| 364 |
t_d2cs_client_header h;
|
| 365 |
bn_short maxchar;
|
| 366 |
bn_short currchar;
|
| 367 |
bn_short u1; /* always zero */
|
| 368 |
bn_short currchar2;
|
| 369 |
} t_d2cs_client_charlistreply_110;
|
| 370 |
|
| 371 |
typedef struct
|
| 372 |
{
|
| 373 |
bn_int expire_time; /* character expire time (in seconds) */
|
| 374 |
/* character name */
|
| 375 |
/* character portrait blocks */
|
| 376 |
/* each block is 0x22 bytes static length */
|
| 377 |
} t_d2cs_client_chardata;
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
#endif
|