skip gold stashing when there's no gold in inventory (#182)

* skip gold stashing when there's no gold in inventory

* skip stashing - performance upgrade
This commit is contained in:
navy91
2021-12-03 22:44:39 +01:00
committed by GitHub
parent 916777b86d
commit 3da81815bd
3 changed files with 14 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -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

View File

@@ -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)):