6 Commits

13 changed files with 105 additions and 12 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

@@ -581,14 +581,25 @@ internal class ReceiveTextParser : ITransactionParserPart {
} }
} }
internal class SelfDestructParser : ITransactionParserPart {
public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
context.SelfDestruct = true;
}
}
internal class DiedParser : ITransactionParserPart { internal class DiedParser : ITransactionParserPart {
public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) { public void Parse(Entry entry, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
// Death only matters in ship. On foot you can just redeploy with the dropship. // Death only matters in ship. On foot you can just redeploy with the dropship.
if (context.IsOnFoot) { if (context.IsOnFoot) {
return; return;
} }
// You can't complete a combat zone if you die in it. Others might keep it open if (context.SelfDestruct != null && context.SelfDestruct == true) {
// for you, but still you will not have completed it unless you jump back in. // Some people just suicide to fast track back to stations after a CZ,
// especially since combat bonds don't disappear on death. So count the CZ
// on self destruct
context.DiscernCombatZone(transactions, entry);
context.SelfDestruct = null;
}
context.ResetCombatZone(); context.ResetCombatZone();
// Dying also moves you back to another instance // Dying also moves you back to another instance
context.LeftInstance(); context.LeftInstance();
@@ -630,6 +641,7 @@ public class TransactionParser {
{ Events.ReceiveText, new ReceiveTextParser() }, { Events.ReceiveText, new ReceiveTextParser() },
{ Events.RedeemVoucher, new RedeemVoucherParser() }, { Events.RedeemVoucher, new RedeemVoucherParser() },
{ Events.SearchAndRescue, new SearchAndRescueParser() }, { Events.SearchAndRescue, new SearchAndRescueParser() },
{ Events.SelfDestruct, new SelfDestructParser() },
{ Events.SellExplorationData, new SellExplorationDataParser() }, { Events.SellExplorationData, new SellExplorationDataParser() },
{ Events.SellMicroResources, new SellMicroResourcesParser() }, { Events.SellMicroResources, new SellMicroResourcesParser() },
{ Events.SellOrganicData, new SellOrganicDataParser() }, { Events.SellOrganicData, new SellOrganicDataParser() },

View File

@@ -62,6 +62,8 @@ internal class TransactionParserContext {
public bool HaveSeenAlliedCorrespondent { get; set; } = false; public bool HaveSeenAlliedCorrespondent { get; set; } = false;
public bool HaveSeenEnemyCorrespondent { get; set; } = false; public bool HaveSeenEnemyCorrespondent { get; set; } = false;
public bool? SelfDestruct { get; set; } = null;
/// <summary> /// <summary>
/// Current Odyssey settlement. /// Current Odyssey settlement.
/// </summary> /// </summary>
@@ -128,16 +130,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 +172,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 +203,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

@@ -42,6 +42,7 @@ public class Entry {
{ Events.ReceiveText, typeof(ReceiveTextEntry) }, { Events.ReceiveText, typeof(ReceiveTextEntry) },
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) }, { Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
{ Events.SearchAndRescue, typeof(SearchAndRescueEntry) }, { Events.SearchAndRescue, typeof(SearchAndRescueEntry) },
{ Events.SelfDestruct, typeof(SelfDestructEntry) },
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) }, { Events.SellExplorationData, typeof(SellExplorationDataEntry) },
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) }, { Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
{ Events.SellOrganicData, typeof(SellOrganicDataEntry) }, { Events.SellOrganicData, typeof(SellOrganicDataEntry) },

View File

@@ -32,6 +32,7 @@ public class Events {
public static readonly string ReceiveText = "ReceiveText"; public static readonly string ReceiveText = "ReceiveText";
public static readonly string RedeemVoucher = "RedeemVoucher"; public static readonly string RedeemVoucher = "RedeemVoucher";
public static readonly string SearchAndRescue = "SearchAndRescue"; public static readonly string SearchAndRescue = "SearchAndRescue";
public static readonly string SelfDestruct = "SelfDestruct";
public static readonly string SellExplorationData = "SellExplorationData"; public static readonly string SellExplorationData = "SellExplorationData";
public static readonly string SellMicroResources = "SellMicroResources"; public static readonly string SellMicroResources = "SellMicroResources";
public static readonly string SellOrganicData = "SellOrganicData"; public static readonly string SellOrganicData = "SellOrganicData";

View File

@@ -0,0 +1,5 @@
namespace EDPlayerJournal.Entries {
public class SelfDestructEntry : Entry {
// Has no data
}
}

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) {

View File

@@ -1,5 +1,10 @@
# EliteBGS changelog # EliteBGS changelog
## 0.4.4 on ??.??.202?
* Add support for Power Conflict Zones
* Show no inf as "Zero INF", so the Nova Navy bot can parse it properly
## 0.4.3 on 18.09.2024 ## 0.4.3 on 18.09.2024
* Add possibility to post log reports to Discord webhooks. * Add possibility to post log reports to Discord webhooks.

View File

@@ -64,6 +64,7 @@ public class MissionFormat : LogFormatter {
Dictionary<string, ulong> passengers = new(); Dictionary<string, ulong> passengers = new();
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
long total_influence = 0; long total_influence = 0;
bool hadmissions = false;
var missions = objective.EnabledOfType<MissionCompleted>(); var missions = objective.EnabledOfType<MissionCompleted>();
var support = objective.EnabledOfType<InfluenceSupport>(); var support = objective.EnabledOfType<InfluenceSupport>();
@@ -85,6 +86,7 @@ public class MissionFormat : LogFormatter {
++collated[m.MissionName][m.Influence]; ++collated[m.MissionName][m.Influence];
hadmissions = true;
total_influence += m.Influence.Length; total_influence += m.Influence.Length;
if (m.AcceptedEntry != null && if (m.AcceptedEntry != null &&
@@ -121,19 +123,23 @@ public class MissionFormat : LogFormatter {
output.Append(failedlog); output.Append(failedlog);
output.Append("\n"); output.Append("\n");
} }
if (failed.Count > 0) {
hadmissions = true;
}
total_influence += failed.Sum(x => x.InfluenceAmount); total_influence += failed.Sum(x => x.InfluenceAmount);
foreach (InfluenceSupport inf in support) { foreach (InfluenceSupport inf in support) {
output.Append(inf.ToString()); output.Append(inf.ToString());
output.Append("\n"); output.Append("\n");
hadmissions = true;
total_influence += inf.Influence.InfluenceAmount; total_influence += inf.Influence.InfluenceAmount;
} }
if (support.Count() > 0) { if (support.Count > 0) {
output.Append("\n"); output.Append("\n");
} }
if (total_influence != 0) { if (hadmissions) {
output.AppendFormat("Total Influence: {0}", total_influence); output.AppendFormat("Total Influence: {0}", total_influence);
} }
@@ -141,6 +147,10 @@ public class MissionFormat : LogFormatter {
} }
public string GenerateSummary(Objective objective) { public string GenerateSummary(Objective objective) {
bool hadmissions = objective
.EnabledOfType<MissionCompleted>()
.Count > 0
;
long influence = objective long influence = objective
.EnabledOfType<MissionCompleted>() .EnabledOfType<MissionCompleted>()
.Sum(x => x.Influence.Length) .Sum(x => x.Influence.Length)
@@ -154,7 +164,7 @@ public class MissionFormat : LogFormatter {
.Sum(x => x.InfluenceAmount) .Sum(x => x.InfluenceAmount)
; ;
if (influence == 0 && support == 0 && failed == 0) { if (influence == 0 && support == 0 && failed == 0 && !hadmissions) {
return ""; return "";
} }

View File

@@ -121,6 +121,7 @@
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/> <Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/> <Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
<Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/> <Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/>
<Button Content="Power" x:Name="Power" Click="Power_Click"/>
</StackPanel> </StackPanel>
</Expander> </Expander>
</StackPanel> </StackPanel>

View File

@@ -476,6 +476,16 @@ public partial class MainWindow : MetroWindow {
RefreshView(); RefreshView();
} }
private void Power_Click(object sender, RoutedEventArgs e) {
CombatZone transaction = GetTransaction<CombatZone>(sender);
if (transaction == null) {
return;
}
transaction.Type = CombatZones.PowerCombatZone;
RefreshView();
}
private void Thargoid_Click(object sender, RoutedEventArgs e) { private void Thargoid_Click(object sender, RoutedEventArgs e) {
CombatZone transaction = GetTransaction<CombatZone>(sender); CombatZone transaction = GetTransaction<CombatZone>(sender);
if (transaction == null) { if (transaction == null) {
@@ -713,4 +723,5 @@ public partial class MainWindow : MetroWindow {
private void PostToAll_Click(object sender, RoutedEventArgs e) { private void PostToAll_Click(object sender, RoutedEventArgs e) {
PostToDiscordWebhook(Config.Global.Webhooks); PostToDiscordWebhook(Config.Global.Webhooks);
} }
} }

View File

@@ -59,7 +59,9 @@ public class UITransaction : INotifyPropertyChanged {
return Visibility.Hidden; return Visibility.Hidden;
} }
if (string.Compare(combat.Type, CombatZones.ShipCombatZone) == 0) { // Both normal and power combat zones have special objectives
if (string.Compare(combat.Type, CombatZones.ShipCombatZone) == 0 ||
string.Compare(combat.Type, CombatZones.PowerCombatZone) == 0) {
return Visibility.Visible; return Visibility.Visible;
} }