fix: BUG 4 - Add starting equipment to craftingStore initial state
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m9s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m9s
This commit is contained in:
@@ -92,7 +92,9 @@ export type CraftingStore = CraftingState & CraftingActions;
|
||||
|
||||
export const useCraftingStore = create<CraftingStore>()(
|
||||
persist(
|
||||
(set, get) => ({
|
||||
(set, get) => {
|
||||
const startingEquipment = createStartingEquipment();
|
||||
return {
|
||||
// Initial state
|
||||
designProgress: null,
|
||||
designProgress2: null,
|
||||
@@ -101,8 +103,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
equipmentCraftingProgress: null,
|
||||
enchantmentDesigns: [],
|
||||
unlockedEffects: [],
|
||||
equipmentInstances: {},
|
||||
equippedInstances: {},
|
||||
...startingEquipment,
|
||||
lootInventory: {
|
||||
materials: {},
|
||||
blueprints: [],
|
||||
@@ -252,7 +253,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,
|
||||
@@ -263,7 +264,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
|
||||
// Initialize crafting
|
||||
const result = CraftingEquipment.initializeEquipmentCrafting(
|
||||
blueprintId,
|
||||
bluePrintId,
|
||||
state.lootInventory.materials,
|
||||
rawMana
|
||||
);
|
||||
@@ -350,7 +351,8 @@ export const useCraftingStore = create<CraftingStore>()(
|
||||
};
|
||||
});
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
{
|
||||
name: 'mana-loop-crafting',
|
||||
partialize: (state) => ({
|
||||
|
||||
Reference in New Issue
Block a user