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()); }
/// <summary> /// Received CharacterCreation packet from LoginServer. /// </summary> /// <returns>The result of the character creation.</returns> public static CharacterCreationStatus OnCharacterCreationProgress(NetworkClient Client, ProcessedPacket Packet) { CharacterCreationStatus CCStatus = (CharacterCreationStatus)Packet.ReadByte(); if (CCStatus == CharacterCreationStatus.Success) { Guid CharacterGUID = new Guid(); CharacterGUID = new Guid(Packet.ReadPascalString()); PlayerAccount.CityToken = Packet.ReadPascalString(); PlayerAccount.CurrentlyActiveSim.AssignGUID(CharacterGUID.ToString()); } return(CCStatus); }
/// <summary> /// Occurs when the client was not authenticated by the loginserver. /// Called by UILoginDialog.cs. /// </summary> /// <param name="Client">The client that received the packet.</param> /// <param name="Packet">The packet that was received.</param> public static void OnLoginFailResponse(ref NetworkClient Client, ProcessedPacket Packet) { EventObject Event; switch (Packet.ReadByte()) { case 0x01: Event = new EventObject(EventCodes.BAD_USERNAME); EventSink.RegisterEvent(Event); break; case 0x02: Event = new EventObject(EventCodes.BAD_PASSWORD); EventSink.RegisterEvent(Event); break; } Client.Disconnect(); }
/// <summary> /// Received from the CityServer in response to a CITY_TOKEN packet. /// </summary> public static CityTransferStatus OnCityTokenResponse(NetworkClient Client, ProcessedPacket Packet) { CityTransferStatus Status = (CityTransferStatus)Packet.ReadByte(); return(Status); }
/// <summary> /// Received CharacterCreation packet from CityServer. /// </summary> /// <returns>The result of the character creation.</returns> public static CharacterCreationStatus OnCharacterCreationStatus(NetworkClient Client, ProcessedPacket Packet) { CharacterCreationStatus CCStatus = (CharacterCreationStatus)Packet.ReadByte(); return(CCStatus); }