| 1 | /* |
| 2 | * Copyright (C) 2000,2001 Onlyer ([email protected]) |
| 3 | * Copyright (C) 2001 faster ([email protected]) |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | #ifndef INCLUDED_D2CS_D2GS_PROTOCOL_H |
| 20 | #define INCLUDED_D2CS_D2GS_PROTOCOL_H |
| 21 | /* |
| 22 | * there is only little comments in this header file |
| 23 | * check the documents for more details |
| 24 | */ |
| 25 | |
| 26 | /* include your own header files here */ |
| 27 | #include "common/bn_type.h" |
| 28 | |
| 29 | #ifdef D2GS |
| 30 | # include "bn_types.h" |
| 31 | #pragma pack(push, pack01, 1) |
| 32 | #endif |
| 33 | |
| 34 | namespace pvpgn |
| 35 | { |
| 36 | |
| 37 | typedef struct |
| 38 | { |
| 39 | bn_short size; |
| 40 | bn_short type; |
| 41 | bn_int seqno; /* seqno, set by the sender */ |
| 42 | } t_d2cs_d2gs_header; |
| 43 | |
| 44 | typedef struct |
| 45 | { |
| 46 | t_d2cs_d2gs_header h; |
| 47 | } t_d2cs_d2gs_generic; |
| 48 | |
| 49 | #define D2CS_D2GS_AUTHREQ 0x10 |
| 50 | typedef struct |
| 51 | { |
| 52 | t_d2cs_d2gs_header h; |
| 53 | bn_int sessionnum; |
| 54 | bn_int signlen; |
| 55 | /* realm name */ |
| 56 | /* key check sum, maybe 128 bytes */ |
| 57 | } t_d2cs_d2gs_authreq; |
| 58 | |
| 59 | #define D2GS_D2CS_AUTHREPLY 0x11 |
| 60 | typedef struct |
| 61 | { |
| 62 | t_d2cs_d2gs_header h; |
| 63 | bn_int version; |
| 64 | bn_int checksum; |
| 65 | bn_int randnum; |
| 66 | bn_int signlen; |
| 67 | bn_basic sign[128]; |
| 68 | } t_d2gs_d2cs_authreply; |
| 69 | |
| 70 | #define D2CS_D2GS_AUTHREPLY 0x11 |
| 71 | typedef struct |
| 72 | { |
| 73 | t_d2cs_d2gs_header h; |
| 74 | bn_int reply; |
| 75 | } t_d2cs_d2gs_authreply; |
| 76 | #define D2CS_D2GS_AUTHREPLY_SUCCEED 0x00 |
| 77 | #define D2CS_D2GS_AUTHREPLY_BAD_VERSION 0x01 |
| 78 | #define D2CS_D2GS_AUTHREPLY_BAD_CHECKSUM 0x02 |
| 79 | |
| 80 | #define D2GS_D2CS_SETGSINFO 0x12 |
| 81 | typedef struct |
| 82 | { |
| 83 | t_d2cs_d2gs_header h; |
| 84 | bn_int maxgame; |
| 85 | bn_int gameflag; |
| 86 | } t_d2gs_d2cs_setgsinfo; |
| 87 | |
| 88 | #define D2CS_D2GS_SETGSINFO 0x12 |
| 89 | typedef struct |
| 90 | { |
| 91 | t_d2cs_d2gs_header h; |
| 92 | bn_int maxgame; |
| 93 | bn_int gameflag; |
| 94 | } t_d2cs_d2gs_setgsinfo; |
| 95 | |
| 96 | #define D2CS_D2GS_ECHOREQ 0x13 |
| 97 | typedef struct |
| 98 | { |
| 99 | t_d2cs_d2gs_header h; |
| 100 | } t_d2cs_d2gs_echoreq; |
| 101 | |
| 102 | #define D2GS_D2CS_ECHOREPLY 0x13 |
| 103 | typedef struct |
| 104 | { |
| 105 | t_d2cs_d2gs_header h; |
| 106 | } t_d2gs_d2cs_echoreply; |
| 107 | |
| 108 | #define D2CS_D2GS_CONTROL 0x14 |
| 109 | typedef struct |
| 110 | { |
| 111 | t_d2cs_d2gs_header h; |
| 112 | bn_int cmd; |
| 113 | bn_int value; |
| 114 | } t_d2cs_d2gs_control; |
| 115 | #define D2CS_D2GS_CONTROL_CMD_RESTART 0x01 |
| 116 | #define D2CS_D2GS_CONTROL_CMD_SHUTDOWN 0x02 |
| 117 | #define D2CS_D2GS_CONTROL_VALUE_DEFAULT 0x00 |
| 118 | |
| 119 | #define D2CS_D2GS_SETINITINFO 0x15 |
| 120 | typedef struct |
| 121 | { |
| 122 | t_d2cs_d2gs_header h; |
| 123 | bn_int time; |
| 124 | bn_int gs_id; |
| 125 | bn_int ac_version; |
| 126 | /* ac_checksum */ |
| 127 | } t_d2cs_d2gs_setinitinfo; |
| 128 | |
| 129 | #define D2CS_D2GS_SETCONFFILE 0x16 |
| 130 | typedef struct |
| 131 | { |
| 132 | t_d2cs_d2gs_header h; |
| 133 | bn_int size; |
| 134 | bn_int reserved1; |
| 135 | /* conf file (null terminated string) */ |
| 136 | } t_d2cs_d2gs_setconffile; |
| 137 | |
| 138 | #define D2CS_D2GS_CREATEGAMEREQ 0x20 |
| 139 | typedef struct |
| 140 | { |
| 141 | t_d2cs_d2gs_header h; |
| 142 | bn_byte ladder; |
| 143 | bn_byte expansion; |
| 144 | bn_byte difficulty; |
| 145 | bn_byte hardcore; |
| 146 | /* gamename */ |
| 147 | /* gamepass */ |
| 148 | /* gamedesc */ |
| 149 | /* create by acctname */ |
| 150 | /* create by charname */ |
| 151 | /* create by ip address(string) */ |
| 152 | } t_d2cs_d2gs_creategamereq; |
| 153 | #define D2GAME_DIFFICULTY_NORMAL 0 |
| 154 | #define D2GAME_DIFFICULTY_NIGHTMARE 1 |
| 155 | #define D2GAME_DIFFICULTY_HELL 2 |
| 156 | |
| 157 | #define D2GS_D2CS_CREATEGAMEREPLY 0x20 |
| 158 | typedef struct |
| 159 | { |
| 160 | t_d2cs_d2gs_header h; |
| 161 | bn_int result; |
| 162 | bn_int gameid; |
| 163 | } t_d2gs_d2cs_creategamereply; |
| 164 | #define D2GS_D2CS_CREATEGAME_SUCCEED 0 |
| 165 | #define D2GS_D2CS_CREATEGAME_FAILED 1 |
| 166 | |
| 167 | |
| 168 | #define D2CS_D2GS_JOINGAMEREQ 0x21 |
| 169 | typedef struct |
| 170 | { |
| 171 | t_d2cs_d2gs_header h; |
| 172 | bn_int gameid; |
| 173 | bn_int token; |
| 174 | /* character name */ |
| 175 | /* account name */ |
| 176 | /* client ip address(string) */ |
| 177 | } t_d2cs_d2gs_joingamereq; |
| 178 | |
| 179 | #define D2GS_D2CS_JOINGAMEREPLY 0x21 |
| 180 | typedef struct |
| 181 | { |
| 182 | t_d2cs_d2gs_header h; |
| 183 | bn_int result; |
| 184 | bn_int gameid; |
| 185 | } t_d2gs_d2cs_joingamereply; |
| 186 | #define D2GS_D2CS_JOINGAME_SUCCEED 0 |
| 187 | #define D2GS_D2CS_JOINGAME_FAILED 1 |
| 188 | #define D2GS_D2CS_JOINGAME_GAME_FULL 2 |
| 189 | |
| 190 | #define D2GS_D2CS_UPDATEGAMEINFO 0x22 |
| 191 | typedef struct |
| 192 | { |
| 193 | t_d2cs_d2gs_header h; |
| 194 | bn_int flag; |
| 195 | bn_int gameid; |
| 196 | bn_int charlevel; |
| 197 | bn_int charclass; |
| 198 | /* charname */ |
| 199 | } t_d2gs_d2cs_updategameinfo; |
| 200 | #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_UPDATE 0 |
| 201 | #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_ENTER 1 |
| 202 | #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_LEAVE 2 |
| 203 | |
| 204 | #define D2GS_D2CS_CLOSEGAME 0x23 |
| 205 | typedef struct |
| 206 | { |
| 207 | t_d2cs_d2gs_header h; |
| 208 | bn_int gameid; |
| 209 | } t_d2gs_d2cs_closegame; |
| 210 | |
| 211 | #ifdef D2GS |
| 212 | #pragma pack(pop, pack01) |
| 213 | #endif |
| 214 | |
| 215 | } |
| 216 | |
| 217 | #endif |