improve detection of combat zones by listening for messages
This commit is contained in:
parent
43ae93658f
commit
123fa15884
@ -44,6 +44,11 @@ internal class TransactionParserContext {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong ThargoidInterceptorKills { get; set; } = 0;
|
public ulong ThargoidInterceptorKills { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether we have seen an AX warzone NPC talk to us with ReceiveText
|
||||||
|
/// </summary>
|
||||||
|
public bool HaveSeenAXWarzoneNPC { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of accepted missions index by their mission ID
|
/// A list of accepted missions index by their mission ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,11 +74,8 @@ internal class TransactionParserContext {
|
|||||||
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
||||||
string? grade = CombatZones.DifficultyLow;
|
string? grade = CombatZones.DifficultyLow;
|
||||||
string cztype;
|
string cztype;
|
||||||
ulong? highest = HighestCombatBond;
|
ulong highest = HighestCombatBond ?? 0;
|
||||||
|
string? faction = LastRecordedAwardingFaction;
|
||||||
if (highest == null || LastRecordedAwardingFaction == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OnFootKills > 0) {
|
if (OnFootKills > 0) {
|
||||||
cztype = CombatZones.GroundCombatZone;
|
cztype = CombatZones.GroundCombatZone;
|
||||||
@ -110,7 +112,8 @@ internal class TransactionParserContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cztype = CombatZones.ShipCombatZone;
|
cztype = CombatZones.ShipCombatZone;
|
||||||
} else if (ThargoidScoutKills > 0 && ThargoidInterceptorKills > 0) {
|
} else if ((ThargoidScoutKills > 0 && ThargoidInterceptorKills > 0) ||
|
||||||
|
HaveSeenAXWarzoneNPC == true) {
|
||||||
// Could be a thargoid combat zones if interceptors and scouts are there
|
// Could be a thargoid combat zones if interceptors and scouts are there
|
||||||
cztype = CombatZones.AXCombatZone;
|
cztype = CombatZones.AXCombatZone;
|
||||||
// Still unknown
|
// Still unknown
|
||||||
@ -122,7 +125,7 @@ internal class TransactionParserContext {
|
|||||||
|
|
||||||
CombatZone zone = new CombatZone() {
|
CombatZone zone = new CombatZone() {
|
||||||
System = CurrentSystem,
|
System = CurrentSystem,
|
||||||
Faction = LastRecordedAwardingFaction,
|
Faction = faction,
|
||||||
IsLegacy = IsLegacy,
|
IsLegacy = IsLegacy,
|
||||||
Grade = grade,
|
Grade = grade,
|
||||||
Type = cztype,
|
Type = cztype,
|
||||||
@ -161,6 +164,7 @@ internal class TransactionParserContext {
|
|||||||
ShipKills = 0;
|
ShipKills = 0;
|
||||||
ThargoidInterceptorKills = 0;
|
ThargoidInterceptorKills = 0;
|
||||||
ThargoidScoutKills = 0;
|
ThargoidScoutKills = 0;
|
||||||
|
HaveSeenAXWarzoneNPC = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BoughtCargo(string? cargo, long? cost) {
|
public void BoughtCargo(string? cargo, long? cost) {
|
||||||
@ -856,11 +860,38 @@ internal class FileHeaderParser : TransactionParserPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class ReceiveTextParser : TransactionParserPart {
|
||||||
|
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
||||||
|
ReceiveTextEntry? receivetext = entry as ReceiveTextEntry;
|
||||||
|
|
||||||
|
if (receivetext == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Compare(receivetext.Channel, Channels.NPC) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Compare(receivetext.NPCCategory, NPCs.AXMilitary) == 0) {
|
||||||
|
context.HaveSeenAXWarzoneNPC = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class DiedParser : TransactionParserPart {
|
||||||
|
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
||||||
|
// You can't complete a combat zone if you die in it. Others might keep it open
|
||||||
|
// for you, but still you will not have completed it unless you jump back in.
|
||||||
|
context.ResetCombatZone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class TransactionParser {
|
public class TransactionParser {
|
||||||
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
|
private static Dictionary<string, TransactionParserPart> ParserParts { get; } = new()
|
||||||
{
|
{
|
||||||
{ Events.CapShipBond, new CapShipBondParser() },
|
{ Events.CapShipBond, new CapShipBondParser() },
|
||||||
{ Events.CommitCrime, new CommitCrimeParser() },
|
{ Events.CommitCrime, new CommitCrimeParser() },
|
||||||
|
{ Events.Died, new DiedParser() },
|
||||||
{ Events.Disembark, new EmbarkDisembarkParser() },
|
{ Events.Disembark, new EmbarkDisembarkParser() },
|
||||||
{ Events.Docked, new DockedParser() },
|
{ Events.Docked, new DockedParser() },
|
||||||
{ Events.Embark, new EmbarkDisembarkParser() },
|
{ Events.Embark, new EmbarkDisembarkParser() },
|
||||||
@ -874,6 +905,7 @@ public class TransactionParser {
|
|||||||
{ Events.MissionCompleted, new MissionCompletedParser() },
|
{ Events.MissionCompleted, new MissionCompletedParser() },
|
||||||
{ Events.MissionFailed, new MissionFailedParser() },
|
{ Events.MissionFailed, new MissionFailedParser() },
|
||||||
{ Events.MultiSellExplorationData, new MultiSellExplorationDataParser() },
|
{ Events.MultiSellExplorationData, new MultiSellExplorationDataParser() },
|
||||||
|
{ Events.ReceiveText, new ReceiveTextParser() },
|
||||||
{ Events.RedeemVoucher, new RedeemVoucherParser() },
|
{ Events.RedeemVoucher, new RedeemVoucherParser() },
|
||||||
{ Events.SearchAndRescue, new SearchAndRescueParser() },
|
{ Events.SearchAndRescue, new SearchAndRescueParser() },
|
||||||
{ Events.SellExplorationData, new SellExplorationDataParser() },
|
{ Events.SellExplorationData, new SellExplorationDataParser() },
|
||||||
|
8
EDPlayerJournal/Channels.cs
Normal file
8
EDPlayerJournal/Channels.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace EDPlayerJournal;
|
||||||
|
|
||||||
|
public class Channels {
|
||||||
|
/// <summary>
|
||||||
|
/// Channel NPCs use to talk to the commander.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string NPC = "npc";
|
||||||
|
}
|
@ -46,7 +46,7 @@ public class ReceiveTextEntry : Entry {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parts[0];
|
return string.Format("{0};", parts[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,11 @@ public class NPCs {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string WarzoneCorrespondent = "$LUASC_Scenario_Warzone_NPC_WarzoneCorrespondent;";
|
public static string WarzoneCorrespondent = "$LUASC_Scenario_Warzone_NPC_WarzoneCorrespondent;";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AX Military NPC
|
||||||
|
/// </summary>
|
||||||
|
public static string AXMilitary = "$Name_AX_Military;";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the pilotname is either a captain, specops, or correspondent
|
/// Returns true if the pilotname is either a captain, specops, or correspondent
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user