コード例 #1
0
        /// <summary>
        /// Decide what category name the given item key should belong to.
        /// </summary>
        /// <returns>The chosen category name.</returns>
        /// <param name="itemKey">The item key to categorize.</param>
        public string GetCategoryName(ItemKey itemKey)
        {
            // move scythe to tools
            if (itemKey.ItemType == ItemType.Weapon && itemKey.ObjectIndex == MeleeWeapon.scythe)
            {
                return("Tool");
            }

            if (itemKey.ItemType != ItemType.Object)
            {
                return(itemKey.ItemType.ToString());
            }


            var categoryName = GetItem(itemKey).getCategoryName();

            return(string.IsNullOrEmpty(categoryName) ? "Miscellaneous" : categoryName);
        }
コード例 #2
0
 /// <summary>
 /// Check whether a given item key is blacklisted.
 /// </summary>
 /// <returns>Whether the key is blacklisted.</returns>
 /// <param name="itemKey">Item key to check.</param>
 public static bool Includes(ItemKey itemKey) =>
 itemKey.ItemType == ItemType.BigCraftable || itemKey.ItemType == ItemType.Furniture || BlacklistedItemKeys.Contains(itemKey);
コード例 #3
0
 public Item GetItem(ItemKey itemKey) => Prototypes.ContainsKey(itemKey)
                                             ? Prototypes[itemKey]
                                             : itemKey.GetOne();
コード例 #4
0
 public DiscoveredItem(ItemType type, int index, Item item)
 {
     ItemKey = new ItemKey(type, index);
     Item    = item;
 }