add support for power combat zones in parsing

This commit is contained in:
Florian Stinglmayr 2024-11-14 11:17:43 +01:00
parent be3bceb880
commit 912e8b602f
4 changed files with 49 additions and 6 deletions

View File

@ -92,6 +92,13 @@ public class CombatZone : Transaction {
get { return string.Compare(Type, CombatZones.AXCombatZone) == 0; } get { return string.Compare(Type, CombatZones.AXCombatZone) == 0; }
} }
/// <summary>
/// Returns true if it is a power combat zone
/// </summary>
public bool IsPower {
get { return string.Compare(Type, CombatZones.PowerCombatZone) == 0; }
}
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)) {
return -1; return -1;

View File

@ -128,16 +128,29 @@ internal class TransactionParserContext {
Settlement = null; Settlement = null;
} }
private bool HadCombatZone() {
if (CurrentInstanceType != null &&
Instances.IsInstance(CurrentInstanceType, Instances.PowerWarzoneMedium)) {
return true;
}
if (HighestCombatBond == null &&
LastRecordedAwardingFaction == null &&
HaveSeenAXWarzoneNPC == false &&
CurrentInstanceType == null) {
return false;
}
return true;
}
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 ?? 0; ulong highest = HighestCombatBond ?? 0;
string? faction = LastRecordedAwardingFaction; string? faction = LastRecordedAwardingFaction;
if (HighestCombatBond == null && if (!HadCombatZone()) {
LastRecordedAwardingFaction == null &&
HaveSeenAXWarzoneNPC == false &&
CurrentInstanceType == null) {
return; return;
} }
@ -157,7 +170,8 @@ internal class TransactionParserContext {
return; return;
} }
if (LastRecordedAwardingFaction == null && if (LastRecordedAwardingFaction == null &&
Instances.IsHumanWarzone(CurrentInstanceType)) { (Instances.IsHumanWarzone(CurrentInstanceType) ||
Instances.IsPowerWarzone(CurrentInstanceType))) {
transactions.AddIncomplete(new CombatZone(), transactions.AddIncomplete(new CombatZone(),
"Could not discern for whom you fought for, " + "Could not discern for whom you fought for, " +
"as it seems you haven't killed anyone in the ship combat zone.", "as it seems you haven't killed anyone in the ship combat zone.",
@ -187,6 +201,9 @@ internal class TransactionParserContext {
} else if (Instances.IsInstance(CurrentInstanceType, Instances.WarzoneThargoidVeryHigh)) { } else if (Instances.IsInstance(CurrentInstanceType, Instances.WarzoneThargoidVeryHigh)) {
cztype = CombatZones.AXCombatZone; cztype = CombatZones.AXCombatZone;
grade = CombatZones.DifficultyVeryHigh; grade = CombatZones.DifficultyVeryHigh;
} else if (Instances.IsInstance(CurrentInstanceType, Instances.PowerWarzoneMedium)) {
cztype = CombatZones.PowerCombatZone;
grade = CombatZones.DifficultyMedium;
} else { } else {
transactions.AddIncomplete(new CombatZone(), transactions.AddIncomplete(new CombatZone(),
"Unknown conflict zone difficulty", "Unknown conflict zone difficulty",

View File

@ -14,6 +14,11 @@ public class CombatZones {
/// </summary> /// </summary>
public static readonly string ShipCombatZone = "Ship"; public static readonly string ShipCombatZone = "Ship";
/// <summary>
/// Power combat zones, new in Ascendancy update.
/// </summary>
public static readonly string PowerCombatZone = "Power";
/// <summary> /// <summary>
/// AX combat zone /// AX combat zone
/// </summary> /// </summary>

View File

@ -18,6 +18,11 @@ public class Instances {
/// </summary> /// </summary>
public static readonly string WarzoneHigh = "$Warzone_PointRace_High"; public static readonly string WarzoneHigh = "$Warzone_PointRace_High";
/// <summary>
/// Medium power play conflict zone, new in PP 2.0 Ascendancy update
/// </summary>
public static readonly string PowerWarzoneMedium = "$Warzone_Powerplay_Med";
/// <summary> /// <summary>
/// Low Thargoid combat zone /// Low Thargoid combat zone
/// </summary> /// </summary>
@ -52,8 +57,17 @@ public class Instances {
; ;
} }
public static bool IsPowerWarzone(string type) {
return
IsInstance(type, PowerWarzoneMedium)
;
}
public static bool IsWarzone(string type) { public static bool IsWarzone(string type) {
return IsHumanWarzone(type) || IsThargoidWarzone(type); return IsHumanWarzone(type) ||
IsThargoidWarzone(type) ||
IsPowerWarzone(type)
;
} }
public static bool IsInstance(string type, string instance) { public static bool IsInstance(string type, string instance) {