Compare commits

...

4 Commits

Author SHA1 Message Date
55e5ba4f1b update README 2022-02-09 09:46:00 +01:00
e6e675c350 update changelog 2022-02-09 09:45:25 +01:00
5f9634cd83 add search and rescue 2022-02-09 09:44:25 +01:00
bd50962794 fix a minor formatting bug 2022-02-07 16:56:38 +01:00
11 changed files with 119 additions and 34 deletions

View File

@ -9,8 +9,10 @@ using EliteBGS.BGS.LogGenerator;
namespace EliteBGS.BGS { namespace EliteBGS.BGS {
public class GenericDiscordLog : IDiscordLogGenerator { public class GenericDiscordLog : IDiscordLogGenerator {
private List<LogFormatter> formatters = new List<LogFormatter>() { private List<LogFormatter> formatters = new List<LogFormatter>() {
new VistaGenomics(), new VistaGenomicsFormat(),
new SearchAndRescueFormat(),
}; };
private string FormatDate() { private string FormatDate() {
DateTime today = DateTime.Now; DateTime today = DateTime.Now;
return today.ToString("dd/MM/yyyy"); return today.ToString("dd/MM/yyyy");
@ -39,8 +41,8 @@ namespace EliteBGS.BGS {
.ToArray() .ToArray()
; ;
if (sold == null && sold.Length > 0) { if (sold == null || sold.Length <= 0) {
return builder.ToString(); return "";
} }
foreach (SellCargo sell in sold) { foreach (SellCargo sell in sold) {

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EliteBGS.BGS.LogGenerator {
/// <summary>
/// Creates a generic log block, that is simply all LogEntries of type "Type"
/// per line
/// </summary>
/// <typeparam name="Type">LogEntry subtype to work on</typeparam>
public class GenericFormat<Type> : LogFormatter {
public string GenerateLog(Objective objective) {
IEnumerable<Type> logs = objective.LogEntries.OfType<Type>();
StringBuilder builder = new StringBuilder();
if (logs == null || logs.Count() <= 0) {
return "";
}
foreach (Type log in logs) {
builder.AppendLine(log.ToString());
}
return builder.ToString();
}
}
}

View File

@ -0,0 +1,4 @@
namespace EliteBGS.BGS.LogGenerator {
public class SearchAndRescueFormat : GenericFormat<SearchAndRescue> {
}
}

View File

@ -1,22 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EliteBGS.BGS.LogGenerator {
class VistaGenomics : LogFormatter {
public string GenerateLog(Objective objective) {
IEnumerable<OrganicData> logs = objective.LogEntries.OfType<OrganicData>();
StringBuilder builder = new StringBuilder();
if (logs == null || logs.Count() < 0) {
return "";
}
foreach(OrganicData log in logs) {
builder.AppendLine(log.ToString());
}
return builder.ToString();
}
}
}

View File

@ -0,0 +1,4 @@
namespace EliteBGS.BGS.LogGenerator {
class VistaGenomicsFormat : GenericFormat<VistaGenomicsFormat> {
}
}

View File

@ -9,7 +9,8 @@ using EliteBGS.BGS.LogGenerator;
namespace EliteBGS.BGS { namespace EliteBGS.BGS {
public class NonaDiscordLog : IDiscordLogGenerator { public class NonaDiscordLog : IDiscordLogGenerator {
private List<LogFormatter> formatters = new List<LogFormatter>() { private List<LogFormatter> formatters = new List<LogFormatter>() {
new VistaGenomics(), new VistaGenomicsFormat(),
new SearchAndRescueFormat(),
}; };
private string FormatDate() { private string FormatDate() {
@ -60,8 +61,8 @@ namespace EliteBGS.BGS {
.ToArray() .ToArray()
; ;
if (sold == null && sold.Length > 0) { if (sold == null || sold.Length <= 0) {
return builder.ToString(); return "";
} }
@ -346,7 +347,10 @@ namespace EliteBGS.BGS {
entries.Append(sold); entries.Append(sold);
foreach (LogFormatter formatter in formatters) { foreach (LogFormatter formatter in formatters) {
entries.AppendFormat("{0}\n", formatter.GenerateLog(objective)); string text = formatter.GenerateLog(objective);
if (!string.IsNullOrEmpty(text)) {
entries.AppendFormat("{0}\n", text);
}
} }
log.Append(entries.ToString().Trim()); log.Append(entries.ToString().Trim());

View File

@ -36,6 +36,7 @@ namespace EliteBGS.BGS {
e.Is(Events.FSDJump) || e.Is(Events.FSDJump) ||
e.Is(Events.Location) || e.Is(Events.Location) ||
e.Is(Events.MultiSellExplorationData) || e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.SearchAndRescue) ||
e.Is(Events.SellExplorationData) || e.Is(Events.SellExplorationData) ||
e.Is(Events.SellMicroResources) || e.Is(Events.SellMicroResources) ||
e.Is(Events.SellOrganicData) || e.Is(Events.SellOrganicData) ||
@ -246,6 +247,14 @@ namespace EliteBGS.BGS {
System = current_system, System = current_system,
}); });
collate = true;
} else if (e.Is(Events.SearchAndRescue)) {
results.Add(new SearchAndRescue(e as SearchAndRescueEntry) {
Faction = controlling_faction,
Station = current_station,
System = current_system,
});
collate = true; collate = true;
} else if (e.Is(Events.MarketSell)) { } else if (e.Is(Events.MarketSell)) {
MarketSellEntry sell = e as MarketSellEntry; MarketSellEntry sell = e as MarketSellEntry;

49
BGS/SearchAndRescue.cs Normal file
View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EDJournal;
namespace EliteBGS.BGS {
public class SearchAndRescue : LogEntry {
public SearchAndRescue (SearchAndRescueEntry e) {
Entries.Add(e);
}
public long Count {
get {
return Entries.OfType<SearchAndRescueEntry>().Sum(x => x.Count);
}
}
public string NameLocalised {
get {
return Entries.OfType<SearchAndRescueEntry>().First().NameLocalised;
}
}
public override int CompareTo(LogEntry o) {
if (o == null || o.GetType() != typeof(SearchAndRescue)) {
return -1;
}
SearchAndRescue other = o as SearchAndRescue;
if (other.System == System &&
other.Station == Station &&
other.Faction == Faction &&
other.NameLocalised == NameLocalised) {
return 0;
}
return -1;
}
public override string ToString() {
return string.Format("Contributed {0} {1} to Search and Rescue", Count, NameLocalised);
}
public override bool OnlyControllingFaction => true;
}
}

View File

@ -1,5 +1,9 @@
# EliteBGS changelog # EliteBGS changelog
## 0.1.0-beta10 on ??.02.2022
* Added search and rescue.
## 0.1.0-beta9 on 07.02.2022 ## 0.1.0-beta9 on 07.02.2022
* Added Vista Genomics to the reports. * Added Vista Genomics to the reports.

View File

@ -85,12 +85,15 @@
<Compile Include="BGS\FoulMurder.cs" /> <Compile Include="BGS\FoulMurder.cs" />
<Compile Include="BGS\GenericDiscordLog.cs" /> <Compile Include="BGS\GenericDiscordLog.cs" />
<Compile Include="BGS\InfluenceSupport.cs" /> <Compile Include="BGS\InfluenceSupport.cs" />
<Compile Include="BGS\LogGenerator\GenericFormat.cs" />
<Compile Include="BGS\LogGenerator\LogFormatter.cs" /> <Compile Include="BGS\LogGenerator\LogFormatter.cs" />
<Compile Include="BGS\LogGenerator\VistaGenomics.cs" /> <Compile Include="BGS\LogGenerator\SearchAndRescueFormat.cs" />
<Compile Include="BGS\LogGenerator\VistaGenomicsFormat.cs" />
<Compile Include="BGS\MissionFailed.cs" /> <Compile Include="BGS\MissionFailed.cs" />
<Compile Include="BGS\NonaDiscordLog.cs" /> <Compile Include="BGS\NonaDiscordLog.cs" />
<Compile Include="BGS\BuyCargo.cs" /> <Compile Include="BGS\BuyCargo.cs" />
<Compile Include="BGS\OrganicData.cs" /> <Compile Include="BGS\OrganicData.cs" />
<Compile Include="BGS\SearchAndRescue.cs" />
<Compile Include="BGS\SellCargo.cs" /> <Compile Include="BGS\SellCargo.cs" />
<Compile Include="BGS\SellMicroResources.cs" /> <Compile Include="BGS\SellMicroResources.cs" />
<Compile Include="BGS\FactionKillBonds.cs" /> <Compile Include="BGS\FactionKillBonds.cs" />

View File

@ -23,15 +23,16 @@ Once you have your objectives have been configured, you can press "Parse Journal
will check your Elite Dangerous player journal for completed missions. Currently the tool will check your Elite Dangerous player journal for completed missions. Currently the tool
recognises the following completed tasks: recognises the following completed tasks:
* Buying of cargo from stations (new in Update 10)
* Completed missions * Completed missions
* Failed missions * Failed missions
* Murders * Murders
* Vouchers, including bounty vouchers, combat bonds, and settlement vouchers (aka intel packages) * Search and Rescue contributions
* Selling of micro resources (Odyssey only)
* Selling of organic data (Odyssey only)
* Selling cartography data * Selling cartography data
* Selling of cargo to stations * Selling of cargo to stations
* Buying of cargo from stations (new in Update 10) * Selling of micro resources (Odyssey only)
* Selling of organic data (Odyssey only)
* Vouchers, including bounty vouchers, combat bonds, and settlement vouchers (aka intel packages)
Selling cargo attempts to discern the profit and/or loss, which is helpful to gauge BGS Selling cargo attempts to discern the profit and/or loss, which is helpful to gauge BGS
impact. But the player journal does not tell the amount of profit in the sell message. impact. But the player journal does not tell the amount of profit in the sell message.