1 /*
2  * Copyright (C) 1998  Mark Baysinger (mbaysing@ucsd.edu)
3  * Copyright (C) 1998,1999,2000  Ross Combs (rocombs@cs.nmsu.edu)
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_ANONGAME_PROTOCOL_TYPES
20 #define INCLUDED_ANONGAME_PROTOCOL_TYPES
21 
22 #ifdef JUST_NEED_TYPES
23 # include "common/bn_type.h"
24 #else
25 # define JUST_NEED_TYPES
26 # include "common/bn_type.h"
27 # undef JUST_NEED_TYPES
28 #endif
29 
30 /***********************************************************************************/
31 /* first packet recieved from client - option decides which struct to use next */
32 #define CLIENT_FINDANONGAME 			0x44ff
33 #define SERVER_FINDANONGAME 			0x44ff
34 typedef struct
35 {
36     t_bnet_header	h;
37     bn_byte		option;
38     /* rest of packet data */
39 } PACKED_ATTR() t_client_anongame;
40 
41 /***********************************************************************************/
42 #define CLIENT_FINDANONGAME_SEARCH              0x00
43 #define CLIENT_FINDANONGAME_INFOS               0x02
44 #define CLIENT_FINDANONGAME_CANCEL		0x03
45 #define CLIENT_FINDANONGAME_PROFILE             0x04
46 #define CLIENT_FINDANONGAME_AT_SEARCH           0x05
47 #define CLIENT_FINDANONGAME_AT_INVITER_SEARCH   0x06
48 #define CLIENT_ANONGAME_TOURNAMENT		0X07
49 #define	CLIENT_FINDANONGAME_PROFILE_CLAN	0x08
50 #define CLIENT_FINDANONGAME_GET_ICON            0x09
51 #define CLIENT_FINDANONGAME_SET_ICON            0x0A
52 
53 #define SERVER_FINDANONGAME_SEARCH              0x00
54 #define SERVER_FINDANONGAME_FOUND		0x01
55 #define SERVER_FINDANONGAME_CANCEL              0x03
56 /***********************************************************************************/
57 /* option 00 - anongame search */
58 /*
59 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
60 Tournament PG 1v1 - battle.net
61 # 440 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
62 0000:   FF 44 1C 00 00 01 00 00   00 00 00 00 00[02 13]01    .D..............
63 0010:   00 00 00 08 13 C7 30 04   04 00 00 00                ......0.....
64 PG 1v1
65 # 438 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
66 0000:   FF 44 1C 00 00 01 00 00   00 00 00 00 00[00 00]FF    .D..............
67 0010:   00 00 00 08 C2 13 A6 02   20 00 00 00                ........ ...
68 PG 2v2
69 # 456 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
70 0000:   FF 44 1C 00 00 02 00 00   00 00 00 00 00[00 01]FF    .D..............
71 0010:   07 00 00 08 A0 45 A6 02   20 00 00 00                .....E.. ...
72 PG 3v3
73 # 482 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
74 0000:   FF 44 1C 00 00 03 00 00   00 00 00 00 00[00 02]FF    .D..............
75 0010:   03 00 00 08 E8 7D A6 02   20 00 00 00                .....}.. ...
76 PG 4v4
77 # 516 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
78 0000:   FF 44 1C 00 00 04 00 00   00 00 00 00 00[00 03]FF    .D..............
79 0010:   01 00 00 08 48 B0 A6 02   20 00 00 00                ....H... ...
80 PG sffa
81 # 550 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=28 class=bnet
82 0000:   FF 44 1C 00 00 05 00 00   00 00 00 00 00[00 04]FF    .D..............
83 0010:   01 00 00 08 E6 F4 A6 02   20 00 00 00                ........ ...
84 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
85 inviter 2v2 - battle.net
86 # 74059 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=57 class=bnet
87 0000:   FF 44 39 00 06 09 00 00   00 A0 03 00 0C 72 40 27    .D9..........r@'
88 0010:   3F 02 B9 DA 6B 9A A4 22   5D 60 49 EF 15 6F 44 25    ?...k.."]`I..oD%
89 0020:   02 4E F9 13 BC 4D 00 00   00 00[01 00]FF 07 00 00    .N...M..........
90 0030:   08 7E 98 E6 04 04 00 00   00                         .~.......
91 inviter 2v2 - battle.net
92 # 83545 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=57 class=bnet
93 0000:   FF 44 39 00 06 0A 00 00   00 E4 03 00 0C 9E 45 27    .D9...........E'
94 0010:   3F 02 1E 4E E7 53 80 F9   01 00 4F 68 A1 58 C5 1B    ?..N.S....Oh.X..
95 0020:   44 31 BD EE 47 7F 00 00   00 00[01 00]FF 07 00 00    D1..G...........
96 0030:   08 48 07 FB 04 04 00 00   00                         .H.......
97 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
98 AT 3v3 - pvpgn - with uid of team members
99 # 378 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=57 class=bnet
100 0000:   FF 44 39 00 06 01 00 00   00[B7 36 C4 19]1B 02 2F    .D9.......6..../
101 0010:   3F 03[19 00 00 00|02 00   00 00|01 00 00 00|FF FF    ?...............
102 0020:   FF FF|FF FF FF FF]00 00   00 00 01 02 FF 03 00 00    ................
103 0030:   08 AA A4 E2 0C 20 00 00   00                         ..... ...
104 
105 # 379 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=51 class=bnet
106 0000:   FF 44 33 00 05 01 00 00   00[B7 36 C4 19]1B 02 2F    .D3.......6..../
107 0010:   3F 03[19 00 00 00|02 00   00 00|01 00 00 00|FF FF    ?...............
108 0020:   FF FF|FF FF FF FF]00 00   00 00 08 59 C6 0E 00 20    ...........Y...
109 0030:   00 00 00                                             ...
110 
111 # 382 packet from client: type=0x44ff(CLIENT_FINDANONGAME) length=51 class=bnet
112 0000:   FF 44 33 00 05 01 00 00   00[B7 36 C4 19]1B 02 2F    .D3.......6..../
113 0010:   3F 03[19 00 00 00|02 00   00 00|01 00 00 00|FF FF    ?...............
114 0020:   FF FF|FF FF FF FF]00 00   00 00 08 45 2C 13 00 20    ...........E,..
115 0030:   00 00 00                                             ...
116 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
117 */
118 
119 typedef struct
120 {
121     t_bnet_header	h;
122     bn_byte		option;
123     bn_int		count;     /* Goes up each time client clicks search */
124     bn_int		unknown2;  /* 00 00 00 00 */
125     bn_byte		type;      /* 0 = PG  , 1 = AT  , 2 = TY - from TYPE */
126     bn_byte		gametype;  /* 0 = 1v1 , 1 = 2v2 , 2 = 3v3 , 3 = 4v4 , 4 = sffa - from TYPE */
127     bn_int		map_prefs; /* map preferences bitmask */
128     bn_byte		unknown3;  /* 8 */
129     bn_int		id;        /* client id */
130     bn_int       	race;      /* 1 = H , 2 = O , 4 = N , 8 = U , 0x20 = R */
131 } PACKED_ATTR() t_client_findanongame;
132 
133 typedef struct
134 {
135     t_bnet_header h;
136     bn_byte      option;
137     bn_int       count;
138     bn_int       tid;        /* team id */
139     bn_int       timestamp;
140     bn_byte	 teamsize;
141     bn_int       info[5];   /* client get this info from SERVER_ARRANGEDTEAM_INVITE_FRIEND_ACK (0x61ff) */
142     bn_int       unknown2;  /* 00 00 00 00 */
143     bn_byte      type;      /* 0 = PG  , 1 = AT  , 2 = TY - from TYPE */
144     bn_byte      gametype;  /* 0 = 1v1 , 1 = 2v2 , 2 = 3v3 , 3 = 4v4 , 4 = sffa - from TYPE */
145     bn_int       map_prefs; /* map preferences bitmask */
146     bn_byte      unknown3;  /* 08 */
147     bn_int       id;	    /* client id */
148     bn_int       race;      /* 1 = H , 2 = O , 4 = N , 8 = U , 0x20 = R */
149 } PACKED_ATTR() t_client_findanongame_at_inv;
150 
151 typedef struct
152 {
153     t_bnet_header h;
154     bn_byte      option;
155     bn_int       count;     /* Goes up each time client clicks search */
156     bn_int       tid;       /* team id */
157     bn_int       timestamp;
158     bn_byte      teamsize;
159     bn_int       info[5];   /* client get this info from inviter form SERVER_ARRANGEDTEAM_INVITE_FRIEND_ACK (0x61ff) */
160     bn_int       unknown2;  /* 00 00 00 00 */
161     bn_byte      unknown3;  /* 08 */
162     bn_int       id;        /* client id */
163     bn_int       race;      /* 1 = H , 2 = O , 4 = N , 8 = U , 0x20 = R */
164 } PACKED_ATTR() t_client_findanongame_at;
165 
166 #define SERVER_ANONGAME_SEARCH_REPLY		0x44ff
167 typedef struct
168 {
169     t_bnet_header h;
170     bn_byte   option;
171     bn_int    count;
172     bn_int    reply;
173     /*      bn_short  avgtime; - only in W3XP so far average time in seconds of search */
174 } PACKED_ATTR() t_server_anongame_search_reply;
175 
176 /***********************************************************************************/
177 /* option 01 - anongame found */
178 /*
179 tournament 1v1
180 # 490 packet from server: type=0x44ff(unknown) length=84 class=bnet
181 0000:   FF 44 54 00 01 01 00 00   00 00 00 00 00 3F F1 53    .DT..........?.S
182 0010:   CD E0 17 F8 CC 00 00 3E   4F 8E 12 06[02 13]4D 61    .......>O.....Ma
183 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
184 0030:   28 34 29 46 6C 6F 6F 64   70 6C 61 69 6E 73 31 76    (4)Floodplains1v
185 0040:   31 2E 77 33 78 00 FF FF   FF FF 31 44 4C 46 02 00    1.w3x.....1DLF..
186 0050:   00 00 02 02                                          ....
187 PG 2v2
188 # 28332 packet from server: type=0x44ff(unknown) length=83 class=bnet
189 0000:   FF 44 53 00 01 02 00 00   00 00 00 00 00 D3 E9 00    .DS.............
190 0010:   DC E0 17 2E 67 00 00 9A   7D 56 0F 06 00 01 4D 61    ....g...}V....Ma
191 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
192 0030:   28 36 29 53 63 6F 72 63   68 65 64 42 61 73 69 6E    (6)ScorchedBasin
193 0040:   2E 77 33 78 00 FF FF FF   FF 4D 41 45 54 04 02 00    .w3x.....MAET...
194 0050:   00 02 02                                             ...
195 PG 4v4
196 # 28827 packet from server: type=0x44ff(unknown) length=82 class=bnet
197 0000:   FF 44 52 00 01 02 00 00   00 00 00 00 00 3F F1 53    .DR..........?.S
198 0010:   DA E0 17 77 D6 00 00 92   D4 B8 56 06 00 03 4D 61    ...w......V...Ma
199 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
200 0030:   28 38 29 42 61 74 74 6C   65 67 72 6F 75 6E 64 2E    (8)Battleground.
201 0040:   77 33 78 00 FF FF FF FF   4D 41 45 54 08 02 00 00    w3x.....MAET....
202 0050:   02 02                                                ..
203 PG 3v3
204 # 357 packet from server: type=0x44ff(unknown) length=84 class=bnet
205 0000:   FF 44 54 00 01 01 00 00   00 00 00 00 00 3F F1 53    .DT..........?.S
206 0010:   CE E0 17 10 22 01 00 29   0F 62 A0 06 00 02 4D 61    ...."..).b....Ma
207 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
208 0030:   28 36 29 42 6C 6F 6F 64   73 74 6F 6E 65 4D 65 73    (6)BloodstoneMes
209 0040:   61 2E 77 33 78 00 FF FF   FF FF 4D 41 45 54 06 02    a.w3x.....MAET..
210 0050:   00 00 02 02                                          ....
211 PG 4v4
212 # 620 packet from server: type=0x44ff(unknown) length=79 class=bnet
213 0000:   FF 44 4F 00 01 02 00 00   00 00 00 00 00 3F F1 53    .DO..........?.S
214 0010:   DA E0 17 94 22 01 00 4C   29 5F 62 06 00 03 4D 61    ...."..L)_b...Ma
215 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
216 0030:   28 38 29 53 61 6E 63 74   75 61 72 79 2E 77 33 78    (8)Sanctuary.w3x
217 0040:   00 FF FF FF FF 4D 41 45   54 08 02 00 00 02 02       .....MAET......
218 PG sffa
219 # 810 packet from server: type=0x44ff(unknown) length=82 class=bnet
220 0000:   FF 44 52 00 01 03 00 00   00 00 00 00 00 3F F1 53    .DR..........?.S
221 0010:   C9 E0 17 3E 22 01 00 93   44 ED 22 06 00 04 4D 61    ...>"...D."...Ma
222 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
223 0030:   28 38 29 42 61 74 74 6C   65 67 72 6F 75 6E 64 2E    (8)Battleground.
224 0040:   77 33 78 00 FF FF FF FF   20 41 46 46 05 00 00 00    w3x..... AFF....
225 0050:   02 02                                                ..
226 =-=-=-=-==-=-=-=-=
227 AT 2v2
228 # 74077 packet from server: type=0x44ff(unknown) length=87 class=bnet
229 0000:   FF 44 57 00 01 09 00 00   00 00 00 00 00 3F F1 53    .DW..........?.S
230 0010:   D3 E0 17 D8 D1 00 00 B4   2B 57 C6 06[01 00]4D 61    ........+W....Ma
231 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
232 0030:   28 36 29 53 74 72 61 6E   67 6C 65 74 68 6F 72 6E    (6)Stranglethorn
233 0040:   56 61 6C 65 2E 77 33 78   00 FF FF FF FF 32 53 56    Vale.w3x.....2SV
234 0050:   32 04 02 00 00 02 02                                 2......
235 
236 AT 2v2
237 # 83549 packet from server: type=0x44ff(unknown) length=79 class=bnet
238 0000:   FF 44 4F 00 01 0A 00 00   00 00 00 00 00 3F F1 53    .DO..........?.S
239 0010:   CF E0 17 BB D1 00 00 01   CB E4 BA 06[01 00]4D 61    ..............Ma
240 0020:   70 73 5C 46 72 6F 7A 65   6E 54 68 72 6F 6E 65 5C    ps\FrozenThrone\
241 0030:   28 36 29 47 6E 6F 6C 6C   57 6F 6F 64 2E 77 33 78    (6)GnollWood.w3x
242 0040:   00 FF FF FF FF 32 53 56   32 04 02 00 00 02 02       .....2SV2......
243 */
244 #define SERVER_ANONGAME_FOUND			0x44ff
245 typedef struct
246 {
247     t_bnet_header	h;
248     bn_byte		option;     /* 1: anongame found */
249     bn_int		count;
250     bn_int		unknown1;   /* 00 00 00 00 */
251     bn_int		ip;
252     bn_short		port;
253     bn_byte		unknown2;
254     bn_byte             unknown3;
255     bn_short		unknown4;   /* usually 00 00 , seen 01 00 */
256     bn_int		id;         /* random val for identifying client */
257     bn_byte		unknown5;   /* 0x06 */
258     bn_byte		type;       /* 0 = PG  , 1 = AT  , 2 = TY - from TYPE */
259     bn_byte		gametype;   /* for PG - 0 = 1v1 , 1 = 2v2 , 2 = 3v3 , 3 = 4v4 , 4 = sffa
260 				     * for AT - 0 = 2v2 , 2 = 3v3 , 3 = 4v3
261 				     * for TY - set to 0
262 				     * from TYPE
263 				     */
264     /* char *		mapname */
265     /* t_saf_pt2 * 	pt2 */
266 } PACKED_ATTR() t_server_anongame_found;
267 
268 /* MISC PACKET APPEND DATA's */
269 typedef struct
270 {
271     bn_int	unknown1;		/* 0xFFFFFFFF */
272     bn_int	anongame_string;	/* ie. SOLO, TEAM, 2VS2, etc. */
273     bn_byte	totalplayers;
274     bn_byte	totalteams;		/* 1v1 & sffa = 0, rest 2 */
275     bn_short	unknown2;		/* 0x0000 */
276     bn_byte	visibility;		/* 0x01 = dark - 0x02 = default */
277     bn_byte	unknown3;		/* 0x02 */
278 } PACKED_ATTR() t_saf_pt2;
279 
280 /***********************************************************************************/
281 /* option 02 - info request */
282 #define CLIENT_FINDANONGAME_INFOREQ             0x44ff
283 typedef struct
284 {
285     t_bnet_header       h;
286     bn_byte             option;         /* type of request:
287 					 * 0x02 for matchmaking infos */
288     bn_int              count;          /* 0x00000001 increments each request of same type */
289     bn_byte             noitems;
290 } PACKED_ATTR() t_client_findanongame_inforeq;
291 
292 #define SERVER_FINDANONGAME_INFOREPLY           0x44ff
293 typedef struct {
294     t_bnet_header       h;
295     bn_byte             option; /* as received from client */
296     bn_int              count; /* as received from client */
297     bn_byte             noitems; /* not very sure about it */
298     /* data */
299 /*
300 for type 0x02 :
301     <type of info><unknown int><info>
302     if <type of info> is :
303 	URL\0 : <info> contains 3 NULL terminated urls/strings
304 	MAP\0 : <info> contains 7 (seen so far) maps names
305 	TYPE  : <info> unknown 38 bytes probably meaning anongame types
306 	DESC  : <info>
307 */
308 } PACKED_ATTR() t_server_findanongame_inforeply;
309 
310 /***********************************************************************************/
311 /* option 03 - playgame cancel */
312 #define SERVER_FINDANONGAME_PLAYGAME_CANCEL 	0x44ff
313 typedef struct
314 {
315     t_bnet_header h; /* header */
316     bn_byte cancel; /* Cancel byte always 03 */
317     bn_int  count;
318 } PACKED_ATTR() t_server_findanongame_playgame_cancel;
319 
320 
321 /* option 04 - profile request */
322 typedef struct
323 {
324     t_bnet_header h;
325     bn_byte     option;
326     bn_int          count;
327     /* USERNAME TO LOOKUP
328      * CLIENT TAG */
329 } PACKED_ATTR() t_client_findanongame_profile;
330 
331 #define SERVER_FINDANONGAME_PROFILE		0x44ff
332 /*
333 typedef struct
334 {
335     t_bnet_header h; //header
336     bn_byte option; // in this case it will be 0x04 (for profile)
337     bn_int count; // count that goes up each time user clicks on someones profile
338     // REST OF PROFILE STATS - THIS WILL BE SET IN HANDLE_BNET.C after
339     // SERVER LOOKS UP THE USER ACCOUNT
340 } PACKED_ATTR() t_server_findanongame_profile;
341 */
342 typedef struct
343 {
344     t_bnet_header	h;
345     bn_byte		option;
346     bn_int		count;
347     bn_int		icon;
348     bn_byte		rescount;
349     /* REST OF PROFILE STATS - THIS WILL BE SET IN HANDLE_BNET.C after
350      * SERVER LOOKS UP THE USER ACCOUNT */
351 } PACKED_ATTR() t_server_findanongame_profile2;
352 
353 /***********************************************************************************/
354 /* option 07 - tournament request */
355 #define CLIENT_FINDANONGAME_TOURNAMENT_REQUEST  0x44ff
356 typedef struct
357 {
358     t_bnet_header       h;
359     bn_byte             option; /* 07 */
360     bn_int              count;  /* 01 00 00 00 */
361 } PACKED_ATTR() t_client_anongame_tournament_request;
362 
363 #define SERVER_FINDANONGAME_TOURNAMENT_REPLY    0x44ff
364 typedef struct
365 {
366     t_bnet_header       h;
367     bn_byte             option;     /* 07 */
368     bn_int              count;      /* 00 00 00 01 reply with same number */
369     bn_byte             type;	    /* type - 	01 = notice - time = prelim round begins
370 				     *		02 = signups - time = signups end
371 				     *		03 = signups over - time = prelim round ends
372 				     *		04 = prelim over - time = finals round 1 begins
373 				     */
374     bn_byte             unknown;    /* 00 */
375     bn_short            unknown4;   /* random ? might be part of time/date ? */
376     bn_int              timestamp;
377     bn_byte             unknown5;   /* 01 effects time/date */
378     bn_short            countdown;  /* countdown until next timestamp (seconds) */
379     bn_short            unknown2;   /* 00 00 */
380     bn_byte		wins;	    /* during prelim */
381     bn_byte		losses;     /* during prelim */
382     bn_byte             ties;	    /* during prelim */
383     bn_byte             unknown3;   /* 00 = notice.  08 = signups thru prelim over (02-04) */
384     bn_byte             selection;  /* matches anongame_TY_section of DESC */
385     bn_byte             descnum;    /* matches desc_count of DESC */
386     bn_byte             nulltag;    /* 00 */
387 } PACKED_ATTR() t_server_anongame_tournament_reply;
388 
389 /***********************************************************************************/
390 
391 /* option 08 - clan profile request */
392 typedef struct
393 {
394     t_bnet_header h;
395     bn_byte	option;
396     bn_int	count;
397     bn_int	clantag;
398     bn_int	clienttag;
399 } PACKED_ATTR() t_client_findanongame_profile_clan;
400 
401 #define SERVER_FINDANONGAME_PROFILE_CLAN	0x44ff
402 
403 typedef struct
404 {
405     t_bnet_header	h;
406     bn_byte		option;
407     bn_int		count;
408     bn_byte		rescount;
409     /* REST OF PROFILE STATS - THIS WILL BE SET IN HANDLE_BNET.C after
410      * SERVER LOOKS UP THE USER ACCOUNT */
411 } PACKED_ATTR() t_server_findanongame_profile_clan;
412 
413 
414 /***********************************************************************************/
415 /* option 9 - icon request */
416 #define SERVER_FINDANONGAME_ICONREPLY           0x44ff
417 typedef struct{
418     t_bnet_header         h;
419     bn_byte               option;                 /* as received from client */
420     bn_int                count;                  /* as received from client */
421     bn_int                curricon;               /* current icon code */
422     bn_byte               table_width;            /* the icon table width */
423     bn_byte               table_size;             /* the icon table total size */
424     /* table data */
425 } PACKED_ATTR() t_server_findanongame_iconreply;
426 
427 /***********************************************************************************/
428 #define SERVER_ANONGAME_SOLO_STR        	0x534F4C4F /* "SOLO" */
429 #define SERVER_ANONGAME_TEAM_STR        	0x5445414D /* "TEAM" */
430 #define SERVER_ANONGAME_SFFA_STR        	0x46464120 /* "FFA " */
431 #define SERVER_ANONGAME_AT2v2_STR       	0x32565332 /* "2VS2" */
432 #define SERVER_ANONGAME_AT3v3_STR       	0x33565333 /* "3VS3" */
433 #define SERVER_ANONGAME_AT4v4_STR       	0x34565334 /* "4VS4" */
434 #define SERVER_ANONGAME_TY_STR			0X54592020 /* "TY  " FIXME-TY: WHAT TO PUT HERE */
435 
436 #define CLIENT_FINDANONGAME_INFOTAG_URL         0x55524c        /*  URL\0 */
437 #define CLIENT_FINDANONGAME_INFOTAG_MAP         0x4d4150        /*  MAP\0 */
438 #define CLIENT_FINDANONGAME_INFOTAG_TYPE        0x54595045      /*  TYPE */
439 #define CLIENT_FINDANONGAME_INFOTAG_DESC        0x44455343      /*  DESC */
440 #define CLIENT_FINDANONGAME_INFOTAG_LADR        0x4c414452      /*  LADR */
441 #define CLIENT_FINDANONGAME_INFOTAG_SOLO        0x534f4c4f      /*  SOLO */
442 #define CLIENT_FINDANONGAME_INFOTAG_TEAM        0x5445414d      /*  TEAM */
443 #define CLIENT_FINDANONGAME_INFOTAG_FFA         0x46464120      /*  FFA\20 */
444 
445 #define ANONGAME_TYPE_1V1       0
446 #define ANONGAME_TYPE_2V2       1
447 #define ANONGAME_TYPE_3V3       2
448 #define ANONGAME_TYPE_4V4       3
449 #define ANONGAME_TYPE_SMALL_FFA 4
450 #define ANONGAME_TYPE_AT_2V2    5
451 #define ANONGAME_TYPE_TEAM_FFA  6
452 #define ANONGAME_TYPE_AT_3V3    7
453 #define ANONGAME_TYPE_AT_4V4    8
454 /* Added by Omega */
455 #define ANONGAME_TYPE_TY	9
456 #define ANONGAME_TYPE_5V5	10
457 #define ANONGAME_TYPE_6V6	11
458 #define ANONGAME_TYPE_2V2V2	12
459 #define ANONGAME_TYPE_3V3V3	13
460 #define ANONGAME_TYPE_4V4V4	14
461 #define ANONGAME_TYPE_2V2V2V2	15
462 #define ANONGAME_TYPE_3V3V3V3	16
463 #define ANONGAME_TYPE_AT_2V2V2	17
464 
465 #define ANONGAME_TYPES 18
466 
467 #define SERVER_FINDANONGAME_PROFILE_UNKNOWN2    0x6E736865 /* Sheep */
468 
469 /***********************************************************************************/
470 /***********************************************************************************/
471 /* This is a blank packet - includes just type and size */
472 #define CLIENT_ARRANGEDTEAM_FRIENDSCREEN 0x60ff
473 typedef struct
474 {
475 	t_bnet_header h;
476 } PACKED_ATTR() t_client_arrangedteam_friendscreen;
477 
478 /***********************************************************************************/
479 #define SERVER_ARRANGEDTEAM_FRIENDSCREEN 0x60ff
480 typedef struct
481 {
482 	t_bnet_header h;
483 	bn_byte f_count;
484 	/* usernames get appended here */
485 } PACKED_ATTR() t_server_arrangedteam_friendscreen;
486 
487 #define SERVER_ARRANGED_TEAM_ADDNAME 0x01
488 
489 /***********************************************************************************/
490 /*
491 0000:   FF 61 1C 00 01 00 00 00   C9 7B A0 02 01 00 00 00    .........{......
492 0010:   01 74 72 65 6E 64 65 63   69 64 65 00                .trendecide.
493 */
494 #define CLIENT_ARRANGEDTEAM_INVITE_FRIEND 0x61ff
495 typedef struct
496 {
497 	t_bnet_header	h;
498 	bn_int		count;
499 	bn_int		id;
500 	bn_int		unknown1;	/* 01 00 00 00 */
501 	bn_byte 	numfriends;	/* next is a byte, that is the number of friends to invite */
502 	/* usernames get appended here */
503 } PACKED_ATTR() t_client_arrangedteam_invite_friend;
504 
505 /***********************************************************************************/
506 #define SERVER_ARRANGEDTEAM_INVITE_FRIEND_ACK 0x61ff
507 typedef struct
508 {
509         t_bnet_header	h;
510         bn_int		count;
511         bn_int 		id;          /* client id */
512         bn_int		timestamp;
513         bn_byte 	teamsize;    /* numfriends + 1 */
514         bn_int		info[5];
515 } PACKED_ATTR() t_server_arrangedteam_invite_friend_ack;
516 
517 /***********************************************************************************/
518 #define SERVER_ARRANGEDTEAM_SEND_INVITE 0x63ff
519 typedef struct
520 {
521 	t_bnet_header h;
522 	bn_int count;
523 	bn_int id;          /* client id of inviter */
524 	bn_int inviterip;   /* IP address of the person who invited them into the game */
525 	bn_short port;      /* Port of the person who invited them into the game */
526 	bn_byte numfriends; /* Number of friends that got invited to the game */
527 	/* username of the inviter */
528 	/* usernames of the others who got invited */
529 } PACKED_ATTR() t_server_arrangedteam_send_invite;
530 
531 /***********************************************************************************/
532 #define CLIENT_ARRANGEDTEAM_ACCEPT_DECLINE_INVITE 0x63ff
533 typedef struct
534 {
535 	t_bnet_header h;
536 	bn_int count;
537 	bn_int id;
538 	bn_int option;   /* accept or decline */
539 	/* username of the inviter */
540 } PACKED_ATTR() t_client_arrangedteam_accept_decline_invite;
541 
542 #define CLIENT_ARRANGEDTEAM_ACCEPT		0x00000003
543 #define CLIENT_ARRANGEDTEAM_DECLINE		0x00000002
544 
545 /***********************************************************************************/
546 #define SERVER_ARRANGEDTEAM_MEMBER_DECLINE 0x62ff
547 typedef struct
548 {
549 	t_bnet_header h;
550 	bn_int count;
551 	bn_int action; /* number assigned to player? playernum? */
552 	/* username of the person who declined invitation */
553 } PACKED_ATTR() t_server_arrangedteam_member_decline;
554 
555 #define SERVER_ARRANGEDTEAM_ACCEPT		0x00000003
556 #define SERVER_ARRANGEDTEAM_DECLINE		0x00000002
557 
558 /***********************************************************************************/
559 /* not used ?? [Omega] */
560 /*
561 0000:   FF 64 1C 00 02 00 00 00  00 00 00 00 01 00 00 00     .d..............
562 0010:   00 00 00 00 03 00 00 00  00 00 00 00                 ............
563 */
564 /* THIS NEEDS FINISHED */
565 /*
566 #define SERVER_ARRANGEDTEAM_TEAM_STATS 0x64ff
567 typedef struct
568 {
569 	t_bnet_header h;
570 }
571 */
572 /***********************************************************************************/
573 /***********************************************************************************/
574 /*
575 # 144 packet from client: type=0x65ff(unknown) length=4 class=bnet
576 0000:   FF 65 04 00                                          .e..
577 */
578 #define CLIENT_FRIENDSLISTREQ 0x65ff
579 typedef struct
580 {
581     t_bnet_header h;
582 } PACKED_ATTR() t_client_friendslistreq;
583 
584 /*
585 # 158 packet from server: type=0x65ff(unknown) length=16 class=bnet
586 0000:   FF 65 10 00     01 66 6F 6F   00 00 00 00 00 00 00 00    .e.. .foo. .......
587 
588 
589 */
590 #define SERVER_FRIENDSLISTREPLY 0x65ff
591 typedef struct
592 {
593     t_bnet_header h;
594     bn_byte friendcount;
595     /* 1 byte status, 0-terminated name, 6 bytes unknown, ... */
596 } PACKED_ATTR() t_server_friendslistreply;
597 
598 typedef struct
599 {
600     bn_byte status;
601     bn_byte location;
602     bn_int clienttag;
603 } PACKED_ATTR() t_server_friendslistreply_status;
604 
605 /*
606 # 124 packet from client: type=0x66ff(unknown) length=5 class=bnet
607 0000:   FF 66 05 00 00                                       .f...
608 */
609 /* FF 66-05 00 00 40 - AT */
610 #define CLIENT_FRIENDINFOREQ 0x66ff
611 typedef struct
612 {
613     t_bnet_header h;
614     bn_byte friendnum;
615 } PACKED_ATTR() t_client_friendinforeq;
616 
617 /*
618 # 126 packet from server: type=0x66ff(unknown) length=12 class=bnet
619 0000:   FF 66 0C 00 00 00 00 00   00 00 00 00                .f..........
620 
621 Arranged Team sends this to each inviter
622          FF 66-1A 00 00 01 03 33 52 41   ..g....f.....3RA
623 0x0040   57 41 72 72 61 6E 67 65-64 20 54 65 61 6D 73 00   WArranged Teams.
624 and this to the inviter
625 FF 66-18 00 00 01 02 33 52 41         ..i....f.....3RA
626 0x0040   57 57 61 72 63 72 61 66-74 20 49 49 49 00         WWarcraft III.
627 */
628 
629 #define SERVER_FRIENDINFOREPLY 0x66ff
630 typedef struct
631 {
632     t_bnet_header h;
633     bn_byte friendnum;
634     bn_byte type;
635     bn_byte status;
636     bn_int clienttag;
637     /* game name */
638 } PACKED_ATTR() t_server_friendinforeply;
639 #define FRIEND_TYPE_NON_MUTUAL 0x00
640 #define FRIEND_TYPE_MUTUAL     0x01
641 #define FRIEND_TYPE_DND	       0x02
642 #define FRIEND_TYPE_AWAY       0x04
643 
644 /******************************************************/
645 /*
646 # 126 packet from server: type=0x67ff(unknown) length=15 class=bnet
647 0000:   FF 67 0F 00 66 6F 6F 00   00 00 00 00 00 00 00       .g..foo........
648 */
649 #define SERVER_FRIENDADD_ACK 0x67ff
650 typedef struct
651 {
652     t_bnet_header h;
653     /* friend name, status */
654 } PACKED_ATTR() t_server_friendadd_ack;
655 /******************************************************/
656 /*
657 # 114 packet from server: type=0x68ff(unknown) length=5 class=bnet
658 0000:   FF 68 05 00 01                                       .h...
659 */
660 #define SERVER_FRIENDDEL_ACK 0x68ff
661 typedef struct
662 {
663     t_bnet_header h;
664     bn_byte friendnum;
665 } PACKED_ATTR() t_server_frienddel_ack;
666 /******************************************************/
667 
668 #define SERVER_FRIENDMOVE_ACK 0x69ff
669 typedef struct
670 {
671     t_bnet_header h;
672     bn_byte pos1;
673     bn_byte pos2;
674 } PACKED_ATTR() t_server_friendmove_ack;
675 
676 #define FRIENDSTATUS_OFFLINE    	0x00
677 #define FRIENDSTATUS_ONLINE     	0x01
678 #define FRIENDSTATUS_CHAT       	0x02
679 #define FRIENDSTATUS_PUBLIC_GAME	0x03
680 #define FRIENDSTATUS_PRIVATE_GAME	0x05
681 
682 #endif
683