fix(#170): wire fabricator crafting completion + bonus enchantments + remove dead code
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ─── Equipment Crafting System ──────────────────────────────────────────────
|
||||
// Equipment crafting functions
|
||||
|
||||
import type { EquipmentInstance, EquipmentCraftingProgress } from './types';
|
||||
import type { EquipmentInstance, EquipmentCraftingProgress, AppliedEnchantment } from './types';
|
||||
import { CRAFTING_RECIPES, canCraftRecipe, type CraftingRecipe } from './data/crafting-recipes';
|
||||
import { EQUIPMENT_TYPES } from './data/equipment';
|
||||
import { ok, fail, ErrorCode } from './utils/result';
|
||||
@@ -92,20 +92,22 @@ const BASE_EQUIPMENT_QUALITY = 100;
|
||||
|
||||
export function completeEquipmentCrafting(
|
||||
blueprintId: string,
|
||||
recipe: CraftingRecipe
|
||||
recipe: CraftingRecipe,
|
||||
bonusEnchantments: AppliedEnchantment[] = []
|
||||
): Result<{ instanceId: string; instance: EquipmentInstance; logMessage: string }> {
|
||||
const equipType = EQUIPMENT_TYPES[recipe.equipmentTypeId];
|
||||
if (!equipType) return fail(ErrorCode.INVALID_EQUIPMENT_TYPE, `Invalid equipment type: ${recipe.equipmentTypeId}`);
|
||||
|
||||
const instanceId = `equip_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
||||
const usedCapacity = bonusEnchantments.reduce((sum, e) => sum + e.actualCost, 0);
|
||||
return ok({
|
||||
instanceId,
|
||||
instance: {
|
||||
instanceId,
|
||||
typeId: recipe.equipmentTypeId,
|
||||
name: recipe.name,
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
enchantments: bonusEnchantments,
|
||||
usedCapacity,
|
||||
totalCapacity: equipType.baseCapacity,
|
||||
rarity: recipe.rarity,
|
||||
quality: BASE_EQUIPMENT_QUALITY,
|
||||
|
||||
Reference in New Issue
Block a user