Archived
1
0
This repository has been archived on 2021-10-19. You can view files and clone it, but cannot push or open issues or pull requests.
nonabgs/BGS/Vouchers.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2021-07-09 11:03:30 +02:00
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();
2021-08-01 15:01:33 +02:00
builder.AppendFormat("{0} Vouchers: {1}", Type, Credits.FormatCredits(TotalSum));
2021-07-09 11:03:30 +02:00
return builder.ToString();
}
/// <summary>
/// Vouchers only help the controlling faction
/// </summary>
public override bool OnlyControllingFaction => true;
}
}