add support for normal selling of cartographic data

This commit is contained in:
Florian Stinglmayr 2022-01-22 13:18:24 +01:00
parent d38fdcac9c
commit c4bdcfeee3
2 changed files with 39 additions and 6 deletions

View File

@ -8,13 +8,34 @@ namespace EliteBGS.BGS {
Entries.Add(e);
}
public int TotalSum {
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 {
return (from entry in Entries
where entry.Is(Events.MultiSellExplorationData)
select (entry as MultiSellExplorationDataEntry).TotalEarnings)
.Sum()
/* 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;
}
}

View File

@ -36,6 +36,7 @@ namespace EliteBGS.BGS {
e.Is(Events.FSDJump) ||
e.Is(Events.Location) ||
e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.SellExplorationData) ||
e.Is(Events.SellMicroResources) ||
e.Is(Events.RedeemVoucher) ||
e.Is(Events.FactionKillBond) ||
@ -139,6 +140,15 @@ namespace EliteBGS.BGS {
/* Mission failed should be collated if they are in the same system/station
*/
collate = true;
} else if (e.Is(Events.SellExplorationData)) {
results.Add(new Cartographics(e as SellExplorationDataEntry) {
System = current_system,
Station = current_station,
Faction = controlling_faction,
});
/* colate single cartographic selling into one */
collate = true;
} else if (e.Is(Events.MultiSellExplorationData)) {
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.
*/
@ -147,6 +157,8 @@ namespace EliteBGS.BGS {
Station = current_station,
Faction = controlling_faction
});
collate = true;
} else if (e.Is(Events.RedeemVoucher)) {
/* Same for selling combat vouchers. Only the current controlling faction matters here.
*/