rework how failed missions are handled
This cleans up the logs, especially since failed missions don't show a lot of detailed information.
This commit is contained in:
parent
cd09fac03a
commit
bf401db483
@ -113,8 +113,10 @@ namespace EliteBGS.BGS {
|
||||
|
||||
foreach (MissionFailed failed in missions) {
|
||||
MissionFailedEntry f = failed.Failed;
|
||||
builder.AppendFormat("Failed mission \"{0}\"\n",
|
||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName
|
||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||
failed.Entries.Count,
|
||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||
failed.Faction
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,24 @@ namespace EliteBGS.BGS {
|
||||
Faction = accepted.Faction;
|
||||
}
|
||||
|
||||
public override int CompareTo(LogEntry other) {
|
||||
if (other.GetType() != typeof(MissionFailed)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
MissionFailed failed = other as MissionFailed;
|
||||
|
||||
/* if it is the same mission name, the same faction and the same system,
|
||||
* collate mission failures together */
|
||||
if (failed.Failed.HumanReadableName == Failed.HumanReadableName &&
|
||||
failed.Faction == Faction &&
|
||||
failed.System == System) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
@ -18,7 +36,8 @@ namespace EliteBGS.BGS {
|
||||
return "";
|
||||
}
|
||||
|
||||
builder.AppendFormat("Mission failed: \"{0}\"",
|
||||
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
||||
Entries.Count,
|
||||
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
||||
);
|
||||
|
||||
|
@ -186,6 +186,25 @@ namespace EliteBGS.BGS {
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
private string BuildFailedMissions(Objective objective) {
|
||||
MissionFailed[] missions = objective.LogEntries.OfType<MissionFailed>().ToArray();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (missions.Length <= 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach (MissionFailed failed in missions) {
|
||||
MissionFailedEntry f = failed.Failed;
|
||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||
failed.Entries.Count,
|
||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||
failed.Faction
|
||||
);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
@ -209,6 +228,9 @@ namespace EliteBGS.BGS {
|
||||
var missions = BuildMissionList(objective);
|
||||
entries.Append(missions);
|
||||
|
||||
var failed = BuildFailedMissions(objective);
|
||||
entries.Append(failed);
|
||||
|
||||
var vouchers = BuildVouchers(objective);
|
||||
entries.Append(vouchers);
|
||||
|
||||
|
@ -121,6 +121,10 @@ namespace EliteBGS.BGS {
|
||||
failed.Name +
|
||||
"\" was not recognised");
|
||||
}
|
||||
|
||||
/* Mission failed should be collated if they are in the same system/station
|
||||
*/
|
||||
collate = true;
|
||||
} else if (e.Is(Events.MultiSellExplorationData)) {
|
||||
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.
|
||||
*/
|
||||
|
14
CHANGELOG.md
Normal file
14
CHANGELOG.md
Normal file
@ -0,0 +1,14 @@
|
||||
# EliteBGS changelog
|
||||
|
||||
## 0.1.0-beta3 on ??.??.????
|
||||
|
||||
* Collated failed missions into a single entry with a counter
|
||||
* Added failed missions to Nova Navy log template
|
||||
|
||||
## 0.1.0-beta2 on 09.01.2022
|
||||
|
||||
* Adding combat zones has been repaired
|
||||
|
||||
## 0.1.0-beta1 on 07.01.2022
|
||||
|
||||
* Initial release
|
@ -168,6 +168,7 @@
|
||||
<Content Include="main-objectives.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="CHANGELOG.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="main-entries.png">
|
||||
|
Loading…
Reference in New Issue
Block a user