644b76f16d
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
- Add unlocksRecipes field to DisciplinePerk type - Add study-fabricator-recipes discipline (earth/metal/sand/crystal recipes) - Add study-wizard-branch discipline (wizard equipment recipes) - Add study-physical-branch discipline (physical combat equipment recipes) - Collect unlocksRecipes during discipline tick processing - Pass recipe unlocks to crafting store via gameStore - Add unlockRecipes action to craftingStore with persistence - Filter fabricator recipes by unlock status in FabricatorSubTab UI
102 lines
2.7 KiB
TypeScript
102 lines
2.7 KiB
TypeScript
// ─── Crafting Store Initial State ─────────────────────────────────────────────
|
|
// Helper to generate the starting equipment instances for new games.
|
|
|
|
import * as CraftingUtils from '../crafting-utils';
|
|
import type { EquipmentInstance } from '../types';
|
|
import type { CraftingState } from './craftingStore.types';
|
|
|
|
/**
|
|
* Create the full default state for the crafting store.
|
|
* Used by both initial store creation and resetCrafting().
|
|
*/
|
|
export function createDefaultCraftingState(): CraftingState {
|
|
const initial = createInitialEquipmentInstances();
|
|
return {
|
|
designProgress: null,
|
|
designProgress2: null,
|
|
preparationProgress: null,
|
|
applicationProgress: null,
|
|
equipmentCraftingProgress: null,
|
|
enchantmentDesigns: [],
|
|
unlockedEffects: [],
|
|
unlockedRecipes: [],
|
|
equippedInstances: initial.equippedInstances,
|
|
equipmentInstances: initial.instances,
|
|
lootInventory: {
|
|
materials: {},
|
|
blueprints: [],
|
|
},
|
|
enchantmentSelection: {
|
|
selectedEquipmentType: null,
|
|
selectedEffects: [],
|
|
designName: '',
|
|
selectedDesign: null,
|
|
selectedEquipmentInstance: null,
|
|
},
|
|
lastError: null,
|
|
};
|
|
}
|
|
|
|
export function createInitialEquipmentInstances() {
|
|
const staffId = CraftingUtils.generateInstanceId();
|
|
const staffInstance: EquipmentInstance = {
|
|
instanceId: staffId,
|
|
typeId: 'basicStaff',
|
|
name: 'Basic Staff',
|
|
enchantments: [{ effectId: 'spell_manaBolt', stacks: 1, actualCost: 50 }],
|
|
usedCapacity: 50,
|
|
totalCapacity: 50,
|
|
rarity: 'common',
|
|
quality: 100,
|
|
tags: [],
|
|
weaponMana: 0,
|
|
weaponManaMax: 0,
|
|
weaponManaRegen: 0,
|
|
weaponManaType: 'raw',
|
|
};
|
|
|
|
const shirtId = CraftingUtils.generateInstanceId();
|
|
const shirtInstance: EquipmentInstance = {
|
|
instanceId: shirtId,
|
|
typeId: 'civilianShirt',
|
|
name: 'Civilian Shirt',
|
|
enchantments: [],
|
|
usedCapacity: 0,
|
|
totalCapacity: 30,
|
|
rarity: 'common',
|
|
quality: 100,
|
|
tags: [],
|
|
};
|
|
|
|
const shoesId = CraftingUtils.generateInstanceId();
|
|
const shoesInstance: EquipmentInstance = {
|
|
instanceId: shoesId,
|
|
typeId: 'civilianShoes',
|
|
name: 'Civilian Shoes',
|
|
enchantments: [],
|
|
usedCapacity: 0,
|
|
totalCapacity: 15,
|
|
rarity: 'common',
|
|
quality: 100,
|
|
tags: [],
|
|
};
|
|
|
|
return {
|
|
instances: {
|
|
[staffId]: staffInstance,
|
|
[shirtId]: shirtInstance,
|
|
[shoesId]: shoesInstance,
|
|
} as Record<string, EquipmentInstance>,
|
|
equippedInstances: {
|
|
mainHand: staffId,
|
|
offHand: null,
|
|
head: null,
|
|
body: shirtId,
|
|
hands: null,
|
|
feet: shoesId,
|
|
accessory1: null,
|
|
accessory2: null,
|
|
} as Record<string, string | null>,
|
|
};
|
|
}
|