collate vouchers together
This commit is contained in:
parent
34934c82a6
commit
32e5898b02
@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Schema;
|
||||
using EDPlayerJournal;
|
||||
using EDPlayerJournal.BGS;
|
||||
|
||||
@ -8,10 +9,10 @@ namespace EliteBGS.LogGenerator;
|
||||
public class VoucherFormat : LogFormatter {
|
||||
public string GenerateLog(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var missions = objective.UITransactions
|
||||
.Where(x => x.IsEnabled)
|
||||
.Select(x => x.Transaction)
|
||||
.OfType<Vouchers>()
|
||||
var missions = objective
|
||||
.EnabledOfType<Vouchers>()
|
||||
.GroupBy(x => x.Type)
|
||||
.ToDictionary(x => x.Key, x => x.ToList())
|
||||
;
|
||||
|
||||
if (missions == null || missions.Count() <= 0) {
|
||||
@ -19,7 +20,8 @@ public class VoucherFormat : LogFormatter {
|
||||
}
|
||||
|
||||
foreach (var m in missions) {
|
||||
builder.AppendFormat("Handed in {0} vouchers: {1}\n", m.Type, Credits.FormatCredits(m.TotalSum));
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user