public override IPacket GetEnterFieldPacket() { using (var p = new Packet(SendPacketOperations.UserEnterField)) { p.Encode <int>(ID); p.Encode <byte>(Character.Level); p.Encode <string>(Character.Name); // Guild p.Encode <string>(""); p.Encode <short>(0); p.Encode <byte>(0); p.Encode <short>(0); p.Encode <byte>(0); TemporaryStats.EncodeRemote(p); p.Encode <short>(Character.Job); Character.EncodeLook(p); p.Encode <int>(0); p.Encode <int>(0); p.Encode <int>(0); p.Encode <int>(0); p.Encode <int>(BasicStat.CompletedSetItemID); p.Encode <int>(PortableChairID ?? 0); p.Encode <Point>(Position); p.Encode <byte>(MoveAction); p.Encode <short>(Foothold); p.Encode <byte>(0); Pets.ForEach(pet => { p.Encode <bool>(true); pet.EncodeData(p); }); p.Encode <bool>(false); p.Encode <int>(0); p.Encode <int>(0); p.Encode <int>(0); p.Encode <byte>(0); p.Encode <bool>(false); p.Encode <bool>(false); p.Encode <bool>(false); p.Encode <bool>(false); p.Encode <byte>(0); p.Encode <byte>(0); p.Encode <int>(0); return(p); } }
public void Write(GamePacketWriter writer) { writer.Write(Inventory.Count); Inventory.ForEach(i => i.Write(writer)); for (uint i = 0u; i < Money.Length; i++) { writer.Write(Money[i]); } writer.Write(Xp); writer.Write(RestBonusXp); writer.Write(ItemProficiencies, 32u); writer.Write(ElderPoints); writer.Write(DailyElderPoints); writer.Write(SpecIndex, 3u); writer.Write(BonusPower); writer.Write(UnknownA0); FactionData.Write(writer); writer.Write(Pets.Count); Pets.ForEach(p => p.Write(writer)); writer.Write(InputKeySet); writer.Write(UnknownBC); writer.Write(ActiveCostumeIndex); writer.Write(UnknownC4); writer.Write(UnknownC8); writer.Write((byte)KnownDyes.Count, 6u); KnownDyes.ForEach(a => writer.Write(a)); for (uint i = 0u; i < TradeskillMaterials.Length; i++) { writer.Write(TradeskillMaterials[i]); } writer.Write(GearScore); writer.Write(IsPvpServer); writer.Write(Unknown4DC); writer.Write(CharacterEntitlements.Count); CharacterEntitlements.ForEach(u => u.Write(writer)); }
protected void LoadFile() { if (File.Exists($@"{Environment.CurrentDirectory}\{fileName}")) { XmlSerializer serializer = null; TextReader reader = null; try { serializer = new XmlSerializer(this.GetType()); reader = new StreamReader(fileName); DBDataContext db = (DBDataContext)serializer.Deserialize(reader); this.Species = db.Species; this.Addresses = db.Addresses; this.UserTypes = db.UserTypes; this.Users = db.Users; this.Pets = db.Pets; this.Clients = db.Clients; this.Appointments = db.Appointments; this.Doctors = db.Doctors; this.AppointmentTypes = db.AppointmentTypes; Addresses.ForEach(item => item.Client = Clients.FirstOrDefault(r => r.Id == item.IdClient)); Users.ForEach(item => item.UserType = UserTypes.FirstOrDefault(r => r.Id == item.IdUserType)); Pets.ForEach(item => { item.Specie = Species.FirstOrDefault(r => r.Id == item.IdSpecie); item.Owner = Clients.FirstOrDefault(r => r.Id == item.IdOwner); }); Clients.ForEach(item => { item.Pets = Pets.Where(r => r.IdOwner == item.Id).ToList(); item.Addresses = Addresses.Where(r => r.IdClient == item.Id).ToList(); }); Appointments.ForEach(item => { item.Pet = Pets.FirstOrDefault(r => r.Id == item.IdPet); item.Address = Addresses.FirstOrDefault(r => r.Id == item.IdAddress); item.Doctor = Doctors.FirstOrDefault(r => r.Id == item.IdDoctor); item.Client = Clients.FirstOrDefault(r => r.Id == item.Pet.IdOwner); item.AppointmentType = AppointmentTypes.FirstOrDefault(r => r.Id == item.IdAppointmentType); }); } catch (Exception ex) { throw ex; } finally { if (reader != null) { reader.Close(); } if (serializer != null) { GC.SuppressFinalize(serializer); } } } }