using Newtonsoft.Json.Linq; namespace EDPlayerJournal.Entries; public class BioData { public string? Genus { get; set; } public string? GenusLocalised { get; set; } public string? Species { get; set; } public string? SpeciesLocalised { get; set; } public long Value { get; set; } = 0; public long Bonus { get; set; } = 0; public long TotalValue { get { return Value + Bonus; } } } public class SellOrganicDataEntry : Entry { public long MarketID { get; set; } public List BioData { get; } = new(); protected override void Initialise() { MarketID = JSON.Value("MarketID") ?? 0; var biodata = JSON.Value("BioData"); if (biodata == null) { return; } foreach (JObject item in biodata) { BioData data = new BioData { Bonus = item.Value("Bonus") ?? 0, Value = item.Value("Value") ?? 0, Species = item.Value("Species"), Genus = item.Value("Genus"), GenusLocalised = item.Value("Genus_Localised"), SpeciesLocalised = item.Value("Species_Localised") }; BioData.Add(data); } } public long TotalValue { get { return BioData.Sum(x => x.TotalValue); } } }