properly load reedem vouchers

This commit is contained in:
Florian Stinglmayr 2022-02-12 18:59:48 +01:00
parent 0e691b2116
commit 08e342991c

View File

@ -12,10 +12,15 @@ namespace EDJournal {
if (factions != null) { if (factions != null) {
foreach (JObject faction in factions.Children<JObject>()) { foreach (JObject faction in factions.Children<JObject>()) {
string faction_name = faction.Value<string>("Faction"); string faction_name = faction.Value<string>("Faction");
long faction_bounty = faction.Value<long?>("Amount") ?? 0;
if (faction_name == null || faction_name.Length <= 0) { if (faction_name == null || faction_name.Length <= 0) {
continue; continue;
} }
Factions.Add(faction_name); Factions.Add(faction_name);
if (!FactionBounties.ContainsKey(faction_name)) {
FactionBounties[faction_name] = 0;
}
FactionBounties[faction_name] += faction_bounty;
} }
} }
@ -29,5 +34,6 @@ namespace EDJournal {
public int Amount { get; set; } = 0; public int Amount { get; set; } = 0;
public string Type { get; set; } = "Bounty"; public string Type { get; set; } = "Bounty";
public List<string> Factions { get; set; } = new List<string>(); public List<string> Factions { get; set; } = new List<string>();
public Dictionary<string, long> FactionBounties { get; set; } = new Dictionary<string, long>();
} }
} }