public override void load(SQLiteDataReader data) { op_stct2 out_name = OPDataContainer.GetOP_Stct(data.GetValue(1) as string); List <op_stct2> out_marteials = new List <op_stct2>(); for (int i = 2; i <= 7; i++) { var s = data.GetValue(i); if (s is System.DBNull == false) { op_stct2 mat_temp = OPDataContainer.GetOP_Stct(s as string); out_marteials.Add(mat_temp); } } var per_str = data.GetValue(8) as long?; int out_percent = 0; if (per_str != null) { out_percent = (int)per_str; } OP_Recipe2 recp = new OP_Recipe2() { name = out_name, materials = out_marteials, percent = out_percent }; op_recipes.Add(recp); }
/// <summary> /// opに指定された素材(複数)と必要な素材を返す /// </summary> /// <param name="op">素材(複数)</param> /// <param name="percent_Plus">確率上昇率 /// [ /// target = op_stct つけるop /// material = List<op_stct> 必要なop /// percent = int 成功確率 /// ] /// </param> /// <returns></returns> static public List <OP_Recipe2> GetMaterials(List <op_stct2> op, int percent_Plus = 0) { List <OP_Recipe2> output_op = new List <OP_Recipe2>(); foreach (op_stct2 o in op) { var op_t = GetMaterials(o, percent_Plus); var data = new OP_Recipe2() { name = o, percent = op_t.Item1, materials = op_t.Item2 }; output_op.Add(data); } return(output_op); }
/// <summary> /// opに指定された素材と、確率を返す。 /// percent_plusで成功確率を上げる /// </summary> /// <param name="op">素材</param> /// <param name="percent_Plus">確率上昇率</param> /// <returns>素材</returns> static public (int, List <op_stct2>) GetMaterials(op_stct2 op, int percent_Plus = 0) { var comArr = RecipeDataContainer.GetOP_Recipes(op); comArr = comArr.OrderBy(x => x.percent).ToList(); if (comArr.Count == 0) { Console.WriteLine("Recepi Not Found:{0}", op.jp_name); return(GetMaterials(OPDataContainer.GetOP_Stct("none"))); } OP_Recipe2 opc = comArr[0]; foreach (OP_Recipe2 o in comArr) { opc = o; int p = o.percent + percent_Plus; if (p >= 100) { break; } } List <op_stct2> op_s = new List <op_stct2>(); foreach (op_stct2 name in opc.materials) { op_s.Add(name); } int output_p = opc.percent + percent_Plus; if (output_p > 100) { output_p = 100; } return(output_p, op_s); }
public int percent; //成功確率 public OP_Recipe_flag(OP_Recipe2 o) { name = o.name; percent = o.percent; materials = o.materials.Select(x => new OP_stct_flag(x)).ToList(); }
public OP_recipe_Data(OP_Recipe2 recipe) { this.origin_recipe = recipe; }