add format for merits gained in log
This commit is contained in:
parent
d9dd2cc524
commit
88b770e5ec
@ -21,6 +21,7 @@ public class DiscordLogGenerator {
|
||||
new CargoSoldFormatter(),
|
||||
new VistaGenomicsFormat(),
|
||||
new SearchAndRescueFormat(),
|
||||
new MeritsGainedFormat(),
|
||||
};
|
||||
|
||||
protected virtual string GetToolVersion() {
|
||||
|
50
EliteBGS/LogGenerator/MeritsGainedFormat.cs
Normal file
50
EliteBGS/LogGenerator/MeritsGainedFormat.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EDPlayerJournal;
|
||||
using EDPlayerJournal.BGS;
|
||||
|
||||
namespace EliteBGS.LogGenerator;
|
||||
|
||||
public class MeritsGainedFormat : LogFormatter {
|
||||
public string GenerateLog(Objective objective) {
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var merits = objective
|
||||
.EnabledOfType<MeritsGained>()
|
||||
.GroupBy(x => x.Power)
|
||||
.ToDictionary(x => x.Key, x => x.Sum(x => x.Merits))
|
||||
;
|
||||
|
||||
if (merits == null || merits.Count == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach (var merit in merits) {
|
||||
builder.AppendFormat("{0} merits gained for {1}\n", merit.Value, merit.Key);
|
||||
}
|
||||
|
||||
return builder.ToString().Trim();
|
||||
}
|
||||
|
||||
public string GenerateSummary(Objective objective) {
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var merits = objective
|
||||
.EnabledOfType<MeritsGained>()
|
||||
.GroupBy(x => x.Power)
|
||||
.ToDictionary(x => x.Key, x => x.Sum(x => x.Merits))
|
||||
;
|
||||
|
||||
if (merits == null || merits.Count == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach (var merit in merits) {
|
||||
builder.AppendFormat("MRT: {0}, {1}; ", merit.Key, merit.Value);
|
||||
}
|
||||
|
||||
return builder.ToString().Trim();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user