implement thargoid bonds for pilots federation

This commit is contained in:
2022-11-25 15:14:50 +01:00
parent 61f1b10f29
commit e8de768d01
6 changed files with 67 additions and 23 deletions

View File

@@ -484,24 +484,37 @@ 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;
}
transactions.Add(new Vouchers(entry) {
System = context.CurrentSystem,
Station = context.CurrentStation,
Faction = faction,
ControllingFaction = context.ControllingFaction,
});
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,
Faction = faction,
ControllingFaction = context.ControllingFaction,
});
}
}
}
}

View File

@@ -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