Silkroad 0x7021 packet

11/30/2015 21:21 medolife20#1
i got 3 packets like
Code:
[C->S] [9] [0x7021] [E] 
01 99 66 de 02 98 ff b9 01                        

[C->S] [9] [0x7021] [E] 
01 99 66 57 03 98 ff bd 01                        

[C->S] [9] [0x7021] [E] 
01 99 66 28 03 98 ff 1a 02
if i wanna send those packets from my C# program how i`m supposed
to do that ?

cause i tried this one and not working i get always DC

Code:
public void triangle()
        {
            Packet p1 = new Packet(0x7021);
            p1.WriteInt8(0x01);
            p1.WriteInt16(0x9966);
            p1.WriteInt16(0xde02);
            p1.WriteInt16(0x98ff);
            p1.WriteInt16(0xb901);
            
            Packet p2 = new Packet(0x7021);
            p2.WriteInt8(0x01);
            p2.WriteInt16(0x9966);
            p2.WriteInt16(0x5703);
            p2.WriteInt16(0x98ff);
            p2.WriteInt16(0xbd01);

            Packet p3 = new Packet(0x7021);
            p3.WriteInt8(0x01);
            p3.WriteInt16(0x9966);
            p3.WriteInt16(0x2803);
            p3.WriteInt16(0x98ff);
            p3.WriteInt16(0x1a02);


            while (true)
            {
                Thread.Sleep(1500);
                Agent.Send(p1);
                Thread.Sleep(1500);
                Agent.Send(p2);
                Thread.Sleep(1500);
                Agent.Send(p3);
            }
        }
12/01/2015 02:57 DaxterSoul#2
Doesn't [E] mean they are encrypted?
So you should encrypt the packet you're trying to send.
12/01/2015 07:50 mxii#3
I think its not nessesary to Encrypt the walking packet, already done it without..
But maybe depends on server?!

Heres an example WITH encryption enabled:

Code:
public static byte GetSectorY(int y)
{
	return (byte)Math.Floor((double)y / 192 + 92);
}

public static byte GetSectorX(int x)
{
	return (byte)Math.Floor((double)x / 192 + 135);
}

public static void WalkTo(Bot bot, int X, int Y)
{
	if (bot == null || bot.Proxy == null) return;

	int xPos = 0;
	int yPos = 0;
	
	byte xSector = DlgMiniMap.GetSectorX(X);
	byte ySector = DlgMiniMap.GetSectorY(Y);

	Packet packet;

	if (bot.Char.Ridepet == null)
	{
		packet = new Packet(0x7021, true);
		packet.WriteUInt8(0x01);
	}
	else
	{
		packet = new Packet(0x70C5, true);
		packet.WriteUInt32(bot.Char.Ridepet.UID);
		packet.WriteUInt8(1);
		packet.WriteUInt8(1);
	}

	packet.WriteUInt8(xSector);
	packet.WriteUInt8(ySector);

	if (bot.Char.IsInCave)
	{
		xSector = bot.Char.CaveFloor;
		ySector = 0x80;
		
		xPos = ((X - ((xSector - 135) * 192)) * 10);
		yPos = ((Y - ((ySector - 92) * 192)) * 10);
	}
	else
	{
		xPos = (ushort)((X - (xSector - 135) * 192) * 10);
		yPos = (ushort)((Y - (ySector - 92) * 192) * 10);
	}

	packet.WriteUInt16(xPos);
	packet.WriteUInt16(0);
	packet.WriteUInt16(yPos);
	
	bot.Proxy.SendToSilkroadServer(packet);
}
12/03/2015 18:54 qqdev#4
It depends on the packet. Some packets require an encryption.
12/06/2015 21:12 theking200051#5
first :- 0x7021 is not encrypted .

second :-u must use
p1.WriteUInt8(0x01); Not
p1.WriteInt8(0x01);
it is unsigned integers not signed .

Third and your problem source :-
u must reverse the bytes order when u read or write from a stream that's how streams works .example lets build sit down packet 0x704f
its opcode is =0x704f
its security bytes =xxxx (dont care about those bytes for now)
its data is =0x04
its data size = 0001 byte
packet build = data size + opcode +security bytes +data
packet = 0x 0100 4f70 xxxx 04

so in your case the code is :-
Code:
Packet p1 = new Packet(0x7021,false,false);
            p1.WriteUInt8(0x01);
            p1.WriteUInt16(0x6699);
            p1.WriteUInt16(0x02de);
            p1.WriteUInt16(0xff98);
            p1.WriteUInt16(0x01b9);
12/10/2015 01:38 medolife20#6
Quote:
Originally Posted by theking200051 View Post
first :- 0x7021 is not encrypted .

second :-u must use
p1.WriteUInt8(0x01); Not
p1.WriteInt8(0x01);
it is unsigned integers not signed .

Third and your problem source :-
u must reverse the bytes order when u read or write from a stream that's how streams works .example lets build sit down packet 0x704f
its opcode is =0x704f
its security bytes =xxxx (dont care about those bytes for now)
its data is =0x04
its data size = 0001 byte
packet build = data size + opcode +security bytes +data
packet = 0x 0100 4f70 xxxx 04

so in your case the code is :-
Code:
Packet p1 = new Packet(0x7021,false,false);
            p1.WriteUInt8(0x01);
            p1.WriteUInt16(0x6699);
            p1.WriteUInt16(0x02de);
            p1.WriteUInt16(0xff98);
            p1.WriteUInt16(0x01b9);
first of all thanks so much bro <3
also
how i know if packet encrypted or not ?
also the same way u did with that packet happen with all packets >?
12/10/2015 20:35 qqdev#7
Your packet analyzer should show it. edxLoader for instance.