Compare commits
5 Commits
123fa15884
...
6f9d3a64ff
Author | SHA1 | Date | |
---|---|---|---|
6f9d3a64ff | |||
abdaca2524 | |||
1f673970ee | |||
2608aeab6f | |||
b84d028115 |
@ -91,7 +91,7 @@ public class CombatZone : Transaction {
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
if (Grade != null) {
|
||||
if (!string.IsNullOrEmpty(Grade)) {
|
||||
return string.Format("Won {0} {1} Combat Zone", Grade, Type);
|
||||
} else {
|
||||
return string.Format("Won {0} Combat Zone", Type);
|
||||
|
@ -51,8 +51,9 @@ public class MissionCompleted : Transaction {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AcceptedEntry.Mission.IsRescueMission &&
|
||||
AcceptedEntry.Mission.Name.Contains("Mission_TW_")) {
|
||||
// If the mission starts with the name for thargoid war mission
|
||||
// names, we assume its a system contribution
|
||||
if (AcceptedEntry.Mission.Name.Contains("Mission_TW_")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,12 @@ internal class TransactionParserContext {
|
||||
ulong highest = HighestCombatBond ?? 0;
|
||||
string? faction = LastRecordedAwardingFaction;
|
||||
|
||||
if (HighestCombatBond == null &&
|
||||
LastRecordedAwardingFaction == null &&
|
||||
HaveSeenAXWarzoneNPC == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (OnFootKills > 0) {
|
||||
cztype = CombatZones.GroundCombatZone;
|
||||
// High on foot combat zones have enforcers that bring 80k a pop
|
||||
|
@ -94,6 +94,7 @@ public class EnglishMissionNames {
|
||||
{"Mission_Sightseeing_Criminal_FAMINE_name", "Sightseeing (Criminal) (Famine)"},
|
||||
{"Mission_Sightseeing_name", "Sightseeing"},
|
||||
{"Mission_TW_PassengerEvacuation_UnderAttack_name", "Passenger Evacuation (Thargoid Invasion)" },
|
||||
{"Mission_TW_Massacre_Scout_Plural_name", "Kill Scouts (Wing)" }
|
||||
};
|
||||
|
||||
public static string? Translate(string name) {
|
||||
|
@ -52,9 +52,8 @@ public class DiscordLogGenerator {
|
||||
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
|
||||
log.AppendFormat("**Target:** {0}\n", location);
|
||||
if (legacycount > 0) {
|
||||
log.AppendFormat("**Warning:** Some actions were performed on ED Legacy");
|
||||
log.AppendFormat("**Warning:** Some actions were performed on ED Legacy\n");
|
||||
}
|
||||
log.AppendLine("");
|
||||
log.AppendLine("```");
|
||||
|
||||
return log.ToString();
|
||||
@ -64,6 +63,16 @@ public class DiscordLogGenerator {
|
||||
return "```\n";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called to do final adjustments to the log body of a given objective.
|
||||
/// </summary>
|
||||
/// <param name="objective">Objective in question.</param>
|
||||
/// <param name="log">Final log as generated.</param>
|
||||
/// <returns>The transformed log.</returns>
|
||||
protected virtual string TransformFinalLogForObjective(Objective objective, string log) {
|
||||
return log;
|
||||
}
|
||||
|
||||
public virtual string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
@ -79,12 +88,12 @@ public class DiscordLogGenerator {
|
||||
return "";
|
||||
}
|
||||
|
||||
log.AppendFormat("{0}\n", GenerateHeader());
|
||||
log.AppendFormat("{0}", GenerateHeader());
|
||||
|
||||
foreach (Objective objective in objectives) {
|
||||
StringBuilder objlog = new StringBuilder();
|
||||
|
||||
log.AppendFormat("{0}\n", GenerateObjectiveHeader(objective));
|
||||
log.AppendFormat("{0}", GenerateObjectiveHeader(objective));
|
||||
|
||||
foreach (LogFormatter formatter in formatters) {
|
||||
string text = formatter.GenerateLog(objective);
|
||||
@ -94,12 +103,15 @@ public class DiscordLogGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
log.AppendFormat("{0}\n", objlog.ToString().Trim());
|
||||
string finallog = objlog.ToString().Trim();
|
||||
finallog = TransformFinalLogForObjective(objective, finallog);
|
||||
|
||||
log.AppendFormat("{0}\n", GenerateObjectiveFooter(objective));
|
||||
log.AppendFormat("{0}\n", finallog);
|
||||
|
||||
log.AppendFormat("{0}", GenerateObjectiveFooter(objective));
|
||||
}
|
||||
|
||||
log.AppendFormat("{0}\n", GenerateFooter());
|
||||
log.AppendFormat("{0}", GenerateFooter());
|
||||
|
||||
return log.ToString().Trim();
|
||||
}
|
||||
|
@ -22,11 +22,18 @@ class CombatZoneFormat : LogFormatter {
|
||||
int optionals = log.Value
|
||||
.Sum(x => x.OptionalObjectivesCompleted)
|
||||
;
|
||||
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
|
||||
log.Value.Count,
|
||||
log.Key.Grade,
|
||||
log.Key.Type
|
||||
);
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
if (optionals > 0) {
|
||||
builder.AppendFormat(" (with {0} optional objectives)", optionals);
|
||||
|
@ -29,6 +29,7 @@ public partial class MainWindow : Window {
|
||||
private static readonly List<DiscordLogGenerator> logtypes = new List<DiscordLogGenerator>() {
|
||||
new NonaDiscordLog(),
|
||||
new GenericDiscordLog(),
|
||||
new OneLineDiscordLog(),
|
||||
};
|
||||
|
||||
public MainWindow() {
|
||||
|
@ -55,21 +55,21 @@ public class NonaDiscordLog : DiscordLogGenerator {
|
||||
log.Append(":rotating_light: `Warning`: Some actions were done in E:D Legacy\n");
|
||||
}
|
||||
log.Append(":clipboard: `Conducted:`\n");
|
||||
log.Append("```");
|
||||
log.Append("```\n");
|
||||
|
||||
return log.ToString();
|
||||
}
|
||||
|
||||
protected override string GenerateObjectiveFooter(Objective objective) {
|
||||
return "```";
|
||||
return "```\n";
|
||||
}
|
||||
|
||||
protected override string GenerateHeader() {
|
||||
return string.Format(":clock2: `Date:` {0}", FormatDate());
|
||||
return string.Format(":clock2: `Date:` {0}\n", FormatDate());
|
||||
}
|
||||
|
||||
protected override string GenerateFooter() {
|
||||
return "";
|
||||
return "\n";
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
|
34
EliteBGS/OneLineDiscordLog.cs
Normal file
34
EliteBGS/OneLineDiscordLog.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace EliteBGS;
|
||||
|
||||
public class OneLineDiscordLog : DiscordLogGenerator {
|
||||
protected override string GenerateObjectiveHeader(Objective objective) {
|
||||
if (!string.IsNullOrEmpty(objective.Faction)) {
|
||||
return string.Format("{0} for {1}: ", objective.System, objective.Faction);
|
||||
} else {
|
||||
return string.Format("{0}: ", objective.System);
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GenerateObjectiveFooter(Objective objective) {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override string GenerateFooter() {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override string GenerateHeader() {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected override string TransformFinalLogForObjective(Objective objective, string log) {
|
||||
string[] lines = log.Split("\n", System.StringSplitOptions.RemoveEmptyEntries);
|
||||
return string.Join(", ", lines);
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "One Line Report";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user