A help and how to fix packages

07/21/2011 13:55 ruancarlosbr#1
example:
[C -> S][7074]
01 ................
01 ................
01 ................
40 2C 1A 00 @,..............

arrange example


Packet topla = new Packet(0x7074);<<1
topla.WriteUInt8(1);
topla.WriteUInt8(1);
topla.WriteUInt8(1);
topla.WriteUInt32(id);
ag_remote_security.Send(topla);

correct?

another Example

[S -> C][0FF1]
01 00 00 00 ................
00 00 00 00 ................

[S -> C][A101]
01 ................
02 ................
1D 00 ................
53 69 6C 6B 72 6F 61 64 5F 4B 6F 72 65 61 5F 59 Silkroad_Korea_Y
61 68 6F 6F 5F 4F 66 66 69 63 69 61 6C ahoo_Official...
00 ................
01 ................
01 00 ................
05 00 ................
74 65 73 74 65 teste...........
00 00 ................
64 00 d...............
01 ................
00 ................

how to fix this package?
07/21/2011 17:09 ZeraPain#2
0FF1

01 00 00 00 -> UInt32(1)
00 00 00 00 -> UInt32(0)

A101

01 -> UInt8(1)
02 -> UInt8(2)
1D 00 -> UInt16(text length)
53 69 6C 6B 72 6F 61 64 5F 4B 6F 72 65 61 5F 59 -> Ascii(text)

as so on...
07/21/2011 17:56 ruancarlosbr#3
everyone could contribute
ITS packages built in C #
07/21/2011 18:03 vorosmihaly#4
well,I don't know what you're talking about.
07/21/2011 18:10 ruancarlosbr#5
PacketWriter Writer = new PacketWriter();
Writer.Create(0xA101);
Writer.Word(0x0201); << ???
Writer.Text("Silkroad_Korea_Yahoo_Official");
Writer.Byte(0);
MsSQL ms = new MsSQL("SELECT * FROM server");



A101

01 -> UInt8(1)
02 -> UInt8(2)
1D 00 -> UInt16(text length)
53 69 6C 6B 72 6F 61 64 5F 4B 6F 72 65 61 5F 59 -> Ascii(text)

???
07/21/2011 18:13 vorosmihaly#6
I guess you should do it this way:
Packet p = new Packet(0xA101);
p.WriteUInt8(1);
p.WriteUInt8(2);
p.WriteAscii("Silkroad_Korea_Yahoo_Offficial");
p.WriteUInt8(0)
and so on..
so I suggest you not to use PacketWriter / PacketReader classes
07/21/2011 18:18 ruancarlosbr#7
which is correct

Server responds to Client
[S -> C][A101]
01 ................
02 ................
1D 00 ................
53 69 6C 6B 72 6F 61 64 5F 4B 6F 72 65 61 5F 59 Silkroad_Korea_Y
61 68 6F 6F 5F 4F 66 66 69 63 69 61 6C ahoo_Official...
00

PacketWriter Writer = new PacketWriter(); Correct code?
Writer.Create(0xA101);
Writer.UInt8(1);
Writer.UInt8(2);
Writer.UInt16(textlength);
Writer.Text("Silkroad_Korea_Yahoo_Official");
Writer.Byte(0);

or this is correct
PacketWriter Writer = new PacketWriter();
Writer.Create(0xA101);
Writer.Word(0x0201);
Writer.Text("Silkroad_Korea_Yahoo_Official");
Writer.Byte(0);
07/21/2011 18:20 vorosmihaly#8
first one
07/21/2011 18:42 ZeraPain#9
please learn how to work with hexadecimal first before asking stupid questions...
07/21/2011 19:34 kevin_owner#10
Indeed.

@ruancarlosbr
1 byte = int8
2 bytes = int16
4 bytes = int32
4 bytes = Single/Float
8 bytes = int64
8 bytes = Double // Not used in sro if i'm correct.

and Word(0x0201) isn't equal to int8(2) and int8(1)

the frist one means 513 in decimal and the others are just 2 and 1.

But I also advice the same thing as ZeraPain. These problems could have been avoided if you read a tutorial or even wikipedia about hex.
07/21/2011 19:49 bootdisk#11
07/21/2011 22:06 ruancarlosbr#12
hum example

0FF1

01 00 00 00 << 4 bytes = int32 < are formed by four numbers ?
00 00 -> 2 bytes = int16

Correct ?
07/21/2011 22:30 kevin_owner#13
that's correct.
07/21/2011 23:15 benco#14
hi people look on my exemple source code, it's very simple to understand.
[Only registered and activated users can see links. Click Here To Register...]

Is it help you ?
07/22/2011 10:54 lesderid#15
By the way, SRO uses Little Endian.