Merge pull request #107 from fishyboteso/feature/menu_show_qr_value

This commit is contained in:
Adam Saudagar 2022-02-25 04:53:53 +05:30 committed by GitHub
commit 3761ad813d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View File

@ -21,7 +21,7 @@ class IEngineHandler:
def toggle_fullfisher(self):
...
def check_pixel_val(self):
def check_qr_val(self):
...
def set_update(self, version):
@ -56,10 +56,10 @@ class EngineEventHandler(IEngineHandler):
def toggle_fullfisher(self):
self.event.append(self.full_fisher_engine.toggle_start)
def check_pixel_val(self):
def check_qr_val(self):
def func():
if self.semi_fisher_engine.start:
self.semi_fisher_engine.show_pixel_vals()
self.semi_fisher_engine.show_qr_vals()
else:
logging.debug("Start the engine first before running this command")

View File

@ -21,6 +21,7 @@ class SemiFisherEngine(IEngine):
def __init__(self, gui_ref: Optional['Callable[[], GUI]']):
super().__init__(gui_ref)
self.window = None
self.values = None
self.name = "SemiFisher"
def run(self):
@ -63,9 +64,9 @@ class SemiFisherEngine(IEngine):
return
# crop qr and get the values from it
values = get_values_from_image(capture)
self.values = get_values_from_image(capture)
# if fishyqr fails to get read multiple times, stop the bot
if not values:
if not self.values:
skip_count += 1
if skip_count >= 5:
logging.error("Couldn't read values from FishyQR, Stopping engine...")
@ -73,8 +74,8 @@ class SemiFisherEngine(IEngine):
else:
skip_count = 0
if values:
fishing_mode.loop(values[3])
if self.values:
fishing_mode.loop(self.values[3])
time.sleep(0.1)
def _wait_and_check(self):
@ -84,16 +85,17 @@ class SemiFisherEngine(IEngine):
"Check out #faqs on our discord channel to troubleshoot the issue")
# TODO: remove this, no longer needed
def show_pixel_vals(self):
def show_qr_vals(self):
def show():
freq = 0.5
t = 0
while t < 10.0:
while t < 25.0:
t += freq
logging.debug(str(FishingMode.CurrentMode) + ":" + str(self.window.get_capture()[0][0]))
logging.info(str(self.values))
time.sleep(freq)
logging.info("Displaying QR values stopped")
logging.debug("Will display pixel values for 10 seconds")
logging.info("Will display QR values for 25 seconds")
time.sleep(5)
Thread(target=show, args=()).start()

View File

@ -75,8 +75,8 @@ def _create(gui: 'GUI'):
menubar.add_cascade(label="Options", menu=filemenu)
debug_menu = tk.Menu(menubar, tearoff=0)
debug_menu.add_command(label="Check PixelVal",
command=lambda: gui.engine.check_pixel_val())
debug_menu.add_command(label="Check QR Value",
command=lambda: gui.engine.check_qr_val())
debug_var = tk.IntVar()
debug_var.set(int(config.get('debug', False)))