private JournalOperation ExtractMaterialsDump(JObject data) { var dump = new DumpOperation { ResetFilter = new HashSet <Kind> { Kind.Data, Kind.Material }, DumpOperations = new List <MaterialOperation>() }; foreach (var jToken in data["Raw"].Union(data["Manufactured"]).Union(data["Encoded"])) { dynamic cc = jToken; var materialName = converter.GetOrCreate((string)cc.Name); int? count = cc.Value ?? cc.Count; var operation = new MaterialOperation { MaterialName = materialName, Size = count ?? 1 }; dump.DumpOperations.Add(operation); } return(dump); }
private JournalOperation ExtractShipLockerMaterials(JObject data) { Dictionary <string, MaterialOperation> operations = new Dictionary <string, MaterialOperation>(); foreach (var kind in new string[] { "Items", "Data", "Components" }) { if (data.ContainsKey(kind)) { foreach (var jToken in data[kind]) { dynamic cc = jToken; var materialName = converter.GetOrCreate(Kind.OdysseyIngredient, (string)cc.Name); int? count = cc.Value ?? cc.Count; if (!operations.ContainsKey(materialName)) { operations.Add(materialName, new MaterialOperation { MaterialName = materialName, Size = 0 }); } operations[materialName].Size += count ?? 1; } } } if (operations.Values.Any()) { var dump = new DumpOperation { ResetFilter = new HashSet <Kind> { Kind.OdysseyIngredient }, DumpOperations = new List <MaterialOperation>() }; dump.DumpOperations.AddRange(operations.Values); return(dump); } return(null); }