implement selling cargo to controlling faction
This commit is contained in:
parent
3b1fc79dba
commit
1d747756ac
@ -43,6 +43,26 @@ namespace NonaBGS.BGS {
|
||||
"(Total value: {1} CR)\n", pages, sum);
|
||||
}
|
||||
|
||||
private string BuildCargoSold(Objective objective) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
SellCargo[] sold = objective.LogEntries
|
||||
.OfType<SellCargo>()
|
||||
.ToArray()
|
||||
;
|
||||
|
||||
if (sold == null && sold.Length > 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (SellCargo sell in sold) {
|
||||
builder.AppendFormat("{0}\n", sell.ToString());
|
||||
}
|
||||
|
||||
builder.AppendFormat("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildMicroResourcesSold(Objective objective) {
|
||||
var total = from entries in objective.LogEntries
|
||||
where entries.GetType() == typeof(SellMicroResources)
|
||||
@ -199,6 +219,9 @@ namespace NonaBGS.BGS {
|
||||
var micro = BuildMicroResourcesSold(objective);
|
||||
entries.Append(micro);
|
||||
|
||||
var sold = BuildCargoSold(objective);
|
||||
entries.Append(sold);
|
||||
|
||||
log.Append(entries.ToString().Trim());
|
||||
log.Append("\n```\n");
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ namespace NonaBGS.BGS {
|
||||
e.Is(Events.MultiSellExplorationData) ||
|
||||
e.Is(Events.SellMicroResources) ||
|
||||
e.Is(Events.RedeemVoucher) ||
|
||||
e.Is(Events.FactionKillBond)
|
||||
e.Is(Events.FactionKillBond) ||
|
||||
e.Is(Events.MarketSell)
|
||||
;
|
||||
}
|
||||
|
||||
@ -105,6 +106,14 @@ namespace NonaBGS.BGS {
|
||||
collate = true;
|
||||
} else if (e.Is(Events.SellMicroResources)) {
|
||||
entry = new SellMicroResources(current_system, current_station);
|
||||
entry.Entries.Add(e);
|
||||
} else if (e.Is(Events.MarketSell)) {
|
||||
entry = new SellCargo() {
|
||||
Faction = controlling_faction,
|
||||
Station = current_station,
|
||||
System = current_system
|
||||
};
|
||||
|
||||
entry.Entries.Add(e);
|
||||
}
|
||||
|
||||
|
31
BGS/SellCargo.cs
Normal file
31
BGS/SellCargo.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using EDJournal;
|
||||
|
||||
namespace NonaBGS.BGS {
|
||||
public class SellCargo : LogEntry {
|
||||
public override string ToString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var sold = Entries.OfType<MarketSellEntry>().ToArray();
|
||||
|
||||
if (sold == null || sold.Length == 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
foreach (MarketSellEntry sell in sold) {
|
||||
builder.AppendFormat("Sold {0} {1} to the {2}\n",
|
||||
sell.Count,
|
||||
sell.Type,
|
||||
sell.BlackMarket ? "Black Market" : "Commodity Market"
|
||||
);
|
||||
}
|
||||
|
||||
return builder.ToString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selling resources to a market only helps the controlling faction
|
||||
/// </summary>
|
||||
public override bool OnlyControllingFaction => true;
|
||||
}
|
||||
}
|
@ -41,7 +41,8 @@
|
||||
<Reference Include="AutoCompleteTextBox, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>packages\AutoCompleteTextBox.1.1.1\lib\net472\AutoCompleteTextBox.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EDJournal">
|
||||
<Reference Include="EDJournal, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\edjournal\bin\Debug\EDJournal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
@ -75,6 +76,7 @@
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="BGS\DiscordLogGenerator.cs" />
|
||||
<Compile Include="BGS\NonaDiscordLog.cs" />
|
||||
<Compile Include="BGS\SellCargo.cs" />
|
||||
<Compile Include="BGS\SellMicroResources.cs" />
|
||||
<Compile Include="BGS\FactionKillBonds.cs" />
|
||||
<Compile Include="EDDB\PopulatedSystems.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user