diff --git a/assets/templates/inventory_no_gold.png b/assets/templates/inventory_no_gold.png new file mode 100644 index 0000000..8a9f0b0 Binary files /dev/null and b/assets/templates/inventory_no_gold.png differ diff --git a/game.ini b/game.ini index 2aec7d3..66e9112 100644 --- a/game.ini +++ b/game.ini @@ -95,6 +95,7 @@ save_and_exit=500,233,273,173 go_btn=533,627,213,67 difficulty_select=556,278,168,142 gold_btn=927,491,267,100 +inventory_gold=980,510,150,40 health_globe=160,580,240,140 mana_globe=887,580,240,140 cut_skill_bar=0,0,1280,653 diff --git a/src/ui_manager.py b/src/ui_manager.py index 1be8a49..20ef74e 100644 --- a/src/ui_manager.py +++ b/src/ui_manager.py @@ -287,14 +287,19 @@ class UiManager(): wait(0.3, 0.4) # stash gold if self._config.char["stash_gold"]: - x, y = self._screen.convert_screen_to_monitor(gold_btn.position) - mouse.move(x, y, randomize=4) - wait(0.1, 0.15) - mouse.press(button="left") - wait(0.25, 0.35) - mouse.release(button="left") - wait(0.4, 0.6) - keyboard.send("enter") #if stash already full of gold just nothing happens -> gold stays on char -> no popup window + inventory_no_gold = self._template_finder.search("INVENTORY_NO_GOLD", self._screen.grab(), roi=self._config.ui_roi["inventory_gold"], threshold=0.95) + if inventory_no_gold.valid: + Logger.debug("Skipping gold stashing") + else: + Logger.debug("Stashing gold") + x, y = self._screen.convert_screen_to_monitor(gold_btn.position) + mouse.move(x, y, randomize=4) + wait(0.1, 0.15) + mouse.press(button="left") + wait(0.25, 0.35) + mouse.release(button="left") + wait(0.4, 0.6) + keyboard.send("enter") #if stash already full of gold just nothing happens -> gold stays on char -> no popup window # stash stuff center_m = self._screen.convert_abs_to_monitor((0, 0)) for column, row in itertools.product(range(num_loot_columns), range(4)):