EliteBGS/BGS/Cartographics.cs

54 lines
1.6 KiB
C#
Raw Permalink Normal View History

2021-08-25 16:36:57 +02:00
using System.Linq;
2021-07-09 11:03:30 +02:00
using System.Text;
2021-08-25 16:36:57 +02:00
using EDJournal;
2021-07-09 11:03:30 +02:00
2021-11-10 21:24:39 +01:00
namespace EliteBGS.BGS {
2021-07-09 11:03:30 +02:00
public class Cartographics : LogEntry {
public Cartographics(MultiSellExplorationDataEntry e) {
2021-11-10 21:24:39 +01:00
Entries.Add(e);
2021-07-09 11:03:30 +02:00
}
public Cartographics(SellExplorationDataEntry e) {
Entries.Add(e);
}
public override int CompareTo(LogEntry other) {
if (other == null || other.GetType() != typeof(Cartographics)) {
return -1;
}
Cartographics b = other as Cartographics;
if (b.System == System && b.Faction == Faction && b.Station == Station) {
return 0;
}
return -1;
}
public long TotalSum {
2021-07-09 11:03:30 +02:00
get {
/* add multi sell and normal ones together */
long total =
Entries.OfType<MultiSellExplorationDataEntry>()
.Sum(x => x.TotalEarnings)
+
Entries.OfType<SellExplorationDataEntry>()
.Sum(x => x.TotalEarnings)
;
return total;
2021-07-09 11:03:30 +02:00
}
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
2021-08-01 15:01:33 +02:00
builder.AppendFormat("Sold {0} worth of Cartographics Data", Credits.FormatCredits(TotalSum));
2021-07-09 11:03:30 +02:00
return builder.ToString();
}
/// <summary>
/// Cartographics only help the controlling faction.
/// </summary>
public override bool OnlyControllingFaction => true;
}
}