improve murder detection

This commit is contained in:
Florian Stinglmayr 2022-02-11 13:26:10 +01:00
parent 054376ef63
commit 59e3373716
2 changed files with 45 additions and 12 deletions

View File

@ -29,22 +29,23 @@ namespace EliteBGS.BGS {
}
private bool IsRelevant(Entry e) {
return e.Is(Events.MissionCompleted) ||
e.Is(Events.MissionFailed) ||
e.Is(Events.MissionAccepted) ||
return e.Is(Events.CommitCrime) ||
e.Is(Events.Docked) ||
e.Is(Events.FactionKillBond) ||
e.Is(Events.FSDJump) ||
e.Is(Events.Location) ||
e.Is(Events.MarketBuy) ||
e.Is(Events.MarketSell) ||
e.Is(Events.MissionAccepted) ||
e.Is(Events.MissionFailed) ||
e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.RedeemVoucher) ||
e.Is(Events.SearchAndRescue) ||
e.Is(Events.SellExplorationData) ||
e.Is(Events.SellMicroResources) ||
e.Is(Events.SellOrganicData) ||
e.Is(Events.RedeemVoucher) ||
e.Is(Events.FactionKillBond) ||
e.Is(Events.MarketBuy) ||
e.Is(Events.MarketSell) ||
e.Is(Events.CommitCrime)
e.Is(Events.ShipTargeted) ||
e.Is(Events.MissionCompleted)
;
}
@ -61,10 +62,15 @@ namespace EliteBGS.BGS {
return;
}
List<Entry> relevant = entries.Where(x => IsRelevant(x)).ToList();
List<Entry> relevant = entries
.Where(x => IsRelevant(x))
.ToList()
;
Dictionary<int, MissionAcceptedEntry> acceptedMissions = new Dictionary<int, MissionAcceptedEntry>();
Dictionary<string, long> buyCost = new Dictionary<string, long>();
Dictionary<ulong, string> systems = new Dictionary<ulong, string>();
Dictionary<string, string> npcfactions = new Dictionary<string, string>();
string current_system = null;
ulong current_system_address = 0;
@ -73,7 +79,7 @@ namespace EliteBGS.BGS {
objectives.ForEach(x => x.Clear());
foreach (var e in relevant) {
foreach (Entry e in relevant) {
List<LogEntry> results = new List<LogEntry>();
bool collate = false;
@ -118,17 +124,39 @@ namespace EliteBGS.BGS {
if (!string.IsNullOrEmpty(location.StationName)) {
current_station = location.StationName;
}
} else if (e.Is(Events.ShipTargeted)) {
ShipTargetedEntry targeted = e as ShipTargetedEntry;
if (string.IsNullOrEmpty(targeted.PilotName) ||
string.IsNullOrEmpty(targeted.Faction)) {
continue;
}
npcfactions.Add(targeted.PilotName, targeted.Faction);
} else if (e.Is(Events.CommitCrime)) {
CommitCrimeEntry crime = e as CommitCrimeEntry;
string faction = crime.Faction;
if (!crime.IsMurder) {
/* we don't care about anything but murder for now */
continue;
}
if (!npcfactions.ContainsKey(crime.Victim)) {
/* The faction in the crime report is the faction that issues the bounty,
* and not the faction of the victim.
*/
OnLog?.Invoke(string.Format(
"No faction found for victim \"{0}\", using faction that issued the bounty instead.",
crime.Victim, crime.Faction
));
} else {
faction = npcfactions[crime.Victim];
}
results.Add(new FoulMurder(crime) {
System = current_system,
Faction = crime.Faction,
Faction = faction,
});
collate = true;
} else if (e.Is(Events.MissionCompleted)) {

View File

@ -38,7 +38,7 @@ Selling cargo attempts to discern the profit and/or loss, which is helpful to ga
impact. But the player journal does not tell the amount of profit in the sell message.
So the tool looks for a buy a message related to the same commodity, and calculates loss
and/or profit from that. If the buy of the commodity is not within the time and date range,
or some other shenanigans happen that the tool does not yet support the profit/loss could
or some other shenanigans happen that the tool does not yet support, the profit/loss could
be wrong. You can use the "Adjust Trade Profit" button to manually adjust the trade profit,
or you could simply edit the discord log manually.
@ -63,6 +63,11 @@ it, if the day you accepted the mission is outside of the given date range. It n
entry where you accept the mission to connect the mission to a faction, system and station. The tool
will warn you if this happens, with a message in the error log in the fourth tab.
When committing murder, the journal entry contains the faction information of the faction that gave
you the bounty. And not the faction of the victim. The tool will look for an event in which you
scanned your victim, and gleem the victim's faction from that. If you did not scan your victim, then
sadly the tool cannot connect the victim's faction to the victim.
![Main Window with entries](main-entries.png)
The window will then list all the journal entries it has found, and group them by objectives. You