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>()(
|
export const useCraftingStore = create<CraftingStore>()(
|
||||||
persist(
|
persist(
|
||||||
(set, get) => ({
|
(set, get) => {
|
||||||
|
const startingEquipment = createStartingEquipment();
|
||||||
|
return {
|
||||||
// Initial state
|
// Initial state
|
||||||
designProgress: null,
|
designProgress: null,
|
||||||
designProgress2: null,
|
designProgress2: null,
|
||||||
@@ -101,8 +103,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
equipmentCraftingProgress: null,
|
equipmentCraftingProgress: null,
|
||||||
enchantmentDesigns: [],
|
enchantmentDesigns: [],
|
||||||
unlockedEffects: [],
|
unlockedEffects: [],
|
||||||
equipmentInstances: {},
|
...startingEquipment,
|
||||||
equippedInstances: {},
|
|
||||||
lootInventory: {
|
lootInventory: {
|
||||||
materials: {},
|
materials: {},
|
||||||
blueprints: [],
|
blueprints: [],
|
||||||
@@ -252,7 +253,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
|
|
||||||
// Check if we can start crafting
|
// Check if we can start crafting
|
||||||
const check = CraftingEquipment.canStartEquipmentCrafting(
|
const check = CraftingEquipment.canStartEquipmentCrafting(
|
||||||
blueprintId,
|
bluePrintId,
|
||||||
state.lootInventory.blueprints.includes(blueprintId),
|
state.lootInventory.blueprints.includes(blueprintId),
|
||||||
state.lootInventory.materials,
|
state.lootInventory.materials,
|
||||||
rawMana,
|
rawMana,
|
||||||
@@ -263,7 +264,7 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
|
|
||||||
// Initialize crafting
|
// Initialize crafting
|
||||||
const result = CraftingEquipment.initializeEquipmentCrafting(
|
const result = CraftingEquipment.initializeEquipmentCrafting(
|
||||||
blueprintId,
|
bluePrintId,
|
||||||
state.lootInventory.materials,
|
state.lootInventory.materials,
|
||||||
rawMana
|
rawMana
|
||||||
);
|
);
|
||||||
@@ -350,7 +351,8 @@ export const useCraftingStore = create<CraftingStore>()(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}),
|
};
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'mana-loop-crafting',
|
name: 'mana-loop-crafting',
|
||||||
partialize: (state) => ({
|
partialize: (state) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user