Пример #1
0
        public static void OnCityInfoResponse(ProcessedPacket Packet)
        {
            byte NumCities = (byte)Packet.ReadByte();

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

                    CityInfo Info = new CityInfo(Name, Description, Thumbnail, UUID, Map, IP, Port);
                    Info.Online = true;
                    Info.Status = Status;
                    NetworkFacade.Cities.Add(Info);
                }
            }
        }
        /// <summary>
        /// LoginServer sent information about the player's characters.
        /// </summary>
        /// <param name="Packet">The packet that was received.</param>
        public static void OnCharacterInfoResponse(ProcessedPacket Packet, NetworkClient Client)
        {
            //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 (Packet.DecryptedLength > 1)
            {
                byte         NumCharacters = (byte)Packet.ReadByte();
                List <UISim> FreshSims     = new List <UISim>();

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

                    UISim FreshSim = new UISim(Packet.ReadString(), false);
                    FreshSim.CharacterID       = CharacterID;
                    FreshSim.Timestamp         = Packet.ReadString();
                    FreshSim.Name              = Packet.ReadString();
                    FreshSim.Sex               = Packet.ReadString();
                    FreshSim.Description       = Packet.ReadString();
                    FreshSim.HeadOutfitID      = Packet.ReadUInt64();
                    FreshSim.BodyOutfitID      = Packet.ReadUInt64();
                    FreshSim.Avatar.Appearance = (AppearanceType)Packet.ReadByte();
                    FreshSim.ResidingCity      = new CityInfo(Packet.ReadString(), "", Packet.ReadUInt64(), Packet.ReadString(),
                                                              Packet.ReadUInt64(), Packet.ReadString(), Packet.ReadInt32());

                    FreshSims.Add(FreshSim);
                }

                if (NumCharacters < 3)
                {
                    FreshSims = Cache.LoadCachedSims(FreshSims);
                }
                NetworkFacade.Avatars = FreshSims;
                Cache.CacheSims(FreshSims);
            }
            else
            {
                NetworkFacade.Avatars = Cache.LoadAllSims();
            }

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

            CityInfoRequest.WriteByte(0x00); //Dummy

            Client.SendEncrypted((byte)PacketType.CITY_LIST, CityInfoRequest.ToArray());
        }