if player targeted warzone NPCs assume its medium or higher

This commit is contained in:
Florian Stinglmayr 2022-11-25 23:54:28 +01:00
parent 1da4549e2c
commit e01d3a869d
2 changed files with 129 additions and 0 deletions

View File

@ -17,6 +17,8 @@ internal class TransactionParserContext {
public ulong? HighestCombatBond { get; set; }
public bool HaveSeenWarzoneNPC { get; set; } = false;
/// <summary>
/// How many on foot kills were done.
/// </summary>
@ -73,6 +75,10 @@ internal class TransactionParserContext {
} else if (ShipKills > 10) {
grade = "Medium";
}
if (HaveSeenWarzoneNPC && grade == "Low") {
// We have seen a warzone NPC so we know its at least medium
grade = "Medium";
}
cztype = "Ship";
} else {
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
@ -106,6 +112,7 @@ internal class TransactionParserContext {
public void ResetCombatZone() {
HighestCombatBond = null;
HaveSeenWarzoneNPC = false;
LastRecordedAwardingFaction = null;
OnFootKills = 0;
ShipKills = 0;
@ -276,6 +283,11 @@ internal class ShipTargetedParser : TransactionParserPart {
!string.IsNullOrEmpty(entry.Faction)) {
context.NPCFaction.TryAdd(entry.PilotNameLocalised, entry.Faction);
}
// We have seen a spec ops, so we know its medium or higher
if (NPCs.IsWarzoneNPC(entry.PilotName)) {
context.HaveSeenWarzoneNPC = true;
}
}
}

117
EDPlayerJournal/NPC.cs Normal file
View File

@ -0,0 +1,117 @@
namespace EDPlayerJournal;
public class NPCs {
/// <summary>
/// Internal name of Spec Ops Wing Alpha
/// </summary>
public static string SpecOpsAInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_A;";
/// <summary>
/// Internal name of Spec Ops Wing Beta
/// </summary>
public static string SpecOpsBInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_B;";
/// <summary>
/// Internal name of Spec Ops Wing Gamma
/// </summary>
public static string SpecOpsGInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_G;";
/// <summary>
/// Internal name of Spec Ops Wing Delta
/// </summary>
public static string SpecOpsDInternal = "$LUASC_Scenario_Warzone_NPC_SpecOps_D;";
/// <summary>
/// Empire captain
/// </summary>
public static string EmpireCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Emp;";
/// <summary>
/// Federation captain
/// </summary>
public static string FederationCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Fed;";
/// <summary>
/// Federation captain
/// </summary>
public static string IndependentCaptain = "$LUASC_Scenario_Warzone_NPC_WarzoneGeneral_Ind;";
/// <summary>
/// Warzone correspondant
/// </summary>
public static string WarzoneCorrespondent = "$LUASC_Scenario_Warzone_NPC_WarzoneCorrespondent;";
/// <summary>
/// Returns true if the pilotname is either a captain, specops, or correspondent
/// </summary>
/// <param name="pilotname"></param>
/// <returns></returns>
public static bool IsWarzoneNPC(string? pilotname) {
if (IsWarzoneCaptain(pilotname) ||
IsWarzoneCorrespondent(pilotname) ||
IsSpecOps(pilotname)) {
return true;
}
return false;
}
/// <summary>
/// Returns true if the given pilot name is a warzone correspondent
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static bool IsWarzoneCorrespondent(string? pilotname) {
if (pilotname == null) {
return false;
}
if (string.Compare(pilotname, WarzoneCorrespondent) == 0) {
return true;
}
return false;
}
/// <summary>
/// Returns true if the given pilot name is a spec ops wing.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static bool IsSpecOps(string? pilotname) {
if (pilotname == null) {
return false;
}
if (string.Compare(pilotname, SpecOpsAInternal) == 0 ||
string.Compare(pilotname, SpecOpsBInternal) == 0 ||
string.Compare(pilotname, SpecOpsGInternal) == 0 ||
string.Compare(pilotname, SpecOpsDInternal) == 0) {
return true;
}
return false;
}
/// <summary>
/// Returns true if the given pilot name is a warzone captain
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static bool IsWarzoneCaptain(string? pilotname) {
if (pilotname == null) {
return false;
}
if (string.Compare(pilotname, EmpireCaptain) == 0 ||
string.Compare(pilotname, FederationCaptain) == 0 ||
string.Compare(pilotname, IndependentCaptain) == 0) {
return true;
}
return false;
}
}
public class NPC {
}