Crafting System v2
This commit is contained in:
@@ -2961,15 +2961,20 @@ public sealed class DungeonHandler : IClientMessageHandler
|
||||
|
||||
if (request.Discover && request.Ingredients != null && request.Ingredients.Count > 0)
|
||||
{
|
||||
// Recipe discovery attempt
|
||||
// Recipe discovery attempt with optional skill type filter
|
||||
var ingredients = request.Ingredients.Select(i => (i.ItemDefinitionId, i.Quantity)).ToList();
|
||||
var (recipe, alreadyKnown) = await _craftingHandler.TryDiscoverRecipeAsync(db, session.CharacterId, ingredients);
|
||||
CraftingSkillType? skillFilter = request.SkillType.HasValue
|
||||
? (CraftingSkillType)request.SkillType.Value
|
||||
: null;
|
||||
|
||||
var (recipe, alreadyKnown, error) = await _craftingHandler.TryDiscoverRecipeAsync(
|
||||
db, session.CharacterId, ingredients, skillFilter);
|
||||
|
||||
if (recipe == null)
|
||||
{
|
||||
await SendAsync(connection, DungeonOpCodes.CRAFTING_RESULT, new {
|
||||
success = false,
|
||||
error = "No recipe found for these ingredients"
|
||||
error = error ?? "No recipe found for these ingredients"
|
||||
}, ct);
|
||||
}
|
||||
else if (alreadyKnown)
|
||||
@@ -3132,6 +3137,7 @@ public class CraftingAttemptRequest
|
||||
public int RecipeId { get; set; }
|
||||
public List<CraftingIngredientInput>? Ingredients { get; set; }
|
||||
public bool Discover { get; set; }
|
||||
public int? SkillType { get; set; }
|
||||
}
|
||||
|
||||
public class CraftingIngredientInput
|
||||
|
||||
Reference in New Issue
Block a user