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,6 +319,20 @@ internal class CommitCrimeParser : TransactionParserPart {
victim = "Unknown"; victim = "Unknown";
} }
string faction;
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)) { if (!context.NPCFaction.ContainsKey(victim)) {
transactions.AddIncomplete( transactions.AddIncomplete(
new FoulMurder(), new FoulMurder(),
@ -326,8 +340,8 @@ internal class CommitCrimeParser : TransactionParserPart {
); );
return; return;
} }
faction = context.NPCFaction[victim];
string 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;
}
} }