refactor: remove legacy store.ts and crafting-slice.ts, complete modular store migration
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
- Delete store.ts (355 LOC monolithic store, zero imports) - Delete crafting-slice.ts (379 LOC legacy crafting module) - Inline createStartingEquipment() into craftingStore.ts - Remove legacy equipment/inventory fields from GameState - Remove EquipmentDef from game.ts imports (unused) - Fix duplicate EquipmentSpellState export in types.ts - Fix bluePrintId typo in craftingStore.ts - Update stores/index.ts to import CraftingState/CraftingActions from craftingStore.types - Update EquipmentTab.test.ts to test store state instead of deleted module - Clean up stale comments referencing crafting-slice.ts - Reduce TS errors from 83 to 72 by removing conflicting legacy types
This commit is contained in:
@@ -7,7 +7,7 @@ import * as CraftingUtils from '../crafting-utils';
|
||||
import * as CraftingDesign from '../crafting-design';
|
||||
import { useManaStore } from './manaStore';
|
||||
import { useCombatStore } from './combatStore';
|
||||
import { createStartingEquipment } from '../crafting-slice';
|
||||
|
||||
import { useUIStore } from './uiStore';
|
||||
import * as ApplicationActions from '../crafting-actions/application-actions';
|
||||
import * as PreparationActions from '../crafting-actions/preparation-actions';
|
||||
@@ -16,7 +16,45 @@ import * as CraftingEquipment from '../crafting-equipment';
|
||||
export const useCraftingStore = create<CraftingStore>()(
|
||||
persist(
|
||||
(set, get) => {
|
||||
const startingEquipment = createStartingEquipment();
|
||||
const staffId = CraftingUtils.generateInstanceId();
|
||||
const staffInstance = {
|
||||
instanceId: staffId,
|
||||
typeId: 'basicStaff',
|
||||
name: 'Basic Staff',
|
||||
enchantments: [{ effectId: 'spell_manaBolt', stacks: 1, actualCost: 50 }],
|
||||
usedCapacity: 50,
|
||||
totalCapacity: 50,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shirtId = CraftingUtils.generateInstanceId();
|
||||
const shirtInstance = {
|
||||
instanceId: shirtId,
|
||||
typeId: 'civilianShirt',
|
||||
name: 'Civilian Shirt',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 30,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
const shoesId = CraftingUtils.generateInstanceId();
|
||||
const shoesInstance = {
|
||||
instanceId: shoesId,
|
||||
typeId: 'civilianShoes',
|
||||
name: 'Civilian Shoes',
|
||||
enchantments: [],
|
||||
usedCapacity: 0,
|
||||
totalCapacity: 15,
|
||||
rarity: 'common',
|
||||
quality: 100,
|
||||
tags: [],
|
||||
};
|
||||
|
||||
return {
|
||||
// Initial state
|
||||
designProgress: null,
|
||||
@@ -26,7 +64,21 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
equipmentCraftingProgress: null,
|
||||
enchantmentDesigns: [],
|
||||
unlockedEffects: [],
|
||||
...startingEquipment,
|
||||
equippedInstances: {
|
||||
mainHand: staffId,
|
||||
offHand: null,
|
||||
head: null,
|
||||
body: shirtId,
|
||||
hands: null,
|
||||
feet: shoesId,
|
||||
accessory1: null,
|
||||
accessory2: null,
|
||||
},
|
||||
equipmentInstances: {
|
||||
[staffId]: staffInstance,
|
||||
[shirtId]: shirtInstance,
|
||||
[shoesId]: shoesInstance,
|
||||
},
|
||||
lootInventory: {
|
||||
materials: {},
|
||||
blueprints: [],
|
||||
@@ -177,7 +229,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
|
||||
// Check if we can start crafting
|
||||
const check = CraftingEquipment.canStartEquipmentCrafting(
|
||||
bluePrintId,
|
||||
blueprintId,
|
||||
state.lootInventory.blueprints.includes(blueprintId),
|
||||
state.lootInventory.materials,
|
||||
rawMana,
|
||||
@@ -188,7 +240,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
|
||||
// Initialize crafting
|
||||
const result = CraftingEquipment.initializeEquipmentCrafting(
|
||||
bluePrintId,
|
||||
blueprintId,
|
||||
state.lootInventory.materials,
|
||||
rawMana
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user