EDBGS/EDPlayerJournal/BGS/OrganicData.cs

42 lines
1.0 KiB
C#

using EDPlayerJournal.Entries;
namespace EDPlayerJournal.BGS;
public class OrganicData : Transaction {
public OrganicData(SellOrganicDataEntry e) {
Entries.Add(e);
}
public long TotalValue {
get {
return Entries.OfType<SellOrganicDataEntry>().Sum(x => x.TotalValue);
}
}
public override int CompareTo(Transaction? other) {
if (other == null || other.GetType() != typeof(OrganicData)) {
return -1;
}
if (other?.Faction == Faction &&
other?.System == System &&
other?.Station == Station) {
return 0;
}
return -1;
}
public override string ToString() {
return string.Format("Sold {0} worth of organic data to Vista Genomics",
Credits.FormatCredits(TotalValue)
);
}
/* Selling organic data only helps the controlling faction, just like
* selling cartographic data.
*/
public override bool OnlyControllingFaction => true;
}