feat(pindle): Fail save in case red portal was missed restart game

This commit is contained in:
aeon0
2021-11-05 10:46:42 +01:00
parent 2c6faf6f40
commit 37d5c4d7d0
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -199,8 +199,10 @@ class Bot:
return
bot._curr_location = Location.NIHLATHAK_PORTAL
wait(0.2, 0.4)
bot._char.select_by_template("A5_RED_PORTAL")
bot._template_finder.search_and_wait("PINDLE_STONE")
self.success &= bot._char.select_by_template("A5_RED_PORTAL")
self.success &= bot._template_finder.search_and_wait("PINDLE_STONE", time_out=15)[0]
if not self.success:
return
bot._char.pre_buff()
wait(0.2, 0.4)
bot._pather.traverse_nodes_fixed("PINDLE", bot._char)
+2 -2
View File
@@ -106,7 +106,7 @@ class TemplateFinder:
return True, ref_point
return False, None
def search_and_wait(self, ref: str, roi: List[float] = None, time_out: float = None, threshold: float = 0.7) -> Tuple[float, float]:
def search_and_wait(self, ref: str, roi: List[float] = None, time_out: float = None, threshold: float = 0.7) -> Tuple[bool, Tuple[float, float]]:
Logger.debug(f"Waiting for Template {ref}")
start = time.time()
while 1:
@@ -130,7 +130,7 @@ if __name__ == "__main__":
template_finder = TemplateFinder(screen)
while 1:
img = screen.grab()
success, pos = template_finder.search("BLUE_PORTAL", img)
success, pos = template_finder.search("BLUE_PORTAL", img, threshold=0.67)
print(template_finder.debug_last_score)
if success:
cv2.circle(img, pos, 7, (255, 0, 0), thickness=5)