2022-11-24 19:38:19 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using EDPlayerJournal;
|
|
|
|
|
using EDPlayerJournal.BGS;
|
|
|
|
|
|
|
|
|
|
namespace EliteBGS.LogGenerator;
|
|
|
|
|
|
|
|
|
|
public class VoucherFormat : LogFormatter {
|
|
|
|
|
public string GenerateLog(Objective objective) {
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
2022-11-25 17:56:43 +01:00
|
|
|
|
var missions = objective
|
|
|
|
|
.EnabledOfType<Vouchers>()
|
|
|
|
|
.GroupBy(x => x.Type)
|
|
|
|
|
.ToDictionary(x => x.Key, x => x.ToList())
|
2022-11-24 19:38:19 +01:00
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
if (missions == null || missions.Count() <= 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var m in missions) {
|
2022-11-25 17:56:43 +01:00
|
|
|
|
ulong total = (ulong)m.Value.Sum(x => (decimal)x.TotalSum);
|
|
|
|
|
builder.AppendFormat("Handed in {0} vouchers: {1}\n", m.Key, Credits.FormatCredits(total));
|
2022-11-24 19:38:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString().Trim();
|
|
|
|
|
}
|
2023-02-23 21:44:55 +01:00
|
|
|
|
|
|
|
|
|
public string GenerateSummary(Objective objective) {
|
|
|
|
|
long bounties = objective
|
|
|
|
|
.EnabledOfType<Vouchers>()
|
|
|
|
|
.Where(x => x.Type == "Bounty")
|
|
|
|
|
.Sum(x => x.TotalSum)
|
|
|
|
|
;
|
|
|
|
|
long bonds = objective
|
|
|
|
|
.EnabledOfType<Vouchers>()
|
|
|
|
|
.Where(x => x.Type == "Combat Bond")
|
|
|
|
|
.Sum(x => x.TotalSum)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new();
|
|
|
|
|
|
|
|
|
|
if (bounties > 0) {
|
|
|
|
|
sb.AppendFormat("Bounties: {0}", Credits.FormatMillions(bounties));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bonds > 0) {
|
|
|
|
|
if (sb.Length > 0) {
|
|
|
|
|
sb.Append(", ");
|
|
|
|
|
}
|
|
|
|
|
sb.AppendFormat("Bonds: {0}", Credits.FormatMillions(bonds));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
2022-11-24 19:38:19 +01:00
|
|
|
|
}
|