implement thargoid bonds for pilots federation
This commit is contained in:
parent
61f1b10f29
commit
e8de768d01
@ -484,18 +484,30 @@ internal class RedeemVoucherParser : TransactionParserPart {
|
||||
if (current_factions == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
"Current system factions are unknown, so vouchers were ineffective");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string faction in entry.Factions) {
|
||||
if (current_factions.Find(x => string.Compare(x.Name, faction, true) == 0) == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
string.Format("Vouchers for {0} were ignored in {1} since said " +
|
||||
"faction is not present here", faction, context.CurrentSystem)
|
||||
);
|
||||
continue;
|
||||
bool relevantBond = false;
|
||||
|
||||
if (string.Compare(faction, Factions.PilotsFederationVouchers) == 0) {
|
||||
// Target faction is pilots' federation, so we assume thargoid bonks
|
||||
relevantBond = true;
|
||||
}
|
||||
|
||||
if (current_factions != null && !relevantBond) {
|
||||
// If we have local factions, and it ain't thargoid bonds see if the bonds were
|
||||
// useful in the current system
|
||||
if (current_factions.Find(x => string.Compare(x.Name, faction, true) == 0) != null) {
|
||||
relevantBond = true;
|
||||
} else {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
string.Format("Vouchers for {0} had no effect in {1} since said " +
|
||||
"faction is not present here", faction, context.CurrentSystem)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (relevantBond) {
|
||||
transactions.Add(new Vouchers(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
@ -505,6 +517,7 @@ internal class RedeemVoucherParser : TransactionParserPart {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class SellMicroResourcesParser : TransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionList transactions) {
|
||||
|
@ -33,7 +33,12 @@ public class Factions {
|
||||
/// <summary>
|
||||
/// Internal name for the Pilots Federation faction
|
||||
/// </summary>
|
||||
public static string PilotsFederation = "$faction_PilotsFederation;";
|
||||
public static string PilotsFederationInternal = "$faction_PilotsFederation;";
|
||||
|
||||
/// <summary>
|
||||
/// Name used for Pilots Federation in vouchers
|
||||
/// </summary>
|
||||
public static string PilotsFederationVouchers = "PilotsFederation";
|
||||
|
||||
/// <summary>
|
||||
/// Internal name for the Thargoid faction
|
||||
|
@ -44,6 +44,9 @@
|
||||
<None Update="SellOrganicData.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ThargoidBonds.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="ThargoidKills.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
3
EDPlayerJournalTests/ThargoidBonds.txt
Normal file
3
EDPlayerJournalTests/ThargoidBonds.txt
Normal file
@ -0,0 +1,3 @@
|
||||
{ "timestamp":"2022-11-25T10:10:43Z", "event":"FSDJump", "Taxi":false, "Multicrew":false, "StarSystem":"Nyalayan", "SystemAddress":1458309042898, "StarPos":[29.71875,-172.71875,-6.46875], "SystemAllegiance":"Independent", "SystemEconomy":"$economy_Agri;", "SystemEconomy_Localised":"Agriculture", "SystemSecondEconomy":"$economy_Refinery;", "SystemSecondEconomy_Localised":"Refinery", "SystemGovernment":"$government_Theocracy;", "SystemGovernment_Localised":"Theocracy", "SystemSecurity":"$SYSTEM_SECURITY_medium;", "SystemSecurity_Localised":"Medium Security", "Population":1920608781, "Body":"Nyalayan A", "BodyID":1, "BodyType":"Star", "JumpDist":7.769, "FuelUsed":0.142448, "FuelLevel":15.857553, "Factions":[ { "Name":"Nyalayan Imperial Society", "FactionState":"Election", "Government":"Patronage", "Influence":0.165138, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":17.496799, "ActiveStates":[ { "State":"Election" } ] }, { "Name":"Reret Emperor's Grace", "FactionState":"War", "Government":"Patronage", "Influence":0.257900, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":100.000000, "ActiveStates":[ { "State":"Expansion" }, { "State":"War" } ] }, { "Name":"Nyalayan Silver Transport Org", "FactionState":"None", "Government":"Corporate", "Influence":0.076453, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":81.875000 }, { "Name":"Nyalayan Power & Co", "FactionState":"None", "Government":"Corporate", "Influence":0.060143, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":23.173201 }, { "Name":"Amanogawa Enlight", "FactionState":"War", "Government":"Theocracy", "Influence":0.257900, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":-1.210600, "ActiveStates":[ { "State":"Expansion" }, { "State":"War" } ] }, { "Name":"Nyalayan Crimson Dragons", "FactionState":"None", "Government":"Anarchy", "Influence":0.017329, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":-13.530000 }, { "Name":"Traditional Nyalayan Front", "FactionState":"Election", "Government":"Dictatorship", "Influence":0.165138, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":64.699997, "ActiveStates":[ { "State":"Election" } ] } ], "SystemFaction":{ "Name":"Amanogawa Enlight", "FactionState":"War" }, "Conflicts":[ { "WarType":"election", "Status":"active", "Faction1":{ "Name":"Nyalayan Imperial Society", "Stake":"Pilcher Port", "WonDays":2 }, "Faction2":{ "Name":"Traditional Nyalayan Front", "Stake":"Lamar Falls", "WonDays":0 } }, { "WarType":"war", "Status":"active", "Faction1":{ "Name":"Reret Emperor's Grace", "Stake":"", "WonDays":1 }, "Faction2":{ "Name":"Amanogawa Enlight", "Stake":"Sutter Ring", "WonDays":2 } } ] }
|
||||
{ "timestamp":"2022-11-25T10:13:32Z", "event":"Docked", "StationName":"Pilcher Port", "StationType":"Orbis", "Taxi":false, "Multicrew":false, "StarSystem":"Nyalayan", "SystemAddress":1458309042898, "MarketID":3222853120, "StationFaction":{ "Name":"Nyalayan Imperial Society", "FactionState":"Election" }, "StationGovernment":"$government_Patronage;", "StationGovernment_Localised":"Patronage", "StationAllegiance":"Empire", "StationServices":[ "dock", "autodock", "commodities", "contacts", "exploration", "missions", "outfitting", "crewlounge", "rearm", "refuel", "repair", "shipyard", "tuning", "engineer", "missionsgenerated", "flightcontroller", "stationoperations", "powerplay", "searchrescue", "stationMenu", "shop", "livery", "socialspace", "bartender", "vistagenomics", "pioneersupplies", "apexinterstellar", "frontlinesolutions" ], "StationEconomy":"$economy_Refinery;", "StationEconomy_Localised":"Refinery", "StationEconomies":[ { "Name":"$economy_Refinery;", "Name_Localised":"Refinery", "Proportion":1.000000 } ], "DistFromStarLS":76.465557, "LandingPads":{ "Small":8, "Medium":11, "Large":6 } }
|
||||
{ "timestamp":"2022-11-25T10:13:53Z", "event":"RedeemVoucher", "Type":"CombatBond", "Amount":24240000, "Faction":"PilotsFederation" }
|
@ -1,10 +1,6 @@
|
||||
using EDPlayerJournal.BGS;
|
||||
using EDPlayerJournal;
|
||||
using EDPlayerJournal.BGS;
|
||||
using EDPlayerJournal.Entries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EDPlayerJournalTests;
|
||||
|
||||
@ -21,13 +17,38 @@ public class ThargoidKills {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Transaction>? transactions = parser.Parse(entries);
|
||||
List<ThargoidKill>? transactions = parser.Parse(entries)?.OfType<ThargoidKill>().ToList();
|
||||
|
||||
Assert.IsNotNull(transactions, "could not parse entries");
|
||||
Assert.AreEqual(transactions.Count, 4);
|
||||
Assert.AreEqual(transactions.Count, 3);
|
||||
|
||||
Assert.IsInstanceOfType(transactions[0], typeof(ThargoidKill), "result is not of type ThargoidKill");
|
||||
Assert.AreEqual(transactions[0].ThargoidType, EDPlayerJournal.ThargoidVessel.Scout);
|
||||
|
||||
Assert.IsInstanceOfType(transactions[1], typeof(ThargoidKill), "result is not of type ThargoidKill");
|
||||
Assert.AreEqual(transactions[1].ThargoidType, EDPlayerJournal.ThargoidVessel.Basilisk);
|
||||
|
||||
Assert.IsInstanceOfType(transactions[2], typeof(ThargoidKill), "result is not of type ThargoidKill");
|
||||
Assert.AreEqual(transactions[2].ThargoidType, EDPlayerJournal.ThargoidVessel.Scout);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ThargoidBonds() {
|
||||
TransactionParser parser = new();
|
||||
|
||||
List<Entry>? entries = Helper.LoadTestData("ThargoidBonds.txt");
|
||||
Assert.IsNotNull(entries, "could not load test data");
|
||||
|
||||
if (entries == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Vouchers>? transactions = parser.Parse(entries)?.OfType<Vouchers>().ToList();
|
||||
|
||||
Assert.IsNotNull(transactions, "could not parse entries");
|
||||
Assert.AreEqual(transactions.Count, 1);
|
||||
Assert.AreEqual(transactions[0].Faction, Factions.PilotsFederationVouchers);
|
||||
Assert.AreEqual(transactions[0].TotalSum, 24240000L);
|
||||
Assert.AreEqual(transactions[0].Type, "Combat Bond");
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
{ "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" }
|
Loading…
Reference in New Issue
Block a user