Changeset - 62d349a8db2f
[Not reviewed]
Jason Maltzen - 3 years ago 2021-08-27 21:58:31
jason@hiddenachievement.com
Fix the PaintMix export format - use the PracticalPaint internal names for ingredients, and remove excess whitespace. Also, don't export a recipe for colors that don't have a recipe.
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
Models/PlayerProfile.cs
Show inline comments
...
 
@@ -642,27 +642,31 @@ namespace DesertPaintCodex.Models
 
        public static void ExportPaintMixFormat(TextWriter writer, Dictionary<string, PaintRecipe> recipeDict)
 
        {
 
            using (writer)
 
            {
 
                foreach (PaintColor color in PaletteService.Colors)
 
                {
 
                    if (recipeDict.TryGetValue(color.Name, out PaintRecipe? recipe))
 
                    {
 
                        if (recipe.Reagents.Count > 0)
 
                        {
 
                        string colorLine = $"{color.Name} : ";
 
                        foreach (PaintRecipe.ReagentQuantity ingredient in recipe.Reagents)
 
                        {
 
                            colorLine += $" {ingredient.Name} {ingredient.Quantity}";
 
                                Reagent reagent = ReagentService.GetReagent(ingredient.Name);
 
                                colorLine += $" {reagent.PracticalPaintName} {ingredient.Quantity}";
 
                        }
 
                        colorLine += $"  - #{color.Red:X2}{color.Green:X2}{color.Blue:X2}";
 
                        writer.WriteLine(colorLine);
 
                    }
 
                    }
 
                    else
 
                    {
 
                        // no recipe
 
                        // no recipe - skip
 
                    }
 
                }
 
            }
 
        }
 

	
 
        public Reaction? FindReaction(Reagent? reagent1, Reagent? reagent2)
 
        {
 
            if ((reagent1 == null) || (reagent2 == null)) return null;
0 comments (0 inline, 0 general)