public ItemPartDataStore(IResourceManager resourceManager,
                                 ILogger <ItemPartDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic itemRes in resource.ItemList)
            {
                var itemPart = new ItemPart();
                itemPart.Index          = itemRes.Index;
                itemPart.Name           = itemRes.Nameen;
                itemPart.Name           = itemPart.Name.Trim();
                itemPart.Hero           = HeroType.Parse(itemRes.Char);
                itemPart.Type           = ItemPartType.Parse(itemRes.Part);
                itemPart.Mesh           = itemRes.Mesh;
                itemPart.Hair           = itemRes.Hair;
                itemPart.Leg            = itemRes.Leg;
                itemPart.Foot           = itemRes.Foot;
                itemPart.EnchantElement = itemRes.EnchantElement;
                Add(itemPart.Index, itemPart);
            }
            _byType = new Dictionary <int, HashSet <int> >();
            _byHero = new Dictionary <HeroType, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
示例#2
0
        public ItemRecipeDataStore(IResourceManager resourceManager,
                                   ILogger <ItemRecipeDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic recipeRes in resource.RecipeList)
            {
                var recipe = new ItemRecipe();
                recipe.Index        = recipeRes.Index;
                recipe.Name         = recipeRes.Nameen;
                recipe.Name         = recipe.Name.Trim();
                recipe.Kind         = RecipeKind.Parse(recipeRes.Kind);
                recipe.UseType      = ItemUseType.Parse(recipeRes.UseType);
                recipe.MaxUse       = recipeRes.MaxUse;
                recipe.UseCount     = recipeRes.UseCount;
                recipe.Hero         = HeroType.Parse(recipeRes.Character);
                recipe.EnableParcel = recipeRes.EnableParcel == 1;
                recipe.RequireGold  = recipeRes.RequireGold;
                recipe.MixGaugeTime = recipeRes.MixGaugeTime;
                recipe.HouseLevel   = recipeRes.Houselevel;
                recipe.Probability  = recipeRes.Probability;
                recipe.Materials    = new List <Recipe.RecipeMaterial>();
                recipe.Mutations    = new List <Recipe.RecipeMutation>();
                for (int i = 0; i < 6; i++)
                {
                    if (recipeRes.Members["Material" + i] != 0)
                    {
                        recipe.Materials.Add(new Recipe.RecipeMaterial()
                        {
                            Index = recipeRes.Members["Material" + i],
                            Count = recipeRes.Members["Count" + i],
                        });
                    }
                }
                for (int i = 0; i < 5; i++)
                {
                    if (recipeRes.Members["Mutation" + i] != 0)
                    {
                        recipe.Mutations.Add(new Recipe.RecipeMutation()
                        {
                            Index       = recipeRes.Members["Mutation" + i],
                            Probability = recipeRes.Members["MutationPro" + i],
                            Min         = recipeRes.Members["MutationMIN" + i],
                            Max         = recipeRes.Members["MutationMAX" + i],
                        });
                    }
                }
                Add(recipe.Index, recipe);
            }

            _byKind = new Dictionary <int, HashSet <int> >();
            logger.LogInformation("loaded.");
        }