2021-09-28 14:41:09 +02:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using EDJournal;
|
|
|
|
|
|
2021-11-10 21:24:39 +01:00
|
|
|
|
namespace EliteBGS.BGS {
|
2021-09-28 14:41:09 +02:00
|
|
|
|
public class SellCargo : LogEntry {
|
2022-01-12 17:29:58 +01:00
|
|
|
|
public int Profit { get; set; }
|
2021-09-28 14:41:09 +02:00
|
|
|
|
public override string ToString() {
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
var sold = Entries.OfType<MarketSellEntry>().ToArray();
|
|
|
|
|
|
|
|
|
|
if (sold == null || sold.Length == 0) {
|
|
|
|
|
return builder.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (MarketSellEntry sell in sold) {
|
2022-01-12 17:29:58 +01:00
|
|
|
|
builder.AppendFormat("Sold {0} {1} to the {2}",
|
2021-09-28 14:41:09 +02:00
|
|
|
|
sell.Count,
|
|
|
|
|
sell.Type,
|
|
|
|
|
sell.BlackMarket ? "Black Market" : "Commodity Market"
|
|
|
|
|
);
|
2022-01-12 17:29:58 +01:00
|
|
|
|
|
|
|
|
|
if (Profit != 0) {
|
|
|
|
|
builder.AppendFormat(" ({0} {1})",
|
|
|
|
|
Credits.FormatCredits(Profit),
|
|
|
|
|
Profit < 0 ? "loss" : "profit"
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-09-28 14:41:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Selling resources to a market only helps the controlling faction
|
|
|
|
|
/// </summary>
|
|
|
|
|
public override bool OnlyControllingFaction => true;
|
|
|
|
|
}
|
|
|
|
|
}
|