factions for onfoot murders are right there

This commit is contained in:
Florian Stinglmayr 2022-11-26 00:30:42 +01:00
parent e01d3a869d
commit 6e5f8f504f
2 changed files with 30 additions and 8 deletions

View File

@ -319,15 +319,29 @@ internal class CommitCrimeParser : TransactionParserPart {
victim = "Unknown"; victim = "Unknown";
} }
if (!context.NPCFaction.ContainsKey(victim)) { string faction;
transactions.AddIncomplete(
new FoulMurder(),
"Crime victim was not properly scanned."
);
return;
}
string faction = context.NPCFaction[victim]; if (entry.IsCrime(CrimeTypes.OnFootMurder)) {
if (entry.Faction == null) {
transactions.AddIncomplete(
new FoulMurder(),
"On foot murder victim did not have a faction"
);
return;
}
// On foot murders are different, there the faction is
// the faction the NPC belonged too
faction = entry.Faction;
} else {
if (!context.NPCFaction.ContainsKey(victim)) {
transactions.AddIncomplete(
new FoulMurder(),
"Crime victim was not properly scanned."
);
return;
}
faction = context.NPCFaction[victim];
}
transactions.Add(new FoulMurder(entry) { transactions.Add(new FoulMurder(entry) {
System = context.CurrentSystem, System = context.CurrentSystem,

View File

@ -19,4 +19,12 @@ public class CommitCrimeEntry : Entry {
public bool IsMurder { public bool IsMurder {
get { return CrimeType?.CompareTo(CrimeTypes.Murder) == 0 || CrimeType?.CompareTo(CrimeTypes.OnFootMurder) == 0; } get { return CrimeType?.CompareTo(CrimeTypes.Murder) == 0 || CrimeType?.CompareTo(CrimeTypes.OnFootMurder) == 0; }
} }
public bool IsCrime(string crimetype) {
if (CrimeType == null) {
return false;
}
return string.Compare(CrimeType, crimetype) == 0;
}
} }