Compare commits

..

No commits in common. "55e5ba4f1b98d7530cf785ff529a8d619d99099a" and "cb19d526eb10756bd6b93cfa7fdba60003216138" have entirely different histories.

11 changed files with 34 additions and 119 deletions

View File

@ -9,10 +9,8 @@ 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 VistaGenomicsFormat(), new VistaGenomics(),
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");
@ -41,8 +39,8 @@ namespace EliteBGS.BGS {
.ToArray() .ToArray()
; ;
if (sold == null || sold.Length <= 0) { if (sold == null && sold.Length > 0) {
return ""; return builder.ToString();
} }
foreach (SellCargo sell in sold) { foreach (SellCargo sell in sold) {

View File

@ -1,27 +0,0 @@
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

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

View File

@ -0,0 +1,22 @@
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

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

View File

@ -9,8 +9,7 @@ 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 VistaGenomicsFormat(), new VistaGenomics(),
new SearchAndRescueFormat(),
}; };
private string FormatDate() { private string FormatDate() {
@ -61,8 +60,8 @@ namespace EliteBGS.BGS {
.ToArray() .ToArray()
; ;
if (sold == null || sold.Length <= 0) { if (sold == null && sold.Length > 0) {
return ""; return builder.ToString();
} }
@ -347,10 +346,7 @@ namespace EliteBGS.BGS {
entries.Append(sold); entries.Append(sold);
foreach (LogFormatter formatter in formatters) { foreach (LogFormatter formatter in formatters) {
string text = formatter.GenerateLog(objective); entries.AppendFormat("{0}\n", 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,7 +36,6 @@ 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) ||
@ -247,14 +246,6 @@ 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;

View File

@ -1,49 +0,0 @@
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,9 +1,5 @@
# 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,15 +85,12 @@
<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\SearchAndRescueFormat.cs" /> <Compile Include="BGS\LogGenerator\VistaGenomics.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,16 +23,15 @@ 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
* Search and Rescue contributions * Vouchers, including bounty vouchers, combat bonds, and settlement vouchers (aka intel packages)
* Selling cartography data
* Selling of cargo to stations
* Selling of micro resources (Odyssey only) * Selling of micro resources (Odyssey only)
* Selling of organic data (Odyssey only) * Selling of organic data (Odyssey only)
* Vouchers, including bounty vouchers, combat bonds, and settlement vouchers (aka intel packages) * Selling cartography data
* Selling of cargo to stations
* Buying of cargo from stations (new in Update 10)
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.