using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NonaBGS.Journal; namespace NonaBGS.BGS { public class Vouchers : LogEntry { public int TotalSum { get { return Entries .Where(x => x.GetType() == typeof(RedeemVoucherEntry)) .Sum(x => (x as RedeemVoucherEntry).Amount) ; } } public string Type { get { string v = Entries .Where(x => x.GetType() == typeof(RedeemVoucherEntry)) .GroupBy(x => (x as RedeemVoucherEntry).Type) .Select(x => x.Key) .First(); return v; } } public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendFormat("{0} Vouchers: {1} CR", TotalSum, Type); return builder.ToString(); } /// /// Vouchers only help the controlling faction /// public override bool OnlyControllingFaction => true; } }