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

View file

@ -0,0 +1,84 @@
"""Countess farming routine for D2R.
Rune farming: Create game Black Marsh WP Tower Cellar
Kill Countess Loot runes Exit Repeat
"""
import logging
from enum import Enum, auto
logger = logging.getLogger(__name__)
class CountessPhase(Enum):
CREATE_GAME = auto()
WAYPOINT_TO_MARSH = auto()
FIND_TOWER = auto()
NAVIGATE_CELLAR = auto()
KILL_COUNTESS = auto()
LOOT = auto()
EXIT_GAME = auto()
class CountessRoutine:
"""Automated Countess farming for rune drops.
Best route for mid-tier rune farming (up to Ist).
Requires navigating 5 tower cellar levels.
"""
def __init__(self, bot):
self.bot = bot
self.phase = CountessPhase.CREATE_GAME
self.run_count = 0
def execute_run(self) -> bool:
"""Execute a single Countess run."""
logger.info(f"Starting Countess run #{self.run_count + 1}")
phases = [
(CountessPhase.CREATE_GAME, self._create_game),
(CountessPhase.WAYPOINT_TO_MARSH, self._go_to_marsh),
(CountessPhase.FIND_TOWER, self._find_tower),
(CountessPhase.NAVIGATE_CELLAR, self._navigate_cellar),
(CountessPhase.KILL_COUNTESS, self._kill_countess),
(CountessPhase.LOOT, self._loot_runes),
(CountessPhase.EXIT_GAME, self._exit_game),
]
for phase, handler in phases:
self.phase = phase
if not handler():
return False
self.bot.humanizer.wait()
self.run_count += 1
return True
def _create_game(self) -> bool:
return True
def _go_to_marsh(self) -> bool:
"""Take waypoint to Black Marsh."""
return True
def _find_tower(self) -> bool:
"""Navigate from Black Marsh to Forgotten Tower entrance."""
# TODO: This is the hardest part — tower location is random
return True
def _navigate_cellar(self) -> bool:
"""Navigate through 5 cellar levels to level 5."""
# TODO: Find stairs on each level, descend
return True
def _kill_countess(self) -> bool:
"""Kill the Countess."""
return True
def _loot_runes(self) -> bool:
"""Pick up rune drops (Countess has special rune drop table)."""
return True
def _exit_game(self) -> bool:
return True

View file

@ -0,0 +1,105 @@
"""Mephisto farming routine for D2R.
Classic Mephisto run: Create game Teleport to Durance 3
Kill Mephisto Loot Exit Repeat
"""
import logging
import time
from enum import Enum, auto
logger = logging.getLogger(__name__)
class MephistoPhase(Enum):
CREATE_GAME = auto()
TELEPORT_TO_DURANCE = auto()
FIND_MEPHISTO = auto()
KILL_MEPHISTO = auto()
LOOT = auto()
TOWN_PORTAL = auto()
STASH_ITEMS = auto()
EXIT_GAME = auto()
class MephistoRoutine:
"""Automated Mephisto farming runs.
Designed for Sorceress with Teleport. Can be adapted for
other classes with Enigma runeword.
"""
def __init__(self, bot):
self.bot = bot
self.phase = MephistoPhase.CREATE_GAME
self.run_count = 0
self.items_found = 0
def execute_run(self) -> bool:
"""Execute a single Mephisto run. Returns True if successful."""
logger.info(f"Starting Mephisto run #{self.run_count + 1}")
phases = [
(MephistoPhase.CREATE_GAME, self._create_game),
(MephistoPhase.TELEPORT_TO_DURANCE, self._teleport_to_durance),
(MephistoPhase.FIND_MEPHISTO, self._find_mephisto),
(MephistoPhase.KILL_MEPHISTO, self._kill_mephisto),
(MephistoPhase.LOOT, self._loot_items),
(MephistoPhase.TOWN_PORTAL, self._town_portal),
(MephistoPhase.STASH_ITEMS, self._stash_items),
(MephistoPhase.EXIT_GAME, self._exit_game),
]
for phase, handler in phases:
self.phase = phase
logger.debug(f"Phase: {phase.name}")
if not handler():
logger.warning(f"Phase {phase.name} failed")
return False
self.bot.humanizer.wait()
self.run_count += 1
logger.info(f"Run #{self.run_count} complete. Total items: {self.items_found}")
return True
def _create_game(self) -> bool:
"""Create a new game."""
# TODO: Navigate menu → create game with random name
return True
def _teleport_to_durance(self) -> bool:
"""Teleport from Act 3 town to Durance of Hate Level 3."""
# TODO: Navigate waypoint → Durance 2 → teleport to Durance 3
return True
def _find_mephisto(self) -> bool:
"""Locate Mephisto on Durance 3."""
# TODO: Teleport around to find Mephisto (moat trick position)
return True
def _kill_mephisto(self) -> bool:
"""Kill Mephisto using appropriate skill rotation."""
# TODO: Position at moat trick spot, cast spells
return True
def _loot_items(self) -> bool:
"""Pick up valuable items."""
# TODO: Detect and pick up items based on loot filter
return True
def _town_portal(self) -> bool:
"""Cast town portal and go to town."""
# TODO: Cast TP, click portal
return True
def _stash_items(self) -> bool:
"""Stash items if inventory is getting full."""
# TODO: Open stash, transfer items
return True
def _exit_game(self) -> bool:
"""Exit the current game."""
# TODO: Save & Exit
return True

View file

@ -0,0 +1,80 @@
"""Pindleskin farming routine for D2R.
Fastest MF run: Create game Take red portal in Harrogath
Kill Pindleskin Loot Exit Repeat
"""
import logging
from enum import Enum, auto
logger = logging.getLogger(__name__)
class PindlePhase(Enum):
CREATE_GAME = auto()
TAKE_PORTAL = auto()
FIND_PINDLE = auto()
KILL_PINDLE = auto()
LOOT = auto()
EXIT_GAME = auto()
class PindleRoutine:
"""Automated Pindleskin farming runs.
The simplest and fastest MF route. Requires Act 5 red portal
(Anya quest completed). Works with any class.
"""
def __init__(self, bot):
self.bot = bot
self.phase = PindlePhase.CREATE_GAME
self.run_count = 0
def execute_run(self) -> bool:
"""Execute a single Pindleskin run."""
logger.info(f"Starting Pindle run #{self.run_count + 1}")
phases = [
(PindlePhase.CREATE_GAME, self._create_game),
(PindlePhase.TAKE_PORTAL, self._take_red_portal),
(PindlePhase.FIND_PINDLE, self._find_pindle),
(PindlePhase.KILL_PINDLE, self._kill_pindle),
(PindlePhase.LOOT, self._loot_items),
(PindlePhase.EXIT_GAME, self._exit_game),
]
for phase, handler in phases:
self.phase = phase
if not handler():
return False
self.bot.humanizer.wait()
self.run_count += 1
return True
def _create_game(self) -> bool:
return True
def _take_red_portal(self) -> bool:
"""Navigate to and enter the red portal near Anya."""
# TODO: Find red portal in Harrogath, click it
return True
def _find_pindle(self) -> bool:
"""Locate Pindleskin in Nihlathak's Temple entrance."""
# TODO: Move toward Pindle's fixed spawn location
return True
def _kill_pindle(self) -> bool:
"""Kill Pindleskin and his minions."""
# TODO: Attack routine
return True
def _loot_items(self) -> bool:
"""Pick up valuable drops."""
return True
def _exit_game(self) -> bool:
"""Exit game."""
return True