add SellOrganicData event

This commit is contained in:
Florian Stinglmayr 2022-02-07 16:21:44 +01:00
parent 420d377fa9
commit 47fcbdb071
4 changed files with 51 additions and 0 deletions

View File

@ -31,6 +31,7 @@ namespace EDJournal {
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) }, { Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) }, { Events.SellExplorationData, typeof(SellExplorationDataEntry) },
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) }, { Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
{ Events.SellOrganicData, typeof(SellOrganicDataEntry) },
{ Events.ShieldState, typeof(ShieldStateEntry) }, { Events.ShieldState, typeof(ShieldStateEntry) },
{ Events.ShipTargeted, typeof(ShipTargetedEntry) }, { Events.ShipTargeted, typeof(ShipTargetedEntry) },
{ Events.UnderAttack, typeof(UnderAttackEntry) }, { Events.UnderAttack, typeof(UnderAttackEntry) },

View File

@ -20,6 +20,7 @@
public static readonly string RedeemVoucher = "RedeemVoucher"; public static readonly string RedeemVoucher = "RedeemVoucher";
public static readonly string SellExplorationData = "SellExplorationData"; public static readonly string SellExplorationData = "SellExplorationData";
public static readonly string SellMicroResources = "SellMicroResources"; public static readonly string SellMicroResources = "SellMicroResources";
public static readonly string SellOrganicData = "SellOrganicData";
public static readonly string ShieldState = "ShieldState"; public static readonly string ShieldState = "ShieldState";
public static readonly string ShipTargeted = "ShipTargeted"; public static readonly string ShipTargeted = "ShipTargeted";
public static readonly string UnderAttack = "UnderAttack"; public static readonly string UnderAttack = "UnderAttack";

48
SellOrganicDataEntry.cs Normal file
View 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);
}
}

View File

@ -71,6 +71,7 @@
<Compile Include="RedeemVoucherEntry.cs" /> <Compile Include="RedeemVoucherEntry.cs" />
<Compile Include="SellExplorationDataEntry.cs" /> <Compile Include="SellExplorationDataEntry.cs" />
<Compile Include="SellMicroResourcesEntry.cs" /> <Compile Include="SellMicroResourcesEntry.cs" />
<Compile Include="SellOrganicDataEntry.cs" />
<Compile Include="ShieldStateEntry.cs" /> <Compile Include="ShieldStateEntry.cs" />
<Compile Include="ShipTargetedEntry.cs" /> <Compile Include="ShipTargetedEntry.cs" />
<Compile Include="UnderAttackEntry.cs" /> <Compile Include="UnderAttackEntry.cs" />