Compare commits
2 Commits
55677f2965
...
0fdd3e2c9a
Author | SHA1 | Date | |
---|---|---|---|
0fdd3e2c9a | |||
fcf1802d22 |
@ -1,5 +1,30 @@
|
||||
namespace NonaBGS.BGS {
|
||||
public class CombatZone {
|
||||
private int level;
|
||||
using System;
|
||||
|
||||
namespace NonaBGS.BGS {
|
||||
public class CombatZone : LogEntry, IComparable {
|
||||
public string Type { get; set; }
|
||||
public string Grade { get; set; }
|
||||
public int Amount { get; set; }
|
||||
|
||||
public int CompareTo(object obj) {
|
||||
if (obj.GetType() != typeof(CombatZone)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var b = obj as CombatZone;
|
||||
if (b.Faction != Faction || b.System != System) {
|
||||
return -1; // System and faction don't match
|
||||
}
|
||||
|
||||
if (b.Type != b.Type || b.Grade != b.Grade) {
|
||||
return -1; // grade and type don't match
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return string.Format("Won {0} x {1} {2} Combat Zone(s)", Amount, Type, Grade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
43
BGS/FactionKillBonds.cs
Normal file
43
BGS/FactionKillBonds.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using EDJournal;
|
||||
|
||||
namespace NonaBGS.BGS {
|
||||
public class FactionKillBonds : LogEntry {
|
||||
public int TotalSum {
|
||||
get {
|
||||
return Entries
|
||||
.OfType<FactionKillBondEntry>()
|
||||
.Sum(x => x.Reward)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public string VictimFaction {
|
||||
get {
|
||||
return Entries
|
||||
.OfType<FactionKillBondEntry>()
|
||||
.First()
|
||||
.VictimFaction
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public override int CompareTo(LogEntry other) {
|
||||
if (other.GetType() != typeof(FactionKillBonds)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var b = other as FactionKillBonds;
|
||||
if (b.VictimFaction == VictimFaction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return string.Format("Faction Kill Bonds: {0}", Credits.FormatCredits(TotalSum));
|
||||
}
|
||||
}
|
||||
}
|
@ -57,6 +57,26 @@ namespace NonaBGS.BGS {
|
||||
return string.Format("Sold {0} CR worth of Micro Resources\n", sum);
|
||||
}
|
||||
|
||||
private string BuildKillBonds(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
FactionKillBonds[] bonds = objective.LogEntries
|
||||
.OfType<FactionKillBonds>()
|
||||
.ToArray()
|
||||
;
|
||||
|
||||
if (bonds == null || bonds.Length == 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (FactionKillBonds bond in bonds) {
|
||||
builder.AppendFormat("{0}\n", bond.ToString());
|
||||
}
|
||||
|
||||
builder.AppendFormat("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildVouchers(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var missions = from entries in objective.LogEntries
|
||||
@ -126,6 +146,26 @@ namespace NonaBGS.BGS {
|
||||
return output.ToString();
|
||||
}
|
||||
|
||||
private string BuildCombatZones(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
CombatZone[] zones = objective.LogEntries
|
||||
.OfType<CombatZone>()
|
||||
.ToArray()
|
||||
;
|
||||
|
||||
if (zones == null || zones.Length == 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (CombatZone zone in zones) {
|
||||
builder.AppendFormat("{0}\n", zone.ToString());
|
||||
}
|
||||
|
||||
builder.Append("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
@ -147,6 +187,12 @@ namespace NonaBGS.BGS {
|
||||
var vouchers = BuildVouchers(objective);
|
||||
entries.Append(vouchers);
|
||||
|
||||
var zones = BuildCombatZones(objective);
|
||||
entries.Append(zones);
|
||||
|
||||
var bonds = BuildKillBonds(objective);
|
||||
entries.Append(bonds);
|
||||
|
||||
var carto = BuildCartoGraphics(objective);
|
||||
entries.Append(carto);
|
||||
|
||||
|
@ -34,7 +34,8 @@ namespace NonaBGS.BGS {
|
||||
e.Is(Events.FSDJump) ||
|
||||
e.Is(Events.MultiSellExplorationData) ||
|
||||
e.Is(Events.SellMicroResources) ||
|
||||
e.Is(Events.RedeemVoucher)
|
||||
e.Is(Events.RedeemVoucher) ||
|
||||
e.Is(Events.FactionKillBond)
|
||||
;
|
||||
}
|
||||
|
||||
@ -93,6 +94,14 @@ namespace NonaBGS.BGS {
|
||||
entry.Station = current_station;
|
||||
entry.Faction = controlling_faction;
|
||||
|
||||
collate = true;
|
||||
} else if (e.Is(Events.FactionKillBond)) {
|
||||
entry = new FactionKillBonds();
|
||||
entry.Entries.Add(e);
|
||||
entry.System = current_system;
|
||||
entry.Station = current_station;
|
||||
entry.Faction = (e as FactionKillBondEntry).AwardingFaction;
|
||||
|
||||
collate = true;
|
||||
} else if (e.Is(Events.SellMicroResources)) {
|
||||
entry = new SellMicroResources(current_system, current_station);
|
||||
|
48
CombatZoneDialog.xaml
Normal file
48
CombatZoneDialog.xaml
Normal file
@ -0,0 +1,48 @@
|
||||
<Window x:Class="NonaBGS.CombatZoneDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:NonaBGS"
|
||||
mc:Ignorable="d"
|
||||
Title="Add Combat Zone Wins" Height="150" Width="370" WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<GroupBox Header="Add Combat Zone" Grid.Row="0" Grid.Column="0" Width="Auto">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ComboBox x:Name="type" Grid.Column="0" VerticalAlignment="Top" Width="Auto" IsReadOnly="True" Height="23" Margin="5" SelectedIndex="0">
|
||||
<ComboBoxItem Content="Space"/>
|
||||
<ComboBoxItem Content="On Foot"/>
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="grade" Grid.Column="1" VerticalAlignment="Top" IsReadOnly="True" Margin="5" Height="23" Width="Auto" SelectedIndex="0">
|
||||
<ComboBoxItem Content="Low"/>
|
||||
<ComboBoxItem Content="Medium"/>
|
||||
<ComboBoxItem Content="High"/>
|
||||
</ComboBox>
|
||||
<TextBox x:Name="amount" Grid.Column="2" Height="23" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="Auto" Margin="5" HorizontalContentAlignment="Right"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="Accept" Content="Accept" HorizontalAlignment="Right" Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsDefault="True" Click="Accept_Click"/>
|
||||
<Button x:Name="Cancel" Content="Cancel" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsCancel="True" Click="Cancel_Click"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
47
CombatZoneDialog.xaml.cs
Normal file
47
CombatZoneDialog.xaml.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace NonaBGS {
|
||||
/// <summary>
|
||||
/// Interaction logic for CombatZoneDialog.xaml
|
||||
/// </summary>
|
||||
public partial class CombatZoneDialog : Window {
|
||||
public CombatZoneDialog() {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string Type => (type.SelectedItem as ComboBoxItem).Content.ToString();
|
||||
public string Grade => (grade.SelectedItem as ComboBoxItem).Content.ToString();
|
||||
public int Amount {
|
||||
get {
|
||||
try {
|
||||
return int.Parse(amount.Text);
|
||||
} catch (Exception) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Accept_Click(object sender, RoutedEventArgs e) {
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, RoutedEventArgs e) {
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -37,6 +37,8 @@
|
||||
<abc:AutoCompleteTextBox x:Name="faction" Margin="0" VerticalAlignment="Center" MinWidth="120" MinHeight="22" KeyDown="Filter_KeyDown"/>
|
||||
<Separator Height="26.2857142857143" Margin="0" VerticalAlignment="Top"/>
|
||||
<Button x:Name="AddFilter" Content="Add Objective" VerticalAlignment="Stretch" Click="AddFilter_Click" Margin="0,0,0,0.286" RenderTransformOrigin="0.5,0.505"/>
|
||||
<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"/>
|
||||
</ToolBar>
|
||||
<ToolBar VerticalAlignment="Top" Grid.Row="1" Width="Auto" Margin="0,0,0,0" Height="Auto" Grid.ColumnSpan="3" HorizontalAlignment="Left">
|
||||
<Button x:Name="ParseJournal" Content="Parse Journal" VerticalAlignment="Center" Click="ParseJournal_Click" HorizontalAlignment="Center"/>
|
||||
|
@ -241,5 +241,39 @@ namespace NonaBGS {
|
||||
dialog.StartDownload();
|
||||
dialog.ShowDialog();
|
||||
}
|
||||
|
||||
private void AddCombatZone_Click(object sender, RoutedEventArgs e) {
|
||||
if (entries.SelectedItem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeViewItem item = entries.SelectedItem as TreeViewItem;
|
||||
var obj = item.Tag;
|
||||
|
||||
if (obj.GetType() != typeof(Objective)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Objective objective = obj as Objective;
|
||||
|
||||
CombatZoneDialog dialog = new CombatZoneDialog() { Owner = this };
|
||||
|
||||
if (!(dialog.ShowDialog() ?? false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CombatZone zone = new CombatZone();
|
||||
|
||||
zone.Faction = objective.Faction;
|
||||
zone.System = objective.System;
|
||||
zone.Station = objective.Station;
|
||||
|
||||
zone.Grade = dialog.Grade;
|
||||
zone.Type = dialog.Type;
|
||||
zone.Amount = dialog.Amount;
|
||||
|
||||
objective.LogEntries.Add(zone);
|
||||
RefreshObjectives();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@
|
||||
<Reference Include="AutoCompleteTextBox, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>packages\AutoCompleteTextBox.1.1.1\lib\net472\AutoCompleteTextBox.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EDJournal, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Reference Include="EDJournal">
|
||||
<HintPath>..\edjournal\bin\Debug\EDJournal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
@ -77,6 +76,7 @@
|
||||
<Compile Include="BGS\DiscordLogGenerator.cs" />
|
||||
<Compile Include="BGS\NonaDiscordLog.cs" />
|
||||
<Compile Include="BGS\SellMicroResources.cs" />
|
||||
<Compile Include="BGS\FactionKillBonds.cs" />
|
||||
<Compile Include="EDDB\PopulatedSystems.cs" />
|
||||
<Compile Include="EDDB\Stations.cs" />
|
||||
<Compile Include="UI\StationSuggestionProvider.cs" />
|
||||
@ -87,6 +87,9 @@
|
||||
<Compile Include="ProgressDialog.xaml.cs">
|
||||
<DependentUpon>ProgressDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CombatZoneDialog.xaml.cs">
|
||||
<DependentUpon>CombatZoneDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -110,6 +113,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="CombatZoneDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
|
Reference in New Issue
Block a user