Pol  Revision:cb584c9
pktin.h
Go to the documentation of this file.
1 
15 #ifndef __PKTINH
16 #define __PKTINH
17 
18 #include "../clib/rawtypes.h"
19 #include "layers.h"
20 #include "pktdef.h"
21 #include "pktinid.h"
22 #include "uconst.h"
23 namespace Pol
24 {
25 namespace Core
26 {
27 #pragma pack( push, 1 )
28 
29 struct PKTIN_00
30 {
31  u8 msgtype; // Byte 0
32  u32 serial; // Bytes 1-4
38  char Name[30]; // Bytes 10-40
44  char unk2[15];
45  u8 Sex; // Byte 70 (0 if Human Male, 1 if Human Female, 2 if Elf Male, 3 if Elf Female)
46  u8 Strength; // Byte 71
47  u8 Dexterity; // Byte 72
48  u8 Intelligence; // Byte 73
49  u8 SkillNumber1; // Byte 74
50  u8 SkillValue1; // Byte 75
51  u8 SkillNumber2; // Byte 76
52  u8 SkillValue2; // Byte 77
53  u8 SkillNumber3; // Byte 78
54  u8 SkillValue3; // Byte 79
55  u16 SkinColor; // Byte 80-81
56  u16 HairStyle; // Byte 82-83
57  u16 HairColor; // Byte 84-85
58  u16 BeardStyle; // Byte 86-87
59  u16 BeardColor; // Byte 88-89
61  u8 StartIndex; // Byte 91 (actually a <word> with unk90)
63  u8 unk93; // <word> with unk92
65  u8 CharNumber; // I think (yup! <word> with unk94 -TJ)
69 };
70 static_assert( sizeof( PKTIN_00 ) == 104, "size missmatch" );
71 
72 struct PKTIN_01
73 {
75  u32 unk; // 0xffffffff
76 };
77 static_assert( sizeof( PKTIN_01 ) == 5, "size missmatch" );
78 
79 struct PKTIN_1E
80 {
82  u8 unk1_3[3];
83 };
84 static_assert( sizeof( PKTIN_1E ) == 4, "size missmatch" );
85 
86 /* Message Type 02, WALK
87 dir: low three bits are direction.
88 bit 0x80 is "run" bit.
89 */
90 struct PKTIN_02
91 {
94  u8 movenum; // Sequence Number (used with fastwalk prevention!) -TJ
96 };
97 
98 /* Message Type 03, Speech Message. Received from client when a
99 character talks.
100 Note text[1]. Text length should be determinable from msglen:
101 msg->msglen - offsetof( PKTIN_03, text )
102 includes the length of the text as well as the null terminator
103 What should the valid range for textlen be? I don't know.
104 
105 SPEECH_MAX_LEN: max length, not including terminator:
106 A line of dots is 120 characters. I haven't found anything
107 yielding more characters, but 200 characters should be safe.
108 */
109 
110 struct PKTIN_03
111 {
117  char text[SPEECH_MAX_LEN + 1]; /* one or more characters, null-terminated. */
118 };
119 
120 struct PKTIN_04
121 {
123  u8 mode; // on/off. 0/1?
124 };
125 static_assert( sizeof( PKTIN_04 ) == 2, "size missmatch" );
126 
127 struct PKTIN_05
128 {
131 };
132 static_assert( sizeof( PKTIN_05 ) == 5, "size missmatch" );
133 
134 struct PKTIN_06
135 {
137  u32 serial; // 0x80000000 bit seems not to count.
138 };
139 static_assert( sizeof( PKTIN_06 ) == 5, "size missmatch" );
140 
141 
142 struct PKTIN_07
143 {
147 };
148 static_assert( sizeof( PKTIN_07 ) == 7, "size missmatch" );
149 
151 {
154  u16 x; // only if x & 0xFF00 = 0xFF?
156  s8 z;
158 };
159 static_assert( sizeof( PKTIN_08_V1 ) == 14, "size missmatch" );
160 
162 {
165  u16 x; // only if x & 0xFF00 = 0xFF?
167  s8 z;
170 };
171 static_assert( sizeof( PKTIN_08_V2 ) == 15, "size missmatch" );
172 
173 struct PKTIN_09
174 {
177 };
178 static_assert( sizeof( PKTIN_09 ) == 05, "size missmatch" );
179 
180 struct PKTIN_12
181 {
185  u8 data[300];
186 };
187 static_assert( sizeof( PKTIN_12 ) == 304, "size missmatch" );
188 
189 struct PKTIN_13
190 {
195 };
196 static_assert( sizeof( PKTIN_13 ) == 10, "size missmatch" );
197 
198 struct PKTIN_34
199 {
204 };
205 static_assert( sizeof( PKTIN_34 ) == 10, "size missmatch" );
206 
207 struct PKTIN_5D
208 {
211  char charname[30];
222  enum
223  { // clientflag
224  FLAG_T2A = 0x00,
225  FLAG_RENAISSANCE = 0x01,
226  FLAG_THIRD_DAWN = 0x02,
227  FLAG_LBR = 0x04,
228  FLAG_AOS = 0x08,
229  FLAG_SE = 0x10,
230  FLAG_SA = 0x20,
231  FLAG_UO3D = 0x40, // ?
232  FLAG_RESERVED = 0x80,
233  FLAG_3DCLIENT = 0x100 // old 3D client
234  };
235 };
236 static_assert( sizeof( PKTIN_5D ) == 0x49, "size missmatch" );
237 
238 struct PKTIN_75
239 {
242  char name[30]; // always null-terminated, or at least the client is supposed to.
243 };
244 static_assert( sizeof( PKTIN_75 ) == 35, "size missmatch" );
245 
246 struct PKTIN_7D
247 {
253  u16 color; // ?? maybe, has always been 0
254 };
255 
256 struct PKTIN_80
257 {
259  char name[30];
260  char password[30];
262 };
263 static_assert( sizeof( PKTIN_80 ) == 62, "size missmatch" );
264 
265 struct PKTIN_83
266 {
268  u8 password[30];
271 };
272 static_assert( sizeof( PKTIN_83 ) == 39, "size missmatch" );
273 
274 // FIXME DO NOT USE YET. This is untested, not validated. Must find out
275 // correct packet structure before moving forward. Different emus and diff documents
276 // show different structures. wtf?
277 // Turley 09/12/02 should work
278 struct PKTIN_8D
279 {
280  u8 msgtype; // 0
282  u32 unk_1; // 3-6
283  u32 char_slot; // 7-10
284  char name[30]; // 11-40
285  char password[30]; // 41-70
286  u8 profession; // 71
287  u8 flags; // 72
288  u8 gender; // 73
289  u8 race; // 74 0=human/1=elf/2=gargoyle
290  u8 strength; // 75
291  u8 dexterity; // 76
293  u16 skin_color; // 78-79
294  u32 unk_2; // 80-83 0x00000000
295  u32 unk_3; // 84-87 0x00000000
304  char unk_4[25]; // 96-121 all 00
305  u8 unk_5; // 122 Always 0x0B?
306  u16 haircolor; // 133-134
307  u16 hairstyle; // 135-136
308  u8 unk_6; // 137 Always 0x0C?
309  u32 unk_7; // 138-141 0x00000000
310  u8 unk_8; // 142 Always 0x0D?
311  u16 shirtcolor; // 143-144
312  u16 pantscolor; // 145-146
313  u8 unk_9; // 147 Always 0x0F?
314  u16 face_color; // 148-149
315  u16 face_id; // 150-151
316  u8 unk_10; // 152
317  u16 beardcolor; // 153
318  u16 beardstyle; // 154
319 };
320 static_assert( sizeof( PKTIN_8D ) == 146, "size missmatch" );
321 
322 struct PKTIN_91
323 {
327  char name[30];
328  char password[30];
329 };
330 static_assert( sizeof( PKTIN_91 ) == 65, "size missmatch" );
331 
332 struct PKTIN_9B
333 {
335  u8 unk[0x101];
336 };
337 static_assert( sizeof( PKTIN_9B ) == 258, "size missmatch" );
338 
339 struct PKTIN_9F
340 {
345  struct
346  {
349  } items[1];
350 };
351 static_assert( sizeof( PKTIN_9F ) == 15, "size missmatch" );
352 
353 struct PKTIN_A0
354 {
357 };
358 static_assert( sizeof( PKTIN_A0 ) == 3, "size missmatch" );
359 
360 struct PKTIN_A4
361 {
363  u8 unknown[0x94];
364 };
365 static_assert( sizeof( PKTIN_A4 ) == 0x95, "size missmatch" );
366 
367 struct PKTIN_A7
368 {
371  u8 prevnext; // 0=prev 1=next
372 };
373 static_assert( sizeof( PKTIN_A7 ) == 4, "size missmatch" );
374 
375 struct PKTIN_AC
376 {
383  enum
384  {
386  RETCODE_OKAY
387  };
389  char data[1];
390 };
391 static_assert( sizeof( PKTIN_AC ) == 13, "size missmatch" );
392 
393 struct PKTIN_AD
394 {
400  char lang[4]; // "enu" - US English
401  u16 wtext[2]; // wide-character, double-null terminated
402 };
403 static_assert( sizeof( PKTIN_AD ) == 16, "size missmatch" );
404 
405 struct PKTIN_B1
406 {
407  struct HEADER
408  {
412  u32 dialogid; // Alias for gumpid
414  };
415  struct INTS_HEADER
416  {
418  };
419  struct INT_ENTRY // FIXME bad name
420  {
422  };
424  {
426  };
428  {
431  u8 data[1]; // !@#!# Unicode
432  };
433 };
434 static_assert( sizeof( PKTIN_B1::HEADER ) == 15, "size missmatch" );
435 static_assert( sizeof( PKTIN_B1::INTS_HEADER ) == 4, "size missmatch" );
436 static_assert( sizeof( PKTIN_B1::INT_ENTRY ) == 4, "size missmatch" );
437 static_assert( sizeof( PKTIN_B1::STRINGS_HEADER ) == 4, "size missmatch" );
438 static_assert( sizeof( PKTIN_B1::STRING_ENTRY ) == 5, "size missmatch" );
439 
440 struct PKTIN_B5
441 {
443  char chatname[63]; // in unicode
444 };
445 static_assert( sizeof( PKTIN_B5 ) == 64, "size missmatch" );
446 
447 struct PKTIN_B6
448 {
452  char lang[3];
453 };
454 static_assert( sizeof( PKTIN_B6 ) == 9, "size missmatch" );
455 
456 struct PKTIN_D9
457 {
459  u8 unknown1; // Unknown - allways 0x02
460  u32 instance; // Unique Instance ID of UO
461  u32 os_major; // OS Major
462  u32 os_minor; // OS Minor
463  u32 os_revision; // OS Revision
464  u8 cpu_manufacturer; // CPU Manufacturer
465  u32 cpu_family; // CPU Family
466  u32 cpu_model; // CPU Model
467  u32 cpu_clockspeed; // CPU Clock Speed [Mhz]
468  u8 cpu_quantity; // CPU Quantity
469  u32 memory; // Memory [MB]
470  u32 screen_width; // Screen Width
471  u32 screen_height; // Screen Height
472  u32 screen_depth; // Screen Depth [Bit]
473  u16 directx_major; // DirectX Major
474  u16 directx_minor; // DirectX Minor
475  u16 video_description[64]; // Video Card Description [wide-character]
476  u32 video_vendor; // Video Card Vendor ID
477  u32 video_device; // Video Card Device ID
478  u32 video_memory; // Video Card Memory [MB]
479  u8 distribution; // Distribution
480  u8 clients_running; // Clients Running
481  u8 clients_installed; // Clients Installed
482  u8 partial_installed; // Partial Insstalled
483  u16 langcode[4]; // Language Code [wide-character]
484  u8 unknown2[64]; // Unknown
485 };
486 static_assert( sizeof( PKTIN_D9 ) == 0x10C, "size missmatch" );
487 
488 struct PKTIN_E1
489 {
494  enum
495  {
496  CLIENTTYPE_KR = 0x2,
497  CLIENTTYPE_SA = 0x3
498  };
499 };
500 static_assert( sizeof( PKTIN_E1 ) == 0x09, "size missmatch" );
501 
502 struct PKTIN_E4
503 {
506  u32 unknown_length; // 16 Bytes
508 };
509 
510 struct PKTIN_EF
511 {
518 };
519 static_assert( sizeof( PKTIN_EF ) == 0x15, "size missmatch" );
520 
521 struct PKTIN_F8
522 {
523  u8 msgtype; // Byte 0
524  u32 serial; // Bytes 1-4
530  char Name[30]; // Bytes 10-40
536  char unk2[15];
537  u8 Sex; // Byte 70 (0 if Human Male, 1 if Human Female, 2 if Elf Male, 3 if Elf Female)
538  u8 Strength; // Byte 71
539  u8 Dexterity; // Byte 72
540  u8 Intelligence; // Byte 73
541  u8 SkillNumber1; // Byte 74
542  u8 SkillValue1; // Byte 75
543  u8 SkillNumber2; // Byte 76
544  u8 SkillValue2; // Byte 77
545  u8 SkillNumber3; // Byte 78
546  u8 SkillValue3; // Byte 79
547  u8 SkillNumber4; // Byte 80
548  u8 SkillValue4; // Byte8 1
549  u16 SkinColor; // Byte 82-83
550  u16 HairStyle; // Byte 84-85
551  u16 HairColor; // Byte 86-87
552  u16 BeardStyle; // Byte 88-89
553  u16 BeardColor; // Byte 90-91
555  u8 StartIndex; // Byte 93 (actually a <word> with unk90)
557  u8 unk93; // <word> with unk92
559  u8 CharNumber; // I think (yup! <word> with unk94 -TJ)
563 };
564 static_assert( sizeof( PKTIN_F8 ) == 106, "size missmatch" );
565 
566 
567 #pragma pack( pop )
568 }
569 }
570 #endif
unsigned char u8
Definition: rawtypes.h:25
u8 clientip[4]
Definition: pktin.h:66
u16 tag
Definition: pktin.h:429
u32 pattern_EDEDEDED
Definition: pktin.h:210
#define SPEECH_MAX_LEN
Definition: pktdef.h:27
Definition: pktin.h:419
Definition: pktin.h:427
unsigned short u16
Definition: rawtypes.h:26
unsigned int u32
Definition: rawtypes.h:27
u32 used_item_serial
Definition: pktin.h:249
char unk2[15]
Definition: pktin.h:44
#define RESPONSE_MAX_LEN
Definition: pktdef.h:107
u16 unk3_4_ClientType
Definition: pktin.h:326
signed char s8
Definition: rawtypes.h:29
std::unordered_map< u64, ScriptDiffData > data
Definition: osmod.cpp:966
u32 value
Definition: pktin.h:421
std::string name
Definition: osmod.cpp:943
u16 length
Definition: pktin.h:430
Definition: berror.cpp:12
char Name[30]
Definition: pktin.h:38