fix cartographics value, use Total instead of TotalEarnings

This commit is contained in:
Florian Stinglmayr 2024-09-17 18:49:18 +02:00
parent 916afb2348
commit 9f013bed38
3 changed files with 29 additions and 5 deletions

View File

@ -35,10 +35,10 @@ public class Cartographics : Transaction {
/* add multi sell and normal ones together */ /* add multi sell and normal ones together */
long total = long total =
Entries.OfType<MultiSellExplorationDataEntry>() Entries.OfType<MultiSellExplorationDataEntry>()
.Sum(x => x.TotalEarnings) .Sum(x => x.Total)
+ +
Entries.OfType<SellExplorationDataEntry>() Entries.OfType<SellExplorationDataEntry>()
.Sum(x => x.TotalEarnings) .Sum(x => x.Total)
; ;
return total; return total;
} }

View File

@ -1,8 +1,23 @@
namespace EDPlayerJournal.Entries; namespace EDPlayerJournal.Entries;
public class MultiSellExplorationDataEntry : Entry { public class MultiSellExplorationDataEntry : Entry {
protected override void Initialise() { protected override void Initialise() {
TotalEarnings = (JSON.Value<int?>("TotalEarnings") ?? 0); TotalEarnings = JSON.Value<long?>("TotalEarnings") ?? 0;
BaseValue = JSON.Value<long?>("BaseValue") ?? 0;
Bonus = JSON.Value<long?>("Bonus") ?? 0;
} }
public int TotalEarnings { get; set; } = 0; public long Total {
get { return BaseValue + Bonus; }
}
public long BaseValue { get; set; } = 0;
public long Bonus { get; set; } = 0;
/// <summary>
/// Total Earnings are the actual earnings without bonus. So this
/// value is BaseValue minus any percent a crew pilot takes.
/// </summary>
public long TotalEarnings { get; set; } = 0;
} }

View File

@ -6,8 +6,17 @@ namespace EDPlayerJournal.Entries;
public class SellExplorationDataEntry : Entry { public class SellExplorationDataEntry : Entry {
public long BaseValue { get; set; } public long BaseValue { get; set; }
public long Bonus { get; set; } public long Bonus { get; set; }
/// <summary>
/// Total Earnings are the actual earnings without bonus. So this
/// value is BaseValue minus any percent a crew pilot takes.
/// </summary>
public long TotalEarnings { get; set; } public long TotalEarnings { get; set; }
public long Total {
get { return BaseValue + Bonus; }
}
public List<string> Systems { get; set; } = new List<string>(); public List<string> Systems { get; set; } = new List<string>();
public List<string> Discovered { get; set; } = new List<string>(); public List<string> Discovered { get; set; } = new List<string>();