EliteBGS/BGS/SearchAndRescue.cs

60 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EDJournal;
namespace EliteBGS.BGS {
public class SearchAndRescue : LogEntry {
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(LogEntry 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;
}
}