using EDPlayerJournal.Entries; namespace EDPlayerJournal.BGS.Parsers; internal class PowerplayParser : ITransactionParserPart { public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) { PowerplayEntry? p = entry as PowerplayEntry; if (p == null) { return; } if (context.LastMerits == null) { context.LastMerits = p.Merits; } context.CurrentMerits = p.Merits; if (context.LastMerits != context.CurrentMerits) { if (!options.IgnorePowerplay) { transactions.Add(new MeritsGained(entry) { Merits = ((long)(context.CurrentMerits - context.LastMerits)), Power = p.Power, System = context.CurrentSystem, Faction = p.Power, }); } } context.LastMerits = context.CurrentMerits; } }