public void Craft(CraftRecipe recipe) { if (!Available(recipe)) { return; } foreach (var itemBase in recipe.Recipe) { _player.Inventory.RemoveItem(itemBase); } _player.Inventory.AddItem((ItemBase)recipe.Result.Clone()); }
public bool Available(CraftRecipe recipe) { return(recipe.Recipe .All(req => _player.Inventory.GetCount(req.ItemId) >= req.Count)); }
public void AddRecipe(CraftRecipe recipe) { _recipes.Add(recipe); }