Page 1 of 1

packet structures

Posted: Fri Feb 06, 2015 4:52 pm
by Greasus
here is some structures of packets, i don't find any documented .If some are not correct please add the correct structures.

Code: Select all

Nordland XI  TAKEN 
[Server] packet : (0xC1) F_OBJECTIVE_INFO 

00 A0 C1 00 00 00 E4 00 01 01 00 00 0F 54 68 65 |.............The|
20 4E 6F 72 64 6C 61 6E 64 20 58 49 01 00 00 04 | Nordland XI....|
C8 02 00 FF 00 05 54 41 4B 45 4E 00 4C 54 68 65 |......TAKEN.LThe|
20 4E 6F 72 64 6C 61 6E 64 20 58 49 20 69 73 20 | Nordland XI is |
73 65 63 75 72 65 21 20 49 74 20 63 61 6E 6E 6F |secure! It canno|
74 20 62 65 20 74 61 6B 65 6E 20 62 79 20 74 68 |t be taken by th|
65 20 65 6E 65 6D 79 20 64 75 72 69 6E 67 20 74 |e enemy during t|
68 69 73 20 74 69 6D 65 2E 00 00 01 2C 00 00 00 |his time....,...|
FA 00 00 19 54 68 65 20 4E 6F 72 64 6C 61 6E 64 |....The Nordland|
20 58 49 20 69 73 20 73 65 63 75 72 65 00 77 01 | XI is secure.w.|
00 00 00                                        |...             |

packet structure

UInt32 = flag Id
Byte ?
Byte ?
Byte ?
UInt16 ?
String = The Nordland XI is secure!It cannot be taken by the enemy during this time
byte ?
UInt32 ?
UInt32 ?
byte ?
byte ?
byte ?
String =The Nordland XI is secure!
byte ?
byte ?
byte ?
Fill = 3

Re: packet structures

Posted: Fri Feb 06, 2015 8:33 pm
by ysor
Greasus wrote:here is some structures of packets, i don't find any documented .If some are not correct please add the correct structures.

Code: Select all

Nordland XI  TAKEN 
[Server] packet : (0xC1) F_OBJECTIVE_INFO 

00 A0 C1 00 

UInt32 = flag Id

Are you sure about "UInt32 = flag Id" ?

Shouldn't it be 0x00A0C100 then?

It also might be just an INT8/CHAR prepended by two bytes, which could be the packet size in bytes (excluding the first fixed 3 bytes for packet size and id flag.

See, 0x00A0 = 160

Exclude the 2 bytes for the packet size and the 1 byte for ID, makes 3 bytes from the 163 bytes of data, you get 160 bytes.

Check it and you will see it does make more sense. But its just blindly guessing. Thats does match and is typical for packaging. YOu want to know the length of the packet and what type of packet.

SO I would say:

UInt16 = Packet CONTENT size
UInt8 = id flag


*edit*

found the corresponding code (not for genereting the package directly, but which proves my idea):
https://github.com/WarEmu/WarEmu/blob/u ... PServer.cs

see this:

Code: Select all

        public TCPServer()
            : base()
        {
            PacketOut.SizeLen       = sizeof(UInt16);
            PacketOut.OpcodeInLen   = false;
            PacketOut.SizeInLen     = false;
            PacketOut.OpcodeReverse = false;
            PacketOut.SizeReverse   = false;
            PacketOut.Struct        = PackStruct.SizeAndOpcode;
        }
you see? SizeLen UInt16 (to be precice sizeof the type UInt16, should it be for any reason not 16bit) and also OpcodeInLen and SizeInLen are both false, so they are not included in the length, which agains matches to what i said ;)

Re: packet structures

Posted: Sat Feb 07, 2015 7:33 am
by Greasus
00 A0 C1 C1 is the opcode = 0xC1) F_OBJECTIVE_INFO ignore theses. 00 A0 C1

00 00 00 E4 (E4 = flag id ) If you write the structure to use i will try it, and let you know if it works.

Re: packet structures

Posted: Sat Feb 07, 2015 9:56 am
by nalgol
this is currently in the code i dont think it works yet though

Code: Select all

PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
            Out.WriteUInt32(Info.Entry);
            Out.WriteByte(0); // Type
            Out.WriteByte(Info.Type);
            Out.WriteByte(Info.Type); // Forteresse, rien du tout ,etc
            Out.WriteUInt16(0);
            Out.WritePascalString(Info.Name);
            Out.WriteByte(1);
            Out.WriteUInt16(0); // Time in second
            Out.WriteUInt32(0x034B0201);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte(1);
            Out.WriteUInt16(0);
            Out.WriteByte(0);
            Out.WritePascalString(Stage.Objectives.First().Objective.Objective);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteStringToZero(Stage.StageName);
            Out.WritePascalString(Stage.Objectives.First().Objective.Description);
            Out.WriteUInt16(0);
            Out.WriteUInt16(0x012C);
            Out.WriteUInt32(0x9E);
            Out.WriteUInt32(0);
            Out.WriteByte(0x48);
            Out.WriteUInt32(0);
            //Out.WriteHexStringBytes(Str.Replace(" ", string.Empty));
            Plr.SendPacket(Out);

Re: packet structures

Posted: Sat Feb 07, 2015 4:41 pm
by Greasus
nalgol wrote:this is currently in the code i dont think it works yet though

Code: Select all

PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_INFO);
            Out.WriteUInt32(Info.Entry);
            Out.WriteByte(0); // Type
            Out.WriteByte(Info.Type);
            Out.WriteByte(Info.Type); // Forteresse, rien du tout ,etc
            Out.WriteUInt16(0);
            Out.WritePascalString(Info.Name);
            Out.WriteByte(1);
            Out.WriteUInt16(0); // Time in second
            Out.WriteUInt32(0x034B0201);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteByte(1);
            Out.WriteUInt16(0);
            Out.WriteByte(0);
            Out.WritePascalString(Stage.Objectives.First().Objective.Objective);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteStringToZero(Stage.StageName);
            Out.WritePascalString(Stage.Objectives.First().Objective.Description);
            Out.WriteUInt16(0);
            Out.WriteUInt16(0x012C);
            Out.WriteUInt32(0x9E);
            Out.WriteUInt32(0);
            Out.WriteByte(0x48);
            Out.WriteUInt32(0);
            //Out.WriteHexStringBytes(Str.Replace(" ", string.Empty));
            Plr.SendPacket(Out);



This is for public quest Stages,which is different packet structure. It's were you walk to The Nordland XL flag,and it displays The Nordland XL at top of right hand side of game ,in yellow.I will mess around with it and see if i can find it

Re: packet structures

Posted: Sat Feb 07, 2015 4:46 pm
by nalgol
ah ok i didn't look that much into it yet to much work with combat

Re: packet structures

Posted: Sun Feb 08, 2015 8:12 pm
by Greasus
Can you pm me your recent PQuest_Objective.cs.I will have a look at it,and see what i can do.

Re: packet structures

Posted: Mon Feb 09, 2015 7:57 pm
by Greasus
sent you pm nalgol dont know if you can receive pm,s