It's a tutorial to learn how packets work, a basic explication of how capture then and edit by analysis.
The first thing you need is capture the packet, can do it using wpe pro or a debbuger, but if you use wpe pro need to decrypt the packet, because;
Using wpe pro(get the packet encrypted)
Code:
C6 DE 72 63 01 21 D0 DD 0B 76 CC B3 EE D6 DE DE 82 DE DE DE 72 21 21 21
Debbuger(get the packet before encryption)
Code:
18 00 00 00 01 00 0F 03 00 00 00 00 40 08 00 00 00 00 00 00 00 00 00 00
Now just need analysis, usually the packets follow the following logic:
00:=Buffer Size;
04:=MyIndex;
06:=Opcode;
12:=TargetID;
16:=Type1;
20:=Type2;
Start count by zero, so,
18 00 00 00 01 00 0F 03 00 00 00 00 40 08 00 00 00 00 00 00 00 00 00 00 - Packet of clicking on NPC.
00:=18;
04:=1;
06:=0F 03;(here you invert the bytes, then "0F 30" turn "30F"
12:=40 08;(invert too and converto from hex to dec, 840 hex = 2112 = dec.
16:=0;
20:=0;
In this case you don't need set the value of your index, then the packet will be something like
PWORD(INTEGER(Buffer)+00)^:=$18;
PWORD(INTEGER(Buffer)+06)^:=$30F;
PWORD(INTEGER(Buffer)+12)^:=2112;//Set how you think better $840(hex) or 2112(dec)
PWORD(INTEGER(Buffer)+16)^:=0;
PWORD(INTEGER(Buffer)+20)^:=0;
This just will open the npc chat.
To edit the packet now you need find new values of type1 and type2 and they function, like
Type1 = 5 (Open Store, so you can open the store of any npc)
so changing to PWORD(INTEGER(Buffer)+16)^:=5; will open the store of selected NPC.
You cant teleport from any npc too editing type1 and type2, set "3" on type1 and "1"(for example) on type2 to go Ursula, "2" to go city and etc..
The packet will be something like
PHP Code:
Function NPC(Type1, Type2: Integer);
var
Buffer:Array Of Byte;
begin
SetLength(Buffer, $18);
PWORD(INTEGER(Buffer)+00)^:=$18;
PWORD(INTEGER(Buffer)+06)^:=$30F;
PWORD(INTEGER(Buffer)+12)^:=TargetID;//it's the function to get npc id
PWORD(INTEGER(Buffer)+16)^:=Type1;
PWORD(INTEGER(Buffer)+20)^:=Type2;
SendPacket(Buffer, $18);
end;
So to use is simple,
If want open store of select npc, just insert the function
NPC(5, 0);
or
Spoiler
PHP Code:
Button1.Click();
var
Buffer:Array Of Byte;
begin
SetLength(Buffer, $18);
PWORD(INTEGER(Buffer)+00)^:=$18;
PWORD(INTEGER(Buffer)+06)^:=$30F;
PWORD(INTEGER(Buffer)+12)^:=TargetID;//it's the function to get npc id
PWORD(INTEGER(Buffer)+16)^:=5;
PWORD(INTEGER(Buffer)+20)^:=0;//Set 1 if don't work
SendPacket(Buffer, $18);
end;
If want teleport to some place, like ursula
NPC(3, 1);
or
Spoiler
PHP Code:
Button1.Click();
var
Buffer:Array Of Byte;
begin
SetLength(Buffer, $18);
PWORD(INTEGER(Buffer)+00)^:=$18;
PWORD(INTEGER(Buffer)+06)^:=$30F;
PWORD(INTEGER(Buffer)+12)^:=TargetID;//it's the function to get npc id
PWORD(INTEGER(Buffer)+16)^:=3;
PWORD(INTEGER(Buffer)+20)^:=1;
SendPacket(Buffer, $18);
end;