implement support for faction kill bonds

This commit is contained in:
Florian Stinglmayr 2021-09-28 13:20:59 +02:00
parent 55677f2965
commit fcf1802d22
3 changed files with 55 additions and 3 deletions

43
BGS/FactionKillBonds.cs Normal file
View 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));
}
}
}

View File

@ -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);

View File

@ -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" />