54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using EDPlayerJournal.Entries;
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
public class SearchAndRescue : Transaction {
|
|
public SearchAndRescue (SearchAndRescueEntry e) {
|
|
Entries.Add(e);
|
|
}
|
|
|
|
public long Count {
|
|
get {
|
|
return Entries.OfType<SearchAndRescueEntry>().Sum(x => x.Count);
|
|
}
|
|
}
|
|
|
|
public long Reward {
|
|
get {
|
|
return Entries.OfType<SearchAndRescueEntry>().Sum(x => x.Reward);
|
|
}
|
|
}
|
|
|
|
public string? NameLocalised {
|
|
get {
|
|
return Entries.OfType<SearchAndRescueEntry>().First().NameLocalised;
|
|
}
|
|
}
|
|
|
|
public override int CompareTo(Transaction? o) {
|
|
if (o == null || o.GetType() != typeof(SearchAndRescue)) {
|
|
return -1;
|
|
}
|
|
|
|
SearchAndRescue? other = o as SearchAndRescue;
|
|
|
|
if (other?.System == System &&
|
|
other?.Station == Station &&
|
|
other?.Faction == Faction &&
|
|
other?.NameLocalised == NameLocalised) {
|
|
return 0;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
public override string ToString() {
|
|
return string.Format("Contributed {0} {1} to Search and Rescue ({2})",
|
|
Count,
|
|
NameLocalised,
|
|
Credits.FormatCredits(Reward)
|
|
);
|
|
}
|
|
|
|
public override bool OnlyControllingFaction => true;
|
|
}
|