add SellOrganicData event
This commit is contained in:
parent
420d377fa9
commit
47fcbdb071
1
Entry.cs
1
Entry.cs
@ -31,6 +31,7 @@ namespace EDJournal {
|
||||
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
||||
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) },
|
||||
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
|
||||
{ Events.SellOrganicData, typeof(SellOrganicDataEntry) },
|
||||
{ Events.ShieldState, typeof(ShieldStateEntry) },
|
||||
{ Events.ShipTargeted, typeof(ShipTargetedEntry) },
|
||||
{ Events.UnderAttack, typeof(UnderAttackEntry) },
|
||||
|
@ -20,6 +20,7 @@
|
||||
public static readonly string RedeemVoucher = "RedeemVoucher";
|
||||
public static readonly string SellExplorationData = "SellExplorationData";
|
||||
public static readonly string SellMicroResources = "SellMicroResources";
|
||||
public static readonly string SellOrganicData = "SellOrganicData";
|
||||
public static readonly string ShieldState = "ShieldState";
|
||||
public static readonly string ShipTargeted = "ShipTargeted";
|
||||
public static readonly string UnderAttack = "UnderAttack";
|
||||
|
48
SellOrganicDataEntry.cs
Normal file
48
SellOrganicDataEntry.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace EDJournal {
|
||||
public class BioData {
|
||||
public string Genus { get; set; }
|
||||
public string GenusLocalised { get; set; }
|
||||
public string Species { get; set; }
|
||||
public string SpeciesLocalised { get; set; }
|
||||
public long Value { get; set; }
|
||||
public long Bonus { get; set; }
|
||||
public long TotalValue => Value + Bonus;
|
||||
}
|
||||
public class SellOrganicDataEntry : Entry {
|
||||
public long MarketID { get; set; }
|
||||
public List<BioData> BioData { get; set; }
|
||||
|
||||
protected override void Initialise() {
|
||||
MarketID = JSON.Value<long?>("MarketID") ?? 0;
|
||||
|
||||
var biodata = JSON.Value<JArray>("BioData");
|
||||
BioData = new List<BioData>();
|
||||
|
||||
if (biodata == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (JObject item in biodata) {
|
||||
BioData data = new BioData {
|
||||
Bonus = item.Value<long?>("Bonus") ?? 0,
|
||||
Value = item.Value<long?>("Value") ?? 0,
|
||||
Species = item.Value<string>("Species") ?? "",
|
||||
Genus = item.Value<string>("Genus") ?? "",
|
||||
GenusLocalised = item.Value<string>("Genus_Localised") ?? "",
|
||||
SpeciesLocalised = item.Value<string>("Species_Localised") ?? ""
|
||||
};
|
||||
|
||||
BioData.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
public long TotalValue => BioData.Sum(x => x.TotalValue);
|
||||
}
|
||||
}
|
@ -71,6 +71,7 @@
|
||||
<Compile Include="RedeemVoucherEntry.cs" />
|
||||
<Compile Include="SellExplorationDataEntry.cs" />
|
||||
<Compile Include="SellMicroResourcesEntry.cs" />
|
||||
<Compile Include="SellOrganicDataEntry.cs" />
|
||||
<Compile Include="ShieldStateEntry.cs" />
|
||||
<Compile Include="ShipTargetedEntry.cs" />
|
||||
<Compile Include="UnderAttackEntry.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user