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) {
|
foreach (MissionFailed failed in missions) {
|
||||||
MissionFailedEntry f = failed.Failed;
|
MissionFailedEntry f = failed.Failed;
|
||||||
builder.AppendFormat("Failed mission \"{0}\"\n",
|
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName
|
failed.Entries.Count,
|
||||||
|
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||||
|
failed.Faction
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,24 @@ namespace EliteBGS.BGS {
|
|||||||
Faction = accepted.Faction;
|
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() {
|
public override string ToString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
@ -18,7 +36,8 @@ namespace EliteBGS.BGS {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.AppendFormat("Mission failed: \"{0}\"",
|
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
||||||
|
Entries.Count,
|
||||||
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -186,6 +186,25 @@ namespace EliteBGS.BGS {
|
|||||||
|
|
||||||
return builder.ToString();
|
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) {
|
public string GenerateDiscordLog(Report report) {
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
@ -209,6 +228,9 @@ namespace EliteBGS.BGS {
|
|||||||
var missions = BuildMissionList(objective);
|
var missions = BuildMissionList(objective);
|
||||||
entries.Append(missions);
|
entries.Append(missions);
|
||||||
|
|
||||||
|
var failed = BuildFailedMissions(objective);
|
||||||
|
entries.Append(failed);
|
||||||
|
|
||||||
var vouchers = BuildVouchers(objective);
|
var vouchers = BuildVouchers(objective);
|
||||||
entries.Append(vouchers);
|
entries.Append(vouchers);
|
||||||
|
|
||||||
|
@ -121,6 +121,10 @@ namespace EliteBGS.BGS {
|
|||||||
failed.Name +
|
failed.Name +
|
||||||
"\" was not recognised");
|
"\" was not recognised");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mission failed should be collated if they are in the same system/station
|
||||||
|
*/
|
||||||
|
collate = true;
|
||||||
} else if (e.Is(Events.MultiSellExplorationData)) {
|
} else if (e.Is(Events.MultiSellExplorationData)) {
|
||||||
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.
|
/* 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">
|
<Content Include="main-objectives.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Include="CHANGELOG.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="main-entries.png">
|
<Content Include="main-entries.png">
|
||||||
|
Loading…
Reference in New Issue
Block a user