From 7a7950e75259fa4bae95d14fa5f8526e75964078 Mon Sep 17 00:00:00 2001 From: alexpolo1 Date: Sat, 22 Aug 2026 14:11:05 +0200 Subject: [PATCH] feat(bot): support no-TP levelling chars (cold-plains-only grinder) - on_init: cold-plains-only profiles skip town-marker detection and start directly (char is already standing in A1 town), same as run_level-only - on_end_run: chars with no teleport at all (pre-clvl-18) walk back to town instead of failing on TP; _walk_back_to_town() walks south in steps checking for town markers, then maintenance's open_wp() re-detects the physical act and traverses from there Enables the bloodmoor profile: lvl 1 sorc firebolt grinder that walks out to Cold Plains, scans for enemies, kills, and walks back. --- src/bot.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/bot.py b/src/bot.py index e2492dc..c196d71 100644 --- a/src/bot.py +++ b/src/bot.py @@ -331,6 +331,15 @@ class Bot: self._curr_loc = Location.A1_TOWN_START self.trigger_or_stop("skip_to_level") return + # Same for a cold-plains-only grinder (e.g. the bloodmoor lvl 1 sorc): + # the character is already standing in A1 town, so skip the town marker + # scan and go straight to the run. + if list(self._do_runs.keys()) == ["run_cold_plains"]: + Logger.info("Cold Plains run only - skipping town detection, starting directly") + self._curr_loc = Location.A1_TOWN_START + self._spawn_act = Location.A1_TOWN_START + self.trigger_or_stop("skip_to_level") + return transition_to_screens = Bot._rebuild_as_asset_to_trigger({ "select_character": main_menu.MAIN_MENU_MARKERS, "start_from_town": town_manager.TOWN_MARKERS, @@ -896,9 +905,32 @@ class Bot: # TP failed twice Logger.warning("TP to town failed twice, trying to walk back") set_pause_state(True) + # No TP at all (e.g. a pre-clvl-18 levelling char): walk back to town. + # The next maintenance's open_wp() re-detects the physical act and + # traverses from wherever the character actually is, so this works + # from anywhere in A1. + if not self._char.capabilities.can_teleport_natively and not self._char.capabilities.can_teleport_with_charges: + Logger.info("No teleport available - walking back to town") + self._walk_back_to_town() + self._curr_loc = self._verify_town_location(self._curr_loc if isinstance(self._curr_loc, str) else None) + self.trigger_or_stop("maintenance") + return self._curr_loc = self._verify_town_location(self._curr_loc if isinstance(self._curr_loc, str) else None) self.trigger_or_stop("maintenance") + def _walk_back_to_town(self, max_steps: int = 24): + """Walk south (town is south of the A1 outdoor areas) until a town + marker is visible. Used when the character has no teleport at all.""" + from screen import convert_abs_to_monitor + for i in range(max_steps): + if self._town_manager.detect_current_act(timeout=1.5): + Logger.info(f"Walk-back: town markers visible after {i + 1} step(s)") + return + pos_m = convert_abs_to_monitor((random.randint(-40, 40), 120 + random.randint(0, 60))) + self._char.walk(pos_m, force_move=True) + wait(1.0, 1.6) + Logger.warning(f"Walk-back: no town marker after {max_steps} steps - continuing anyway") + # All the runs go here # ================================== def _save_error_screenshot(self, run_name: str, reason: str):