Compare commits
6 Commits
2bdb1847dc
...
d0bd8ce711
Author | SHA1 | Date | |
---|---|---|---|
d0bd8ce711 | |||
8f40c1d75e | |||
ceaf8035e9 | |||
3e15096dfc | |||
7274436ff2 | |||
35fbde7c3f |
@ -4,10 +4,8 @@ using EDJournal;
|
|||||||
|
|
||||||
namespace EliteBGS.BGS {
|
namespace EliteBGS.BGS {
|
||||||
public class Cartographics : LogEntry {
|
public class Cartographics : LogEntry {
|
||||||
public Cartographics(MultiSellExplorationDataEntry e, string current_system, string current_station) {
|
public Cartographics(MultiSellExplorationDataEntry e) {
|
||||||
Entries.Add(e);
|
Entries.Add(e);
|
||||||
System = current_system;
|
|
||||||
Station = current_station;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int TotalSum {
|
public int TotalSum {
|
||||||
|
24
BGS/InfluenceSupport.cs
Normal file
24
BGS/InfluenceSupport.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS {
|
||||||
|
/// <summary>
|
||||||
|
/// This class is used when a completed mission gives influence to another
|
||||||
|
/// faction as well. This happens, for example, when you deliver cargo from one
|
||||||
|
/// faction to another. Both sometimes gain influence.
|
||||||
|
/// </summary>
|
||||||
|
public class InfluenceSupport : LogEntry {
|
||||||
|
public string Influence { get; set; }
|
||||||
|
public MissionCompleted RelevantMission { get; set; }
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
builder.AppendFormat("Influence gained from \"{0}\": \"{1}\"",
|
||||||
|
RelevantMission.MissionName,
|
||||||
|
string.IsNullOrEmpty(Influence) ? "NONE" : Influence
|
||||||
|
);
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,6 @@ namespace EliteBGS.BGS {
|
|||||||
throw new NotImplementedException("not implemented");
|
throw new NotImplementedException("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => this.ToString();
|
public string Name => ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
||||||
Entries.Count,
|
// +1 since the other entries are just copies of the one we have in our properties
|
||||||
|
Entries.Count + 1,
|
||||||
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
122
BGS/Report.cs
122
BGS/Report.cs
@ -65,7 +65,7 @@ namespace EliteBGS.BGS {
|
|||||||
objectives.ForEach(x => x.Clear());
|
objectives.ForEach(x => x.Clear());
|
||||||
|
|
||||||
foreach (var e in relevant) {
|
foreach (var e in relevant) {
|
||||||
LogEntry entry = null;
|
List<LogEntry> results = new List<LogEntry>();
|
||||||
bool collate = false;
|
bool collate = false;
|
||||||
|
|
||||||
if (e.Is(Events.Docked)) {
|
if (e.Is(Events.Docked)) {
|
||||||
@ -94,10 +94,10 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
} else if (e.Is(Events.MissionCompleted)) {
|
} else if (e.Is(Events.MissionCompleted)) {
|
||||||
var completed = e as MissionCompletedEntry;
|
var completed = e as MissionCompletedEntry;
|
||||||
entry = new MissionCompleted(completed) {
|
results.Add(new MissionCompleted(completed) {
|
||||||
System = current_system,
|
System = current_system,
|
||||||
Station = current_station
|
Station = current_station
|
||||||
};
|
});
|
||||||
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
|
||||||
* generated names all sort of suck, we should have more human readable names in
|
* generated names all sort of suck, we should have more human readable names in
|
||||||
@ -107,6 +107,17 @@ namespace EliteBGS.BGS {
|
|||||||
completed.Name +
|
completed.Name +
|
||||||
"\" was generated, please report this.");
|
"\" was generated, please report this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (string other in completed.AffectedFactions.Where(x => !x.Equals(results[0].Faction))) {
|
||||||
|
string faction = other;
|
||||||
|
string influence = completed.GetInfluenceForFaction(faction);
|
||||||
|
|
||||||
|
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;
|
||||||
acceptedMissions[accepted.MissionID] = accepted;
|
acceptedMissions[accepted.MissionID] = accepted;
|
||||||
@ -118,7 +129,7 @@ namespace EliteBGS.BGS {
|
|||||||
"Please adjust start date to when the mission was accepted to include it in the list.");
|
"Please adjust start date to when the mission was accepted to include it in the list.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entry = new MissionFailed(accepted) { Failed = failed, System = current_system };
|
results.Add(new MissionFailed(accepted) { Failed = failed, System = current_system });
|
||||||
if (failed.HumanReadableName == null) {
|
if (failed.HumanReadableName == null) {
|
||||||
OnLog?.Invoke("Human readable name for mission \"" +
|
OnLog?.Invoke("Human readable name for mission \"" +
|
||||||
failed.Name +
|
failed.Name +
|
||||||
@ -131,27 +142,28 @@ namespace EliteBGS.BGS {
|
|||||||
} 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.
|
||||||
*/
|
*/
|
||||||
entry = new Cartographics(e as MultiSellExplorationDataEntry, current_system, current_station);
|
results.Add(new Cartographics(e as MultiSellExplorationDataEntry) {
|
||||||
entry.Faction = controlling_faction;
|
System = current_system,
|
||||||
|
Station = current_station,
|
||||||
|
Faction = controlling_faction
|
||||||
|
});
|
||||||
} else if (e.Is(Events.RedeemVoucher)) {
|
} else if (e.Is(Events.RedeemVoucher)) {
|
||||||
/* Same for selling combat vouchers. Only the current controlling faction matters here.
|
/* Same for selling combat vouchers. Only the current controlling faction matters here.
|
||||||
*/
|
*/
|
||||||
entry = new Vouchers();
|
results.Add(new Vouchers(e as RedeemVoucherEntry) {
|
||||||
entry.Entries.Add(e);
|
System = current_system,
|
||||||
entry.System = current_system;
|
Station = current_station,
|
||||||
entry.Station = current_station;
|
Faction = (e as RedeemVoucherEntry).Factions.FirstOrDefault() ?? "",
|
||||||
entry.Faction = (e as RedeemVoucherEntry).Factions.FirstOrDefault() ?? "";
|
ControllingFaction = controlling_faction,
|
||||||
entry.ControllingFaction = controlling_faction;
|
});
|
||||||
|
|
||||||
collate = true;
|
collate = true;
|
||||||
} else if (e.Is(Events.SellMicroResources)) {
|
} else if (e.Is(Events.SellMicroResources)) {
|
||||||
entry = new SellMicroResources() {
|
results.Add(new SellMicroResources(e as SellMicroResourcesEntry) {
|
||||||
Faction = controlling_faction,
|
Faction = controlling_faction,
|
||||||
Station = current_station,
|
Station = current_station,
|
||||||
System = current_system
|
System = current_system
|
||||||
};
|
});
|
||||||
|
|
||||||
entry.Entries.Add(e);
|
|
||||||
} else if (e.Is(Events.MarketBuy)) {
|
} else if (e.Is(Events.MarketBuy)) {
|
||||||
MarketBuyEntry buy = e as MarketBuyEntry;
|
MarketBuyEntry buy = e as MarketBuyEntry;
|
||||||
if (string.IsNullOrEmpty(buy.Type) || buy.BuyPrice == 0) {
|
if (string.IsNullOrEmpty(buy.Type) || buy.BuyPrice == 0) {
|
||||||
@ -169,60 +181,60 @@ namespace EliteBGS.BGS {
|
|||||||
profit = sell.TotalSale - (avg * sell.Count);
|
profit = sell.TotalSale - (avg * sell.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = new SellCargo() {
|
results.Add(new SellCargo(e as MarketSellEntry) {
|
||||||
Faction = controlling_faction,
|
Faction = controlling_faction,
|
||||||
Station = current_station,
|
Station = current_station,
|
||||||
System = current_system,
|
System = current_system,
|
||||||
Profit = profit
|
Profit = profit
|
||||||
};
|
});
|
||||||
|
|
||||||
entry.Entries.Add(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry == null) {
|
if (results == null || results.Count <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find all objectives that generally match.
|
foreach (LogEntry entry in results) {
|
||||||
*/
|
/* Find all objectives that generally match.
|
||||||
var matches = objectives
|
|
||||||
.Where(x => x.Matches(entry) > 0)
|
|
||||||
.OrderBy(x => x.Matches(entry))
|
|
||||||
;
|
|
||||||
|
|
||||||
Objective objective = null;
|
|
||||||
if (matches != null && matches.Count() > 0) {
|
|
||||||
/* Then select the one that matches the most.
|
|
||||||
*/
|
*/
|
||||||
objective = matches
|
var matches = objectives
|
||||||
|
.Where(x => x.Matches(entry) > 0)
|
||||||
.OrderBy(x => x.Matches(entry))
|
.OrderBy(x => x.Matches(entry))
|
||||||
.Reverse()
|
|
||||||
.First()
|
|
||||||
;
|
;
|
||||||
} else {
|
|
||||||
/* create a new objective if we don't have one */
|
|
||||||
objective = new Objective() {
|
|
||||||
Station = entry.Station,
|
|
||||||
Faction = entry.Faction,
|
|
||||||
System = entry.System,
|
|
||||||
};
|
|
||||||
objectives.Add(objective);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogEntry existing = null;
|
Objective objective = null;
|
||||||
|
if (matches != null && matches.Count() > 0) {
|
||||||
existing = objective.LogEntries.Find(x => {
|
/* Then select the one that matches the most.
|
||||||
try {
|
*/
|
||||||
return x.CompareTo(entry) == 0;
|
objective = matches
|
||||||
} catch (NotImplementedException) {
|
.OrderBy(x => x.Matches(entry))
|
||||||
return false;
|
.Reverse()
|
||||||
|
.First()
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
/* create a new objective if we don't have one */
|
||||||
|
objective = new Objective() {
|
||||||
|
Station = entry.Station,
|
||||||
|
Faction = entry.Faction,
|
||||||
|
System = entry.System,
|
||||||
|
};
|
||||||
|
objectives.Add(objective);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (collate && existing != null) {
|
LogEntry existing = null;
|
||||||
existing.Entries.Add(e);
|
|
||||||
} else if (!collate || existing == null) {
|
existing = objective.LogEntries.Find(x => {
|
||||||
objective.LogEntries.Add(entry);
|
try {
|
||||||
|
return x.CompareTo(entry) == 0;
|
||||||
|
} catch (NotImplementedException) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (collate && existing != null) {
|
||||||
|
existing.Entries.Add(e);
|
||||||
|
} else if (!collate || existing == null) {
|
||||||
|
objective.LogEntries.Add(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,13 @@ using EDJournal;
|
|||||||
namespace EliteBGS.BGS {
|
namespace EliteBGS.BGS {
|
||||||
public class SellCargo : LogEntry {
|
public class SellCargo : LogEntry {
|
||||||
public int Profit { get; set; }
|
public int Profit { get; set; }
|
||||||
|
|
||||||
|
public SellCargo() { }
|
||||||
|
|
||||||
|
public SellCargo(MarketSellEntry e) {
|
||||||
|
Entries.Add(e);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
var sold = Entries.OfType<MarketSellEntry>().ToArray();
|
var sold = Entries.OfType<MarketSellEntry>().ToArray();
|
||||||
@ -14,9 +21,20 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (MarketSellEntry sell in sold) {
|
foreach (MarketSellEntry sell in sold) {
|
||||||
|
string cargo;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(sell.TypeLocalised)) {
|
||||||
|
cargo = sell.TypeLocalised;
|
||||||
|
} else {
|
||||||
|
cargo = sell.Type;
|
||||||
|
if (cargo.Length >= 2) {
|
||||||
|
cargo = cargo[0].ToString().ToUpper() + cargo.Substring(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
builder.AppendFormat("Sold {0} {1} to the {2}",
|
builder.AppendFormat("Sold {0} {1} to the {2}",
|
||||||
sell.Count,
|
sell.Count,
|
||||||
sell.Type,
|
cargo,
|
||||||
sell.BlackMarket ? "Black Market" : "Commodity Market"
|
sell.BlackMarket ? "Black Market" : "Commodity Market"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -12,6 +12,12 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SellMicroResources() { }
|
||||||
|
|
||||||
|
public SellMicroResources(SellMicroResourcesEntry e) {
|
||||||
|
Entries.Add(e);
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return string.Format("Sell Micro Resources: {0}", Credits.FormatCredits(TotalSum));
|
return string.Format("Sell Micro Resources: {0}", Credits.FormatCredits(TotalSum));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,13 @@ namespace EliteBGS.BGS {
|
|||||||
public class Vouchers : LogEntry {
|
public class Vouchers : LogEntry {
|
||||||
private string type = null;
|
private string type = null;
|
||||||
|
|
||||||
|
public Vouchers() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vouchers(RedeemVoucherEntry e) {
|
||||||
|
Entries.Add(e);
|
||||||
|
}
|
||||||
|
|
||||||
public int TotalSum {
|
public int TotalSum {
|
||||||
get {
|
get {
|
||||||
return Entries
|
return Entries
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BGS\DiscordLogGenerator.cs" />
|
<Compile Include="BGS\DiscordLogGenerator.cs" />
|
||||||
<Compile Include="BGS\GenericDiscordLog.cs" />
|
<Compile Include="BGS\GenericDiscordLog.cs" />
|
||||||
|
<Compile Include="BGS\InfluenceSupport.cs" />
|
||||||
<Compile Include="BGS\MissionFailed.cs" />
|
<Compile Include="BGS\MissionFailed.cs" />
|
||||||
<Compile Include="BGS\NonaDiscordLog.cs" />
|
<Compile Include="BGS\NonaDiscordLog.cs" />
|
||||||
<Compile Include="BGS\SellCargo.cs" />
|
<Compile Include="BGS\SellCargo.cs" />
|
||||||
@ -190,9 +191,9 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="LICENCE.txt">
|
<Content Include="LICENCE.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Resource>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="logo_v4.png">
|
<Resource Include="logo_v4.png">
|
||||||
|
@ -42,6 +42,11 @@ Please note that cartography data, and micro resources only help the controlling
|
|||||||
of a station. The tool is clever enough to exclude these if the station you turn them in at, is not
|
of a station. The tool is clever enough to exclude these if the station you turn them in at, is not
|
||||||
controlled by the faction you specified in the objective.
|
controlled by the faction you specified in the objective.
|
||||||
|
|
||||||
|
Some missions may show up having zero influence for the given faction. This happens if you do
|
||||||
|
missions for a faction which is currently in an election state. You do not gain influence for
|
||||||
|
the faction so the influence reads as zero. But contribute towards the election, so the missions
|
||||||
|
are selected anyway.
|
||||||
|
|
||||||
There is no entry in the journal if you win a combat zone. So you have to add those manually. Select
|
There is no entry in the journal if you win a combat zone. So you have to add those manually. Select
|
||||||
an objective for which you wish to log a combat zone. The faction in the objective, must be the
|
an objective for which you wish to log a combat zone. The faction in the objective, must be the
|
||||||
faction you fought for in the combat zone. Then click "Add Combat Zone Win". Select type,
|
faction you fought for in the combat zone. Then click "Add Combat Zone Win". Select type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user