protected override OptionResult Run(GameHitParameters <GameObject> parameters) { RecipeSelection recipeSelection = RecipeSelection.Create(new List <string>(Cupcake.Settings.mRandomRestockSettings.Keys)); OptionResult recipeResult = recipeSelection.Perform(); if (recipeResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } QualitySelection qualitySelection = QualitySelection.Create(new List <Quality>(Cupcake.Settings.RandomRestockQualitiesAsList())); OptionResult qualityResult = qualitySelection.Perform(); if (qualityResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } foreach (Recipe recipe in recipeSelection.selectedItems) { Cupcake.Settings.AddRandomRestockRecipe(recipe.Key, qualitySelection.selectedItems); } Common.Notify(Common.Localize("General:Success")); return(OptionResult.SuccessClose); }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { SlotSelection slotSelection = SlotSelection.Create(mTarget as CraftersConsignmentDisplay); OptionResult result = slotSelection.Perform(); if (result != OptionResult.SuccessClose) { return(OptionResult.Failure); } RecipeSelection recipeSelection = RecipeSelection.Create(Cupcake.Settings.BuildSlotsWithRecipes(Cupcake.Settings.GetDisplaySettings(mTarget.ObjectId))); OptionResult recipeResult = recipeSelection.Perform(); if (recipeResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } QualitySelection qualitySelection = QualitySelection.Create(Cupcake.Settings.BuildSlotsWithQualities(Cupcake.Settings.GetDisplaySettings(mTarget.ObjectId))); OptionResult qualityResult = qualitySelection.Perform(); if (qualityResult != OptionResult.SuccessClose) { return(OptionResult.Failure); } foreach (Recipe recipe in recipeSelection.selectedItems) { Cupcake.Settings.AddDisplayRecipe(mTarget.ObjectId, slotSelection.selectedItems, recipe.Key, false); } foreach (Quality quality in qualitySelection.selectedItems) { Cupcake.Settings.SetRecipeQuality(mTarget.ObjectId, slotSelection.selectedItems, quality, false); } Common.Notify(Common.Localize("General:Success")); return(OptionResult.SuccessClose); }