import { useState, useEffect, useRef } from 'react' import { invoke } from '@tauri-apps/api/tauri' import { Monitor, Crosshair, Check, ChevronRight, ChevronLeft, RefreshCw, AlertCircle, Settings2 } from 'lucide-react' interface CalibrationRegion { name: string key: string description: string required: boolean detected?: boolean } const REGIONS: CalibrationRegion[] = [ { name: 'HP Bar', key: 'hp_bar', description: 'Health bar at bottom of screen', required: true }, { name: 'Radar', key: 'radar', description: 'Mini-map showing location', required: true }, { name: 'Skill Window', key: 'skill_window', description: 'Window showing skill gains', required: false }, { name: 'Mob Name', key: 'mob_name', description: 'Floating text above creatures', required: false }, ] export default function SetupWizard() { const [step, setStep] = useState(0) const [isDetecting, setIsDetecting] = useState(false) const [detections, setDetections] = useState>({}) const [calibration, setCalibration] = useState(null) const [showWizard, setShowWizard] = useState(false) useEffect(() => { checkFirstRun() }, []) const checkFirstRun = async () => { try { const settings = await invoke('get_settings') if (!settings?.ocr?.calibration) { setShowWizard(true) } } catch (e) { setShowWizard(true) } } const autoDetect = async () => { setIsDetecting(true) try { const detected = await invoke('detect_ui_elements') setDetections({ hp_bar: detected.hp_bar.found, radar: detected.radar.found, skill_window: detected.skill_window.found, }) } catch (e) { console.error('Detection failed:', e) } setIsDetecting(false) } const saveCalibration = async () => { try { await invoke('set_ocr_calibration', { calibration }) setShowWizard(false) } catch (e) { console.error('Save failed:', e) } } if (!showWizard) return null return (
{/* Header */}

EU-Utility Setup

Configure screen regions for OCR recognition

{/* Steps */}
{step === 0 && (

Welcome to EU-Utility V3

This setup wizard will help you configure the application to read screen elements from Entropia Universe. This enables features like automatic loot tracking, HP monitoring, and skill gain detection.

What will be configured:

  • HP bar position and reading
  • Radar/mini-map coordinate extraction
  • Skill window detection
  • Mob name recognition
)} {step === 1 && (

Auto-Detect UI Elements

Make sure Entropia Universe is running and visible on your screen, then click detect to automatically find UI elements.

{REGIONS.map((region) => (
{region.name} {detections[region.key] ? ( ) : ( )}

{region.description}

))}
)} {step === 2 && ( { setCalibration(cal) setStep(3) }} /> )} {step === 3 && (

Setup Complete

EU-Utility is now configured to read screen elements. You can adjust these settings anytime in Settings {`->`} OCR.

)}
{/* Navigation */}
{REGIONS.map((_, i) => (
))}
) } interface RegionCalibratorProps { regions: CalibrationRegion[] onComplete: (calibration: any) => void } function RegionCalibrator({ regions, onComplete }: RegionCalibratorProps) { const [activeRegion, setActiveRegion] = useState(0) const [regions_, _setRegions] = useState>({}) const canvasRef = useRef(null) const captureScreen = async () => { try { const screenshot = await invoke('capture_screen') return screenshot } catch (e) { console.error('Capture failed:', e) return null } } return (

Click and drag on the screenshot to define each region

{regions.map((region, i) => ( ))}
) }