for murders take the faction from the ship

This commit is contained in:
Florian Stinglmayr 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) {

View File

@ -202,6 +202,8 @@
<Content Include="main-objectives.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="TestData\MurderOtherThanControllingFaction.txt" />
<None Include="TestData\TestMurder.txt" />
<None Include="TestData\SellOrganicData.txt" />
<None Include="TestData\Double-5-Inf.txt" />
<None Include="TestData\SameInfTwice-Log.txt" />

View File

@ -0,0 +1,14 @@
{ "timestamp":"2022-02-11T12:31:28Z", "event":"FSDJump", "Taxi":false, "Multicrew":false, "StarSystem":"CD-60 278", "SystemAddress":672027715001, "StarPos":[89.87500,-153.87500,40.87500], "SystemAllegiance":"Empire", "SystemEconomy":"$economy_Military;", "SystemEconomy_Localised":"Military", "SystemSecondEconomy":"$economy_HighTech;", "SystemSecondEconomy_Localised":"High Tech", "SystemGovernment":"$government_Patronage;", "SystemGovernment_Localised":"Patronage", "SystemSecurity":"$SYSTEM_SECURITY_medium;", "SystemSecurity_Localised":"Medium Security", "Population":201705, "Body":"CD-60 278", "BodyID":0, "BodyType":"Star", "JumpDist":6.190, "FuelUsed":0.529440, "FuelLevel":17.500498, "Factions":[ { "Name":"CD-60 278 Emperor's Grace", "FactionState":"CivilWar", "Government":"Patronage", "Influence":0.141294, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000, "ActiveStates":[ { "State":"CivilWar" } ] }, { "Name":"Svari Emperor's Grace", "FactionState":"None", "Government":"Patronage", "Influence":0.559204, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000 }, { "Name":"Wardhara Imperial Society", "FactionState":"Retreat", "Government":"Patronage", "Influence":0.009950, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":-42.000000, "ActiveStates":[ { "State":"Retreat" } ] }, { "Name":"CD-60 278 Crimson Organisation", "FactionState":"None", "Government":"Anarchy", "Influence":0.074627, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000 }, { "Name":"CD-60 278 Crimson Life Company", "FactionState":"None", "Government":"Corporate", "Influence":0.051741, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000 }, { "Name":"Workers of CD-60 278 Values Party", "FactionState":"CivilWar", "Government":"Democracy", "Influence":0.141294, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000, "ActiveStates":[ { "State":"CivilWar" } ] }, { "Name":"CD-60 278 Crimson Gang", "FactionState":"None", "Government":"Anarchy", "Influence":0.021891, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":0.000000 } ], "SystemFaction":{ "Name":"Svari Emperor's Grace" }, "Conflicts":[ { "WarType":"civilwar", "Status":"active", "Faction1":{ "Name":"CD-60 278 Emperor's Grace", "Stake":"Weinbaum Silo", "WonDays":0 }, "Faction2":{ "Name":"Workers of CD-60 278 Values Party", "Stake":"", "WonDays":0 } } ] }
{ "timestamp":"2022-02-11T12:36:19Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":0 }
{ "timestamp":"2022-02-11T12:36:20Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":1, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous" }
{ "timestamp":"2022-02-11T12:36:22Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":2, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous", "ShieldHealth":100.000000, "HullHealth":100.000000 }
{ "timestamp":"2022-02-11T12:36:24Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":3, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:26Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"vulture", "ScanStage":3, "PilotName":"$ShipName_Military_Empire;", "PilotName_Localised":"Imperial Navy Vessel", "PilotRank":"Competent", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:26Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":3, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:27Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"vulture", "ScanStage":3, "PilotName":"$ShipName_Military_Empire;", "PilotName_Localised":"Imperial Navy Vessel", "PilotRank":"Competent", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:28Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":3, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:29Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"vulture", "ScanStage":3, "PilotName":"$ShipName_Military_Empire;", "PilotName_Localised":"Imperial Navy Vessel", "PilotRank":"Competent", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:31Z", "event":"ShipTargeted", "TargetLocked":true, "Ship":"anaconda", "ScanStage":3, "PilotName":"$npc_name_decorate:#name=Shortland;", "PilotName_Localised":"Shortland", "PilotRank":"Dangerous", "ShieldHealth":100.000000, "HullHealth":100.000000, "Faction":"Dei Muata Society", "LegalStatus":"Clean" }
{ "timestamp":"2022-02-11T12:36:36Z", "event":"ReceiveText", "From":"$npc_name_decorate:#name=Shortland;", "From_Localised":"Shortland", "Message":"$BountyHunter_Attack02;", "Message_Localised":"You appear to be a fish worth catching.", "Channel":"npc" }
{ "timestamp":"2022-02-11T12:36:37Z", "event":"CommitCrime", "CrimeType":"assault", "Faction":"Wardhara Imperial Society", "Victim":"Shortland", "Bounty":200 }
{ "timestamp":"2022-02-11T12:38:26Z", "event":"CommitCrime", "CrimeType":"murder", "Faction":"Wardhara Imperial Society", "Victim":"Shortland", "Bounty":4238500 }

636
TestData/TestMurder.txt Normal file

File diff suppressed because one or more lines are too long