Initial project structure: reusable isometric bot engine with D2R implementation
This commit is contained in:
commit
e0282a7111
44 changed files with 3433 additions and 0 deletions
83
games/d2r/config.py
Normal file
83
games/d2r/config.py
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
"""Diablo II: Resurrected configuration.
|
||||
|
||||
Game-specific settings for screen regions, colors, and timings.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, Tuple
|
||||
|
||||
|
||||
@dataclass
|
||||
class D2RScreenRegions:
|
||||
"""Screen regions for UI elements at 1920x1080."""
|
||||
|
||||
health_orb: Tuple[int, int, int, int] = (28, 545, 170, 170)
|
||||
mana_orb: Tuple[int, int, int, int] = (1722, 545, 170, 170)
|
||||
xp_bar: Tuple[int, int, int, int] = (0, 1058, 1920, 22)
|
||||
belt: Tuple[int, int, int, int] = (838, 1010, 244, 48)
|
||||
minimap: Tuple[int, int, int, int] = (1600, 0, 320, 320)
|
||||
inventory: Tuple[int, int, int, int] = (960, 330, 530, 440)
|
||||
stash: Tuple[int, int, int, int] = (430, 330, 530, 440)
|
||||
chat: Tuple[int, int, int, int] = (0, 800, 500, 200)
|
||||
skill_left: Tuple[int, int, int, int] = (194, 1036, 52, 52)
|
||||
skill_right: Tuple[int, int, int, int] = (1674, 1036, 52, 52)
|
||||
|
||||
|
||||
@dataclass
|
||||
class D2RColors:
|
||||
"""HSV color ranges for game element detection."""
|
||||
|
||||
health_filled: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(0, 100, 100), (10, 255, 255) # Red
|
||||
)
|
||||
mana_filled: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(100, 100, 100), (130, 255, 255) # Blue
|
||||
)
|
||||
item_unique: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(15, 100, 180), (30, 255, 255) # Gold/unique
|
||||
)
|
||||
item_set: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(35, 100, 150), (55, 255, 255) # Green/set
|
||||
)
|
||||
item_rare: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(15, 50, 200), (25, 150, 255) # Yellow/rare
|
||||
)
|
||||
portal_blue: Tuple[Tuple[int, int, int], Tuple[int, int, int]] = (
|
||||
(90, 150, 150), (120, 255, 255) # Town portal blue
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class D2RTimings:
|
||||
"""Game-specific timing constants in seconds."""
|
||||
|
||||
loading_screen_max: float = 15.0
|
||||
town_portal_cast: float = 3.5
|
||||
teleport_delay: float = 0.15
|
||||
potion_cooldown: float = 1.0
|
||||
click_delay: float = 0.1
|
||||
pickup_delay: float = 0.3
|
||||
vendor_interaction: float = 0.5
|
||||
|
||||
|
||||
@dataclass
|
||||
class D2RConfig:
|
||||
"""Master D2R configuration."""
|
||||
|
||||
resolution: Tuple[int, int] = (1920, 1080)
|
||||
regions: D2RScreenRegions = field(default_factory=D2RScreenRegions)
|
||||
colors: D2RColors = field(default_factory=D2RColors)
|
||||
timings: D2RTimings = field(default_factory=D2RTimings)
|
||||
|
||||
# Loot filter
|
||||
pickup_uniques: bool = True
|
||||
pickup_sets: bool = True
|
||||
pickup_rares: bool = True
|
||||
pickup_runes: bool = True
|
||||
min_rune_tier: int = 10 # Lem+
|
||||
pickup_gems: bool = False
|
||||
|
||||
# Safety
|
||||
health_potion_threshold: float = 0.5
|
||||
mana_potion_threshold: float = 0.3
|
||||
chicken_threshold: float = 0.2 # Exit game if health below this
|
||||
Loading…
Add table
Add a link
Reference in a new issue