39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using EDPlayerJournal.Entries;
|
|
|
|
namespace EDPlayerJournal.BGS;
|
|
|
|
internal class SellOrganicDataParser : ITransactionParserPart {
|
|
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
|
// If exo biology is ignored, simply do nothing
|
|
if (options.IgnoreExoBiology) {
|
|
return;
|
|
}
|
|
|
|
SellOrganicDataEntry? entry = e as SellOrganicDataEntry;
|
|
if (entry == null) {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
if (context.StationOwner == null) {
|
|
transactions.AddIncomplete(
|
|
new OrganicData(),
|
|
"Could not discern the station owner for organic data sell.",
|
|
e);
|
|
return;
|
|
}
|
|
|
|
// Ignore if its a fleet carrier faction.
|
|
if (string.Compare(context.StationOwner, Factions.FleetCarrier, StringComparison.OrdinalIgnoreCase) == 0 &&
|
|
options.IgnoreFleetCarrierFaction) {
|
|
return;
|
|
}
|
|
|
|
transactions.Add(new OrganicData(entry) {
|
|
System = context.CurrentSystem,
|
|
Station = context.CurrentStation,
|
|
Faction = context.StationOwner,
|
|
IsLegacy = context.IsLegacy,
|
|
});
|
|
}
|
|
}
|