add vista genomics to the tool

This commit is contained in:
Florian Stinglmayr 2022-02-07 16:47:00 +01:00
parent 5dbbcd2512
commit b4260059d7
8 changed files with 134 additions and 0 deletions

View File

@ -4,9 +4,13 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using EDJournal; using EDJournal;
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>() {
new VistaGenomics(),
};
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");
@ -291,6 +295,10 @@ namespace EliteBGS.BGS {
var sold = BuildCargoSold(objective); var sold = BuildCargoSold(objective);
entries.Append(sold); entries.Append(sold);
foreach (LogFormatter formatter in formatters) {
entries.AppendFormat("{0}\n", formatter.GenerateLog(objective));
}
log.Append(entries.ToString().Trim()); log.Append(entries.ToString().Trim());
log.Append("\n```\n"); log.Append("\n```\n");
} }

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EliteBGS.BGS.LogGenerator {
public interface LogFormatter {
string GenerateLog(Objective objective);
}
}

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

@ -4,9 +4,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Globalization; using System.Globalization;
using EDJournal; using EDJournal;
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>() {
new VistaGenomics(),
};
private string FormatDate() { private string FormatDate() {
CultureInfo cultureInfo = CultureInfo.InvariantCulture; CultureInfo cultureInfo = CultureInfo.InvariantCulture;
StringBuilder date = new StringBuilder(); StringBuilder date = new StringBuilder();
@ -340,6 +345,10 @@ namespace EliteBGS.BGS {
var sold = BuildCargoSold(objective); var sold = BuildCargoSold(objective);
entries.Append(sold); entries.Append(sold);
foreach (LogFormatter formatter in formatters) {
entries.AppendFormat("{0}\n", formatter.GenerateLog(objective));
}
log.Append(entries.ToString().Trim()); log.Append(entries.ToString().Trim());
log.Append("\n```\n"); log.Append("\n```\n");
} }

45
BGS/OrganicData.cs Normal file
View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EDJournal;
namespace EliteBGS.BGS {
public class OrganicData : LogEntry {
public OrganicData(SellOrganicDataEntry e) {
Entries.Add(e);
}
public long TotalValue {
get {
return Entries.OfType<SellOrganicDataEntry>().Sum(x => x.TotalValue);
}
}
public override int CompareTo(LogEntry other) {
if (other == null || other.GetType() != typeof(OrganicData)) {
return -1;
}
if (other.Faction == Faction &&
other.System == System &&
other.Station == Station) {
return 0;
}
return -1;
}
public override string ToString() {
return string.Format("Sold {0} worth of organic data to Vista Genomics",
Credits.FormatCredits(TotalValue)
);
}
/* Selling organic data only helps the controlling faction, just like
* selling cartographic data.
*/
public override bool OnlyControllingFaction => true;
}
}

View File

@ -38,6 +38,7 @@ namespace EliteBGS.BGS {
e.Is(Events.MultiSellExplorationData) || e.Is(Events.MultiSellExplorationData) ||
e.Is(Events.SellExplorationData) || e.Is(Events.SellExplorationData) ||
e.Is(Events.SellMicroResources) || e.Is(Events.SellMicroResources) ||
e.Is(Events.SellOrganicData) ||
e.Is(Events.RedeemVoucher) || e.Is(Events.RedeemVoucher) ||
e.Is(Events.FactionKillBond) || e.Is(Events.FactionKillBond) ||
e.Is(Events.MarketBuy) || e.Is(Events.MarketBuy) ||
@ -195,6 +196,15 @@ namespace EliteBGS.BGS {
}); });
/* colate single cartographic selling into one */ /* colate single cartographic selling into one */
collate = true;
} else if (e.Is(Events.SellOrganicData)) {
/* organic data sold to Vista Genomics */
results.Add(new OrganicData(e as SellOrganicDataEntry) {
System = current_system,
Station = current_station,
Faction = controlling_faction,
});
collate = true; collate = true;
} else if (e.Is(Events.MultiSellExplorationData)) { } else if (e.Is(Events.MultiSellExplorationData)) {
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters. /* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.

View File

@ -85,9 +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\LogFormatter.cs" />
<Compile Include="BGS\LogGenerator\VistaGenomics.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\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" />
@ -186,6 +189,7 @@
<Content Include="main-objectives.png"> <Content Include="main-objectives.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<None Include="TestData\SellOrganicData.txt" />
<None Include="TestData\Double-5-Inf.txt" /> <None Include="TestData\Double-5-Inf.txt" />
<None Include="TestData\SameInfTwice-Log.txt" /> <None Include="TestData\SameInfTwice-Log.txt" />
<None Include="TestData\SameInfTwice.txt" /> <None Include="TestData\SameInfTwice.txt" />

View File

@ -0,0 +1,25 @@
{ "timestamp":"2022-02-06T16:36:53Z", "event":"Fileheader", "part":1, "language":"English/UK", "Odyssey":true, "gameversion":"4.0.0.1102", "build":"r280672/r0 " }
{ "timestamp":"2022-02-06T18:10:13Z", "event":"Music", "MusicTrack":"NoTrack" }
{ "timestamp":"2022-02-06T18:10:26Z", "event":"ReceiveText", "From":"", "Message":"$COMMS_entered:#name=Akualanu;", "Message_Localised":"Entered Channel: Akualanu", "Channel":"npc" }
{ "timestamp":"2022-02-06T18:10:26Z", "event":"FSDJump", "Taxi":false, "Multicrew":false, "StarSystem":"Akualanu", "SystemAddress":5069805856169, "StarPos":[63.78125,-128.50000,3.00000], "SystemAllegiance":"Empire", "SystemEconomy":"$economy_Tourism;", "SystemEconomy_Localised":"Tourism", "SystemSecondEconomy":"$economy_HighTech;", "SystemSecondEconomy_Localised":"High Tech", "SystemGovernment":"$government_Patronage;", "SystemGovernment_Localised":"Patronage", "SystemSecurity":"$SYSTEM_SECURITY_low;", "SystemSecurity_Localised":"Low Security", "Population":787019, "Body":"Akualanu A", "BodyID":1, "BodyType":"Star", "Powers":[ "A. Lavigny-Duval" ], "PowerplayState":"Exploited", "JumpDist":40.001, "FuelUsed":4.849240, "FuelLevel":22.573641, "Factions":[ { "Name":"Akualanu United & Co", "FactionState":"War", "Government":"Corporate", "Influence":0.158000, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand3;", "Happiness_Localised":"Discontented", "MyReputation":100.000000, "RecoveringStates":[ { "State":"InfrastructureFailure", "Trend":0 } ], "ActiveStates":[ { "State":"Lockdown" }, { "State":"Famine" }, { "State":"War" } ] }, { "Name":"Alacagui Holdings", "FactionState":"War", "Government":"Corporate", "Influence":0.086000, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":55.000000, "RecoveringStates":[ { "State":"PirateAttack", "Trend":0 } ], "ActiveStates":[ { "State":"War" } ] }, { "Name":"Left Party of Akualanu", "FactionState":"War", "Government":"Communism", "Influence":0.086000, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand3;", "Happiness_Localised":"Discontented", "MyReputation":95.899399, "RecoveringStates":[ { "State":"InfrastructureFailure", "Trend":0 } ], "ActiveStates":[ { "State":"Lockdown" }, { "State":"Famine" }, { "State":"War" } ] }, { "Name":"Cartel of Akualanu", "FactionState":"Famine", "Government":"Anarchy", "Influence":0.028000, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand2;", "Happiness_Localised":"Happy", "MyReputation":29.040001, "RecoveringStates":[ { "State":"InfrastructureFailure", "Trend":0 } ], "ActiveStates":[ { "State":"Famine" } ] }, { "Name":"Revolutionary Akualanu Liberals", "FactionState":"Bust", "Government":"Democracy", "Influence":0.085000, "Allegiance":"Independent", "Happiness":"$Faction_HappinessBand3;", "Happiness_Localised":"Discontented", "MyReputation":43.093700, "PendingStates":[ { "State":"Lockdown", "Trend":0 } ], "ActiveStates":[ { "State":"InfrastructureFailure" }, { "State":"Bust" } ] }, { "Name":"Conservatives of Cockaigne", "FactionState":"War", "Government":"Dictatorship", "Influence":0.138000, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand3;", "Happiness_Localised":"Discontented", "MyReputation":70.000000, "ActiveStates":[ { "State":"CivilUnrest" }, { "State":"InfrastructureFailure" }, { "State":"War" } ] }, { "Name":"Nova Paresa", "FactionState":"Investment", "Government":"Patronage", "Influence":0.419000, "Allegiance":"Empire", "Happiness":"$Faction_HappinessBand1;", "Happiness_Localised":"Elated", "SquadronFaction":true, "MyReputation":100.000000, "ActiveStates":[ { "State":"Investment" }, { "State":"CivilLiberty" } ] } ], "SystemFaction":{ "Name":"Nova Paresa", "FactionState":"Investment" }, "Conflicts":[ { "WarType":"war", "Status":"active", "Faction1":{ "Name":"Akualanu United & Co", "Stake":"Konig Institution", "WonDays":0 }, "Faction2":{ "Name":"Conservatives of Cockaigne", "Stake":"", "WonDays":1 } }, { "WarType":"war", "Status":"active", "Faction1":{ "Name":"Alacagui Holdings", "Stake":"Ware Cultivation Facility", "WonDays":2 }, "Faction2":{ "Name":"Left Party of Akualanu", "Stake":"", "WonDays":2 } } ] }
{ "timestamp":"2022-02-06T18:10:26Z", "event":"Music", "MusicTrack":"DestinationFromHyperspace" }
{ "timestamp":"2022-02-06T18:10:31Z", "event":"Music", "MusicTrack":"Supercruise" }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"FSSSignalDiscovered", "SystemAddress":5069805856169, "SignalName":"P.T.N. RACKMOBILE H0H-W6T", "IsStation":true }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"FSSSignalDiscovered", "SystemAddress":5069805856169, "SignalName":"BARON VON ZOOMSKI K8L-04G", "IsStation":true }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"FSSSignalDiscovered", "SystemAddress":5069805856169, "SignalName":"Hughes Vista", "IsStation":true }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"FSSSignalDiscovered", "SystemAddress":5069805856169, "SignalName":"GOTHAM CITY J8T-1VM", "IsStation":true }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"FSSSignalDiscovered", "SystemAddress":5069805856169, "SignalName":"NAUVOO JNB-BHF", "IsStation":true }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"SupercruiseExit", "Taxi":false, "Multicrew":false, "StarSystem":"Akualanu", "SystemAddress":5069805856169, "Body":"Hughes Vista", "BodyID":29, "BodyType":"Station" }
{ "timestamp":"2022-02-06T18:12:18Z", "event":"Music", "MusicTrack":"DestinationFromSupercruise" }
{ "timestamp":"2022-02-06T18:12:23Z", "event":"Music", "MusicTrack":"NoTrack" }
{ "timestamp":"2022-02-06T18:12:23Z", "event":"ReceiveText", "From":"Hughes Vista", "Message":"$STATION_NoFireZone_entered;", "Message_Localised":"No fire zone entered.", "Channel":"npc" }
{ "timestamp":"2022-02-06T18:12:23Z", "event":"DockingRequested", "MarketID":3222969088, "StationName":"Hughes Vista", "StationType":"Coriolis", "LandingPads":{ "Small":13, "Medium":16, "Large":8 } }
{ "timestamp":"2022-02-06T18:12:24Z", "event":"ReceiveText", "From":"Hughes Vista", "Message":"$DockingChatter_Allied;", "Message_Localised":"An ally like you is always welcome here.", "Channel":"npc" }
{ "timestamp":"2022-02-06T18:12:24Z", "event":"ReceiveText", "From":"Hughes Vista", "Message":"$STATION_docking_granted;", "Message_Localised":"Docking request granted.", "Channel":"npc" }
{ "timestamp":"2022-02-06T18:12:24Z", "event":"DockingGranted", "LandingPad":37, "MarketID":3222969088, "StationName":"Hughes Vista", "StationType":"Coriolis" }
{ "timestamp":"2022-02-06T18:12:26Z", "event":"Music", "MusicTrack":"DockingComputer" }
{ "timestamp":"2022-02-06T18:13:30Z", "event":"Docked", "StationName":"Hughes Vista", "StationType":"Coriolis", "Taxi":false, "Multicrew":false, "StarSystem":"Akualanu", "SystemAddress":5069805856169, "MarketID":3222969088, "StationFaction":{ "Name":"Nova Paresa", "FactionState":"Investment" }, "StationGovernment":"$government_Patronage;", "StationGovernment_Localised":"Patronage", "StationAllegiance":"Empire", "StationServices":[ "dock", "autodock", "commodities", "contacts", "exploration", "missions", "outfitting", "crewlounge", "rearm", "refuel", "repair", "shipyard", "tuning", "engineer", "missionsgenerated", "facilitator", "flightcontroller", "stationoperations", "powerplay", "searchrescue", "stationMenu", "shop", "livery", "socialspace", "bartender", "vistagenomics", "pioneersupplies", "apexinterstellar", "frontlinesolutions" ], "StationEconomy":"$economy_Tourism;", "StationEconomy_Localised":"Tourism", "StationEconomies":[ { "Name":"$economy_Tourism;", "Name_Localised":"Tourism", "Proportion":1.000000 } ], "DistFromStarLS":78.917615, "LandingPads":{ "Small":13, "Medium":16, "Large":8 } }
{ "timestamp":"2022-02-06T18:16:08Z", "event":"Disembark", "SRV":false, "Taxi":false, "Multicrew":false, "ID":65, "StarSystem":"Akualanu", "SystemAddress":5069805856169, "Body":"Hughes Vista", "BodyID":29, "OnStation":true, "OnPlanet":false, "StationName":"Hughes Vista", "StationType":"Coriolis", "MarketID":3222969088 }
{ "timestamp":"2022-02-06T18:16:12Z", "event":"ReceiveText", "From":"Hughes Vista", "Message":"$STATION_NoFireZone_entered;", "Message_Localised":"No fire zone entered.", "Channel":"npc" }
{ "timestamp":"2022-02-06T18:17:44Z", "event":"Promotion", "Exobiologist":1 }
{ "timestamp":"2022-02-06T18:17:44Z", "event":"SellOrganicData", "MarketID":3222969088, "BioData":[ { "Genus":"$Codex_Ent_Stratum_Genus_Name;", "Genus_Localised":"Stratum", "Species":"$Codex_Ent_Stratum_07_Name;", "Species_Localised":"Stratum Tectonicas", "Value":806300, "Bonus":0 }, { "Genus":"$Codex_Ent_Aleoids_Genus_Name;", "Genus_Localised":"Aleoida", "Species":"$Codex_Ent_Aleoids_05_Name;", "Species_Localised":"Aleoida Gravis", "Value":596500, "Bonus":0 } ] }