From 227e1b7183806f2ae8b6c11492bd70522238225f Mon Sep 17 00:00:00 2001 From: zhipu Date: Fri, 27 Mar 2026 17:58:00 +0000 Subject: [PATCH] fix: correct imports for getActiveEquipmentSpells and getTotalDPS - Import getActiveEquipmentSpells and getTotalDPS from computed-stats.ts instead of store.ts - Remove duplicate local function definition in SpireTab.tsx - Clean up unused imports --- src/app/page.tsx | 3 ++- src/components/game/tabs/SpireTab.tsx | 36 +-------------------------- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index c2fd217..bfa6dbd 100755 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,8 @@ 'use client'; import { useEffect, useState } from 'react'; -import { useGameStore, useGameLoop, fmt, fmtDec, getFloorElement, computeMaxMana, computeRegen, computeClickMana, getMeditationBonus, getIncursionStrength, canAffordSpellCost, getActiveEquipmentSpells, getTotalDPS } from '@/lib/game/store'; +import { useGameStore, useGameLoop, fmt, fmtDec, getFloorElement, computeMaxMana, computeRegen, computeClickMana, getMeditationBonus, getIncursionStrength, canAffordSpellCost } from '@/lib/game/store'; +import { getActiveEquipmentSpells, getTotalDPS } from '@/lib/game/computed-stats'; import { getDamageBreakdown } from '@/lib/game/computed-stats'; import { ELEMENTS, GUARDIANS, SPELLS_DEF, PRESTIGE_DEF, getStudySpeedMultiplier, getStudyCostMultiplier } from '@/lib/game/constants'; import { SKILL_EVOLUTION_PATHS, getTierMultiplier } from '@/lib/game/skill-evolution'; diff --git a/src/components/game/tabs/SpireTab.tsx b/src/components/game/tabs/SpireTab.tsx index a0a045e..595fe09 100755 --- a/src/components/game/tabs/SpireTab.tsx +++ b/src/components/game/tabs/SpireTab.tsx @@ -11,44 +11,10 @@ import { Swords, BookOpen, ChevronUp, ChevronDown, RotateCcw, X } from 'lucide-r import type { GameStore } from '@/lib/game/types'; import { ELEMENTS, GUARDIANS, SPELLS_DEF, SKILLS_DEF } from '@/lib/game/constants'; import { fmt, fmtDec, getFloorElement, canAffordSpellCost } from '@/lib/game/store'; +import { getActiveEquipmentSpells, getTotalDPS } from '@/lib/game/computed-stats'; import { formatSpellCost, getSpellCostColor, formatStudyTime } from '@/lib/game/formatting'; import { ComboMeter, CraftingProgress, StudyProgress } from '@/components/game'; -import { ENCHANTMENT_EFFECTS } from '@/lib/game/data/enchantment-effects'; -import { EQUIPMENT_TYPES } from '@/lib/game/data/equipment'; import { getUnifiedEffects } from '@/lib/game/effects'; -import { getTotalDPS } from '@/lib/game/store'; - -// Helper to get active spells from equipped caster weapons -function getActiveEquipmentSpells( - equippedInstances: Record, - equipmentInstances: Record }> -): Array<{ spellId: string; equipmentId: string }> { - const spells: Array<{ spellId: string; equipmentId: string }> = []; - const weaponSlots = ['mainHand', 'offHand'] as const; - - for (const slot of weaponSlots) { - const instanceId = equippedInstances[slot]; - if (!instanceId) continue; - - const instance = equipmentInstances[instanceId]; - if (!instance) continue; - - const equipType = EQUIPMENT_TYPES[instance.typeId]; - if (!equipType || equipType.category !== 'caster') continue; - - for (const ench of instance.enchantments) { - const effectDef = ENCHANTMENT_EFFECTS[ench.effectId]; - if (effectDef?.effect.type === 'spell' && effectDef.effect.spellId) { - spells.push({ - spellId: effectDef.effect.spellId, - equipmentId: instanceId, - }); - } - } - } - - return spells; -} interface SpireTabProps { store: GameStore;