Fix merc detection and portal clicking

- Crop A5_RED_PORTAL template to remove empty space (center now aligns with portal)
- Fix merc_icon ROI from 10,9,50,50 to 15,14,40,40 (matches 40x40 merc templates)
- Lower MercIcon threshold from 0.9 to 0.85, add MERC_A2_2 variant
- Add merc panel confirmation with 'O' key before resurrect (prevents false resurrect when icon detection fails)
- Override capabilities to can_teleport_natively
This commit is contained in:
alex
2026-06-01 22:20:49 +02:00
parent 2cd683ac7b
commit 2baf51c717
5 changed files with 22 additions and 11 deletions
+13 -2
View File
@@ -464,12 +464,23 @@ class Bot:
# Check if merc needs to be revived
if Config().char["use_merc"]:
merc_visible = False
try:
merc_visible = is_visible(ScreenObjects.MercIcon)
except Exception:
# ROI/template shape error - skip resurrect check
Logger.debug("Merc icon detection error (ROI/template issue), skipping resurrect check")
Logger.debug("Merc icon detection error, skipping resurrect check")
merc_visible = True
# Confirm with 'O' key - opens merc panel if alive, does nothing if dead
if not merc_visible and not self._game_stats._merc_resurrect_failed:
Logger.debug("Merc icon not visible, confirming with merc panel check")
keyboard.send("o")
wait(0.3, 0.4)
merc_panel_open = is_visible(ScreenObjects.LeftPanel)
if merc_panel_open:
# Merc is alive - panel opened, close it
keyboard.send("o")
wait(0.2, 0.3)
merc_visible = True
if not merc_visible and not self._game_stats._merc_resurrect_failed:
Logger.info("Resurrect merc")
new_loc = self._town_manager.resurrect(self._curr_loc)