Compare commits
3 Commits
e01d3a869d
...
8d95a42698
Author | SHA1 | Date | |
---|---|---|---|
8d95a42698 | |||
aa7f0bcd1a | |||
6e5f8f504f |
@ -29,7 +29,6 @@ public class CombatZone : Transaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return string.Format("Won {0} x {1} {2} Combat Zone(s) for {3}",
|
return string.Format("Won {0} x {1} {2} Combat Zone(s)", Amount, Grade, Type);
|
||||||
Amount, Grade, Type, Faction);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,48 @@
|
|||||||
using EDPlayerJournal.BGS;
|
using EDPlayerJournal.BGS;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using EDPlayerJournal;
|
||||||
|
|
||||||
namespace EliteBGS.LogGenerator;
|
namespace EliteBGS.LogGenerator;
|
||||||
|
|
||||||
public class MurderFormat : GenericFormat<FoulMurder> {
|
public class MurderFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
var logs = objective
|
||||||
|
.EnabledOfType<FoulMurder>()
|
||||||
|
.GroupBy(x => x.CrimeType)
|
||||||
|
.ToDictionary(x => x.Key, x => x.ToList())
|
||||||
|
;
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
if (logs == null || logs.Count() <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var log in logs) {
|
||||||
|
string type;
|
||||||
|
|
||||||
|
if (string.Compare(log.Key, CrimeTypes.Murder) == 0) {
|
||||||
|
if (log.Value.Count > 1) {
|
||||||
|
type = "ships";
|
||||||
|
} else {
|
||||||
|
type = "ship";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (log.Value.Count > 1) {
|
||||||
|
type = "people";
|
||||||
|
} else {
|
||||||
|
type = "person";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
builder.AppendFormat("Murdered {0} {1} (Bounties: {2}, Fines: {3})",
|
||||||
|
log.Value.Count, type,
|
||||||
|
log.Value.Sum(x => x.Bounties),
|
||||||
|
log.Value.Sum(x => x.Fines)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user