Compare commits
4 Commits
aea12022a7
...
2a55c05806
Author | SHA1 | Date | |
---|---|---|---|
2a55c05806 | |||
941e0ff4c6 | |||
3df438a465 | |||
afad459210 |
@ -115,12 +115,14 @@ namespace EliteBGS.BGS {
|
|||||||
foreach (MissionFailed failed in missions) {
|
foreach (MissionFailed failed in missions) {
|
||||||
MissionFailedEntry f = failed.Failed;
|
MissionFailedEntry f = failed.Failed;
|
||||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||||
failed.Entries.Count,
|
failed.Amount,
|
||||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||||
failed.Faction
|
failed.Faction
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.Append("\n");
|
||||||
|
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ namespace EliteBGS.BGS {
|
|||||||
public List<Entry> Entries => entries;
|
public List<Entry> Entries => entries;
|
||||||
public string Station { get; set; }
|
public string Station { get; set; }
|
||||||
public string System { get; set; }
|
public string System { get; set; }
|
||||||
|
public ulong SystemAddress { get; set; }
|
||||||
public string Faction { get; set; }
|
public string Faction { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this entry was manually added. Manually added entries are not deleted
|
/// Whether this entry was manually added. Manually added entries are not deleted
|
||||||
|
@ -29,7 +29,7 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
var entry = Entries[0] as MissionCompletedEntry;
|
var entry = Entries[0] as MissionCompletedEntry;
|
||||||
var influence = entry.GetInfluenceForFaction(Faction);
|
var influence = entry.GetInfluenceForFaction(Faction, SystemAddress);
|
||||||
|
|
||||||
builder.AppendFormat("{0}", MissionName);
|
builder.AppendFormat("{0}", MissionName);
|
||||||
if (influence != "") {
|
if (influence != "") {
|
||||||
|
@ -29,6 +29,9 @@ namespace EliteBGS.BGS {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +1 since the other entries are just copies of the one we have in our properties
|
||||||
|
public int Amount => Entries.Count + 1;
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
@ -37,8 +40,7 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
||||||
// +1 since the other entries are just copies of the one we have in our properties
|
Amount,
|
||||||
Entries.Count + 1,
|
|
||||||
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -244,12 +244,14 @@ namespace EliteBGS.BGS {
|
|||||||
foreach (MissionFailed failed in missions) {
|
foreach (MissionFailed failed in missions) {
|
||||||
MissionFailedEntry f = failed.Failed;
|
MissionFailedEntry f = failed.Failed;
|
||||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||||
failed.Entries.Count,
|
failed.Amount,
|
||||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||||
failed.Faction
|
failed.Faction
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.Append("\n");
|
||||||
|
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,10 @@ namespace EliteBGS.BGS {
|
|||||||
List<Entry> relevant = entries.Where(x => IsRelevant(x)).ToList();
|
List<Entry> relevant = entries.Where(x => IsRelevant(x)).ToList();
|
||||||
Dictionary<int, MissionAcceptedEntry> acceptedMissions = new Dictionary<int, MissionAcceptedEntry>();
|
Dictionary<int, MissionAcceptedEntry> acceptedMissions = new Dictionary<int, MissionAcceptedEntry>();
|
||||||
Dictionary<string, long> buyCost = new Dictionary<string, long>();
|
Dictionary<string, long> buyCost = new Dictionary<string, long>();
|
||||||
|
Dictionary<ulong, string> systems = new Dictionary<ulong, string>();
|
||||||
|
|
||||||
string current_system = null;
|
string current_system = null;
|
||||||
|
ulong current_system_address = 0;
|
||||||
string current_station = null;
|
string current_station = null;
|
||||||
string controlling_faction = null;
|
string controlling_faction = null;
|
||||||
|
|
||||||
@ -80,17 +82,34 @@ namespace EliteBGS.BGS {
|
|||||||
current_station = docked.StationName;
|
current_station = docked.StationName;
|
||||||
current_system = docked.StarSystem;
|
current_system = docked.StarSystem;
|
||||||
controlling_faction = docked.StationFaction;
|
controlling_faction = docked.StationFaction;
|
||||||
|
current_system_address = docked.SystemAddress;
|
||||||
|
|
||||||
|
if (!systems.ContainsKey(docked.SystemAddress)) {
|
||||||
|
systems.Add(docked.SystemAddress, docked.StarSystem);
|
||||||
|
}
|
||||||
} else if (e.Is(Events.FSDJump)) {
|
} else if (e.Is(Events.FSDJump)) {
|
||||||
/* Gleem current system and controlling faction from this message.
|
/* Gleem current system and controlling faction from this message.
|
||||||
*/
|
*/
|
||||||
current_system = (e as FSDJumpEntry).StarSystem;
|
FSDJumpEntry fsd = e as FSDJumpEntry;
|
||||||
controlling_faction = (e as FSDJumpEntry).SystemFaction;
|
current_system_address = fsd.SystemAddress;
|
||||||
|
current_system = fsd.StarSystem;
|
||||||
|
controlling_faction = fsd.SystemFaction;
|
||||||
|
|
||||||
|
if (!systems.ContainsKey(fsd.SystemAddress)) {
|
||||||
|
systems.Add(fsd.SystemAddress, fsd.StarSystem);
|
||||||
|
}
|
||||||
} else if (e.Is(Events.Location)) {
|
} else if (e.Is(Events.Location)) {
|
||||||
/* Get current system, faction name and station from Location message
|
/* Get current system, faction name and station from Location message
|
||||||
*/
|
*/
|
||||||
LocationEntry location = e as LocationEntry;
|
LocationEntry location = e as LocationEntry;
|
||||||
|
|
||||||
current_system = location.StarSystem;
|
current_system = location.StarSystem;
|
||||||
|
current_system_address = location.SystemAddress;
|
||||||
|
|
||||||
|
if (!systems.ContainsKey(location.SystemAddress)) {
|
||||||
|
systems.Add(location.SystemAddress, location.StarSystem);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(location.SystemFaction)) {
|
if (!string.IsNullOrEmpty(location.SystemFaction)) {
|
||||||
controlling_faction = location.SystemFaction;
|
controlling_faction = location.SystemFaction;
|
||||||
}
|
}
|
||||||
@ -114,7 +133,8 @@ namespace EliteBGS.BGS {
|
|||||||
var completed = e as MissionCompletedEntry;
|
var completed = e as MissionCompletedEntry;
|
||||||
results.Add(new MissionCompleted(completed) {
|
results.Add(new MissionCompleted(completed) {
|
||||||
System = current_system,
|
System = current_system,
|
||||||
Station = current_station
|
Station = current_station,
|
||||||
|
SystemAddress = current_system_address,
|
||||||
});
|
});
|
||||||
if (completed.HumanReadableNameWasGenerated) {
|
if (completed.HumanReadableNameWasGenerated) {
|
||||||
/* If the human readable name was generated, we send a log message. Because the
|
/* If the human readable name was generated, we send a log message. Because the
|
||||||
@ -126,22 +146,27 @@ namespace EliteBGS.BGS {
|
|||||||
"\" was generated, please report this.");
|
"\" was generated, please report this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string other in completed.AffectedFactions.Where(x => !x.Equals(results[0].Faction))) {
|
if (completed.Influences.Count > 1) {
|
||||||
string faction = other;
|
foreach (var other in completed.Influences) {
|
||||||
string influence = completed.GetInfluenceForFaction(faction);
|
string faction = other.Key;
|
||||||
|
if (string.IsNullOrEmpty(faction)) {
|
||||||
/* ignore empty factions which can happen
|
continue;
|
||||||
* I assume that this denotes that you are losing REP with a superpower
|
}
|
||||||
*/
|
foreach (var influences in other.Value) {
|
||||||
if (string.IsNullOrEmpty(faction)) {
|
ulong system_address = influences.Key;
|
||||||
continue;
|
if (!faction.Equals(results[0].Faction) ||
|
||||||
|
(faction.Equals(results[0].Faction) && system_address != current_system_address)) {
|
||||||
|
string system = systems.TryGetValue(system_address, out string sys) ? sys : "";
|
||||||
|
results.Add(new InfluenceSupport() {
|
||||||
|
Faction = faction,
|
||||||
|
Influence = influences.Value,
|
||||||
|
System = system,
|
||||||
|
SystemAddress = system_address,
|
||||||
|
RelevantMission = results[0] as MissionCompleted
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
results.Add(new InfluenceSupport() {
|
|
||||||
Faction = faction,
|
|
||||||
Influence = influence,
|
|
||||||
RelevantMission = results[0] as MissionCompleted
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else if (e.Is(Events.MissionAccepted)) {
|
} else if (e.Is(Events.MissionAccepted)) {
|
||||||
MissionAcceptedEntry accepted = e as MissionAcceptedEntry;
|
MissionAcceptedEntry accepted = e as MissionAcceptedEntry;
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
# EliteBGS changelog
|
# EliteBGS changelog
|
||||||
|
|
||||||
## 0.1.0-beta7 on ??.??.2022
|
## 0.1.0-beta7 on 27.01.2022
|
||||||
|
|
||||||
* Added murders, since they give negative INF for the target faction.
|
* Added murders, since they give negative INF for the target faction.
|
||||||
* Cargo is now collated for the NONA discord template.
|
* Cargo is now collated for the NONA discord template.
|
||||||
* Empty secondary influences no longer show up.
|
* Empty secondary influences no longer show up.
|
||||||
* Market buying is not part of the BGS since Update 10.
|
* Market buying is not part of the BGS since Update 10.
|
||||||
* Remove decimal point unless absolutely necessary.
|
* Remove decimal point unless absolutely necessary.
|
||||||
|
* Fixed log file template regarding failed missions.
|
||||||
|
* Support missions were the source and target are both the same faction, but in
|
||||||
|
different systems. Here both systems should be listed in the BGS list.
|
||||||
|
|
||||||
## 0.1.0-beta6 on 22.01.2022
|
## 0.1.0-beta6 on 22.01.2022
|
||||||
|
|
||||||
|
@ -186,6 +186,8 @@
|
|||||||
<Content Include="main-objectives.png">
|
<Content Include="main-objectives.png">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Resource Include="TestData\SameInfTwice-Log.txt" />
|
||||||
|
<None Include="TestData\SameInfTwice.txt" />
|
||||||
<None Include="CHANGELOG.md">
|
<None Include="CHANGELOG.md">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
1439
TestData/SameInfTwice-Log.txt
Normal file
1439
TestData/SameInfTwice-Log.txt
Normal file
File diff suppressed because one or more lines are too long
47
TestData/SameInfTwice.txt
Normal file
47
TestData/SameInfTwice.txt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
This happens when target and source faction are the same faction
|
||||||
|
|
||||||
|
{ "timestamp":"2022-01-26T23:14:26Z", "event":"MissionAccepted", "Faction":"Peraesii Empire Consulate", "Name":"Mission_Courier_Famine", "LocalisedName":"Famine Data Transportation", "TargetFaction":"Peraesii Empire Consulate", "DestinationSystem":"Madngela", "DestinationStation":"Napier Dock", "Expiry":"2022-01-27T23:10:47Z", "Wing":false, "Influence":"++", "Reputation":"+", "Reward":94062, "MissionID":840783745 }
|
||||||
|
{ "timestamp":"2022-01-26T23:42:37Z", "event":"MissionCompleted", "Faction":"Peraesii Empire Consulate", "Name":"Mission_Courier_Famine_name", "MissionID":840783745, "TargetFaction":"Peraesii Empire Consulate", "DestinationSystem":"Madngela", "DestinationStation":"Napier Dock", "Reward":11002, "FactionEffects":[ { "Faction":"Peraesii Empire Consulate", "Effects":[ { "Effect":"$MISSIONUTIL_Interaction_Summary_EP_up;", "Effect_Localised":"The economic status of $#MinorFaction; has improved in the $#System; system.", "Trend":"UpGood" }, { "Effect":"$MISSIONUTIL_Interaction_Summary_EP_up;", "Effect_Localised":"The economic status of $#MinorFaction; has improved in the $#System; system.", "Trend":"UpGood" } ], "Influence":[ { "SystemAddress":7269097350585, "Trend":"UpGood", "Influence":"+++" }, { "SystemAddress":2557887746778, "Trend":"UpGood", "Influence":"+++" } ], "ReputationTrend":"UpGood", "Reputation":"++" } ] }
|
||||||
|
|
||||||
|
{
|
||||||
|
"timestamp": "2022-01-26T23:42:37Z",
|
||||||
|
"event": "MissionCompleted",
|
||||||
|
"Faction": "Peraesii Empire Consulate",
|
||||||
|
"Name": "Mission_Courier_Famine_name",
|
||||||
|
"MissionID": 840783745,
|
||||||
|
"TargetFaction": "Peraesii Empire Consulate",
|
||||||
|
"DestinationSystem": "Madngela",
|
||||||
|
"DestinationStation": "Napier Dock",
|
||||||
|
"Reward": 11002,
|
||||||
|
"FactionEffects": [
|
||||||
|
{
|
||||||
|
"Faction": "Peraesii Empire Consulate",
|
||||||
|
"Effects": [
|
||||||
|
{
|
||||||
|
"Effect": "$MISSIONUTIL_Interaction_Summary_EP_up;",
|
||||||
|
"Effect_Localised": "The economic status of $#MinorFaction; has improved in the $#System; system.",
|
||||||
|
"Trend": "UpGood"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Effect": "$MISSIONUTIL_Interaction_Summary_EP_up;",
|
||||||
|
"Effect_Localised": "The economic status of $#MinorFaction; has improved in the $#System; system.",
|
||||||
|
"Trend": "UpGood"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Influence": [
|
||||||
|
{
|
||||||
|
"SystemAddress": 7269097350585,
|
||||||
|
"Trend": "UpGood",
|
||||||
|
"Influence": "+++"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SystemAddress": 2557887746778,
|
||||||
|
"Trend": "UpGood",
|
||||||
|
"Influence": "+++"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ReputationTrend": "UpGood",
|
||||||
|
"Reputation": "++"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user