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 {
string v = Entries
.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}", Type, Credits.FormatCredits(TotalSum));
return builder.ToString();
/// <summary>
/// Vouchers only help the controlling faction
/// </summary>
public override bool OnlyControllingFaction => true;