Compare commits
No commits in common. "aea12022a7f939e774f4fd0395b27daea672c473" and "f4bce14ad0d47af579f5200d91f562a21539fa6e" have entirely different histories.
aea12022a7
...
f4bce14ad0
@ -1,69 +0,0 @@
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using EDJournal;
|
||||
|
||||
namespace EliteBGS.BGS {
|
||||
public class BuyCargo : LogEntry {
|
||||
public BuyCargo() { }
|
||||
|
||||
public BuyCargo(MarketBuyEntry e) {
|
||||
Entries.Add(e);
|
||||
}
|
||||
|
||||
public string Cargo {
|
||||
get {
|
||||
string cargo;
|
||||
var sell = Entries.OfType<MarketBuyEntry>().First();
|
||||
|
||||
if (!string.IsNullOrEmpty(sell.TypeLocalised)) {
|
||||
cargo = sell.TypeLocalised;
|
||||
} else {
|
||||
cargo = sell.Type;
|
||||
if (cargo.Length >= 2) {
|
||||
cargo = cargo[0].ToString().ToUpper() + cargo.Substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
return cargo;
|
||||
}
|
||||
}
|
||||
|
||||
public long Amount {
|
||||
get { return Entries.OfType<MarketBuyEntry>().Sum(x => x.Count); }
|
||||
}
|
||||
|
||||
public override int CompareTo(LogEntry other) {
|
||||
if (other == null || other.GetType() != typeof(BuyCargo)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
BuyCargo buycargo = other as BuyCargo;
|
||||
if (buycargo.Cargo == Cargo &&
|
||||
buycargo.System == System && buycargo.Faction == Faction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (Entries.Count <= 0) {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
builder.AppendFormat("Bought {0} {1} at the Commodity Market",
|
||||
Amount,
|
||||
Cargo
|
||||
);
|
||||
|
||||
return builder.ToString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selling resources to a market only helps the controlling faction
|
||||
/// </summary>
|
||||
public override bool OnlyControllingFaction => true;
|
||||
}
|
||||
}
|
@ -221,24 +221,6 @@ namespace EliteBGS.BGS {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildMarketBuy(Objective objective) {
|
||||
BuyCargo[] buys = objective.LogEntries.OfType<BuyCargo>().ToArray();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (buys.Length <= 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach (BuyCargo buy in buys) {
|
||||
builder.Append(buy.ToString());
|
||||
builder.Append("\n");
|
||||
}
|
||||
|
||||
builder.Append("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
@ -283,9 +265,6 @@ namespace EliteBGS.BGS {
|
||||
var micro = BuildMicroResourcesSold(objective);
|
||||
entries.Append(micro);
|
||||
|
||||
var buy = BuildMarketBuy(objective);
|
||||
entries.Append(buy);
|
||||
|
||||
var sold = BuildCargoSold(objective);
|
||||
entries.Append(sold);
|
||||
|
||||
|
@ -271,24 +271,6 @@ namespace EliteBGS.BGS {
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildMarketBuy(Objective objective) {
|
||||
BuyCargo[] buys = objective.LogEntries.OfType<BuyCargo>().ToArray();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (buys.Length <= 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
foreach (BuyCargo buy in buys) {
|
||||
builder.Append(buy.ToString());
|
||||
builder.Append("\n");
|
||||
}
|
||||
|
||||
builder.Append("\n");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
public string GenerateDiscordLog(Report report) {
|
||||
StringBuilder log = new StringBuilder();
|
||||
|
||||
@ -332,9 +314,6 @@ namespace EliteBGS.BGS {
|
||||
var micro = BuildMicroResourcesSold(objective);
|
||||
entries.Append(micro);
|
||||
|
||||
var buy = BuildMarketBuy(objective);
|
||||
entries.Append(buy);
|
||||
|
||||
var sold = BuildCargoSold(objective);
|
||||
entries.Append(sold);
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace EliteBGS.BGS {
|
||||
|
||||
List<Entry> relevant = entries.Where(x => IsRelevant(x)).ToList();
|
||||
Dictionary<int, MissionAcceptedEntry> acceptedMissions = new Dictionary<int, MissionAcceptedEntry>();
|
||||
Dictionary<string, long> buyCost = new Dictionary<string, long>();
|
||||
Dictionary<string, int> buyCost = new Dictionary<string, int>();
|
||||
|
||||
string current_system = null;
|
||||
string current_station = null;
|
||||
@ -130,13 +130,6 @@ namespace EliteBGS.BGS {
|
||||
string faction = other;
|
||||
string influence = completed.GetInfluenceForFaction(faction);
|
||||
|
||||
/* ignore empty factions which can happen
|
||||
* I assume that this denotes that you are losing REP with a superpower
|
||||
*/
|
||||
if (string.IsNullOrEmpty(faction)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
results.Add(new InfluenceSupport() {
|
||||
Faction = faction,
|
||||
Influence = influence,
|
||||
@ -206,23 +199,15 @@ namespace EliteBGS.BGS {
|
||||
continue;
|
||||
}
|
||||
buyCost[buy.Type] = buy.BuyPrice;
|
||||
|
||||
results.Add(new BuyCargo(buy) {
|
||||
Faction = controlling_faction,
|
||||
Station = current_station,
|
||||
System = current_system,
|
||||
});
|
||||
|
||||
collate = true;
|
||||
} else if (e.Is(Events.MarketSell)) {
|
||||
MarketSellEntry sell = e as MarketSellEntry;
|
||||
long profit = 0;
|
||||
int profit = 0;
|
||||
|
||||
if (!buyCost.ContainsKey(sell.Type)) {
|
||||
OnLog?.Invoke("Could not find buy order for the given commodity. Please adjust profit manually.");
|
||||
} else {
|
||||
long avg = buyCost[sell.Type];
|
||||
profit = (long)sell.TotalSale - (avg * sell.Count);
|
||||
int avg = buyCost[sell.Type];
|
||||
profit = sell.TotalSale - (avg * sell.Count);
|
||||
}
|
||||
|
||||
results.Add(new SellCargo(e as MarketSellEntry) {
|
||||
|
@ -4,7 +4,7 @@ using EDJournal;
|
||||
|
||||
namespace EliteBGS.BGS {
|
||||
public class SellCargo : LogEntry {
|
||||
public long Profit { get; set; }
|
||||
public int Profit { get; set; }
|
||||
|
||||
public SellCargo() { }
|
||||
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
* Added murders, since they give negative INF for the target faction.
|
||||
* Cargo is now collated for the NONA discord template.
|
||||
* Empty secondary influences no longer show up.
|
||||
* Market buying is not part of the BGS since Update 10.
|
||||
* Remove decimal point unless absolutely necessary.
|
||||
|
||||
## 0.1.0-beta6 on 22.01.2022
|
||||
|
||||
|
@ -87,7 +87,6 @@
|
||||
<Compile Include="BGS\InfluenceSupport.cs" />
|
||||
<Compile Include="BGS\MissionFailed.cs" />
|
||||
<Compile Include="BGS\NonaDiscordLog.cs" />
|
||||
<Compile Include="BGS\BuyCargo.cs" />
|
||||
<Compile Include="BGS\SellCargo.cs" />
|
||||
<Compile Include="BGS\SellMicroResources.cs" />
|
||||
<Compile Include="BGS\FactionKillBonds.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user