Bug: Crafting cancellation never refunds resources (mana + materials) #221

Closed
opened 2026-05-30 21:10:32 +02:00 by Anexim · 1 comment
Owner

Bug Description

When cancelling any form of crafting (equipment crafting, enchantment application, enchantment preparation, or fabricator crafting), none of the invested resources are refunded. The cancel handlers only log a message and set progress to null.

Additionally, for fabricator recipes, the blueprint lookup fails because it searches CRAFTING_RECIPES with the full fabricator-xxx prefix, which doesn't exist there, so even the broken refund path returns "Invalid crafting recipe."

Code Locations

  1. Equipment crafting (craftingStore.ts lines 208-215): Calls CraftingEquipment.cancelEquipmentCrafting() which only returns 50% of raw mana spent. Never refunds materials.
  2. Enchantment application (crafting-apply.ts lines 163-165): Just sets progress to null. No mana refund despite tracking manaSpent.
  3. Enchantment preparation (crafting-prep.ts lines 96-98): Just sets progress to null. No mana refund despite tracking manaCostPaid.
  4. Fabricator crafting: Same equipment cancel path, but blueprint lookup fails completely → 0 refund.

The refundFabricatorMana function exists in crafting-fabricator.ts but is never called anywhere — it's dead code.

Impact

High. Players permanently lose all mana and materials invested in any crafting that gets cancelled. This is especially punishing for:

  • Accidental starts of expensive fabricator recipes
  • Changing your mind on enchantment application midway
  • Any enchantment preparation cancellation

Fix Required

All three cancel paths need resource refunds:

  1. Equipment crafting: refund 50% of raw mana AND some portion of materials
  2. Application: refund some/all of manaSpent
  3. Preparation: refund some/all of manaCostPaid
  4. Fabricator: wire up the existing refundFabricatorMana function
## Bug Description When cancelling any form of crafting (equipment crafting, enchantment application, enchantment preparation, or fabricator crafting), none of the invested resources are refunded. The cancel handlers only log a message and set progress to null. Additionally, for fabricator recipes, the blueprint lookup fails because it searches `CRAFTING_RECIPES` with the full `fabricator-xxx` prefix, which doesn't exist there, so even the broken refund path returns "Invalid crafting recipe." ## Code Locations 1. **Equipment crafting** (`craftingStore.ts` lines 208-215): Calls `CraftingEquipment.cancelEquipmentCrafting()` which only returns 50% of **raw** mana spent. Never refunds materials. 2. **Enchantment application** (`crafting-apply.ts` lines 163-165): Just sets progress to null. No mana refund despite tracking `manaSpent`. 3. **Enchantment preparation** (`crafting-prep.ts` lines 96-98): Just sets progress to null. No mana refund despite tracking `manaCostPaid`. 4. **Fabricator crafting**: Same equipment cancel path, but blueprint lookup fails completely → 0 refund. The `refundFabricatorMana` function exists in `crafting-fabricator.ts` but is **never called anywhere** — it's dead code. ## Impact **High.** Players permanently lose all mana and materials invested in any crafting that gets cancelled. This is especially punishing for: - Accidental starts of expensive fabricator recipes - Changing your mind on enchantment application midway - Any enchantment preparation cancellation ## Fix Required All three cancel paths need resource refunds: 1. Equipment crafting: refund 50% of raw mana AND some portion of materials 2. Application: refund some/all of `manaSpent` 3. Preparation: refund some/all of `manaCostPaid` 4. Fabricator: wire up the existing `refundFabricatorMana` function
Anexim added the ai:todo label 2026-05-30 21:10:32 +02:00
n8n-gitea was assigned by Anexim 2026-05-30 21:10:32 +02:00
Author
Owner

Fixed: Cancel handlers for application, preparation, and fabricator crafting now refund mana proportionally to remaining progress.

Fixed: Cancel handlers for application, preparation, and fabricator crafting now refund mana proportionally to remaining progress.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#221