From e184db70451b36d9db57a43dbb8d39be19f12ed3 Mon Sep 17 00:00:00 2001 From: aeon0 Date: Sun, 12 Dec 2021 18:08:38 +0100 Subject: [PATCH] Rename region of interest (#275) --- config/game.ini | 4 ++-- src/ui/ui_manager.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/game.ini b/config/game.ini index 7fb1e3e..12696fc 100644 --- a/config/game.ini +++ b/config/game.ini @@ -92,7 +92,8 @@ max_walk_dist=127 ; all rois are in [left, top, width, height] format is_overburdened=11,510,513,60 save_and_exit=500,233,273,173 -go_btn=533,627,213,67 +offline_btn=533,627,213,67 +online_btn=427,613,213,67 difficulty_select=536,236,210,320 gold_btn=927,491,267,100 inventory_gold=980,510,150,40 @@ -109,7 +110,6 @@ inventory=860,343,394,165 vendor_stash=29,84,400,400 skill_right=664,673,41,41 hero_selection_logo=0,0,367,553 -play_btn=427,613,213,67 window_ingame_ref=600,650,90,90 no_pickup=5,530,240,65 repair_needed=1000,0,280,280 diff --git a/src/ui/ui_manager.py b/src/ui/ui_manager.py index c3c30be..0ad0727 100644 --- a/src/ui/ui_manager.py +++ b/src/ui/ui_manager.py @@ -157,7 +157,7 @@ class UiManager(): # it returns a bool value (True or False) if the button was found, and the position of it # roi = Region of interest. It reduces the search area and can be adapted within game.ini # by running >> python src/screen.py you can visualize all of the currently set region of interests - found_btn = self._template_finder.search(["PLAY_BTN","PLAY_BTN_GRAY"], img, roi=self._config.ui_roi["go_btn"], threshold=0.8, best_match=True) + found_btn = self._template_finder.search(["PLAY_BTN","PLAY_BTN_GRAY"], img, roi=self._config.ui_roi["offline_btn"], threshold=0.8, best_match=True) if found_btn.name == "PLAY_BTN": # We need to convert the position to monitor coordinates (e.g. if someone is using 2 monitors or windowed mode) x, y = self._screen.convert_screen_to_monitor(found_btn.position) @@ -170,7 +170,7 @@ class UiManager(): break else: # Might be in online mode? - found_btn = self._template_finder.search("PLAY_BTN", img, roi=self._config.ui_roi["play_btn"], threshold=0.8) + found_btn = self._template_finder.search("PLAY_BTN", img, roi=self._config.ui_roi["online_btn"], threshold=0.8) if found_btn.valid: Logger.error("Botty only works for single player. Please switch to offline mode and restart botty!") return False