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); 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 { get {
return (from entry in Entries /* add multi sell and normal ones together */
where entry.Is(Events.MultiSellExplorationData) long total =
select (entry as MultiSellExplorationDataEntry).TotalEarnings) Entries.OfType<MultiSellExplorationDataEntry>()
.Sum() .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.FSDJump) ||
e.Is(Events.Location) || e.Is(Events.Location) ||
e.Is(Events.MultiSellExplorationData) || e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.SellExplorationData) ||
e.Is(Events.SellMicroResources) || e.Is(Events.SellMicroResources) ||
e.Is(Events.RedeemVoucher) || e.Is(Events.RedeemVoucher) ||
e.Is(Events.FactionKillBond) || e.Is(Events.FactionKillBond) ||
@ -139,6 +140,15 @@ namespace EliteBGS.BGS {
/* Mission failed should be collated if they are in the same system/station /* Mission failed should be collated if they are in the same system/station
*/ */
collate = true; 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)) { } else if (e.Is(Events.MultiSellExplorationData)) {
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters. /* 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, Station = current_station,
Faction = controlling_faction Faction = controlling_faction
}); });
collate = true;
} else if (e.Is(Events.RedeemVoucher)) { } else if (e.Is(Events.RedeemVoucher)) {
/* Same for selling combat vouchers. Only the current controlling faction matters here. /* Same for selling combat vouchers. Only the current controlling faction matters here.
*/ */