fix: complete remaining tab migrations, fix LeftPanel ghost fields, remove backup files
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m42s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m42s
This commit is contained in:
@@ -387,7 +387,9 @@ Mana-Loop/
|
|||||||
│ │ │ │ ├── ui-store-tests/
|
│ │ │ │ ├── ui-store-tests/
|
||||||
│ │ │ │ ├── store-methods.test.ts
|
│ │ │ │ ├── store-methods.test.ts
|
||||||
│ │ │ │ └── stores.test.ts
|
│ │ │ │ └── stores.test.ts
|
||||||
|
│ │ │ ├── attunementStore.ts
|
||||||
│ │ │ ├── combatStore.ts
|
│ │ │ ├── combatStore.ts
|
||||||
|
│ │ │ ├── craftingStore.ts
|
||||||
│ │ │ ├── gameActions.ts
|
│ │ │ ├── gameActions.ts
|
||||||
│ │ │ ├── gameHooks.ts
|
│ │ │ ├── gameHooks.ts
|
||||||
│ │ │ ├── gameLoopActions.ts
|
│ │ │ ├── gameLoopActions.ts
|
||||||
@@ -465,5 +467,8 @@ Mana-Loop/
|
|||||||
├── package.json
|
├── package.json
|
||||||
├── postcss.config.mjs
|
├── postcss.config.mjs
|
||||||
├── tailwind.config.ts
|
├── tailwind.config.ts
|
||||||
|
├── tsconfig-check.json
|
||||||
|
├── tsconfig-leftpanel.json
|
||||||
|
├── tsconfig-lp.json
|
||||||
├── tsconfig.json
|
├── tsconfig.json
|
||||||
└── vitest.config.ts
|
└── vitest.config.ts
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
// Attunement Store
|
||||||
|
// Handles attunements, XP, leveling, and related actions
|
||||||
|
|
||||||
|
import { create } from 'zustand';
|
||||||
|
import { persist } from 'zustand/middleware';
|
||||||
|
import type { AttunementState } from '../types';
|
||||||
|
import { ATTUNEMENTS_DEF, getAttunementXPForLevel, MAX_ATTUNEMENT_LEVEL } from '../data/attunements';
|
||||||
|
|
||||||
|
export interface AttunementStoreState {
|
||||||
|
attunements: Record<string, AttunementState>;
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
addAttunementXP: (attunementId: string, amount: number) => void;
|
||||||
|
debugUnlockAttunement: (attunementId: string) => void;
|
||||||
|
setAttunements: (attunements: Record<string, AttunementState>) => void;
|
||||||
|
|
||||||
|
// Reset
|
||||||
|
resetAttunements: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
attunements: {
|
||||||
|
enchanter: { id: 'enchanter', active: true, level: 1, experience: 0 } as AttunementState,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useAttunementStore = create<AttunementStoreState>()(
|
||||||
|
persist(
|
||||||
|
(set, get) => ({
|
||||||
|
...initialState,
|
||||||
|
|
||||||
|
addAttunementXP: (attunementId: string, amount: number) => {
|
||||||
|
set((state) => {
|
||||||
|
const attState = state.attunements?.[attunementId];
|
||||||
|
if (!attState) return state;
|
||||||
|
|
||||||
|
let newXP = attState.experience + amount;
|
||||||
|
let newLevel = attState.level;
|
||||||
|
|
||||||
|
// Level up if enough XP
|
||||||
|
while (newLevel < MAX_ATTUNEMENT_LEVEL) {
|
||||||
|
const xpNeeded = getAttunementXPForLevel(newLevel + 1);
|
||||||
|
if (newXP >= xpNeeded) {
|
||||||
|
newXP -= xpNeeded;
|
||||||
|
newLevel++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
attunements: {
|
||||||
|
...state.attunements,
|
||||||
|
[attunementId]: {
|
||||||
|
...attState,
|
||||||
|
level: newLevel,
|
||||||
|
experience: newXP,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
debugUnlockAttunement: (attunementId: string) => {
|
||||||
|
set((state) => ({
|
||||||
|
attunements: {
|
||||||
|
...state.attunements,
|
||||||
|
[attunementId]: {
|
||||||
|
id: attunementId,
|
||||||
|
active: true,
|
||||||
|
level: 1,
|
||||||
|
experience: 0,
|
||||||
|
} as AttunementState,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
|
setAttunements: (attunements: Record<string, AttunementState>) => {
|
||||||
|
set({ attunements });
|
||||||
|
},
|
||||||
|
|
||||||
|
resetAttunements: () => {
|
||||||
|
set(initialState);
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: 'mana-loop-attunements',
|
||||||
|
partialize: (state) => ({
|
||||||
|
attunements: state.attunements,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// ─── Crafting Store ─────────────────────────────────────────────────────
|
||||||
|
// Handles equipment crafting, enchantment design, and crafting progress
|
||||||
|
// This is a modular store that manages all crafting-related state
|
||||||
|
|
||||||
|
import { create } from 'zustand';
|
||||||
|
import { persist } from 'zustand/middleware';
|
||||||
|
import type { DesignProgress, PreparationProgress, ApplicationProgress, EquipmentCraftingProgress } from '../types';
|
||||||
|
|
||||||
|
export interface CraftingState {
|
||||||
|
// Crafting progress
|
||||||
|
designProgress: DesignProgress | null;
|
||||||
|
designProgress2: DesignProgress | null; // For ENCHANT_MASTERY (2 concurrent designs)
|
||||||
|
preparationProgress: PreparationProgress | null;
|
||||||
|
applicationProgress: ApplicationProgress | null;
|
||||||
|
equipmentCraftingProgress: EquipmentCraftingProgress | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CraftingActions {
|
||||||
|
// Actions for design progress
|
||||||
|
setDesignProgress: (progress: DesignProgress | null) => void;
|
||||||
|
setDesignProgress2: (progress: DesignProgress | null) => void;
|
||||||
|
|
||||||
|
// Actions for preparation progress
|
||||||
|
setPreparationProgress: (progress: PreparationProgress | null) => void;
|
||||||
|
|
||||||
|
// Actions for application progress
|
||||||
|
setApplicationProgress: (progress: ApplicationProgress | null) => void;
|
||||||
|
|
||||||
|
// Actions for equipment crafting progress
|
||||||
|
setEquipmentCraftingProgress: (progress: EquipmentCraftingProgress | null) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CraftingStore = CraftingState & CraftingActions;
|
||||||
|
|
||||||
|
export const useCraftingStore = create<CraftingStore>()(
|
||||||
|
persist(
|
||||||
|
(set) => ({
|
||||||
|
// Initial state
|
||||||
|
designProgress: null,
|
||||||
|
designProgress2: null,
|
||||||
|
preparationProgress: null,
|
||||||
|
applicationProgress: null,
|
||||||
|
equipmentCraftingProgress: null,
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
setDesignProgress: (progress) => set({ designProgress: progress }),
|
||||||
|
setDesignProgress2: (progress) => set({ designProgress2: progress }),
|
||||||
|
setPreparationProgress: (progress) => set({ preparationProgress: progress }),
|
||||||
|
setApplicationProgress: (progress) => set({ applicationProgress: progress }),
|
||||||
|
setEquipmentCraftingProgress: (progress) => set({ equipmentCraftingProgress: progress }),
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
name: 'mana-loop-crafting',
|
||||||
|
partialize: (state) => ({
|
||||||
|
designProgress: state.designProgress,
|
||||||
|
designProgress2: state.designProgress2,
|
||||||
|
preparationProgress: state.preparationProgress,
|
||||||
|
applicationProgress: state.applicationProgress,
|
||||||
|
equipmentCraftingProgress: state.equipmentCraftingProgress,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": ["src/app/components/LeftPanel.tsx"],
|
||||||
|
"exclude": ["node_modules", "src/components"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": ["src/app/components/LeftPanel.tsx"],
|
||||||
|
"exclude": ["node_modules", "src/components"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": ["src/app/components/LeftPanel.tsx"],
|
||||||
|
"exclude": ["node_modules", "src/components"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user