Пример #1
0
 /// <summary>
 /// Determines whether the actual item matches with the required item definition.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="requiredItem">The required item.</param>
 /// <returns><c>true</c>, if the actual item matches with the required item definition.</returns>
 protected virtual bool RequiredItemMatches(Item item, ItemCraftingRequiredItem requiredItem)
 {
     return((!requiredItem.PossibleItems.Any() || requiredItem.PossibleItems.Contains(item.Definition)) &&
            item.Level >= requiredItem.MinimumItemLevel &&
            item.Level <= requiredItem.MaximumItemLevel &&
            requiredItem.RequiredItemOptions.All(r => item.ItemOptions.Any(o => o.ItemOption.OptionType == r)));
 }
Пример #2
0
        /// <summary>
        /// Determines whether the actual item matches with the required item definition.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="requiredItem">The required item.</param>
        /// <returns><c>true</c>, if the actual item matches with the required item definition.</returns>
        protected virtual bool RequiredItemMatches(Item item, ItemCraftingRequiredItem requiredItem)
        {
            item.ThrowNotInitializedProperty(item.Definition is null, nameof(item.Definition));

            return((!requiredItem.PossibleItems.Any() || requiredItem.PossibleItems.Contains(item.Definition)) &&
                   item.Level >= requiredItem.MinimumItemLevel &&
                   item.Level <= requiredItem.MaximumItemLevel &&
                   requiredItem.RequiredItemOptions.All(r => item.ItemOptions.Any(o => o.ItemOption !.OptionType == r)));
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CraftingRequiredItemLink"/> class.
 /// </summary>
 /// <param name="storedItem">The stored item.</param>
 /// <param name="requiredItem">The required item.</param>
 public CraftingRequiredItemLink(IEnumerable <Item> storedItem, ItemCraftingRequiredItem requiredItem)
 {
     this.StoredItem      = storedItem;
     this.ItemRequirement = requiredItem;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CraftingRequiredItemLink"/> class.
 /// </summary>
 /// <param name="items">The items which are linked to the <see cref="ItemCraftingRequiredItem"/>.</param>
 /// <param name="requiredItem">The required item.</param>
 public CraftingRequiredItemLink(IEnumerable <Item> items, ItemCraftingRequiredItem requiredItem)
 {
     this.Items           = items;
     this.ItemRequirement = requiredItem;
 }