EDBGS/EliteBGS/LogGenerator/VoucherFormat.cs

30 lines
843 B
C#

using System.Linq;
using System.Text;
using System.Xml.Schema;
using EDPlayerJournal;
using EDPlayerJournal.BGS;
namespace EliteBGS.LogGenerator;
public class VoucherFormat : LogFormatter {
public string GenerateLog(Objective objective) {
StringBuilder builder = new StringBuilder();
var missions = objective
.EnabledOfType<Vouchers>()
.GroupBy(x => x.Type)
.ToDictionary(x => x.Key, x => x.ToList())
;
if (missions == null || missions.Count() <= 0) {
return "";
}
foreach (var m in missions) {
ulong total = (ulong)m.Value.Sum(x => (decimal)x.TotalSum);
builder.AppendFormat("Handed in {0} vouchers: {1}\n", m.Key, Credits.FormatCredits(total));
}
return builder.ToString().Trim();
}
}