From c4bdcfeee3df6c52872c6f980fed236b1e38b154 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sat, 22 Jan 2022 13:18:24 +0100 Subject: [PATCH] add support for normal selling of cartographic data --- BGS/Cartographics.cs | 33 +++++++++++++++++++++++++++------ BGS/Report.cs | 12 ++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/BGS/Cartographics.cs b/BGS/Cartographics.cs index a5ac29a..41217cd 100644 --- a/BGS/Cartographics.cs +++ b/BGS/Cartographics.cs @@ -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() + .Sum(x => x.TotalEarnings) + + + Entries.OfType() + .Sum(x => x.TotalEarnings) + ; + return total; } } diff --git a/BGS/Report.cs b/BGS/Report.cs index d9712c9..f42676f 100644 --- a/BGS/Report.cs +++ b/BGS/Report.cs @@ -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. */