From 85848a7381649f7f0fd047d86c52985c2454c0b9 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 25 Nov 2022 12:34:11 +0100 Subject: [PATCH] prepare transaction engine for thargoid kills --- .../Entries/FactionKillBondEntry.cs | 19 +++++++ EDPlayerJournal/Faction.cs | 15 ++++- EDPlayerJournal/Thargoid.cs | 56 +++++++++++++++++++ EDPlayerJournalTests/ThargoidKills.txt | 4 ++ 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 EDPlayerJournal/Thargoid.cs create mode 100644 EDPlayerJournalTests/ThargoidKills.txt diff --git a/EDPlayerJournal/Entries/FactionKillBondEntry.cs b/EDPlayerJournal/Entries/FactionKillBondEntry.cs index e5ed38f..6e43941 100644 --- a/EDPlayerJournal/Entries/FactionKillBondEntry.cs +++ b/EDPlayerJournal/Entries/FactionKillBondEntry.cs @@ -1,13 +1,32 @@ namespace EDPlayerJournal.Entries; public class FactionKillBondEntry : Entry { + /// + /// Reward given + /// public int Reward { get; set; } + /// + /// Faction that awarded the kill bond + /// public string? AwardingFaction { get; set; } + /// + /// Localised string of the awarding faction if available + /// + public string? AwardingFactionLocalised { get; set; } + /// + /// Victim faction, internal name + /// public string? VictimFaction { get; set; } + /// + /// Localised name of the victim faction + /// + public string? VictimFactionLocalised { get; set; } protected override void Initialise() { Reward = JSON.Value("Reward") ?? 0; AwardingFaction = JSON.Value("AwardingFaction"); + AwardingFactionLocalised = JSON.Value("AwardingFaction_Localised"); VictimFaction = JSON.Value("VictimFaction"); + VictimFactionLocalised = JSON.Value("VictimFaction_Localised"); } } diff --git a/EDPlayerJournal/Faction.cs b/EDPlayerJournal/Faction.cs index dadd4b1..e264099 100644 --- a/EDPlayerJournal/Faction.cs +++ b/EDPlayerJournal/Faction.cs @@ -5,7 +5,8 @@ using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; -namespace EDPlayerJournal; +namespace EDPlayerJournal; + public class FactionState { public string? State { get; set; } public long? Trend { get; set; } @@ -28,6 +29,18 @@ public class FactionState { } } +public class Factions { + /// + /// Internal name for the Pilots Federation faction + /// + public static string PilotsFederation = "$faction_PilotsFederation;"; + + /// + /// Internal name for the Thargoid faction + /// + public static string Thargoid = "$faction_Thargoid;"; +} + public class Faction { public string? Name { get; set; } public string? FactionState { get; set; } diff --git a/EDPlayerJournal/Thargoid.cs b/EDPlayerJournal/Thargoid.cs new file mode 100644 index 0000000..e70f487 --- /dev/null +++ b/EDPlayerJournal/Thargoid.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EDPlayerJournal; + +public enum ThargoidVessel { + Unknown = 0, + Scout = 1, + /// + /// According to AX wiki no longer found ingame + /// + Orthrus = 2, + Cyclops = 3, + Basilisk = 4, + Medusa = 5, + Hydra = 6, +} + +public class Thargoid { + public static string ThargoidFaction = Factions.Thargoid; + + public static Dictionary VesselPayout { get; } = new() { + { 80000, ThargoidVessel.Scout }, + { 8000000, ThargoidVessel.Cyclops }, + { 24000000, ThargoidVessel.Basilisk }, + { 40000000, ThargoidVessel.Medusa }, + { 60000000, ThargoidVessel.Hydra }, + }; + + public static Dictionary VesselNames { get; } = new() { + { ThargoidVessel.Unknown, null }, + { ThargoidVessel.Scout, "Thargoid Scout" }, + { ThargoidVessel.Orthrus, "Orthrus" }, + { ThargoidVessel.Cyclops, "Cyclops" }, + { ThargoidVessel.Basilisk, "Basilisk" }, + { ThargoidVessel.Medusa, "Medusa" }, + { ThargoidVessel.Hydra, "Hydra" }, + }; + + public static ThargoidVessel GetVesselByPayout(ulong payout) { + if (VesselPayout.ContainsKey(payout)) { + return VesselPayout[payout]; + } + return ThargoidVessel.Unknown; + } + + public static string? GetVesselName(ThargoidVessel v) { + if (VesselNames.ContainsKey(v)) { + return VesselNames[v]; + } + return null; + } +} diff --git a/EDPlayerJournalTests/ThargoidKills.txt b/EDPlayerJournalTests/ThargoidKills.txt new file mode 100644 index 0000000..d468e1d --- /dev/null +++ b/EDPlayerJournalTests/ThargoidKills.txt @@ -0,0 +1,4 @@ +{ "timestamp":"2022-11-25T09:50:45Z", "event":"FactionKillBond", "Reward":80000, "AwardingFaction":"$faction_PilotsFederation;", "AwardingFaction_Localised":"Pilots' Federation", "VictimFaction":"$faction_Thargoid;", "VictimFaction_Localised":"Thargoids" } +{ "timestamp":"2022-11-25T09:52:28Z", "event":"FactionKillBond", "Reward":24000000, "AwardingFaction":"$faction_PilotsFederation;", "AwardingFaction_Localised":"Pilots' Federation", "VictimFaction":"$faction_Thargoid;", "VictimFaction_Localised":"Thargoids" } +{ "timestamp":"2022-11-25T09:47:19Z", "event":"FactionKillBond", "Reward":80000, "AwardingFaction":"$faction_PilotsFederation;", "AwardingFaction_Localised":"Pilots' Federation", "VictimFaction":"$faction_Thargoid;", "VictimFaction_Localised":"Thargoids" } +{ "timestamp":"2022-11-25T10:13:53Z", "event":"RedeemVoucher", "Type":"CombatBond", "Amount":24240000, "Faction":"PilotsFederation" } \ No newline at end of file