45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
"""Main menu and character select screen detection for D2R."""
|
|
|
|
from typing import Optional
|
|
import logging
|
|
|
|
import numpy as np
|
|
|
|
from engine.vision.detector import ElementDetector, Detection
|
|
from games.d2r.config import D2RConfig
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class MenuDetector:
|
|
"""Detects D2R menu screens (main menu, character select, lobby)."""
|
|
|
|
def __init__(self, config: D2RConfig):
|
|
self.config = config
|
|
self.detector = ElementDetector()
|
|
|
|
def is_main_menu(self, screen: np.ndarray) -> bool:
|
|
"""Check if we're on the main menu."""
|
|
# TODO: Template match for main menu elements
|
|
return False
|
|
|
|
def is_character_select(self, screen: np.ndarray) -> bool:
|
|
"""Check if we're on character select screen."""
|
|
return False
|
|
|
|
def is_lobby(self, screen: np.ndarray) -> bool:
|
|
"""Check if we're in the game lobby."""
|
|
return False
|
|
|
|
def is_loading(self, screen: np.ndarray) -> bool:
|
|
"""Check if a loading screen is active."""
|
|
return False
|
|
|
|
def select_character(self, screen: np.ndarray, char_index: int = 0) -> Optional[Detection]:
|
|
"""Find and return the character slot to click."""
|
|
# TODO: Detect character slots
|
|
return None
|
|
|
|
def find_create_game_button(self, screen: np.ndarray) -> Optional[Detection]:
|
|
"""Find the create game button."""
|
|
return None
|