Compare commits
5 Commits
6bbc063c25
...
0820998d3e
Author | SHA1 | Date | |
---|---|---|---|
0820998d3e | |||
f14982f37a | |||
f0977b774b | |||
04a839417e | |||
93359321d6 |
@ -3,20 +3,40 @@ using System.Linq;
|
||||
|
||||
namespace EDPlayerJournal.BGS;
|
||||
public class CombatZone : Transaction {
|
||||
/// <summary>
|
||||
/// Type string for ground combat zone
|
||||
/// </summary>
|
||||
public static readonly string GroundCombatZone = "Ground";
|
||||
|
||||
/// <summary>
|
||||
/// Type string for ship combat zones
|
||||
/// </summary>
|
||||
public static readonly string ShipCombatZone = "Ship";
|
||||
|
||||
/// <summary>
|
||||
/// Difficulty low
|
||||
/// </summary>
|
||||
public static readonly string DifficultyLow = "Low";
|
||||
|
||||
/// <summary>
|
||||
/// Difficulty medium
|
||||
/// </summary>
|
||||
public static readonly string DifficultyMedium = "Medium";
|
||||
|
||||
/// <summary>
|
||||
/// Difficulty high
|
||||
/// </summary>
|
||||
public static readonly string DifficultyHigh = "High";
|
||||
|
||||
/// <summary>
|
||||
/// Type, either on foot or ship
|
||||
/// </summary>
|
||||
public string Type { get; set; } = "Ship";
|
||||
public string Type { get; set; } = ShipCombatZone;
|
||||
|
||||
/// <summary>
|
||||
/// Difficulty type, low, medium or high.
|
||||
/// </summary>
|
||||
public string Grade { get; set; } = "Low";
|
||||
|
||||
/// <summary>
|
||||
/// How many?
|
||||
/// </summary>
|
||||
public int Amount { get; set; } = 1;
|
||||
public string Grade { get; set; } = DifficultyLow;
|
||||
|
||||
/// <summary>
|
||||
/// Whether spec ops were won.
|
||||
@ -57,14 +77,14 @@ public class CombatZone : Transaction {
|
||||
/// Returns true if it is an on foot/ground combat zone
|
||||
/// </summary>
|
||||
public bool IsGround {
|
||||
get { return string.Compare(Type, "On Foot") == 0; }
|
||||
get { return string.Compare(Type, GroundCombatZone) == 0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if it is an on foot combat zone
|
||||
/// </summary>
|
||||
public bool IsShip {
|
||||
get { return string.Compare(Type, "Ship") == 0; }
|
||||
get { return string.Compare(Type, ShipCombatZone) == 0; }
|
||||
}
|
||||
|
||||
public override int CompareTo(Transaction? obj) {
|
||||
@ -89,6 +109,6 @@ public class CombatZone : Transaction {
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return string.Format("Won {0} x {1} {2} Combat Zone(s)", Amount, Grade, Type);
|
||||
return string.Format("Won {0} {1} Combat Zone", Grade, Type);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ internal class TransactionParserContext {
|
||||
public Dictionary<string, long> BuyCost = new();
|
||||
|
||||
public void DiscernCombatZone(TransactionList transactions, Entry e) {
|
||||
string grade = "Low";
|
||||
string grade = CombatZone.DifficultyLow;
|
||||
string cztype;
|
||||
ulong? highest = HighestCombatBond;
|
||||
|
||||
@ -66,40 +66,40 @@ internal class TransactionParserContext {
|
||||
}
|
||||
|
||||
if (OnFootKills > 0) {
|
||||
cztype = "On Foot";
|
||||
cztype = CombatZone.GroundCombatZone;
|
||||
// High on foot combat zones have enforcers that bring 80k a pop
|
||||
if (highest >= 80000) {
|
||||
grade = "High";
|
||||
grade = CombatZone.DifficultyHigh;
|
||||
} else if (highest >= 40000) {
|
||||
grade = "Medium";
|
||||
grade = CombatZone.DifficultyMedium;
|
||||
} else {
|
||||
grade = "Low";
|
||||
grade = CombatZone.DifficultyLow;
|
||||
}
|
||||
} else if (ShipKills > 0) {
|
||||
// Ship combat zones can be identified by the amount of kills
|
||||
if (ShipKills > 20) {
|
||||
grade = "High";
|
||||
grade = CombatZone.DifficultyHigh;
|
||||
} else if (ShipKills > 10) {
|
||||
grade = "Medium";
|
||||
grade = CombatZone.DifficultyMedium;
|
||||
}
|
||||
|
||||
// Cap ship, means a high conflict zone
|
||||
if (HaveSeenCapShip) {
|
||||
grade = "High";
|
||||
grade = CombatZone.DifficultyHigh;
|
||||
} else {
|
||||
int warzoneNpcs = new List<bool>() { HaveSeenCaptain, HaveSeenCorrespondent, HaveSeenSpecOps }
|
||||
.Where(x => x == true)
|
||||
.Count()
|
||||
;
|
||||
|
||||
if (warzoneNpcs >= 2 && grade != "High") {
|
||||
if (warzoneNpcs >= 2 && grade != CombatZone.DifficultyHigh) {
|
||||
// Only large combat zones have two NPCs
|
||||
grade = "High";
|
||||
} else if (warzoneNpcs >= 1 && grade == "Low") {
|
||||
grade = "Medium";
|
||||
grade = CombatZone.DifficultyHigh;
|
||||
} else if (warzoneNpcs >= 1 && grade == CombatZone.DifficultyLow) {
|
||||
grade = CombatZone.DifficultyMedium;
|
||||
}
|
||||
}
|
||||
cztype = "Ship";
|
||||
cztype = CombatZone.ShipCombatZone;
|
||||
} else {
|
||||
transactions.AddIncomplete(new CombatZone(), "Failed to discern combat zone type");
|
||||
return;
|
||||
@ -116,7 +116,6 @@ internal class TransactionParserContext {
|
||||
SpecOps = HaveSeenSpecOps ? true : null,
|
||||
Correspondent = HaveSeenCorrespondent ? true : null,
|
||||
Captain = HaveSeenCaptain ? true : null,
|
||||
Amount = 1,
|
||||
};
|
||||
zone.Entries.Add(e);
|
||||
transactions.Add(zone);
|
||||
|
@ -14,14 +14,6 @@
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Salus.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EDJournal, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\edjournal\bin\Debug\EDJournal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Security" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="main-page.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@ -59,10 +51,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.355802">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -22,7 +22,7 @@ class CombatZoneFormat : LogFormatter {
|
||||
int optionals = log.Value
|
||||
.Sum(x => x.OptionalObjectivesCompleted)
|
||||
;
|
||||
builder.AppendFormat("Won {0}x {1} {2} Combat Zones",
|
||||
builder.AppendFormat("Won {0}x {1} {2} Combat Zone(s)",
|
||||
log.Value.Count,
|
||||
log.Key.Grade,
|
||||
log.Key.Type
|
||||
|
@ -43,8 +43,6 @@
|
||||
<DatePicker x:Name="startdate" Height="26.2857142857143" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Label Content="To:" Height="26.2857142857143" VerticalAlignment="Top"/>
|
||||
<DatePicker x:Name="enddate" Height="26.2857142857143" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
|
||||
<Button x:Name="AddCombatZone" Content="Add Combat Zone Win" VerticalAlignment="Stretch" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505" Click="AddCombatZone_Click"/>
|
||||
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
|
||||
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
|
||||
</ToolBar>
|
||||
@ -58,19 +56,34 @@
|
||||
>
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}" ItemsSource="{Binding UITransactions}" ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Visibility="{Binding HasSystem}" Margin="5,0,0,0"/>
|
||||
<TextBlock Text="{Binding System}" FontWeight="DemiBold" Visibility="{Binding HasSystem}"/>
|
||||
<TextBlock Text="Faction: " Visibility="{Binding HasFaction}" Margin="5,0,0,0"/>
|
||||
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/>
|
||||
</StackPanel>
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Visibility="{Binding HasSystem}" Margin="5,0,0,0"/>
|
||||
<TextBlock Text="{Binding System}" FontWeight="DemiBold" Visibility="{Binding HasSystem}"/>
|
||||
<TextBlock Text="Faction: " Visibility="{Binding HasFaction}" Margin="5,0,0,0"/>
|
||||
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold" Visibility="{Binding HasFaction}"/>
|
||||
</StackPanel>
|
||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
||||
<StackPanel Grid.Column="2">
|
||||
<Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<HierarchicalDataTemplate.ItemTemplate>
|
||||
<HierarchicalDataTemplate>
|
||||
<!-- This will stretch out the width of the item-->
|
||||
<Grid Initialized="Transaction_Initialized"
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
Margin="0,5,0,5"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
@ -95,7 +108,7 @@
|
||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
||||
<Button Content="High" x:Name="High" Click="High_Click"/>
|
||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
||||
<Button Content="On Foot" x:Name="OnFoot" Click="OnFoot_Click"/>
|
||||
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
|
||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
||||
</StackPanel>
|
||||
|
@ -202,55 +202,22 @@ public partial class MainWindow : Window {
|
||||
journal = new PlayerJournal(Config.Global.JournalLocation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the currently selected objective, even if a log entry in said objective
|
||||
/// is selected instead. If nothing is selected, returns null.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private Objective GetSelectedObjective() {
|
||||
var obj = entries.SelectedItem;
|
||||
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (obj.GetType() == typeof(Objective)) {
|
||||
return obj as Objective;
|
||||
}
|
||||
|
||||
// Some form of entry perhaps?
|
||||
if (obj.GetType().IsSubclassOf(typeof(Transaction))) {
|
||||
Transaction entry = obj as Transaction;
|
||||
Objective objective = entries.Items
|
||||
.OfType<Objective>()
|
||||
.First(x => x.Transactions.Contains(entry))
|
||||
;
|
||||
|
||||
return objective;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void AddCombatZone_Click(object sender, RoutedEventArgs e) {
|
||||
Objective objective = GetSelectedObjective();
|
||||
|
||||
if (objective == null) {
|
||||
System.Windows.Controls.Control control = sender as System.Windows.Controls.Control;
|
||||
if (control == null || control.DataContext == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CombatZoneDialog dialog = new CombatZoneDialog() { Owner = this };
|
||||
|
||||
if (!(dialog.ShowDialog() ?? false)) {
|
||||
Objective objective = control.DataContext as Objective;
|
||||
if (objective == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CombatZone zone = new CombatZone {
|
||||
Faction = objective.Faction,
|
||||
System = objective.System,
|
||||
Grade = dialog.Grade,
|
||||
Type = dialog.Type,
|
||||
Amount = dialog.Amount
|
||||
Grade = "Low",
|
||||
Type = "Ship",
|
||||
};
|
||||
|
||||
UITransaction uitransaction = new UITransaction(zone);
|
||||
@ -318,7 +285,7 @@ public partial class MainWindow : Window {
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Grade = "Low";
|
||||
transaction.Grade = CombatZone.DifficultyLow;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
@ -328,7 +295,7 @@ public partial class MainWindow : Window {
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Grade = "Medium";
|
||||
transaction.Grade = CombatZone.DifficultyMedium;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
@ -338,17 +305,17 @@ public partial class MainWindow : Window {
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Grade = "High";
|
||||
transaction.Grade = CombatZone.DifficultyHigh;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
private void OnFoot_Click(object sender, RoutedEventArgs e) {
|
||||
private void Ground_Click(object sender, RoutedEventArgs e) {
|
||||
CombatZone transaction = GetTransaction<CombatZone>(sender);
|
||||
if (transaction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Type = "On Foot";
|
||||
transaction.Type = CombatZone.GroundCombatZone;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
@ -358,7 +325,7 @@ public partial class MainWindow : Window {
|
||||
return;
|
||||
}
|
||||
|
||||
transaction.Type = "Ship";
|
||||
transaction.Type = CombatZone.ShipCombatZone;
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user