📄 d2game_protocol.h
字号:
/* * Copyright (C) 2000 Otto Chan (kenshin_@hotmail.com) * Copyright (C) 2000 Ross Combs (rocombs@cs.nmsu.edu) * Copyright (C) 2000 Onlyer (onlyer@263.net) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef INCLUDED_D2GAME_PROTOCOL_TYPES#define INCLUDED_D2GAME_PROTOCOL_TYPES#ifdef JUST_NEED_TYPES# include "bn_type.h"#else# define JUST_NEED_TYPES# include "bn_type.h"# undef JUST_NEED_TYPES#endif/* * The protocol for communicating between a Diablo II client * and game server. * FIXME: put the #define's into the PROTO section *//******************************************************/typedef struct{#ifdef NOTONLYER bn_short magic; bn_short size; bn_byte type;/* FIXME: the two sets of packets don't jive... did the beta have a different game protocol or am I just confused (could easily be the later). */#else bn_byte type;#endif} t_d2game_header;/******************************************************//******************************************************/typedef struct{ t_d2game_header h;} t_d2game_generic;/******************************************************//******************************************************//*D2 00 05 00 00*/#define SERVER_00 0x00 /* beta-only? */typedef struct{ t_d2game_header h; bn_byte unknown1; /* data request #? */} PACKED_ATTR() t_server_00_req;#define SERVER_00 0x00/******************************************************//******************************************************//*D2 00 20 00 01 E2 5E 13 BE 4C 02 04 CA 00 00 00 .........L......6C 69 6C 6A 6F 65 00 00 64 25 42 00 1C E9 50 00 liljoe..d.B...P.*/#define CLIENT_01 0x01 /* beta-only? */typedef struct /* game select? */{ t_d2game_header h; bn_byte unknown1; /* data reply #? */ bn_int gameid1; /* same as in auth 04 reply */ bn_short gameid2; /* same as in auth 04 reply */ bn_byte unknown2[5]; /* character name */ /* 00 64 25 42 00 1C E9 50 00 unknown... string or numeric? */} PACKED_ATTR() t_client_01;/******************************************************//******************************************************//*0030 22 38 32 5D 00 00 97 20 20 20 20 20 "82]........*/#define D2GAME_SERVER_WELCOME 0x97typedef struct{ t_d2game_header h;} t_d2game_server_welcome;/*0000: 60 00 27 04 18 79 27 04 A8 00 00 00 07 02 00 00 `.'..y'.........0010: B0 01 01 00 00 6F 6E 6C 79 65 72 00 B8 6A F7 BF .....onlyer..j..0020: 00 00 00 00 34 00 00 04 00 00 00 00 00 ....4........ 0000: 60 00 27 04 18 79 27 04 30 0D 00 00 07 02 00 00 `.'..y'.0.......0010: B0 01 04 00 01 41 4C 42 45 52 54 00 B8 6A F7 BF .....ALBERT..j..0020: 00 00 00 00 34 00 00 04 00 00 00 00 00 ....4........ 0000: 60 00 27 04 18 79 27 04 A0 0A 00 00 07 02 00 00 `.'..y'.........0010: B0 01 04 00 02 41 4C 42 45 52 54 00 B8 6A F7 BF .....ALBERT..j..0020: 00 00 00 00 34 00 00 04 00 00 00 00 00 ....4........ 0000: 60 00 AB 04 18 79 AB 04 DE 00 9F 00 0C 02 00 00 `....y..........0010: 60 01 04 00 00 62 62 62 00 71 DF 77 A6 C0 E6 77 `....bbb.q.w...w0020: A6 C0 E6 77 34 05 00 04 00 00 00 00 00 ...w4........ */#define D2GAME_CLIENT_CREATEGAMEREQ 0x60typedef bn_basic bn_charname[16];typedef struct{ t_d2game_header h; char gamename[16]; bn_byte servertype; /* servertype=0, data not send to client and have no host */ /* creator changed to newbie data saved in server machine*/ /* servertype=1, data send to client and have host */ /* servertype=2, data send to client and have no host */ /* servertype=3, client all newbie,seems to be wrong */ /* data is saved in server machine */ /* client is loaded from server machine */ bn_byte class; bn_byte template; /* character template */ /* affect the reply in 0x01 */ /* should less than the lines of excel/CharTemplate.txt */ bn_byte difficulty; bn_charname charname; bn_short arena; bn_int gameflag; bn_byte unknownb2; /* unused */ bn_byte unknownb3; /* unused */} t_d2game_client_creategamereq; typedef struct{ bn_byte flag1; /* "test gameflag,06" should not be zero,or will be bad gameflag */ /* flag1 should be set with bit 0x04 or will fail or crash */ /* bit 0x10,0x20,0x08 is ignored in reply */ bn_byte flag2; /* hardcore and softcore */ /* 0x0 means softcore,0x1 template mode,0x8 means hardcore */ /* bit 0x02,0x04,0xF0 is ignored in reply */ /* have sth to do with char template */ /* opengame */ bn_byte flag3; /* guild data (not in reply) */ /* 0x01 means have guild */ /* others bits seems all unused */ bn_byte flag4; /* seems to be unused */} t_d2game_gameflag;/*0030 22 37 86 D7 00 00 61 65 00 00 00 00 00 01 03 00 "7....ae........0040 00 00 6F 6E 6C 79 65 72 2D 63 6E 61 61 00 24 E0 ..onlyer-cnaa.$.0050 7B 05 {.*/ #define D2GAME_CLIENT_JOINGAMEREQ 0x61typedef struct{ t_d2game_header h; bn_int token; bn_short gameid; bn_byte charclass; /* 00=Amazon 01=Sor 02=Nec 03=Pal 04=Bar */ bn_int version; bn_charname charname; /* 16 bytes playe name (including 0x0 ending) */} t_d2game_client_joingamereq;/*0030 22 1C C9 65 00 00 20 20 20 20 20 20 "..e........*/#define D2GAME_SERVER_NOOP 0x20typedef struct{ t_d2game_header h; /* 5 \x20 noop */} t_d2game_server_noop;/*0030 22 37 17 07 00 00 66 91 4B A1 00 00 00 00 00 "7....f.K......*/#define D2GAME_CLIENT_UNKNOWN_66 0x66 /* echo message? */typedef struct{ t_d2game_header h; bn_int unknown1; bn_int unknown2;} t_d2game_client_unknown_66;/*0000: 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................0020: 00 . */#define D2GAME_SERVER_UNKNOWN_8F 0x8f /* echo reply? */typedef struct{ t_d2game_header h; bn_int unknown1; bn_int unknown2; bn_int unknown3; bn_int unknown4; bn_int unknown5; bn_int unknown6; bn_int unknown7; /* all here for open char is zero */} t_d2game_server_unknown_8f;/*0030 22 1C C4 53 00 00 01 00 04 00 00 00 00 02 "..S..........*/#define D2GAME_SERVER_JOINOK 0x01/* this message will appear after * 1. CLIENT_CREATEGAEM valid * 2. CLIENT_JOINGAME valid */typedef struct{ t_d2game_header h; bn_byte difficulty; bn_short gameflag; bn_byte template; bn_short unknown1; bn_short unknown2;} t_d2game_server_joinok;/*0030 22 2F 65 38 00 00 64 "/e8..d*/#define D2GAME_CLIENT_JOINACTREQ 0x64typedef struct{ t_d2game_header h; /* none */} t_d2game_client_joinactreq;#define D2GAME_SERVER_UNKNOWN_59 0x59typedef struct{ t_d2game_header h;} t_d2game_server_unknown_59;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -