public static void OnSimulationState(NetworkClient Client, PacketStream Packet, LotScreen Lot) { List <SimulationObject> SimObjects = new List <SimulationObject>(); byte Opcode = (byte)Packet.ReadByte(); byte NumTicks = (byte)Packet.ReadByte(); int NumObjects = Packet.ReadInt32(); BinaryFormatter BinFormatter = new BinaryFormatter(); for (int i = 0; i < NumObjects; i++) { SimulationObject SimObject = (SimulationObject)BinFormatter.Deserialize(Packet); SimObjects.Add(SimObject); } Lot.UpdateSimulationState(NumTicks, SimObjects); }
public static void OnSimulationState(NetworkClient Client, PacketStream Packet, LotScreen Lot) { List<SimulationObject> SimObjects = new List<SimulationObject>(); byte Opcode = (byte)Packet.ReadByte(); byte NumTicks = (byte)Packet.ReadByte(); int NumObjects = Packet.ReadInt32(); BinaryFormatter BinFormatter = new BinaryFormatter(); for (int i = 0; i < NumObjects; i++) { SimulationObject SimObject = (SimulationObject)BinFormatter.Deserialize(Packet); SimObjects.Add(SimObject); } Lot.UpdateSimulationState(NumTicks, SimObjects); }
/// <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()); }
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); } }