private void GatherDresses(EnumCharacterDressType type)
        {
            List <ItemStack> dresses = new List <ItemStack>();

            dresses.Add(null);

            string stringtype = type.ToString().ToLowerInvariant();

            IList <Item> items = capi.World.Items;

            for (int i = 0; i < items.Count; i++)
            {
                Item item = items[i];
                if (item == null || item.Code == null || item.Attributes == null)
                {
                    continue;
                }

                string clothcat = item.Attributes["clothescategory"]?.AsString();
                bool   allow    = item.Attributes["inCharacterCreationDialog"]?.AsBool() == true;

                if (allow && clothcat?.ToLowerInvariant() == stringtype)
                {
                    dresses.Add(new ItemStack(item));
                }
            }

            DressesByDressType[type]       = dresses.ToArray();
            DressPositionByTressType[type] = 0;
        }
예제 #2
0
        /// <summary>
        /// Checks to see what dress type the given item is.
        /// </summary>
        /// <param name="itemstack"></param>
        /// <param name="dressType"></param>
        /// <returns></returns>
        public static bool IsDressType(IItemStack itemstack, EnumCharacterDressType dressType)
        {
            if (itemstack == null || itemstack.Collectible.Attributes == null)
            {
                return(false);
            }

            string stackDressType = itemstack.Collectible.Attributes["clothescategory"].AsString();

            return(stackDressType != null && dressType.ToString().Equals(stackDressType, StringComparison.InvariantCultureIgnoreCase));
        }