From 87314d0258b8781a197df027649b69f027ff1d61 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Wed, 19 Apr 2023 09:19:37 +0200 Subject: [PATCH] we still want profit info, just not BGS info --- EDPlayerJournal/BGS/TransactionParser.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 4ff0a6f..c9ad6f7 100644 --- a/EDPlayerJournal/BGS/TransactionParser.cs +++ b/EDPlayerJournal/BGS/TransactionParser.cs @@ -635,15 +635,22 @@ internal class SearchAndRescueParser : TransactionParserPart { internal class MarketBuyParser : TransactionParserPart { public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) { - if (options.IgnoreMarketBuy) { - return; - } - MarketBuyEntry? entry = e as MarketBuyEntry; if (entry == null) { throw new NotImplementedException(); } + context.BoughtCargo(entry.Type, entry.BuyPrice); + + // We still want the information on buy price for profit, + // but if the option is on, we don't care for parsing it + // further. + // TODO: might be wise to split this parser into two; one for + // determining profit, the other for the BGS information + if (options.IgnoreMarketBuy) { + return; + } + if (context.StationOwner == null) { transactions.AddIncomplete( new OrganicData(), @@ -652,8 +659,6 @@ internal class MarketBuyParser : TransactionParserPart { return; } - context.BoughtCargo(entry.Type, entry.BuyPrice); - transactions.Add(new BuyCargo(entry) { System = context.CurrentSystem, Station = context.CurrentStation,