private JournalOperation ExtractTransferMicroResources(JObject data) { var operation = new MaterialTradeOperation(); var transferts = data["Transfers"]; foreach (var item in transferts) { converter.TryGet(Kind.OdysseyIngredient, (string)item["Name"], out var materialName); if (materialName != null) { if (item["LockerOldCount"] != null && item["LockerNewCount"] != null) { var oldCount = (int)item["LockerOldCount"]; var newCount = (int)item["LockerNewCount"]; operation.AddIngredient(materialName, newCount - oldCount); } else if ((string)item["Direction"] == "ToShipLocker")// old logs { var count = (int)item["Count"]; operation.AddIngredient(materialName, count); } else if ((string)item["Direction"] == "ToBackpack")// old logs { var count = (int)item["Count"]; operation.RemoveIngredient(materialName, count); } } } return(operation); }
private JournalOperation ExtractMaterialTrade(JObject data) { converter.TryGet(Kind.Data | Kind.Material, (string)data["Received"]["Material"], out var ingredientAdded); converter.TryGet(Kind.Data | Kind.Material, (string)data["Paid"]["Material"], out var ingredientRemoved); var addedQuantity = (int)data["Received"]["Quantity"]; var removedQuantity = (int)data["Paid"]["Quantity"]; var trade = new MaterialTradeOperation(); trade.AddIngredient(ingredientAdded, addedQuantity); trade.RemoveIngredient(ingredientRemoved, removedQuantity); return(trade); }
private JournalOperation ExtractMicroResourcesSold(JObject data) { var trade = new MaterialTradeOperation(); var sold = data["MicroResources"]; foreach (var item in sold) { converter.TryGet(Kind.OdysseyIngredient, (string)item["Name"], out var ingredientRemoved); var removedQuantity = (int)item["Count"]; trade.RemoveIngredient(ingredientRemoved, removedQuantity); } return(trade); }
private JournalOperation ExtractMicroResourcesTrade(JObject data) { var trade = new MaterialTradeOperation(); var offered = data["Offered"]; foreach (var item in offered) { converter.TryGet(Kind.OdysseyIngredient, (string)item["Name"], out var ingredientRemoved); var removedQuantity = (int)item["Count"]; trade.RemoveIngredient(ingredientRemoved, removedQuantity); } converter.TryGet(Kind.OdysseyIngredient, (string)data["Received"], out var ingredientAdded); var addedQuantity = (int)data["Count"]; trade.AddIngredient(ingredientAdded, addedQuantity); return(trade); }