Exemple #1
0
        public Dictionary <string, List <StoreItem> > ItemDictionaryFoodServing()
        {
            string food_serving = "food_serving";

            Dictionary <string, List <StoreItem> > servings = new Dictionary <string, List <StoreItem> >();

            servings.Add(food_serving, new List <StoreItem>());

            foreach (Recipe recipe in Recipe.Recipes)
            {
                string           name          = base.Actor.TraitManager.HasElement(TraitNames.Vegetarian) ? recipe.GenericVegetarianName : recipe.GenericName;
                List <WorldName> allowedWorlds = null;
                if (recipe.RequiredWorld != WorldName.Undefined)
                {
                    allowedWorlds = new List <WorldName>();
                    allowedWorlds.Add(recipe.RequiredWorld);
                }
                StoreItem item = null;

                float recipePrice = ((float)recipe.RegisterValue > 0 ? (float)recipe.RegisterValue : 10);

                if (!recipe.IsSnack)
                {
                    item = new StoreItem(name, recipePrice * 24, recipe, recipe.GetThumbnailKey(ThumbnailSize.Medium), "recipe_" + recipe.Key, new CreateObjectCallback(this.CreateServingCallback), new ProcessObjectCallback(ShoppingRabbitHole.ProcessObject), allowedWorlds);
                }
                else
                {
                    item = new StoreItem(name, recipePrice, recipe, recipe.GetThumbnailKey(ThumbnailSize.Medium), "recipe_" + recipe.Key, new CreateObjectCallback(this.CreateSnackCallback), new ProcessObjectCallback(ShoppingRabbitHole.ProcessObject), allowedWorlds);
                }

                //Skip cone ice-cream
                if (!servings[food_serving].Contains(item) && !CommonMethods.IsRecipeIceCream(recipe))
                {
                    servings[food_serving].Add(item);
                }
            }


            return(servings);
        }