Compare commits

...

5 Commits

9 changed files with 81 additions and 19 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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

View File

@ -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) {

View File

@ -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();
}

View File

@ -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);

View File

@ -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() {

View File

@ -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() {

View 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";
}
}