Esempio n. 1
0
        public ItemEnchantDataStore(IResourceManager resourceManager,
                                    ILogger <ItemEnchantDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic enchantRes in resource.ItemList)
            {
                var enchant = new ItemEnchant();
                enchant.Index         = enchantRes.Index;
                enchant.Name          = enchantRes.Nameen;
                enchant.Name          = enchant.Name.Trim();
                enchant.Kind          = EnchantKind.Parse(enchantRes.Kind);
                enchant.UseType       = ItemUseType.Parse(enchantRes.UseType);
                enchant.MaxUse        = enchantRes.MaxUse;
                enchant.ElementalKind = ElementalKind.Parse(enchantRes.ElementalKind);
                enchant.AddPer        = enchantRes.AddPer;
                enchant.SellPrice     = enchantRes.SellPrice;
                enchant.Hair          = enchantRes.HAIR == 1;
                enchant.Body          = enchantRes.BODY == 1;
                enchant.Pants         = enchantRes.PANTS == 1;
                enchant.Foot          = enchantRes.FOOT == 1;
                enchant.Cap           = enchantRes.CAP == 1;
                enchant.Hand          = enchantRes.HAND == 1;
                enchant.Glasses       = enchantRes.GLASSES == 1;
                enchant.Bag           = enchantRes.BAG == 1;
                enchant.Socks         = enchantRes.SOCKS == 1;
                enchant.Racket        = enchantRes.RACKET == 1;
                Add(enchant.Index, enchant);
            }
            _byKind = new Dictionary <EnchantKind, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
Esempio n. 2
0
        private void UpdateConsumeText()
        {
            IConsumable consumable = currentItem as IConsumable;

            consumeButton.Text = consumable.GetConsumeText();
            currentUseType     = ItemUseType.CONSUME;
        }
        public ItemHouseDecorationDataStore(IResourceManager resourceManager,
                                            ILogger <ItemHouseDecorationDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic houseDecoRes in resource.ItemList)
            {
                var houseDeco = new ItemHouseDecoration();
                houseDeco.Index         = houseDecoRes.Index;
                houseDeco.Name          = houseDecoRes.Nameen;
                houseDeco.Name          = houseDeco.Name.Trim();
                houseDeco.Kind          = HouseDecorationKind.Parse(houseDecoRes.Kind);
                houseDeco.UseType       = ItemUseType.Parse(houseDecoRes.UseType);
                houseDeco.MaxUse        = houseDecoRes.MaxUse;
                houseDeco.HousingPoint  = houseDecoRes.Housingpoint;
                houseDeco.InHouse       = houseDecoRes.InHouse == 1;
                houseDeco.AddGold       = houseDecoRes.AddGold;
                houseDeco.AddExp        = houseDecoRes.AddExp;
                houseDeco.AddBattleGold = houseDecoRes.AddBattleGold;
                houseDeco.AddBattleExp  = houseDecoRes.AddBattleExp;
                houseDeco.EnableParcel  = houseDecoRes.EnableParcel == 1;
                Add(houseDeco.Index, houseDeco);
            }
            _byKind = new Dictionary <HouseDecorationKind, HashSet <int> >();
            logger.LogInformation("loaded.");
        }
        public ShopItemDataStore(IResourceManager resourceManager,
                                 IItemPartDataStore itemPartDataStore,
                                 IItemHouseDecorationDataStore houseDecorationDataStore,
                                 IItemEnchantDataStore enchantDataStore,
                                 IItemRecipeDataStore recipeDataStore,
                                 ILogger <ShopItemDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            var tmp = new Dictionary <int, ShopItem>();

            foreach (dynamic itemRes in resource.ProductList)
            {
                var shopItem = new ShopItem();
                shopItem.Display      = itemRes.DISPLAY;
                shopItem.Index        = itemRes.Index;
                shopItem.Enable       = itemRes.Enable == 1;
                shopItem.Free         = itemRes.Free == 1;
                shopItem.Sale         = itemRes.Sale == 1;
                shopItem.Event        = itemRes.Event == 1;
                shopItem.Couple       = itemRes.Couple == 1;
                shopItem.Nobuy        = itemRes.Nobuy == 1;
                shopItem.Rand         = itemRes.Rand != "No";
                shopItem.UseType      = ItemUseType.Parse(itemRes.UseType);
                shopItem.Use0         = itemRes.Use0;
                shopItem.Use1         = itemRes.Use1;
                shopItem.Use2         = itemRes.Use2;
                shopItem.PriceType    = ShopPriceType.Parse(itemRes.PriceType);
                shopItem.Price0       = itemRes.Price0;
                shopItem.Price1       = itemRes.Price1;
                shopItem.Price2       = itemRes.Price2;
                shopItem.OldPrice0    = itemRes.OldPrice0;
                shopItem.OldPrice1    = itemRes.OldPrice1;
                shopItem.OldPrice2    = itemRes.OldPrice2;
                shopItem.CouplePrice  = itemRes.CouplePrice;
                shopItem.CategoryType = ShopCategoryType.Parse(itemRes.Category);
                shopItem.Name         = itemRes.Name;
                shopItem.GoldBack     = itemRes.GoldBack;
                shopItem.EnableParcel = itemRes.EnableParcel == 1;
                shopItem.Hero         = (int)itemRes.Char;
                shopItem.Items        = new[] { itemRes.Item0, itemRes.Item1, itemRes.Item2, itemRes.Item3, itemRes.Item4, itemRes.Item5, itemRes.Item6, itemRes.Item7, itemRes.Item8, itemRes.Item9 }
                .Select(p => (int)p).Where(p => p != 0).ToArray();
                tmp.Add(shopItem.Index, shopItem);
            }

            foreach (var kvp in tmp.OrderBy(p => p.Key))
            {
                Add(kvp.Key, kvp.Value);
            }

            _itemPartDataStore        = itemPartDataStore;
            _houseDecorationDataStore = houseDecorationDataStore;
            _enchantDataStore         = enchantDataStore;
            _recipeDataStore          = recipeDataStore;
            logger.LogInformation("loaded.");
        }
Esempio n. 5
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.");
        }
Esempio n. 6
0
 private void UpdateEquipText()
 {
     if (currentSlot is BackPackSlot)
     {
         equipButton.Text = "Equip";
         currentUseType   = ItemUseType.EQUIP;
     }
     else
     {
         equipButton.Text = "Remove";
         currentUseType   = ItemUseType.UNEQUIP;
     }
 }
Esempio n. 7
0
        public void HandleOnItemUse(ItemSlot sourceSlot, ItemUseType useType)
        {
            ItemInventoryTile usedItem = sourceSlot.GetItemTile();

            if (useType == ItemUseType.CONSUME)
            {
                // TODO
            }
            else if (useType == ItemUseType.EQUIP)
            {
                HandleUseEquip(sourceSlot, usedItem);
            }
            else if (useType == ItemUseType.UNEQUIP)
            {
                HandleUseUnEquip(sourceSlot, usedItem);
            }
        }
Esempio n. 8
0
        public ItemToolDataStore(IResourceManager resourceManager,
                                 ILogger <ItemToolDataStore> logger)
        {
            logger.LogInformation("loading...");
            var resource = XmlSlurper.ParseText(resourceManager.ReadResource(Resource));

            foreach (dynamic toolRes in resource.RecipeList)
            {
                var tool = new ItemTool();
                tool.Index        = toolRes.Index;
                tool.Name         = toolRes.Nameen;
                tool.Name         = tool.Name.Trim();
                tool.Kind         = ItemToolKind.Parse(toolRes.Kind);
                tool.UseType      = ItemUseType.Parse(toolRes.UseType);
                tool.MaxUse       = toolRes.MaxUse;
                tool.EnableParcel = toolRes.EnableParcel == 1;

                Add(tool.Index, tool);
            }
            logger.LogInformation("loading...");
        }