From c86e86b901069d26d78673c023ae549fc8e5cbf6 Mon Sep 17 00:00:00 2001 From: Adam Saudagar Date: Wed, 21 Apr 2021 21:50:28 +0530 Subject: [PATCH] hotfix: data not being send, when fishing is interupted --- fishy/__init__.py | 2 +- fishy/engine/semifisher/fishing_event.py | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/fishy/__init__.py b/fishy/__init__.py index 7e38728..efa7c27 100644 --- a/fishy/__init__.py +++ b/fishy/__init__.py @@ -1,2 +1,2 @@ from fishy.__main__ import main -__version__ = "0.4.7" +__version__ = "0.4.9" diff --git a/fishy/engine/semifisher/fishing_event.py b/fishy/engine/semifisher/fishing_event.py index 9aff60c..895d566 100644 --- a/fishy/engine/semifisher/fishing_event.py +++ b/fishy/engine/semifisher/fishing_event.py @@ -53,6 +53,15 @@ def if_eso_is_focused(func): return wrapper +def _sound_and_send_fishy_data(): + if FishEvent.fishCaught > 0: + web.send_hole_deplete(FishEvent.fishCaught, time.time() - FishEvent.hole_start_time, FishEvent.fish_times) + FishEvent.fishCaught = 0 + + if FishEvent.sound: + playsound(helper.manifest_file("sound.mp3"), False) + + def init(): subscribe() FishEvent.jitter = config.get("jitter", False) @@ -99,9 +108,12 @@ def fisher_callback(event: State): def on_idle(): if FishEvent.previousState in (State.FISHING, State.REELIN): logging.info("FISHING INTERRUPTED") + _sound_and_send_fishy_data() - if FishEvent.sound: - playsound(helper.manifest_file("sound.mp3"), False) + +def on_depleted(): + logging.info("HOLE DEPLETED") + _sound_and_send_fishy_data() def on_lookaway(): @@ -117,13 +129,6 @@ def on_looking(): keyboard.press_and_release(FishEvent.action_key) -def on_depleted(): - logging.info("HOLE DEPLETED") - if FishEvent.fishCaught > 0: - web.send_hole_deplete(FishEvent.fishCaught, time.time() - FishEvent.hole_start_time, FishEvent.fish_times) - FishEvent.fishCaught = 0 - - def on_nobait(): msg = "No bait equipped!" logging.info(msg)