Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum ArenaIDS : uint
- {
- ShowPlayerRankList=0xA,
- QualifierList=0x6
- }
- public class WinnerList
- {
- public ushort Size;
- public ushort Type;
- public ArenaIDS ID;
- public List<PlayerStatistcs> Players = new List<PlayerStatistcs>();
- public byte[] BuildPacket()
- {
- MemoryStream strm = new MemoryStream();
- BinaryWriter wtr = new BinaryWriter(strm);
- wtr.Write((ushort)0);
- wtr.Write((ushort)2208);
- wtr.Write((uint)ID);
- foreach (PlayerStatistcs entry in Players)
- {
- wtr.Write((uint)entry.PlayerID);
- for (int i = 0; i < 16; i++)
- {
- if (i < entry.Name.Length)
- {
- wtr.Write((byte)entry.Name[i]);
- }
- else
- wtr.Write((byte)0);
- }
- wtr.Write((uint)entry.Avatar);
- wtr.Write((uint)entry.Level);
- wtr.Write((uint)entry.Job);
- wtr.Write((uint)entry.Rank);
- wtr.Write((uint)entry.ArenaPoint);
- wtr.Write((uint)entry.WinsToday);
- wtr.Write((uint)(entry.MatchesToday - entry.WinsToday));
- }
- int packetlength = (int)strm.Length;
- strm.Position = 0;
- wtr.Write((ushort)packetlength);
- strm.Position = strm.Length;
- wtr.Write(ASCIIEncoding.ASCII.GetBytes("TQServer"));
- strm.Position = 0;
- byte[] buf = new byte[strm.Length];
- strm.Read(buf, 0, buf.Length);
- wtr.Close();
- strm.Close();
- return buf;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement