Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a3b7623557 | |||
| 1c2fc1e2e6 | |||
| 53da6b4bc2 | |||
| bc44ceb205 | |||
| 4d3048a37d | |||
| 463598c779 | |||
| bf56f3a2d5 | |||
| 450824733d | |||
| 110f909c6f | |||
| a1099628a0 | |||
| 7e85159fd5 | |||
| 2e8daca61c | |||
| 05b714a607 | |||
| 3b0492c70f | |||
| c20280eb13 | |||
| dd863c326e | |||
| 2012aab7b3 | |||
| abb7954614 | |||
| 0f44a6a9a7 | |||
| 34e0a0c8ba | |||
| b0b82811cc | |||
| 4855d78823 |
84
EDPlayerJournal/BGS/Parsers/RedeemVoucherParser.cs
Normal file
84
EDPlayerJournal/BGS/Parsers/RedeemVoucherParser.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using EDPlayerJournal.Entries;
|
||||
|
||||
namespace EDPlayerJournal.BGS.Parsers;
|
||||
|
||||
internal class RedeemVoucherParser : ITransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
||||
RedeemVoucherEntry? entry = e as RedeemVoucherEntry;
|
||||
if (entry == null) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.CurrentSystem == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
"Could not find out where the vouchers were redeemed", e
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
List<Faction>? current_factions = context.GetFactions(context.CurrentSystem);
|
||||
if (current_factions == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
"Current system factions are unknown, so vouchers were ineffective", e);
|
||||
}
|
||||
|
||||
foreach (string faction in entry.Factions) {
|
||||
bool relevantBond = false;
|
||||
string relevantFaction = faction;
|
||||
|
||||
if (string.Compare(faction, Factions.PilotsFederationVouchers) == 0) {
|
||||
// Target faction is pilots' federation, so we assume thargoid bonks
|
||||
// Also assign this combat bond to the Pilots Federation
|
||||
relevantFaction = Factions.PilotsFederation;
|
||||
relevantBond = true;
|
||||
}
|
||||
|
||||
if (current_factions != null && !relevantBond) {
|
||||
// If we have local factions, and it ain't thargoid bonds see if the bonds were
|
||||
// useful in the current system
|
||||
if (current_factions.Find(x => string.Compare(x.Name, faction, true) == 0) != null) {
|
||||
relevantBond = true;
|
||||
} else {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
string.Format("Vouchers for \"{0}\" had no effect in \"{1}\" since said " +
|
||||
"faction is not present there", faction, context.CurrentSystem), e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!relevantBond) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var voucher = new Vouchers(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = relevantFaction,
|
||||
ControllingFaction = context.ControllingFaction,
|
||||
IsLegacy = context.IsLegacy,
|
||||
};
|
||||
|
||||
if (options.FilterDoubleRedeemVouchers) {
|
||||
// To filter out doubly redeemed vouchers, find another redeem voucher
|
||||
// event that happened in the same system, same total sum, and also the
|
||||
// same faction. If there is one, filter this one out.
|
||||
var doubledEntry = transactions
|
||||
.OfType<Vouchers>()
|
||||
.Where(x => x.TotalSum == voucher.TotalSum &&
|
||||
x.System == voucher.System &&
|
||||
x.Faction == voucher.Faction)
|
||||
.ToList()
|
||||
;
|
||||
if (doubledEntry.Count > 0) {
|
||||
transactions.AddIncomplete(
|
||||
voucher,
|
||||
string.Format("A doubled redeem voucher for {0} valued {1} was detected",
|
||||
voucher.Faction, Credits.FormatMillions(voucher.TotalSum)),
|
||||
e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
transactions.Add(voucher);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,11 @@ public class SellCargo : Transaction {
|
||||
}
|
||||
|
||||
foreach (MarketSellEntry sell in sold) {
|
||||
builder.AppendFormat("Sold {0} {1} to the {2}",
|
||||
builder.AppendFormat("Sold {0} {1} to the {2} of {3}",
|
||||
sell.Count,
|
||||
Cargo,
|
||||
Market
|
||||
Market,
|
||||
Station
|
||||
);
|
||||
|
||||
if (Profit != 0) {
|
||||
|
||||
@@ -28,6 +28,14 @@ public class TransactionParserOptions {
|
||||
/// Whether we should ignore things done for the fleet carrier faction.
|
||||
/// </summary>
|
||||
public bool IgnoreFleetCarrierFaction { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Filter out double redeem vouchers that happen when you redeem a specific
|
||||
/// voucher, and then redeem the rest of your vouchers (say from a KWS) in
|
||||
/// bulk. The bulk redeem will also list the first voucher redeem again in
|
||||
/// its bulk list.
|
||||
/// </summary>
|
||||
public bool FilterDoubleRedeemVouchers { get; set; } = true;
|
||||
}
|
||||
|
||||
public class TransactionList : List<Transaction> {
|
||||
@@ -422,63 +430,6 @@ internal class MissionFailedParser : ITransactionParserPart {
|
||||
}
|
||||
}
|
||||
|
||||
internal class RedeemVoucherParser : ITransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
||||
RedeemVoucherEntry? entry = e as RedeemVoucherEntry;
|
||||
if (entry == null) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
if (context.CurrentSystem == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
"Could not find out where the vouchers were redeemed", e
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
List<Faction>? current_factions = context.GetFactions(context.CurrentSystem);
|
||||
if (current_factions == null) {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
"Current system factions are unknown, so vouchers were ineffective", e);
|
||||
}
|
||||
|
||||
foreach (string faction in entry.Factions) {
|
||||
bool relevantBond = false;
|
||||
string relevantFaction = faction;
|
||||
|
||||
if (string.Compare(faction, Factions.PilotsFederationVouchers) == 0) {
|
||||
// Target faction is pilots' federation, so we assume thargoid bonks
|
||||
// Also assign this combat bond to the Pilots Federation
|
||||
relevantFaction = Factions.PilotsFederation;
|
||||
relevantBond = true;
|
||||
}
|
||||
|
||||
if (current_factions != null && !relevantBond) {
|
||||
// If we have local factions, and it ain't thargoid bonds see if the bonds were
|
||||
// useful in the current system
|
||||
if (current_factions.Find(x => string.Compare(x.Name, faction, true) == 0) != null) {
|
||||
relevantBond = true;
|
||||
} else {
|
||||
transactions.AddIncomplete(new Vouchers(),
|
||||
string.Format("Vouchers for \"{0}\" had no effect in \"{1}\" since said " +
|
||||
"faction is not present there", faction, context.CurrentSystem), e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (relevantBond) {
|
||||
transactions.Add(new Vouchers(entry) {
|
||||
System = context.CurrentSystem,
|
||||
Station = context.CurrentStation,
|
||||
Faction = relevantFaction,
|
||||
ControllingFaction = context.ControllingFaction,
|
||||
IsLegacy = context.IsLegacy,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class SellMicroResourcesParser : ITransactionParserPart {
|
||||
public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) {
|
||||
SellMicroResourcesEntry? entry = e as SellMicroResourcesEntry;
|
||||
|
||||
7
EDPlayerJournalTests/double-vouchers-2.txt
Normal file
7
EDPlayerJournalTests/double-vouchers-2.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
{"timestamp":"2024-04-27T13:27:08Z","event":"Fileheader","part":1,"language":"English/UK","Odyssey":true,"gameversion":"4.0.0.1803","build":"r301470/r0 "}
|
||||
{"timestamp":"2024-04-27T13:27:34Z","event":"Commander","FID":"F9183790","Name":"Jeremaya"}
|
||||
{"timestamp":"2024-04-27T15:06:31Z","event":"FSDJump","Taxi":false,"Multicrew":false,"StarSystem":"HIP 3318","SystemAddress":525890177387,"StarPos":[50.21875,-190.6875,37.5],"SystemAllegiance":"Empire","SystemEconomy":"$economy_Refinery;","SystemEconomy_Localised":"Refinery","SystemSecondEconomy":"$economy_Extraction;","SystemSecondEconomy_Localised":"Extraction","SystemGovernment":"$government_Patronage;","SystemGovernment_Localised":"Patronage","SystemSecurity":"$SYSTEM_SECURITY_high;","SystemSecurity_Localised":"High Security","Population":239484,"Body":"HIP 3318 A","BodyID":2,"BodyType":"Star","JumpDist":27.495,"FuelUsed":3.115176,"FuelLevel":13.228082,"Factions":[{"Name":"HIP 3318 Autocracy","FactionState":"None","Government":"Dictatorship","Influence":0.119192,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":0.0},{"Name":"Chakho Gold Galactic Limited","FactionState":"None","Government":"Corporate","Influence":0.09798,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":0.0},{"Name":"HIP 3318 Interstellar","FactionState":"None","Government":"Corporate","Influence":0.075758,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":0.0},{"Name":"HIP 3318 Values Party","FactionState":"None","Government":"Democracy","Influence":0.032323,"Allegiance":"Independent","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":0.0},{"Name":"Nationalists of HIP 3318","FactionState":"None","Government":"Dictatorship","Influence":0.035354,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":0.0},{"Name":"Nova Paresa","FactionState":"Boom","Government":"Patronage","Influence":0.434343,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","SquadronFaction":true,"MyReputation":100.0,"PendingStates":[{"State":"Expansion","Trend":0}]},{"Name":"Empire Consulate Ltd","FactionState":"None","Government":"Patronage","Influence":0.20505,"Allegiance":"Empire","Happiness":"$Faction_HappinessBand2;","Happiness_Localised":"Happy","MyReputation":94.474998}],"SystemFaction":{"Name":"Nova Paresa","FactionState":"Boom"}}
|
||||
{"timestamp":"2024-04-27T15:12:23Z","event":"ApproachSettlement","Name":"Koh Biological Installation","MarketID":3803792128,"StationFaction":{"Name":"Nova Paresa","FactionState":"Boom"},"StationGovernment":"$government_Patronage;","StationGovernment_Localised":"Patronage","StationAllegiance":"Empire","StationServices":["dock","autodock","commodities","contacts","exploration","missions","refuel","repair","engineer","missionsgenerated","flightcontroller","stationoperations","searchrescue","stationMenu"],"StationEconomy":"$economy_HighTech;","StationEconomy_Localised":"High Tech","StationEconomies":[{"Name":"$economy_HighTech;","Name_Localised":"High Tech","Proportion":1.0}],"SystemAddress":525890177387,"BodyID":26,"BodyName":"HIP 3318 D 3","Latitude":-0.893061,"Longitude":-62.928345}
|
||||
{"timestamp":"2024-04-27T15:14:08Z","event":"Docked","StationName":"Koh Biological Installation","StationType":"OnFootSettlement","Taxi":false,"Multicrew":false,"StarSystem":"HIP 3318","SystemAddress":525890177387,"MarketID":3803792128,"StationFaction":{"Name":"Nova Paresa","FactionState":"Boom"},"StationGovernment":"$government_Patronage;","StationGovernment_Localised":"Patronage","StationAllegiance":"Empire","StationServices":["dock","autodock","commodities","contacts","exploration","missions","refuel","repair","engineer","missionsgenerated","flightcontroller","stationoperations","searchrescue","stationMenu"],"StationEconomy":"$economy_HighTech;","StationEconomy_Localised":"High Tech","StationEconomies":[{"Name":"$economy_HighTech;","Name_Localised":"High Tech","Proportion":1.0}],"DistFromStarLS":11972.63409,"LandingPads":{"Small":1,"Medium":0,"Large":1}}
|
||||
{"timestamp":"2024-04-27T15:15:10Z","event":"RedeemVoucher","Type":"bounty","Amount":9449329,"Factions":[{"Faction":"Nova Paresa","Amount":9449329}]}
|
||||
{"timestamp":"2024-04-27T15:15:51Z","event":"RedeemVoucher","Type":"bounty","Amount":18780130,"Factions":[{"Faction":"","Amount":224449},{"Faction":"","Amount":730880},{"Faction":"","Amount":1272764},{"Faction":"","Amount":580384},{"Faction":"","Amount":10180261},{"Faction":"","Amount":1413153},{"Faction":"","Amount":1365934},{"Faction":"","Amount":202193},{"Faction":"Nova Paresa","Amount":9449329},{"Faction":"","Amount":104412},{"Faction":"","Amount":2453443},{"Faction":"","Amount":252257}]}
|
||||
@@ -1,12 +1,30 @@
|
||||
# EliteBGS changelog
|
||||
|
||||
# 0.3.7 on 29.01.2024
|
||||
## 0.4.1 on 28.04.2024
|
||||
|
||||
* Filter out vouchers that are redeemed twice, due to bulk turn-in. If you
|
||||
redeem a singular voucher for value X, and then redeem the rest of your
|
||||
vouchers - say KWS vouchers - in bulk, the first voucher of value X will
|
||||
appear again in the logs. It appears twice in the logs, but only counts
|
||||
once.
|
||||
* Add the market name to the trading log entries.
|
||||
|
||||
## 0.4.0 on 13.04.2024
|
||||
|
||||
* Change layout of the results into System -> Faction -> Transaction.
|
||||
Many people who contribute *a lot* of things to the BGS have preferred such
|
||||
a layout to find the right things to post to various discord guilds/threads.
|
||||
* Sort all systems in the new overview by name. It just makes them easier to
|
||||
find when there are a lot of entries.
|
||||
* Add a button to deselect/select all buttons.
|
||||
|
||||
## 0.3.7 on 29.01.2024
|
||||
|
||||
* Fix wrong locations of BGS action if you remain on your carrier while its
|
||||
jumping to a new system.
|
||||
* Identify a capital ship in a high CZ by its music.
|
||||
|
||||
# 0.3.6 on 25.10.2023
|
||||
## 0.3.6 on 25.10.2023
|
||||
|
||||
* U17 introduced invalid JSON into the player journal. EliteBGS can now skip over
|
||||
those and keep processing. This way players won't have to delete lines in their
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<Version>0.3.7</Version>
|
||||
<Version>0.4.1</Version>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
@@ -18,12 +18,15 @@
|
||||
<Copyright>Copyright 2019 by Florian Stinglmayr</Copyright>
|
||||
<RepositoryUrl>https://codeberg.org/nola/EDBGS</RepositoryUrl>
|
||||
<PackageTags>ED;Elite Dangerous;BGS</PackageTags>
|
||||
<PackageProjectUrl>https://bgs.n0la.org</PackageProjectUrl>
|
||||
<PackageProjectUrl>https://salusinvicta.org/bgstool/</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<Description>Elite: Dangerous BGS logging and reporting tool
|
||||
</Description>
|
||||
<PackageIcon>logo_v5.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="main-page.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="main-page.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@@ -37,15 +40,10 @@
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
<None Update="docs\CHANGELOG.md">
|
||||
<None Update="CHANGELOG.md">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="docs\main-page.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="LICENCE.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
@@ -55,12 +53,12 @@
|
||||
<Resource Include="Salus.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,15 +9,112 @@
|
||||
mc:Ignorable="d"
|
||||
Title="Elite: Dangerous BGS Helper" Height="520" Width="950" Icon="Salus.ico" Closing="window_Closing">
|
||||
<Window.Resources>
|
||||
<local:MinusFortyFiveConverter x:Key="MinusFortyFiveConverter" />
|
||||
<Style x:Key="StretchingTreeViewStyle" TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
<local:MinusFortyFiveConverter x:Key="MinusFortyFiveConverter" />
|
||||
|
||||
<local:Report x:Key="ObjectivesBasedOnSystem" />
|
||||
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:SystemObjectives}" ItemsSource="{Binding Path=Objectives}">
|
||||
<Grid
|
||||
HorizontalAlignment="Stretch"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding SystemName}" FontWeight="DemiBold"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}"
|
||||
ItemsSource="{Binding Path=UITransactions}"
|
||||
ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
||||
<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" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="Faction: " Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding Faction}" FontWeight="DemiBold"/>
|
||||
</StackPanel>
|
||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
||||
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<ToggleButton x:Name="ToggleAll" Content="Toggle All" Click="ToggleAll_Click" IsChecked="True" IsThreeState="False"/>
|
||||
<Separator Margin="2,0,2,0" />
|
||||
<Button x:Name="AddCombatZone" Content="Add Combat Zone" Click="AddCombatZone_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type local:UITransaction}">
|
||||
<!-- This will stretch out the width of the item-->
|
||||
<Grid Initialized="Transaction_Initialized"
|
||||
HorizontalAlignment="Left"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
Margin="0,2,0,2"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CompletedAt}" Margin="2,0,2,0" HorizontalAlignment="Right" TextAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
|
||||
<Expander Header="Optional Objectives" Visibility="{Binding IsShipCombatZone}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCaptain" Margin="2,0,2,0" Content="Allied Captain" IsChecked="{Binding HasAlliedCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCaptain" Margin="2,0,2,0" Content="Enemy Captain" IsChecked="{Binding HasEnemyCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCorrespondent" Margin="2,0,2,0" Content="Allied Correspondent" IsChecked="{Binding HasAlliedCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCorrespondent" Margin="2,0,2,0" Content="Enemy Correspondent" IsChecked="{Binding HasEnemyCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Difficulty">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
|
||||
<Button x:Name="Med" Content="Med" Click="Med_Click"/>
|
||||
<Button x:Name="High" Content="High" Click="High_Click"/>
|
||||
<Button x:Name="VeryHigh" Content="Very High" Click="VeryHigh_Click" />
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Type">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
|
||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
||||
<Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
|
||||
<TextBlock Text="Adjust Profit: " TextAlignment="Center" />
|
||||
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="Profit_LostFocus" KeyUp="Profit_KeyUp"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
</Window.Resources>
|
||||
<mah:MetroWindow.RightWindowCommands>
|
||||
<mah:WindowCommands ShowSeparators="False">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,5,0">
|
||||
<Hyperlink x:Name="URL" NavigateUri="https://bgs.n0la.org/" RequestNavigate="URL_RequestNavigate">Homepage</Hyperlink>
|
||||
<Hyperlink x:Name="URL" NavigateUri="https://salusinvicta.org/bgstool/" RequestNavigate="URL_RequestNavigate">Homepage</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,15,0">
|
||||
<Hyperlink x:Name="SRC" NavigateUri="https://codeberg.org/nola/EDBGS" RequestNavigate="URL_RequestNavigate">Source</Hyperlink>
|
||||
@@ -63,95 +160,19 @@
|
||||
<Button x:Name="GenerateDiscord" Content="Generate Discord Report" VerticalAlignment="Stretch" Margin="0,0,0,0" VerticalContentAlignment="Center" Click="GenerateDiscord_Click"/>
|
||||
<Separator />
|
||||
<ComboBox x:Name="LogType" VerticalAlignment="Stretch" Margin="0,3,0,3" Width="140" SelectionChanged="LogType_SelectionChanged" />
|
||||
<Separator />
|
||||
<CheckBox x:Name="SelectAll" Content="Select All" IsChecked="True" Click="SelectAll_Click"/>
|
||||
</ToolBar>
|
||||
<TreeView CheckBox.Checked="TreeView_CheckBox_Updated"
|
||||
CheckBox.Unchecked="TreeView_CheckBox_Updated"
|
||||
x:Name="entries" Margin="0,0,0,0"
|
||||
Grid.ColumnSpan="3" Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="2"
|
||||
KeyUp="entries_KeyUp"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
ItemsSource="{Binding Source={StaticResource ObjectivesBasedOnSystem}}"
|
||||
>
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type local:Objective}" ItemsSource="{Binding UITransactions}" ItemContainerStyle="{StaticResource StretchingTreeViewStyle}">
|
||||
<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" VerticalAlignment="Center" Margin="0,2,0,2">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="System: " Visibility="{Binding HasSystem}" Margin="2,0,0,0"/>
|
||||
<TextBlock Text="{Binding System}" FontWeight="DemiBold" Visibility="{Binding HasSystem}"/>
|
||||
<TextBlock Text="Faction: " Visibility="{Binding HasFaction}" Margin="2,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" HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<ToggleButton x:Name="ToggleAll" Content="Toggle All" Click="ToggleAll_Click" IsChecked="True" IsThreeState="False"/>
|
||||
<Separator Margin="2,0,2,0" />
|
||||
<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="Left"
|
||||
Width="{Binding ActualWidth, ElementName=entries, Converter={StaticResource MinusFortyFiveConverter}}"
|
||||
Margin="0,2,0,2"
|
||||
>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<CheckBox Focusable="False" IsChecked="{Binding IsEnabled}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding CompletedAt}" Margin="2,0,2,0" HorizontalAlignment="Right" TextAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}" FontWeight="DemiBold" TextAlignment="Center"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
|
||||
<Expander Header="Optional Objectives" Visibility="{Binding IsShipCombatZone}">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCaptain" Margin="2,0,2,0" Content="Allied Captain" IsChecked="{Binding HasAlliedCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCaptain" Margin="2,0,2,0" Content="Enemy Captain" IsChecked="{Binding HasEnemyCaptain, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="AlliedCorrespondent" Margin="2,0,2,0" Content="Allied Correspondent" IsChecked="{Binding HasAlliedCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="EnemyCorrespondent" Margin="2,0,2,0" Content="Enemy Correspondent" IsChecked="{Binding HasEnemyCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
|
||||
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Difficulty">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button x:Name="Low" Content="Low" Click="Low_Click"/>
|
||||
<Button x:Name="Med" Content="Med" Click="Med_Click"/>
|
||||
<Button x:Name="High" Content="High" Click="High_Click"/>
|
||||
<Button x:Name="VeryHigh" Content="Very High" Click="VeryHigh_Click" />
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<Expander Header="Type">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
|
||||
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
|
||||
<Button Content="AX" x:Name="Thargoid" Click="Thargoid_Click"/>
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="SellCargo" Visibility="{Binding IsSellCargo}">
|
||||
<TextBlock Text="Adjust Profit: " TextAlignment="Center" />
|
||||
<TextBox x:Name="Profit" MinWidth="80" HorizontalContentAlignment="Right" Text="{Binding Profit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" LostFocus="Profit_LostFocus" KeyUp="Profit_KeyUp"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</HierarchicalDataTemplate>
|
||||
</HierarchicalDataTemplate.ItemTemplate>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
||||
|
||||
@@ -107,6 +107,10 @@ public partial class MainWindow : MetroWindow {
|
||||
//{ "HouseSalus", Color.FromRgb(0xBC, 0x94, 0x39) },
|
||||
{ "HouseSalus", Color.FromRgb(0xED, 0xDA, 0x70) },
|
||||
{ "NovaNavy", Color.FromRgb(0xA1, 0xA4, 0xDB) },
|
||||
// Official Red of the Polish Flag
|
||||
{ "PolskaGurom", Color.FromRgb(0xD4, 0x21, 0x3D) },
|
||||
// Official Blue in the Armenian Flag
|
||||
{ "ArmeniaBlue", Color.FromRgb(0x00, 0x33, 0xA0) },
|
||||
};
|
||||
|
||||
foreach (var colourtheme in colorThemes) {
|
||||
@@ -192,7 +196,7 @@ public partial class MainWindow : MetroWindow {
|
||||
transactions.RemoveAll(x => incompletes.Contains(x));
|
||||
|
||||
report = new Report(transactions);
|
||||
this.entries.ItemsSource = report.Objectives;
|
||||
this.entries.ItemsSource = report.SystemObjectives;
|
||||
} catch (Exception exception) {
|
||||
Log("Something went terribly wrong while parsing the E:D player journal.");
|
||||
Log("Please send this to CMDR Hekateh:");
|
||||
@@ -271,15 +275,27 @@ public partial class MainWindow : MetroWindow {
|
||||
object obj = entries.SelectedItem;
|
||||
bool removed = false;
|
||||
|
||||
if (obj.GetType() == typeof(Objective)) {
|
||||
removed = report.Objectives.Remove(obj as Objective);
|
||||
if (obj.GetType() == typeof(SystemObjectives)) {
|
||||
removed = report.SystemObjectives.Remove(obj as SystemObjectives);
|
||||
} else if (obj.GetType() == typeof(Objective)) {
|
||||
report
|
||||
.SystemObjectives
|
||||
.ForEach(x => {
|
||||
if (x.Objectives.Remove(obj as Objective)) {
|
||||
removed = true;
|
||||
}
|
||||
});
|
||||
} else if (obj.GetType() == typeof(UITransaction) ||
|
||||
obj.GetType().IsSubclassOf(typeof(UITransaction))) {
|
||||
foreach (Objective parent in report.Objectives) {
|
||||
if (parent.UITransactions.Remove(obj as UITransaction)) {
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
obj.GetType().IsSubclassOf(typeof(UITransaction))) {
|
||||
report
|
||||
.SystemObjectives
|
||||
.SelectMany(x =>
|
||||
x.Objectives
|
||||
.Where(x => x.UITransactions.Contains(obj as UITransaction))
|
||||
)
|
||||
.ToList()
|
||||
.ForEach(x => removed = x.UITransactions.Remove(obj as UITransaction))
|
||||
;
|
||||
}
|
||||
|
||||
if (removed) {
|
||||
@@ -557,4 +573,11 @@ public partial class MainWindow : MetroWindow {
|
||||
} catch (Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectAll_Click(object sender, RoutedEventArgs e) {
|
||||
if (report == null) {
|
||||
return;
|
||||
}
|
||||
report.SystemObjectives.ForEach(t => { t.IsEnabled = (bool)SelectAll.IsChecked; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class MinusFortyFiveConverter : IValueConverter {
|
||||
/// <inheritdoc/>
|
||||
public object Convert(
|
||||
object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
return (double)value - 80;
|
||||
return (double)value - 110;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -242,7 +242,7 @@ public class UITransaction : INotifyPropertyChanged {
|
||||
}
|
||||
|
||||
public class Objective : IComparable<Objective> {
|
||||
public bool IsEnabled { get; set; }
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
public List<UITransaction> UITransactions { get; } = new List<UITransaction>();
|
||||
|
||||
|
||||
@@ -49,5 +49,5 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.3.7.0")]
|
||||
[assembly: AssemblyFileVersion("0.3.7.0")]
|
||||
[assembly: AssemblyVersion("0.4.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.4.1.0")]
|
||||
|
||||
@@ -7,7 +7,7 @@ been parsed, you may then generate a BGS report you can copy/paste into Discord.
|
||||
|
||||
Source code is available at [https://codeberg.org/nola/edbgs](https://codeberg.org/nola/edbgs).
|
||||
|
||||
Binary downloads can be found here: [https://bgs.n0la.org/](https://bgs.n0la.org/).
|
||||
Binary downloads can be found here: [https://salusinvicta.org/bgstool/](https://salusinvicta.org/bgstool/).
|
||||
|
||||
## How To
|
||||
|
||||
|
||||
@@ -1,10 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using EDPlayerJournal.BGS;
|
||||
|
||||
namespace EliteBGS;
|
||||
|
||||
public class SystemObjectives : INotifyPropertyChanged, IComparable<SystemObjectives> {
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private bool isenabled = true;
|
||||
|
||||
public bool IsEnabled {
|
||||
get { return isenabled; }
|
||||
set {
|
||||
isenabled = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsEnabled"));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsExpanded { get; set; } = false;
|
||||
|
||||
public string SystemName { get; set; } = string.Empty;
|
||||
|
||||
public List<Objective> Objectives { get; set; } = new();
|
||||
|
||||
public int CompareTo(SystemObjectives other) {
|
||||
if (other == null) return 1;
|
||||
return string.Compare(SystemName, other.SystemName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public class Report {
|
||||
public List<Objective> Objectives { get; set; } = new List<Objective>();
|
||||
public List<SystemObjectives> SystemObjectives { get; set; } = new();
|
||||
|
||||
public Report() { }
|
||||
|
||||
@@ -12,29 +40,35 @@ public class Report {
|
||||
Populate(transactions);
|
||||
}
|
||||
|
||||
public List<Objective> Objectives {
|
||||
get {
|
||||
return SystemObjectives
|
||||
.Where(t => t.IsEnabled)
|
||||
.SelectMany(x => x.Objectives)
|
||||
.ToList()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
private void Populate(List<Transaction> transactions) {
|
||||
if (transactions == null || transactions.Count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Transaction t in transactions) {
|
||||
Objective o;
|
||||
if (t.SystemContribution) {
|
||||
o = Objectives.Find(x => x.Matches(t.System));
|
||||
} else {
|
||||
o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
}
|
||||
|
||||
var o = SystemObjectives.Find(x => string.Compare(x.SystemName, t.System) == 0);
|
||||
if (o == null) {
|
||||
if (t.SystemContribution) {
|
||||
o = new Objective() { System = t.System };
|
||||
} else {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
}
|
||||
Objectives.Add(o);
|
||||
o = new SystemObjectives() { SystemName = t.System };
|
||||
SystemObjectives.Add(o);
|
||||
}
|
||||
|
||||
o.UITransactions.Add(new UITransaction(t));
|
||||
var objective = o.Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
if (objective == null) {
|
||||
objective = new Objective() { Faction = t.Faction, System = t.System };
|
||||
o.Objectives.Add(objective);
|
||||
}
|
||||
objective.UITransactions.Add(new UITransaction(t));
|
||||
}
|
||||
|
||||
SystemObjectives.Sort();
|
||||
}
|
||||
}
|
||||
|
||||
BIN
EliteBGS/combatzone.png
Normal file
BIN
EliteBGS/combatzone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB |
@@ -26,7 +26,7 @@ You can download the **latest** version **0.3.7** at CodeBerg:
|
||||
|
||||
Or alternatively from my server:
|
||||
|
||||
* [https://bgs.n0la.org/elitebgs-0.3.6.zip](https://bgs.n0la.org/elitebgs-0.3.7.zip)
|
||||
* [https://bgs.n0la.org/elitebgs-0.3.7.zip](https://bgs.n0la.org/elitebgs-0.3.7.zip)
|
||||
|
||||
## Old Versions
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 74 KiB |
@@ -1,15 +0,0 @@
|
||||
site_name: EliteBGS
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.snippets:
|
||||
check_paths: true
|
||||
|
||||
theme:
|
||||
name: lumen
|
||||
|
||||
nav:
|
||||
- Overview: 'index.md'
|
||||
- "Detailed Description": 'description.md'
|
||||
- "Combat Zones": 'combatzones.md'
|
||||
- FAQ: 'faq.md'
|
||||
- Changelog: 'CHANGELOG.md'
|
||||
@@ -3,7 +3,7 @@
|
||||
EDBGS is a project containing the EliteBGS BGS application. It also contains the dotnet
|
||||
class library EDPlayerJournal, which reads and parses Elite Dangerous player journals.
|
||||
|
||||
See [https://bgs.n0la.org/](https://bgs.n0la.org) for further details.
|
||||
See [https://salusinvicta.org/bgstool/](https://salusinvicta.org/bgstool/) for further details.
|
||||
|
||||
The tool helps with creating BGS reports for squadrons that support factions in
|
||||
Elite: Dangerous that can be copy and pasted into a Discord server. It finds all BGS
|
||||
|
||||
Reference in New Issue
Block a user