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