public static Chip Read(BinaryReader reader, int position) { var chip = (Chip)Empty.MemberwiseClone(); chip.Position = position; chip.BaseCode = reader.ReadInt32(); chip.BaseId = reader.ReadInt32(); chip.Type = reader.ReadInt32(); chip.Level = reader.ReadInt32(); chip.Weight = reader.ReadInt32(); chip.SlotA = reader.ReadInt32(); chip.SlotB = reader.ReadInt32(); chip.SlotC = reader.ReadInt32(); for (int i = 0; i < 0x10; i++) { reader.ReadByte(); } if (Chips.TryGetValue(chip.Type, out var knownChip)) { chip.Name = knownChip.Name; chip.BaseCode = knownChip.BaseCode; chip.BaseId = knownChip.BaseId; } else if (chip.Type != Empty.Type) { chip.Name = "???"; chip.BaseCode -= chip.Level; chip.BaseId -= chip.Level; } return(chip); }
public static Item Read(BinaryReader reader, int position) { var item = (Item)Empty.MemberwiseClone(); item.Position = position; item.Id = reader.ReadInt32(); item.Status = (ItemStatus)reader.ReadInt32(); item.Quantity = reader.ReadInt32(); item.Name = Items.TryGetValue(item.Id, out var knownItem) ? knownItem.Name : "???"; return(item); }
public static Weapon Read(BinaryReader reader, int position) { var weapon = (Weapon)Empty.MemberwiseClone(); weapon.Id = reader.ReadInt32(); weapon.Level = reader.ReadInt32(); weapon.NewItem = reader.ReadInt32(); weapon.NewStory = reader.ReadInt32(); weapon.EnemiesDefeated = reader.ReadInt32(); if (position >= 0 && position < Weapons.Count) { if (!Weapons.TryGetValue(weapon.Id, out var originalWeapon)) { originalWeapon = Weapons.Values.ElementAt(position); } if (weapon.Id == originalWeapon.Id) { weapon.Obtained = true; } else { weapon = (Weapon)originalWeapon.MemberwiseClone(); } weapon.Name = originalWeapon.Name; } else { weapon.Name = "???"; } weapon.Position = position; return(weapon); }