d2gs发送给客户段的一段代码?
0 1 2
01
01 00 04 08 30 00 01 01 00
01 00 04 00 30 00 01 01 00
01 00 07 4B 00 05
02//blank
03: "Press OK to trade" menu comes up/ opens inventory out of town for one second. Weird!
04: Displays the loading screen
05 //blank?
07: Server tells client to add/display map data
07 [WORD X] [WORD Y] [BYTE Area ID]
08: Server tells client to delete/hide map data
08 [WORD x] [WORD y] [BYTE Area ID]
09 //Cave Notification/aLen == 11\\(aPacket[1] == 0x05)?lvl_wrap_data[aPacket[6]].lvlName
//(&unit.dwUnitID, aPacket + 2, 4)unit.dwUnitType = aPacket[1](&x, aPacket + 7, 2)(&y, aPacket + 9, 2)
if (aPacket[1] == 0x05) {DWORD id=*((DWORD*)(aPacket+2));POINT16 *p = (POINT16*)(aPacket+7);
if(aPacket[6]==0x12) //类型:地下墓穴的楼梯
09 05 [DWORD id] [WORD UnitType] [WORD X] [WORD Y]
0a //Object/Unit is Destroyed by the Game (be Gone from Player's Vision)/aLen == 6
//(&unit.dwUnitID, aPacket + 2, 4)unit.dwUnitType = aPacket[1]//Remove Entity
0a [BYTE entity kind] [DWORD id]
0b nPlayerID = *(DWORD *)(aPacket + 2);
0C: Entity State Info
0d //other player info/movement
//(aPacket[2] == leaderId)(&leaderLoc.x, (aPacket+7), 2)(&leaderLoc.y, (aPacket+9), 2)<=follow/bot1.cpp
//Unit State //Enity State Info, Health/Dead/Position/etc...
0d [DWORD Unit ID] [BYTE Unit Type] XX XX XX XX 00 00
0D 00 07 00 00 00 07 F4 13 C0 13 00 63 //13
0D 00 07 00 00 00 07 F6 13 C2 13 00 63
0D 00 07 00 00 00 07 F1 13 BD 13 00 63
2 7 9
//k3c.cpp if(aPacket[6] == 0x01 && aPacket[11] == 0x00 && aPacket[12] == 0x00) {
::memcpy(&WpLocation.x, aPacket + 7, 2);::memcpy(&WpLocation.y, aPacket + 9, 2);
sprintf(sMsg, "WpLocation (%04x,%04x)", WpLocation.x,WpLocation.y);
0e 03 xx xx xx xx [other shit] //xxxxxxxx = tpid
//when a town portal changes modes,may be sent when you click a chest/shrine also because of the mode change.
//Update Object State
0e 02 [DWORD Object ID] XX XX [DWORD State]
51 02 1A 00 00 00 25 00 A9 16 B8 11 02 00
0E 02 1A 00 00 00 03 00 02 00 00 00
51 02 19 00 00 00 25 00 A9 16 EC 11 02 00
0E 02 19 00 00 00 03 00 02 00 00 00
0F //other player movement/(aPacket[2] == leaderId)//Player/Entity, Running
0F 00 07 00 00 00 17 F7 13 C4 13 00 F9 13 CB 13
0F 00 07 00 00 00 17 F6 13 C2 13 00 F8 13 C9 13
0F 00 07 00 00 00 01 F4 13 C0 13 00 F2 13 BC 13 walk
0F 00 07 00 00 00 17 F1 13 BD 13 00 F4 13 C0 13 run
2 7 9 <-12 14
10 //cave follow code
if ( toFollow && (aPacket[1] == 0x00) && // not sure if this is always 0x00
(aPacket[2] == leaderId) &&
(aPacket[6] == 0x18) && // seems to be constant
(aPacket[7] == 0x05)
10 00 02 00 00 00 18 02 55 00 00 00 7A 15 5B 12
11 - {8} - [11 00 (DWORD Player ID) (BYTE Unit ID) 00 - /Attacked By Player??/
12: Update Entity State, Auras/Spells/Dead/etc...
13 //aura types/((aLen == 14 && aPacket[0] == 0x13 && aPacket[6] != 0x69)|| (aLen == 18 && aPacket[0] == 0x14))
//(&dwID, aPacket + 2, 4)g_aAttrs[g_nAuraPos] = aPacket[6] + AURA_BASE
13 AC 13 01 00 0D 4B 00 05 95 83 21 40 01 //14
14//18
15 //Map Blink (Teleport, WP, TP, etc)/aLen == 11 IsThisPlayerID(aPacket + 2) (&x, aPacket + 6, 2) (&y, aPacket + 8, 2)
// teleport successfully if(aPacket[1] == 0x01)
15 00 [DWORD Player ID] XX XX XX XX XX
//Entity Position, Sent When Out of Sync With Client or for Major Updates
19 0C: Picking up Gold
1B //blank?
1d 0c //Player Character Level Changed/aLen == 3
1d 0e //gold BYTE
1e 0e //gold word
1f 0e //gold dword
//Inventory gold 0e/Stash gold 0f
20 07 00 00 00 43 64 00 00 00
20 07 00 00 00 44 64 00 00 00
20 07 00 00 00 0C 4F 00 00 00
20 07 00 00 00 00 23 00 00 00
20 07 00 00 00 02 14 00 00 00
id
21: Tells client info about a single skill base level (eg, update the skill level on skill tab)
21 00 00 01 00 00 00 36 00 00 03 00
21 00 00 01 00 00 00 71 00 00 3F 00
22 //alen=12?Charge-able Spells(&ca.wSpellID, aPacket + 7, 2)ca.dwCharges = aPacket[9]
7 9
22 00 EA 01 00 00 00 DC 00 1A E3 00
22 00 EA 01 00 00 00 DA 00 2A E3 00
//got when open stash
23 00 //Player Left/Right Spell Selected/aLen == 13 IsThisPlayerID(aPacket + 2) (&wSpell, aPacket + 7, 2)
//(aPacket[6])// left-hand// right-hand\\(aPacket[6] == 0x01) // left
//Switch Skill
23 00 [DWORD Player ID] [BYTE Left/Right (00/01)] [WORD Skill ID] FF FF FF FF
26 MsgType //welcome msg/01chat
26 01 00 02 00 00 00 00 00 (varies, character name) 00 (varies, message)]
26 01 00 02 00 00 00 00 00 61 46 6C 79 5F 41 75 72 61 00 00
// 01 is standard chat message
// 02 prints in the format "%s whispers: %s" where the first var is Name, and the second is Message.
// 04 bypasses the name checks, etc, and prints the message with color specified in Color.
// 05 creates an overhead struct and assigns it to the unit with id (UnitId)
// 06 prints the "You whispered to %s: %s, with the first var being Name, and the second being Message.
// 07 prints Message on a recipe scroll background. Recipe scroll pane opens but lacks buttons.
typedef struct
{
t_d2game_header h;
bn_short unknown1;
bn_int unknown2;
bn_short unknown3;
bn_byte unknown4; /* id or token? a fixed number for each char*/
/* player name */
/* message */
} t_d2game_server_chat_message;
27 //interact_succeed/aLen == 40 && aPacket[1] == 0x01(&id, aPacket + 2, 4)
27 01 01 00 00 00 01 6F 03 02 7C 0D 00 76 43 05 01 00 00 00 78 F5 F2 00 00 76 43 05 00 56 A6 01 7C 00 FA 00 01 00 00 00
27 01 09 00 00 00 01 00 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
29 //97
28 //105/103
//interact npc->27 29 28 npcmove
2a //(aPacket[1] == 0x01)repaired
2B 00 01 04 14 30 40 01 //hp mp?
2B 00 01 08 00 05 00 63 //8
2C 00 //Inventory is Full/aLen=8 aPacket[1]=0x00 aPacket[6]=0x17 aPacket[7]=0x00 IsThisPlayerID(aPacket + 2)
2C 00 ID 17 00
2C: Some sounds (Like open a TP, the "Follow Me" sayings, etc.)
2C 01 0A 00 00 00 12 00
id
2D 41 7D E2 73 42 FD 13 //8
2D 21 25 82 BF 22 85 1F
2D 21 F3 81 6A 22 93 0A
2D A1 90 C2 15 A3 D0 15
2F 00 00 42 00 00 7F /37 11 /04 16 /01 00 07 4B 00 05
2F 00 14 00 97 00 01 /95 0F /57 13 /01 00 07 4B 00 05
2F 00 00 00 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //37
2F 00 00 00 8F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30 01 //NPDSTROE?
3e // arrow/bolt/throwing weapon quantity update(aLen == 11&& aPacket[0] == 0x3e)(&g_wAmmoQuantity, aPacket + 7, 2)
3f 08 Right Click(scroll, pot,etc)
3f [BYTE Used[00/ff] [DWORD ItemID] ff
3F FF 08 00 00 00 FF FF //7C 04 08 00 00 00 //after open cube
47 00 00 02 00 00 00 00 00 00 00 //11
id
48 00 00 02 00 00 00 00 00 00 00//11
49 //GameIP?
4c //leader use skill(target)/aPacket[2] == leaderId
// 06(click unitL) -> 09(hold unitL),
// 07(shift unitL) -> 0A (shift hold unit L),
// 0d(click unitR) -> 10 (hold unitR),
// oe(shift unitR) -> 11 (shift hold unit R)
4d //other player use skill (non target)/???<=follow bot
//(aPacket[2] == leaderId)(aPacket[6] == 0x36 && aPacket[7] == 0x00=>tp)
4d //Monster Revived by Itself (Act5 Zombies)/aLen == 17 aPacket[1] == 0x01
//(&unit.dwUnitID, aPacket + 2, 4)
4E: //Merc-Trade-Info
4E 58 0D AC EA B0 AD //7
4E 5B 0D 7E 19 BC F7
4E 5D 0D DF 53 C0 43
4E 5E 0D 9D AC 45 B8
4E 6D 0D 37 6B 0F D0
4E 6E 0D 07 30 BE 7D
4E 70 0D A9 EC F6 22
4E 71 0D 7B 56 6E DF
4E 78 0D 76 08 04 72
4E 7A 0D 3A D7 3E 48
4f//blank?1st talk to merc
4F 00 14 00 4C 00 00 00 00 01/D0 13/9A 13/01 00 07 4B 00 05
4F 00 42 00 27 00 00/86 14/B2 18/01 00 07 4B 00 05
4F 00 14 00 31 20 00 EE
4F 00 14 00 31 20 00/EA 13/A6 13/01 00 0D 4B 00 05
4F 00 00 00
4F 00 00
4F 56 5E 00 00 28 11 0B 16 80
4F 56 E0 00 78 0F 86 13 80//9
4F 56 19 00 00 73 0F 43 13 80
4F 56 0B 00 00 AE 0F 5D 13 80
4F 56 F8 00 3E 15 5C 12 80
4F E9 00 00 00 00 00 00 76 14 AC 18 80
50: Quest Related
51:World Entity Info
//Town Portal Appeared/aLen>12 aPacket[0]=0x51 aPacket[6]= 0x3b aPacket[7] == 0x00 (&gu.dwUnitID, aPacket + 2, 4)
//Static Object Spawned/aLen > 12 (&unit.dwUnitID, aPacket + 2, 4)(&x, aPacket + 8, 2)(&y, aPacket + 10, 2)
//Packet 51 02 - world entity update
//(&wFingerPrint, aPacket + 6, 2)
51 //14 Identifies Close Objects
51 02 [DWORD ID][WORD object ID][DWORD Coordinates X,Y][WORD state]
51 02 1A 00 00 00 25 00 A9 16 B8 11 02 00
0E 02 1A 00 00 00 03 00 02 00 00 00
51 02 19 00 00 00 25 00 A9 16 EC 11 02 00
0E 02 19 00 00 00 03 00 02 00 00 00
51 if(aPacket[1] == 0x02 && aPacket[8] == 0x27 && aPacket[10] == 0xb9 && aLen==0x0e) {
::memcpy(&WpID,aPacket+2,4);
//14//abot
if (aLen != 14 && aPacket[1] != 0x02) return aLen;
{ WORD code;::memcpy(&code, aPacket + 6, 2);
DWORD id=*((DWORD*)(aPacket + 2));
POINT16 *p = (POINT16*)(aPacket+8);
if (code == 0x0077 &&_wp1.id==0) // act1 wp
{ _wp1.id=id; _wp1.pos=*p;
if (code == 0x010b &&_stash.id==0) // act1 wp
{ _stash.id=id; _stash.pos=*p;
52: Quest Related
53
53 02 00 00 00 80 08 00 00 00 //10
53 02 00 00 00 00 11 00 00 00
53 02 00 00 00 80 19 00 00 00
54//blank?
54 00 00 00
54 69 60 00 A7 0F 5C 13 80
54 69 60 00 B2 0F 59 13 80 //9
54 69 F3 00 00 98 0F 63 13 80
54 69 35 00 00 76 0F 4C 13 80
54 69 33 00 00 C0 14 93 18 80
54 69 35 00 00 D2 13 A0 13 80 //10
54 4A 00 01 00 00 00 18 14 AD 13 80 //12
54 4A 00 00 00 00 00 00 90 0F 50 13 80 //13
54 4A 00 00 00 00 00 00 8A 0F 52 13 80
55 //NPC Info
//(aLen == 13&& aPacket[0] == 0x55&& aPacket[11] == 0x80&& aPacket[12] == 0x01)
//(&wFingerPrint, aPacket + 5, 2)(ID, aPacket + 1, 4)(Location.x, aPacket + 7, 2)(Location.y, aPacket + 9, 2)
//npc update/(WORD*)(aPacket+5) == healer
.entityID/(&healer.baseID, aPacket+1, 2)
56 // monster/NPC/merc/summonning spawn packet
if (aLen == 46&& aPacket[0] == 0x56)
{if (aPacket[15] != 0xff // friendly units&& aPacket[37] == 0x13) // merc token
{::memcpy(&g_dwMercID, aPacket + 1, 4); g_mem.SetBool(TRUE, MEM_MERCALIVE);
//server->GamePrintInfo("Merc is