EliteBGS/BGS/Cartographics.cs

54 lines
1.6 KiB
C#

using System.Linq;
using System.Text;
using EDJournal;
namespace EliteBGS.BGS {
public class Cartographics : LogEntry {
public Cartographics(MultiSellExplorationDataEntry e) {
Entries.Add(e);
}
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 {
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;
}
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
builder.AppendFormat("Sold {0} worth of Cartographics Data", Credits.FormatCredits(TotalSum));
return builder.ToString();
}
/// <summary>
/// Cartographics only help the controlling faction.
/// </summary>
public override bool OnlyControllingFaction => true;
}
}