using System.Text; using System.Linq; using EDJournal; namespace EliteBGS.BGS { public class SellCargo : LogEntry { public int Profit { get; set; } public override string ToString() { StringBuilder builder = new StringBuilder(); var sold = Entries.OfType().ToArray(); if (sold == null || sold.Length == 0) { return builder.ToString(); } foreach (MarketSellEntry sell in sold) { builder.AppendFormat("Sold {0} {1} to the {2}", sell.Count, sell.Type, sell.BlackMarket ? "Black Market" : "Commodity Market" ); if (Profit != 0) { builder.AppendFormat(" ({0} {1})", Credits.FormatCredits(Profit), Profit < 0 ? "loss" : "profit" ); } } return builder.ToString().Trim(); } /// /// Selling resources to a market only helps the controlling faction /// public override bool OnlyControllingFaction => true; } }