reintroduce human readable mission names

This commit is contained in:
Florian Stinglmayr 2022-11-25 10:44:48 +01:00
parent 1d04579bb8
commit 091c443440
6 changed files with 134 additions and 99 deletions

View File

@ -16,11 +16,7 @@ public class MissionCompleted : Transaction {
return "";
}
if (string.IsNullOrEmpty(c.Mission.LocalisedName)) {
return (c.Mission.Name ?? "");
} else {
return c.Mission.LocalisedName;
}
return c.Mission.FriendlyName;
}
}

View File

@ -39,8 +39,9 @@ public class MissionFailed : Transaction {
return -1;
}
// +1 since the other entries are just copies of the one we have in our properties
public int Amount => Entries.Count + 1;
public int Amount {
get { return Entries.Count + 1; }
}
public override string ToString() {
StringBuilder builder = new StringBuilder();
@ -51,8 +52,7 @@ public class MissionFailed : Transaction {
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
Amount,
Failed?.Mission?.LocalisedName != null ?
Failed?.Mission?.LocalisedName : Failed?.Mission?.Name
Failed?.Mission?.FriendlyName
);
return builder.ToString();

View File

@ -10,10 +10,4 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="MissionNames.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,105 @@
using EDPlayerJournal.BGS;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Collections.ObjectModel;
using System.Diagnostics.Metrics;
using System.Net.NetworkInformation;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System;
namespace EDPlayerJournal;
public class EnglishMissionNames {
public static Dictionary<string, string> MissionNames { get; } = new Dictionary<string, string>() {
{"Chain_FindThePirateLord_name", "Assassination (Pirate Lord) (Chain)"},
{"Chain_RegainFooting_name", "Regain Footing (Chain)"},
{"Chain_SalvageJustice_name", "Assassination (Legal) (Chain)"},
{"Mission_Altruism_name", "Donate"},
{"Mission_AltruismCredits_Bust_name", "Donate Credits (Bust)"},
{"Mission_AltruismCredits_Famine_name", "Donate Credits (Famine)"},
{"Mission_AltruismCredits_name", "Donate Credits"},
{"Mission_Assassinate_Illegal_BLOPS_name", "Assassination (Illegal)"},
{"Mission_Assassinate_Legal_Corporate_name", "Corporate Assassination (Legal)"},
{"Mission_Assassinate_name", "Assassination"},
{"Mission_Assassinate_Planetary_name", "Assassination (Planetary Scan)"},
{"Mission_Collect_Bust_name", "Provide (Bust)"},
{"Mission_Collect_CivilLiberty_name", "Provide (Civil Liberty)"},
{"Mission_Collect_CivilUnrest_name", "Provide (Civil Unrest)"},
{"Mission_Collect_Famine_name", "Provide (Famine)"},
{"Mission_Collect_Industrial_name", "Provide (Industrial)"},
{"Mission_Collect_name", "Provide"},
{"Mission_Collect_RankEmp_name", "Provide (Imperial Navy)"},
{"Mission_Collect_Retreat_name", "Provide (Retreat)"},
{"Mission_Courier_Democracy_name", "Courier (Democracy)"},
{"Mission_Courier_Elections_name", "Courier (Elections)"},
{"Mission_Courier_Expansion_name", "Courier (Expansion)"},
{"Mission_Courier_Famine_name", "Courier (Famine)"},
{"Mission_Courier_Lockdown_name", "Courier (Lockdown)"},
{"Mission_Courier_name", "Courier"},
{"Mission_Courier_RankEmp_name", "Courier (Imperial Navy)"},
{"Mission_Delivery_Agriculture_name", "Delivery (Agriculture)"},
{"Mission_Delivery_Boom_name", "Delivery (Boom)"},
{"Mission_Delivery_Democracy_name", "Delivery (Democracy)"},
{"Mission_Delivery_Investment_name", "Delivery (Investment)"},
{"Mission_Delivery_name", "Delivery"},
{"Mission_Delivery_RankEmp_name", "Delivery (Imperial Navy)"},
{"Mission_Delivery_Retreat_name", "Delivery (Retreat)"},
{"Mission_DeliveryWing_name", "Delivery (Wing)"},
{"Mission_DeliveryWing_War_name", "Delivery (Wing) (War)"},
{"Mission_Hack_BLOPS_Boom_name", "Hack Surface Installation (Boom)"},
{"Mission_Hack_BLOPS_Elections_name", "Hack Surface Installation (Elections)"},
{"Mission_Hack_BLOPS_Expansion_name", "Hack Surface Installation (Expansion)"},
{"MISSION_Hack_BLOPS_name", "Hack Surface Installation"},
{"Mission_HackMegaship_name", "Hack Megaship"},
{"Mission_LongDistanceExpedition_Explorer_Boom_name", "Long Distance Expedition (Boom)"},
{"Mission_LongDistanceExpedition_name", "Long Distance Expedition"},
{"Mission_Massacre_Conflict_CivilWar_name", "Massacre (Civil War)"},
{"Mission_Massacre_name", "Massacre"},
{"Mission_Massacre_RankEmp_name", "Massacre (Imperial Navy)"},
{"Mission_MassacreWing_Legal_Bust_name", "Massacre (Wing) (Bust)"},
{"Mission_MassacreWing_name", "Massacre (Wing)"},
{"Mission_OnFoot_Assassination_MB_name", "On Foot Assassination"},
{"Mission_OnFoot_AssassinationIllegal_MB_name", "On Foot Assassination (Illegal)"},
{"Mission_OnFoot_Collect_Contact_MB_name", "On Foot Collect"},
{"Mission_OnFoot_Collect_MB_name", "On Foot Collection"},
{"Mission_OnFoot_Delivery_Contact_MB_name", "On Foot Delivery (Contact)"},
{"Mission_OnFoot_Hack_Upload_Covert_MB_name", "On Foot Hack (Covert Upload)"},
{"Mission_OnFoot_Hack_Upload_MB_name", "On Foot Hack (Upload)"},
{"Mission_OnFoot_Heist_POI_MB_name", "On Foot Heist (POI)"},
{"Mission_OnFoot_Onslaught_MB_name", "On Foot Onslaught"},
{"Mission_OnFoot_Onslaught_Offline_MB_name", "On Foot Onslaught (Offline)"},
{"Mission_OnFoot_ProductionHeist_Covert_MB_name", "On Foot Production Heist (Covert)"},
{"Mission_OnFoot_ProductionHeist_MB_name", "On Foot Production Heist"},
{"Mission_OnFoot_Reboot_MB_name", "On Foot Reboot"},
{"Mission_OnFoot_RebootRestore_MB_name", "On Foot Reboot/Restore"},
{"Mission_OnFoot_Sabotage_Production_Covert_MB_name", "On Foot Sabotage Production (Covert)"},
{"Mission_OnFoot_Salvage_MB_name", "On Foot Salvage"},
{"Mission_OnFoot_SalvageIllegal_MB_name", "On Foot Salvage (Illegal)"},
{"Mission_PassengerBulk_AIDWORKER_ARRIVING", "Aid Workers Seeking Transport"},
{"Mission_PassengerVIP", "Passenger (VIP)"},
{"Mission_PassengerVIP_Criminal_BOOM_name", "Passenger Criminal (VIP) (Boom)"},
{"Mission_PassengerVIP_name", "Passenger (VIP)"},
{"Mission_PassengerVIP_Scientist_FAMINE_name", "Passenger Scientist (VIP) (Famine)"},
{"Mission_PassengerVIP_Tourist_BOOM_name", "Passenger Tourist (VIP) (Boom)"},
{"Mission_Rescue_Planet_name", "Planet Rescue"},
{"MISSION_Salvage_CivilUnrest_name", "Salvage (Civil Unrest)"},
{"MISSION_Salvage_Expansion_name", "Salvage (Expansion)"},
{"MISSION_Salvage_Illegal_name", "Salvage (Illegal)"},
{"Mission_Salvage_name", "Salvage"},
{"Mission_Salvage_RankEmp_name", "Salvage (Imperial Navy)"},
{"MISSION_Salvage_Refinery_name", "Salvage (Refinery)"},
{"MISSION_Salvage_Retreat_name", "Salvage (Retreat)"},
{"MISSION_Scan_name", "Scan"},
{"Mission_Sightseeing_Criminal_FAMINE_name", "Sightseeing (Criminal) (Famine)"},
{"Mission_Sightseeing_name", "Sightseeing"},
};
public static string? Translate(string name) {
if (MissionNames.ContainsKey(name)) {
return MissionNames[name];
}
return null;
}
}

View File

@ -250,6 +250,30 @@ public class Mission : IComparable<Mission> {
/// </summary>
public List<MissionFactionEffects> FactionEffects { get; set; } = new List<MissionFactionEffects>();
/// <summary>
/// Returns a friendly human-readable name for the mission. If a localised name is available
/// it will use that, baring that it will check EnglishMissionNames for a translation, and
/// if that ain't available either, it will just use the internal Name.
/// </summary>
public string FriendlyName {
get {
if (!string.IsNullOrEmpty(LocalisedName)) {
return LocalisedName;
}
if (string.IsNullOrEmpty(Name)) {
return "Unknown Mission";
}
string? translate = EnglishMissionNames.Translate(Name);
if (!string.IsNullOrEmpty(translate)) {
return translate;
}
return Name;
}
}
public int CompareTo(Mission? other) {
if (other == null) {
return 1;

View File

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Missions>
<Mission Name="Chain_FindThePirateLord_name">Assassination (Pirate Lord) (Chain)</Mission>
<Mission Name="Chain_RegainFooting_name">Regain Footing (Chain)</Mission>
<Mission Name="Chain_SalvageJustice_name">Assassination (Legal) (Chain)</Mission>
<Mission Name="Mission_Altruism_name">Donate</Mission>
<Mission Name="Mission_AltruismCredits_Bust_name">Donate Credits (Bust)</Mission>
<Mission Name="Mission_AltruismCredits_Famine_name">Donate Credits (Famine)</Mission>
<Mission Name="Mission_AltruismCredits_name">Donate Credits</Mission>
<Mission Name="Mission_Assassinate_Illegal_BLOPS_name">Assassination (Illegal)</Mission>
<Mission Name="Mission_Assassinate_Legal_Corporate_name">Corporate Assassination (Legal)</Mission>
<Mission Name="Mission_Assassinate_name">Assassination</Mission>
<Mission Name="Mission_Assassinate_Planetary_name">Assassination (Planetary Scan)</Mission>
<Mission Name="Mission_Collect_Bust_name">Provide (Bust)</Mission>
<Mission Name="Mission_Collect_CivilLiberty_name">Provide (Civil Liberty)</Mission>
<Mission Name="Mission_Collect_CivilUnrest_name">Provide (Civil Unrest)</Mission>
<Mission Name="Mission_Collect_Famine_name">Provide (Famine)</Mission>
<Mission Name="Mission_Collect_Industrial_name">Provide (Industrial)</Mission>
<Mission Name="Mission_Collect_name">Provide</Mission>
<Mission Name="Mission_Collect_RankEmp_name">Provide (Imperial Navy)</Mission>
<Mission Name="Mission_Collect_Retreat_name">Provide (Retreat)</Mission>
<Mission Name="Mission_Courier_Democracy_name">Courier (Democracy)</Mission>
<Mission Name="Mission_Courier_Elections_name">Courier (Elections)</Mission>
<Mission Name="Mission_Courier_Expansion_name">Courier (Expansion)</Mission>
<Mission Name="Mission_Courier_Famine_name">Courier (Famine)</Mission>
<Mission Name="Mission_Courier_Lockdown_name">Courier (Lockdown)</Mission>
<Mission Name="Mission_Courier_name">Courier</Mission>
<Mission Name="Mission_Courier_RankEmp_name">Courier (Imperial Navy)</Mission>
<Mission Name="Mission_Delivery_Agriculture_name">Delivery (Agriculture)</Mission>
<Mission Name="Mission_Delivery_Boom_name">Delivery (Boom)</Mission>
<Mission Name="Mission_Delivery_Democracy_name">Delivery (Democracy)</Mission>
<Mission Name="Mission_Delivery_Investment_name">Delivery (Investment)</Mission>
<Mission Name="Mission_Delivery_name">Delivery</Mission>
<Mission Name="Mission_Delivery_RankEmp_name">Delivery (Imperial Navy)</Mission>
<Mission Name="Mission_Delivery_Retreat_name">Delivery (Retreat)</Mission>
<Mission Name="Mission_DeliveryWing_name">Delivery (Wing)</Mission>
<Mission Name="Mission_DeliveryWing_War_name">Delivery (Wing) (War)</Mission>
<Mission Name="Mission_Hack_BLOPS_Boom_name">Hack Surface Installation (Boom)</Mission>
<Mission Name="Mission_Hack_BLOPS_Elections_name">Hack Surface Installation (Elections)</Mission>
<Mission Name="Mission_Hack_BLOPS_Expansion_name">Hack Surface Installation (Expansion)</Mission>
<Mission Name="MISSION_Hack_BLOPS_name">Hack Surface Installation</Mission>
<Mission Name="Mission_HackMegaship_name">Hack Megaship</Mission>
<Mission Name="Mission_LongDistanceExpedition_Explorer_Boom_name">Long Distance Expedition (Boom)</Mission>
<Mission Name="Mission_LongDistanceExpedition_name">Long Distance Expedition</Mission>
<Mission Name="Mission_Massacre_Conflict_CivilWar_name">Massacre (Civil War)</Mission>
<Mission Name="Mission_Massacre_name">Massacre</Mission>
<Mission Name="Mission_Massacre_RankEmp_name">Massacre (Imperial Navy)</Mission>
<Mission Name="Mission_MassacreWing_Legal_Bust_name">Massacre (Wing) (Bust)</Mission>
<Mission Name="Mission_MassacreWing_name">Massacre (Wing)</Mission>
<Mission Name="Mission_OnFoot_Assassination_MB_name">On Foot Assassination</Mission>
<Mission Name="Mission_OnFoot_AssassinationIllegal_MB_name">On Foot Assassination (Illegal)</Mission>
<Mission Name="Mission_OnFoot_Collect_Contact_MB_name">On Foot Collect</Mission>
<Mission Name="Mission_OnFoot_Collect_MB_name">On Foot Collection</Mission>
<Mission Name="Mission_OnFoot_Delivery_Contact_MB_name">On Foot Delivery (Contact)</Mission>
<Mission Name="Mission_OnFoot_Hack_Upload_Covert_MB_name">On Foot Hack (Covert Upload)</Mission>
<Mission Name="Mission_OnFoot_Hack_Upload_MB_name">On Foot Hack (Upload)</Mission>
<Mission Name="Mission_OnFoot_Heist_POI_MB_name">On Foot Heist (POI)</Mission>
<Mission Name="Mission_OnFoot_Onslaught_MB_name">On Foot Onslaught</Mission>
<Mission Name="Mission_OnFoot_Onslaught_Offline_MB_name">On Foot Onslaught (Offline)</Mission>
<Mission Name="Mission_OnFoot_ProductionHeist_Covert_MB_name">On Foot Production Heist (Covert)</Mission>
<Mission Name="Mission_OnFoot_ProductionHeist_MB_name">On Foot Production Heist</Mission>
<Mission Name="Mission_OnFoot_Reboot_MB_name">On Foot Reboot</Mission>
<Mission Name="Mission_OnFoot_RebootRestore_MB_name">On Foot Reboot/Restore</Mission>
<Mission Name="Mission_OnFoot_Sabotage_Production_Covert_MB_name">On Foot Sabotage Production (Covert)</Mission>
<Mission Name="Mission_OnFoot_Salvage_MB_name">On Foot Salvage</Mission>
<Mission Name="Mission_OnFoot_SalvageIllegal_MB_name">On Foot Salvage (Illegal)</Mission>
<Mission Name="Mission_PassengerBulk_AIDWORKER_ARRIVING">Aid Workers Seeking Transport</Mission>
<Mission Name="Mission_PassengerVIP">Passenger (VIP)</Mission>
<Mission Name="Mission_PassengerVIP_Criminal_BOOM_name">Passenger Criminal (VIP) (Boom)</Mission>
<Mission Name="Mission_PassengerVIP_name">Passenger (VIP)</Mission>
<Mission Name="Mission_PassengerVIP_Scientist_FAMINE_name">Passenger Scientist (VIP) (Famine)</Mission>
<Mission Name="Mission_PassengerVIP_Tourist_BOOM_name">Passenger Tourist (VIP) (Boom)</Mission>
<Mission Name="Mission_Rescue_Planet_name">Planet Rescue</Mission>
<Mission Name="MISSION_Salvage_CivilUnrest_name">Salvage (Civil Unrest)</Mission>
<Mission Name="MISSION_Salvage_Expansion_name">Salvage (Expansion)</Mission>
<Mission Name="MISSION_Salvage_Illegal_name">Salvage (Illegal)</Mission>
<Mission Name="Mission_Salvage_name">Salvage</Mission>
<Mission Name="Mission_Salvage_RankEmp_name">Salvage (Imperial Navy)</Mission>
<Mission Name="MISSION_Salvage_Refinery_name">Salvage (Refinery)</Mission>
<Mission Name="MISSION_Salvage_Retreat_name">Salvage (Retreat)</Mission>
<Mission Name="MISSION_Scan_name">Scan</Mission>
<Mission Name="Mission_Sightseeing_Criminal_FAMINE_name">Sightseeing (Criminal) (Famine)</Mission>
<Mission Name="Mission_Sightseeing_name">Sightseeing</Mission>
</Missions>