using System.Collections.Generic; namespace DDD { public static class DrinkDataExtensions { public static List GetIngredients(this DrinkData data) => CraftingHelper.ExtractIngredients( data.IngredientKey1, data.IngredientAmount1, data.IngredientKey2, data.IngredientAmount2, data.IngredientKey3, data.IngredientAmount3, data.IngredientKey4, data.IngredientAmount4 ); public static List GetTasteDatas(this DrinkData data) => CraftingHelper.ResolveTasteDatas( new[] { data.TasteKey1, data.TasteKey2, data.TasteKey3, data.TasteKey4, data.TasteKey5, data.TasteKey6 }, DataManager.Instance.TasteDataSo ); public static int GetCraftableCount(this DrinkData data) => CraftingHelper.GetCraftableCount(data.GetIngredients()); public static bool TryConsumeIngredients(this DrinkData data, int count = 1) => CraftingHelper.TryConsumeIngredients(data.GetIngredients(), count); public static int ConsumeAllCraftableIngredients(this DrinkData data) { var ingredients = data.GetIngredients(); int count = CraftingHelper.GetCraftableCount(ingredients); return CraftingHelper.ConsumeAll(ingredients, count); } public static void RefundIngredients(this DrinkData data, int count = 1) => CraftingHelper.RefundIngredients(data.GetIngredients(), count); } }