fix(baal_xp): keep the leech cycling when a profile [routes] section exists

Two config-layer gaps stopped the leech from ever completing a cycle:

- _do_runs built 'run_baal_xp' from routes.get('run_baal_xp'), which raised
  KeyError when the key was absent (a profile-level [routes] section that
  lists only its own runs, e.g. paladalla's run_pindle/run_trav/run_diablo,
  does not define it). The exception escaped the Bot constructor and took
  the whole bot down at startup. Now .get(key, False).

- _baal_xp_rearm only re-set the _do_runs flag. on_maintenance re-reads
  Config().routes for its 'any run left?' check, so the leech fell through
  to end_game after every cycle and the controller created a brand new game
  purely to leave it again. Re-arm Config().routes too. The matching
  run_baal_xp=1 entry (deliberately NOT in order= - the leech is
  self-contained and must not sit between real runs) goes in the
  gitignored profile ini.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
alexpolo1
2026-09-03 21:49:55 +02:00
co-authored by Claude Opus 5
parent 21c62f2cc9
commit 53ddbc0f60
+6 -1
View File
@@ -123,7 +123,7 @@ class Bot:
self._do_runs = {
"run_level": Config().routes.get("run_level"),
"run_cold_plains": Config().routes.get("run_cold_plains"),
"run_baal_xp": Config().routes.get("run_baal_xp") and Config().baal_xp.get("enabled", False),
"run_baal_xp": Config().routes.get("run_baal_xp", False) and Config().baal_xp.get("enabled", False),
"run_trav": Config().routes.get("run_trav"),
"run_pindle": Config().routes.get("run_pindle"),
"run_shenk": Config().routes.get("run_eldritch") or Config().routes.get("run_eldritch_shenk"),
@@ -1266,6 +1266,11 @@ class Bot:
self._baal_xp_fails = 0
return
self._do_runs["run_baal_xp"] = True
# Re-arm the route in the config layer too: on_maintenance re-reads
# Config().routes for its "any run left?" check, and a profile-level
# [routes] section that lacks run_baal_xp would otherwise read False
# there and send the bot to end_game instead of the next leech cycle.
Config().routes["run_baal_xp"] = True
def _baal_xp_only(self) -> bool:
"""True when baal_xp is the only route configured."""