Example #1
0
        public static BasePacket Create(byte[] data, ChannelID channel)
        {
            switch (channel)
            {
            case ChannelID.Default:
                return(KeyCheckPacket.Create(data));

            case ChannelID.ClientToServer:
            case ChannelID.SynchClock:
            case ChannelID.Broadcast:
            case ChannelID.BroadcastUnreliable:
                return(GamePacket.Create(data));

            case ChannelID.Chat: {
                var packet = new Chat();
                packet.Read(data);
                return(packet);
            }

            case ChannelID.QuickChat: {
                var packet = new QuickChat();
                packet.Read(data);
                return(packet);
            }

            case ChannelID.LoadingScreen:
                return(LoadScreenPacket.Create(data));

            default:
                throw new IOException("Unknown packet channel.");
            }
        }
Example #2
0
        public static KeyCheckPacket Create(byte[] data)
        {
            var packet = new KeyCheckPacket();

            packet.Read(data);
            return(packet);
        }
Example #3
0
        public BasePacket Create(PacketReader reader, ChannelID channel)
        {
            switch (channel)
            {
            case ChannelID.Default:
                return(KeyCheckPacket.Create(reader));

            case ChannelID.ClientToServer:
            case ChannelID.SynchClock:
            case ChannelID.Broadcast:
            case ChannelID.BroadcastUnreliable:
                return(GamePacket.Create(reader));

            case ChannelID.Chat:
                reader.ReadPad(0);
                return(Chat.CreateBody(reader));

            case ChannelID.QuickChat:
                reader.ReadPad(0);
                return(QuickChat.CreateBody(reader));

            case ChannelID.LoadingScreen:
                return(PayloadPacket.Create(reader));

            default:
                return(null);
            }
        }
        public static KeyCheckPacket Create(PacketReader reader)
        {
            var result = new KeyCheckPacket();

            result.ID = reader.ReadByte();
            reader.ReadPad(3);
            result.ClientID      = reader.ReadClientID();
            result.PlayerID      = reader.ReadPlayerID();
            result.VersionNumber = reader.ReadUInt32();
            result.CheckSum      = reader.ReadUInt64();
            return(result);
        }