gambling bugfix (#519)
* Update ui_manager.py Fix for gambling issue. Looks like self._config.char["gamble_items"] always returns true. Therefore im checking if the first entry is empty and go for a not. not self._config.char["gamble_items"][0]=="" * simplify Co-authored-by: mgleed <[email protected]>
This commit is contained in:
committed by
GitHub
co-authored by
mgleed
parent
b83dbb8e8d
commit
5ae6194d23
+4
-6
@@ -345,17 +345,15 @@ class Bot:
|
||||
return self.trigger_or_stop("end_game", failed=True)
|
||||
|
||||
# Check if gambling is needed
|
||||
gambling = self._ui_manager.gambling_needed()
|
||||
if gambling:
|
||||
if self._ui_manager.gambling_needed() and self._config.char["gamble_items"]:
|
||||
for x in range (4):
|
||||
self._curr_loc = self._town_manager.gamble(self._curr_loc)
|
||||
self._ui_manager.gamble(self._item_finder)
|
||||
if (x ==3):
|
||||
self._curr_loc = self._town_manager.stash (self._curr_loc)
|
||||
self._curr_loc = self._town_manager.stash(self._curr_loc)
|
||||
else:
|
||||
self._curr_loc = self._town_manager.stash (self._curr_loc, gamble=gambling)
|
||||
|
||||
self._ui_manager.set__gold_full (False)
|
||||
self._curr_loc = self._town_manager.stash(self._curr_loc, gamble=True)
|
||||
self._ui_manager.set__gold_full(False)
|
||||
|
||||
# Start a new run
|
||||
started_run = False
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ class Config:
|
||||
"atk_len_cs_trashmobs": float(Config._select_val("char", "atk_len_cs_trashmobs")),
|
||||
"kill_cs_trash": float(Config._select_val("char", "kill_cs_trash")),
|
||||
"runs_per_repair": False if not Config._select_val("char", "runs_per_repair") else int(Config._select_val("char", "runs_per_repair")),
|
||||
"gamble_items": Config._select_val("char", "gamble_items").replace(" ","").split(","),
|
||||
"gamble_items": False if not Config._select_val("char", "gamble_items") else Config._select_val("char", "gamble_items").replace(" ","").split(","),
|
||||
}
|
||||
# Sorc base config
|
||||
sorc_base_cfg = dict(Config._config["sorceress"])
|
||||
|
||||
@@ -416,7 +416,7 @@ class UiManager():
|
||||
cv2.imwrite("./info_screenshots/info_gold_stash_full_" + time.strftime("%Y%m%d_%H%M%S") + ".png", self._screen.grab())
|
||||
if self._curr_stash["gold"] > 3:
|
||||
#decide if gold pickup should be disabled or gambling is active
|
||||
if (self._config.char["gamble_items"]):
|
||||
if self._config.char["gamble_items"]:
|
||||
self._gold_full = True
|
||||
else:
|
||||
# turn off gold pickup
|
||||
@@ -760,4 +760,4 @@ if __name__ == "__main__":
|
||||
template_finder = TemplateFinder(screen)
|
||||
item_finder = ItemFinder()
|
||||
ui_manager = UiManager(screen, template_finder, game_stats)
|
||||
ui_manager.gamble (item_finder)
|
||||
ui_manager.gamble (item_finder)
|
||||
|
||||
Reference in New Issue
Block a user