import { useFrame } from "@react-three/fiber"; import { useRef } from "react"; import type { Group } from "three"; import { useGameStore } from "../game/store"; import { useWailingEncounterStore, wailingDisciplePosition, } from "../game/wailingCavernsEncounter"; import { WorldNpcPrompt } from "./WorldNpcPrompt"; export function WailingNaralexEvent() { const activeDungeonId = useGameStore((state) => state.activeDungeonId); const gameMode = useGameStore((state) => state.gameMode); const phase = useWailingEncounterStore((state) => state.phase); const phaseStartedAt = useWailingEncounterStore((state) => state.phaseStartedAt); const groupRef = useRef(null); useFrame(() => { if (activeDungeonId !== "wailing-caverns" || gameMode !== "dungeon") return; const now = Date.now(); const position = wailingDisciplePosition( useWailingEncounterStore.getState().phase, useWailingEncounterStore.getState().phaseStartedAt, now, ); groupRef.current?.position.set(...position); }); if (activeDungeonId !== "wailing-caverns" || gameMode !== "dungeon") return null; const initialPosition = wailingDisciplePosition(phase, phaseStartedAt); return (
Disciple of Naralex {phase === "locked" ? Defeat the four Fanglords : null} {phase === "ready" ? ( ) : null} {phase === "cleansing" ? Channeling Serpentine Cleansing… : null} {phase === "complete" ? Naralex has awakened : null}
); }