Compare commits
2 Commits
0be9791abc
...
e01d3a869d
Author | SHA1 | Date | |
---|---|---|---|
e01d3a869d | |||
1da4549e2c |
@ -6,13 +6,6 @@ public class CombatZone : Transaction {
|
|||||||
public string Type { get; set; } = "";
|
public string Type { get; set; } = "";
|
||||||
public string Grade { get; set; } = "";
|
public string Grade { get; set; } = "";
|
||||||
public int Amount { get; set; } = 0;
|
public int Amount { get; set; } = 0;
|
||||||
public DateTime Completed { get; set; } = DateTime.UtcNow;
|
|
||||||
|
|
||||||
public override string CompletedAt {
|
|
||||||
get {
|
|
||||||
return Completed.ToString("dd.MM.yyyy HH:mm UTC");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int CompareTo(Transaction? obj) {
|
public override int CompareTo(Transaction? obj) {
|
||||||
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using EDPlayerJournal.Entries;
|
using EDPlayerJournal.Entries;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace EDPlayerJournal.BGS;
|
namespace EDPlayerJournal.BGS;
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ internal class TransactionParserContext {
|
|||||||
|
|
||||||
public ulong? HighestCombatBond { get; set; }
|
public ulong? HighestCombatBond { get; set; }
|
||||||
|
|
||||||
|
public bool HaveSeenWarzoneNPC { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many on foot kills were done.
|
/// How many on foot kills were done.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -49,7 +51,7 @@ internal class TransactionParserContext {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, long> BuyCost = new();
|
public Dictionary<string, long> BuyCost = new();
|
||||||
|
|
||||||
public void DiscernCombatZone(TransactionList transactions) {
|
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
||||||
string grade = "Low";
|
string grade = "Low";
|
||||||
string cztype;
|
string cztype;
|
||||||
ulong? highest = HighestCombatBond;
|
ulong? highest = HighestCombatBond;
|
||||||
@ -73,6 +75,10 @@ internal class TransactionParserContext {
|
|||||||
} else if (ShipKills > 10) {
|
} else if (ShipKills > 10) {
|
||||||
grade = "Medium";
|
grade = "Medium";
|
||||||
}
|
}
|
||||||
|
if (HaveSeenWarzoneNPC && grade == "Low") {
|
||||||
|
// We have seen a warzone NPC so we know its at least medium
|
||||||
|
grade = "Medium";
|
||||||
|
}
|
||||||
cztype = "Ship";
|
cztype = "Ship";
|
||||||
} else {
|
} else {
|
||||||
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
||||||
@ -86,6 +92,7 @@ internal class TransactionParserContext {
|
|||||||
Type = cztype,
|
Type = cztype,
|
||||||
Amount = 1,
|
Amount = 1,
|
||||||
};
|
};
|
||||||
|
zone.Entries.Add(e);
|
||||||
transactions.Add(zone);
|
transactions.Add(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +112,7 @@ internal class TransactionParserContext {
|
|||||||
|
|
||||||
public void ResetCombatZone() {
|
public void ResetCombatZone() {
|
||||||
HighestCombatBond = null;
|
HighestCombatBond = null;
|
||||||
|
HaveSeenWarzoneNPC = false;
|
||||||
LastRecordedAwardingFaction = null;
|
LastRecordedAwardingFaction = null;
|
||||||
OnFootKills = 0;
|
OnFootKills = 0;
|
||||||
ShipKills = 0;
|
ShipKills = 0;
|
||||||
@ -275,6 +283,11 @@ internal class ShipTargetedParser : TransactionParserPart {
|
|||||||
!string.IsNullOrEmpty(entry.Faction)) {
|
!string.IsNullOrEmpty(entry.Faction)) {
|
||||||
context.NPCFaction.TryAdd(entry.PilotNameLocalised, 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,14 +722,14 @@ internal class EmbarkDisembarkParser : TransactionParserPart {
|
|||||||
|
|
||||||
internal class SupercruiseEntryParser : TransactionParserPart {
|
internal class SupercruiseEntryParser : TransactionParserPart {
|
||||||
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
||||||
context.DiscernCombatZone(transactions);
|
context.DiscernCombatZone(transactions, entry);
|
||||||
context.ResetCombatZone();
|
context.ResetCombatZone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ShutdownParser : TransactionParserPart {
|
internal class ShutdownParser : TransactionParserPart {
|
||||||
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
public void Parse(Entry entry, TransactionParserContext context, TransactionList transactions) {
|
||||||
context.DiscernCombatZone(transactions);
|
context.DiscernCombatZone(transactions, entry);
|
||||||
context.ResetCombatZone();
|
context.ResetCombatZone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
117
EDPlayerJournal/NPC.cs
Normal file
117
EDPlayerJournal/NPC.cs
Normal 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 {
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user