Esempio n. 1
0
        /// <summary>
        /// LoginServer sent information about the player's characters.
        /// </summary>
        /// <param name="Packet">The packet that was received.</param>
        public static void OnCharacterInfoResponse(PacketStream Packet, NetworkClient Client)
        {
            byte Opcode          = (byte)Packet.ReadByte();
            byte Length          = (byte)Packet.ReadByte();
            byte DecryptedLength = (byte)Packet.ReadByte();

            Packet.DecryptPacket(PlayerAccount.EncKey, new DESCryptoServiceProvider(), DecryptedLength);

            //If the decrypted length == 1, it means that there were 0
            //characters that needed to be updated, or that the user
            //hasn't created any characters on his/her account yet.
            //Since the Packet.Length property is equal to the length
            //of the encrypted data, it cannot be used to get the length
            //of the decrypted data.
            if (DecryptedLength > 1)
            {
                byte       NumCharacters = (byte)Packet.ReadByte();
                List <Sim> FreshSims     = new List <Sim>();

                for (int i = 0; i < NumCharacters; i++)
                {
                    int CharacterID = Packet.ReadInt32();

                    Sim FreshSim = new Sim(Packet.ReadString());
                    FreshSim.CharacterID = CharacterID;
                    FreshSim.Timestamp   = Packet.ReadString();
                    FreshSim.Name        = Packet.ReadString();
                    FreshSim.Sex         = Packet.ReadString();

                    FreshSims.Add(FreshSim);
                }

                NetworkFacade.Avatars = FreshSims;
                CacheSims(FreshSims);
            }

            PacketStream CityInfoRequest = new PacketStream(0x06, 0);

            CityInfoRequest.WriteByte(0x00); //Dummy

            Client.SendEncrypted(0x06, CityInfoRequest.ToArray());
        }
        /// <summary>
        /// LoginServer sent information about the player's characters.
        /// </summary>
        /// <param name="Packet">The packet that was received.</param>
        public static void OnCharacterInfoResponse(PacketStream Packet, NetworkClient Client)
        {
            byte Opcode = (byte)Packet.ReadByte();
            byte Length = (byte)Packet.ReadByte();
            byte DecryptedLength = (byte)Packet.ReadByte();

            Packet.DecryptPacket(PlayerAccount.EncKey, new DESCryptoServiceProvider(), DecryptedLength);

            //If the decrypted length == 1, it means that there were 0
            //characters that needed to be updated, or that the user
            //hasn't created any characters on his/her account yet.
            //Since the Packet.Length property is equal to the length
            //of the encrypted data, it cannot be used to get the length
            //of the decrypted data.
            if (DecryptedLength > 1)
            {
                byte NumCharacters = (byte)Packet.ReadByte();
                List<Sim> FreshSims = new List<Sim>();

                for (int i = 0; i < NumCharacters; i++)
                {
                    int CharacterID = Packet.ReadInt32();

                    Sim FreshSim = new Sim(Packet.ReadString());
                    FreshSim.CharacterID = CharacterID;
                    FreshSim.Timestamp = Packet.ReadString();
                    FreshSim.Name = Packet.ReadString();
                    FreshSim.Sex = Packet.ReadString();

                    FreshSims.Add(FreshSim);
                }

                NetworkFacade.Avatars = FreshSims;
                CacheSims(FreshSims);
            }

            PacketStream CityInfoRequest = new PacketStream(0x06, 0);
            CityInfoRequest.WriteByte(0x00); //Dummy

            Client.SendEncrypted(0x06, CityInfoRequest.ToArray());
        }
Esempio n. 3
0
        public static void OnCityInfoResponse(PacketStream Packet)
        {
            byte Opcode          = (byte)Packet.ReadByte();
            byte Length          = (byte)Packet.ReadByte();
            byte DecryptedLength = (byte)Packet.ReadByte();

            Packet.DecryptPacket(PlayerAccount.EncKey, new DESCryptoServiceProvider(), DecryptedLength);

            byte NumCities = (byte)Packet.ReadByte();

            for (int i = 0; i < NumCities; i++)
            {
                string         Name        = Packet.ReadString();
                string         Description = Packet.ReadString();
                string         IP          = Packet.ReadString();
                int            Port        = Packet.ReadInt32();
                CityInfoStatus Status      = (CityInfoStatus)Packet.ReadByte();
                ulong          Thumbnail   = Packet.ReadUInt64();
                string         UUID        = Packet.ReadString();

                CityInfo Info = new CityInfo(Name, Description, Thumbnail, UUID, 0, IP, Port);
                NetworkFacade.Cities.Add(Info);
            }
        }
        public static void OnCityInfoResponse(PacketStream Packet)
        {
            byte Opcode = (byte)Packet.ReadByte();
            byte Length = (byte)Packet.ReadByte();
            byte DecryptedLength = (byte)Packet.ReadByte();

            Packet.DecryptPacket(PlayerAccount.EncKey, new DESCryptoServiceProvider(), DecryptedLength);

            byte NumCities = (byte)Packet.ReadByte();

            for (int i = 0; i < NumCities; i++)
            {
                string Name = Packet.ReadString();
                string Description = Packet.ReadString();
                string IP = Packet.ReadString();
                int Port = Packet.ReadInt32();
                CityInfoStatus Status = (CityInfoStatus)Packet.ReadByte();
                ulong Thumbnail = Packet.ReadUInt64();
                string UUID = Packet.ReadString();

                CityInfo Info = new CityInfo(Name, Description, Thumbnail, UUID, 0, IP, Port);
                NetworkFacade.Cities.Add(Info);
            }
        }