for murders take the faction from the ship

This commit is contained in:
2022-02-12 16:22:08 +01:00
parent 59e3373716
commit 6048ce0756
4 changed files with 663 additions and 5 deletions

View File

@@ -127,12 +127,12 @@ namespace EliteBGS.BGS {
} else if (e.Is(Events.ShipTargeted)) {
ShipTargetedEntry targeted = e as ShipTargetedEntry;
if (string.IsNullOrEmpty(targeted.PilotName) ||
if (string.IsNullOrEmpty(targeted.PilotNameLocalised) ||
string.IsNullOrEmpty(targeted.Faction)) {
continue;
}
npcfactions.Add(targeted.PilotName, targeted.Faction);
npcfactions[targeted.PilotNameLocalised] = targeted.Faction;
} else if (e.Is(Events.CommitCrime)) {
CommitCrimeEntry crime = e as CommitCrimeEntry;
string faction = crime.Faction;
@@ -142,16 +142,22 @@ namespace EliteBGS.BGS {
continue;
}
if (!npcfactions.ContainsKey(crime.Victim)) {
/* use localised victim name if we have it, otherwise use normal name */
string victim = crime.VictimLocalised;
if (string.IsNullOrEmpty(victim)) {
victim = crime.Victim;
}
if (!npcfactions.ContainsKey(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
victim, crime.Faction
));
} else {
faction = npcfactions[crime.Victim];
faction = npcfactions[victim];
}
results.Add(new FoulMurder(crime) {