Initial project structure: reusable isometric bot engine with D2R implementation

This commit is contained in:
Hoid 2026-02-14 08:50:36 +00:00
commit e0282a7111
44 changed files with 3433 additions and 0 deletions

View file

@ -0,0 +1,46 @@
"""Character movement control for isometric games.
Handles click-to-move navigation with human-like patterns.
"""
from typing import Tuple, Optional
import logging
import time
import numpy as np
from engine.input.mouse import MouseController
from engine.input.humanize import Humanizer
from engine.navigation.pathfinder import Waypoint, WaypointGraph
logger = logging.getLogger(__name__)
class MovementController:
"""Controls character movement via click-to-move."""
def __init__(self, mouse: MouseController, humanizer: Humanizer):
self.mouse = mouse
self.humanizer = humanizer
self.waypoints = WaypointGraph()
def click_to_move(self, x: int, y: int) -> None:
"""Click a screen position to move there."""
jx, jy = self.humanizer.jitter_position(x, y)
self.mouse.move_to(jx, jy)
self.humanizer.wait()
self.mouse.click()
def navigate_waypoints(self, start: str, goal: str) -> bool:
"""Navigate between named waypoints."""
path = self.waypoints.find_path(start, goal)
if not path:
logger.warning(f"No path from {start} to {goal}")
return False
for waypoint in path[1:]: # Skip start
self.click_to_move(waypoint.screen_x, waypoint.screen_y)
# Wait for movement (game-specific timing)
time.sleep(self.humanizer.reaction_delay() + 0.5)
return True