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
        /// <summary>
        /// Gets an equiped item based on a given item part.
        /// </summary>
        /// <param name="equipedItemPart">Item part type.</param>
        /// <returns>Equiped item if there is one; null otherwise.</returns>
        public Item GetEquipedItem(ItemPartType equipedItemPart)
        {
            int equipedItemSlot = EquipOffset + (int)equipedItemPart;

            if (equipedItemSlot > MaxInventoryItems || equipedItemSlot < EquipOffset)
            {
                return(null);
            }

            return(_items[_itemsMask[equipedItemSlot]]);
        }