implement support for faction kill bonds
This commit is contained in:
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user