Quote:
Originally Posted by DarkPlayer123
this is code. what are the packets?
|
You actually were away for a while don't ya?
This are packets, based on ByteArray's..
Code:
public class OutgoingPacket
{
public List<byte> Message;
public bool NROL;
public OutgoingPacket(short ID, bool NeedReverseOrLength = true)
{
Message = new List<byte>();
NROL = NeedReverseOrLength;
Short(ID);
}
public void setNROL(bool to)
{
NROL = to;
}
public void Integer(int Int32)
{
AddBytes(BitConverter.GetBytes(Int32), true);
}
public void Short(short Short)
{
AddBytes(BitConverter.GetBytes(Short), true);
}
public void UTF(string String)
{
Short((short)String.Length);
AddBytes(Encoding.Default.GetBytes(String), false);
}
public void Boolean(bool Bool)
{
AddBytes(new byte[] { (Bool) ? (byte)1 : (byte)0 }, false);
}
public void AddBytes(byte[] Bytes, bool IsInt)
{
if (IsInt)
{
for (int i = Bytes.Length - 1; i > -1; i--)
{
this.Message.Add(Bytes[i]);
}
}
else
{
this.Message.AddRange(Bytes);
}
}
public byte[] ToByteArray()
{
List<byte> NewMsg = new List<byte>();
NewMsg.AddRange(BitConverter.GetBytes(Message.Count));
NewMsg.Reverse();
NewMsg.AddRange(Message);
List<byte> NewMsg2 = new List<byte>();
for (int i = 2; i < NewMsg.ToArray().Length; i++)
{
NewMsg2.Add(NewMsg.ToArray()[i]);
}
return NewMsg2.ToArray();
}
}
Simple explaination of the working of DO's ByteArrays:
For example: Alien packets:
Code:
.H{......^...T........-=[ Streuner ]=-..!F.........................................^..!i...q...
the HEX of it:
Code:
00 48 7B 1C 00 00 05 E6 A7 5E 00 00 00 54 00 00 00 01 00 00 00 10 2D 3D 5B 20 53 74 72 65 75 6E 65 72 20 5D 3D 2D 00 00 21 46 00 00 18 C9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 14 18 A2 00 00 05 E6 A7 5E 00 00 21 69 00 00 19 71 00 00 03 E8
Then u pick the FIRST 2 Hex (bytes).. and parse them with:
00 48
[Only registered and activated users can see links. Click Here To Register...]
Result=72 => We got the length of the whole packet here (Doesn't mean u need to add 72 items.. no)
Then the second 2 bytes: 7B 1C
[Only registered and activated users can see links. Click Here To Register...]
There u got the Packet ID.. and from that way u can find more.. but I'll explain this later :)