2022-11-26 16:27:51 +01:00
|
|
|
|
using EDPlayerJournal;
|
|
|
|
|
using EDPlayerJournal.BGS;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2022-11-24 19:38:19 +01:00
|
|
|
|
|
|
|
|
|
namespace EliteBGS.LogGenerator;
|
|
|
|
|
|
2022-11-26 16:27:51 +01:00
|
|
|
|
class CombatZoneFormat : LogFormatter {
|
|
|
|
|
public string GenerateLog(Objective objective) {
|
|
|
|
|
var logs = objective
|
|
|
|
|
.EnabledOfType<CombatZone>()
|
2023-02-26 21:57:24 +01:00
|
|
|
|
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
|
2022-11-26 16:27:51 +01:00
|
|
|
|
.GroupBy(x => new { x.Type, x.Grade })
|
|
|
|
|
.ToDictionary(x => x.Key, x => x.ToList())
|
|
|
|
|
;
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (logs == null || logs.Count() <= 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var log in logs) {
|
2022-11-28 20:06:14 +01:00
|
|
|
|
int optionals = log.Value
|
|
|
|
|
.Sum(x => x.OptionalObjectivesCompleted)
|
|
|
|
|
;
|
2022-12-07 22:43:24 +01:00
|
|
|
|
if (!string.IsNullOrEmpty(log.Key.Grade)) {
|
|
|
|
|
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
|
|
|
|
|
log.Value.Count,
|
|
|
|
|
log.Key.Grade,
|
|
|
|
|
log.Key.Type
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
builder.AppendFormat("Won {0}x {1} Combat Zone(s)",
|
|
|
|
|
log.Value.Count,
|
|
|
|
|
log.Key.Type
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-11-28 20:06:14 +01:00
|
|
|
|
|
|
|
|
|
if (optionals > 0) {
|
|
|
|
|
builder.AppendFormat(" (with {0} optional objectives)", optionals);
|
|
|
|
|
}
|
|
|
|
|
builder.Append("\n");
|
2022-11-26 16:27:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString().Trim();
|
|
|
|
|
}
|
2023-02-23 21:44:55 +01:00
|
|
|
|
|
|
|
|
|
public string GenerateSummary(Objective objective) {
|
|
|
|
|
var logs = objective
|
|
|
|
|
.EnabledOfType<CombatZone>()
|
2023-02-26 21:57:24 +01:00
|
|
|
|
.OrderBy(x => (CombatZones.DifficultyRank(x.Grade) ?? 0))
|
2023-02-23 21:44:55 +01:00
|
|
|
|
.GroupBy(x => new { x.Type, x.Grade })
|
|
|
|
|
.ToDictionary(x => x.Key, x => x.ToList())
|
|
|
|
|
;
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (logs == null || logs.Count() <= 0) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var log in logs) {
|
|
|
|
|
int optionals = log.Value
|
|
|
|
|
.Sum(x => x.OptionalObjectivesCompleted)
|
|
|
|
|
;
|
|
|
|
|
if (builder.Length > 0) {
|
|
|
|
|
builder.Append(", ");
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(log.Key.Grade)) {
|
|
|
|
|
string grade = log.Key.Grade.Substring(0, 1);
|
|
|
|
|
if (log.Key.Grade == CombatZones.DifficultyVeryHigh) {
|
|
|
|
|
grade = "VH";
|
|
|
|
|
}
|
|
|
|
|
builder.AppendFormat("CZ: {0}x{1}{2}",
|
|
|
|
|
log.Value.Count,
|
2023-02-26 21:57:45 +01:00
|
|
|
|
grade,
|
2023-02-23 21:44:55 +01:00
|
|
|
|
log.Key.Type.Substring(0, 1)
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
builder.AppendFormat("CZ: {0}x?{1}",
|
|
|
|
|
log.Value.Count,
|
|
|
|
|
log.Key.Type.Substring(0, 1)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (optionals > 0) {
|
|
|
|
|
builder.AppendFormat("+ {0} OPTS", optionals);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder.ToString().Trim();
|
|
|
|
|
}
|
2022-11-24 19:38:19 +01:00
|
|
|
|
}
|