45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
|
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();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Vouchers only help the controlling faction
|
|||
|
/// </summary>
|
|||
|
public override bool OnlyControllingFaction => true;
|
|||
|
}
|
|||
|
}
|