mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
add option to have human like jitter in delays
This commit is contained in:
parent
b449bd8e57
commit
d0e170c6b5
@ -16,6 +16,7 @@ import keyboard
|
||||
|
||||
from fishy.helper.config import config
|
||||
|
||||
import random
|
||||
|
||||
class FishEvent:
|
||||
fishCaught = 0
|
||||
@ -24,6 +25,7 @@ class FishEvent:
|
||||
fish_times = []
|
||||
hole_start_time = 0
|
||||
FishingStarted = False
|
||||
jitter = False
|
||||
previousState = State.IDLE
|
||||
|
||||
# initialize these
|
||||
@ -32,9 +34,16 @@ class FishEvent:
|
||||
uid = None
|
||||
sound = False
|
||||
|
||||
def _fishing_sleep(waittime, lower_limit = 16, upper_limit = 58):
|
||||
reaction = 0.0
|
||||
if (FishEvent.jitter):
|
||||
reaction = float( random.randrange(lower_limit, upper_limit) )/100.0
|
||||
time.sleep(waittime+reaction)
|
||||
|
||||
|
||||
def init():
|
||||
subscribe()
|
||||
FishEvent.jitter = config.get("jitter", False)
|
||||
FishEvent.action_key = config.get("action_key", 'e')
|
||||
FishEvent.collect_key = config.get("collect_key", 'r')
|
||||
FishEvent.collect_allow_auto = config.get("collect_allow_auto", False)
|
||||
@ -73,13 +82,14 @@ def on_hook():
|
||||
FishEvent.fish_times.append(time_to_hook)
|
||||
logging.info("HOOOOOOOOOOOOOOOOOOOOOOOK....... " + str(FishEvent.fishCaught) + " caught " + "in " + str(
|
||||
round(time_to_hook, 2)) + " secs. " + "Total: " + str(FishEvent.totalFishCaught))
|
||||
|
||||
_fishing_sleep(0.0)
|
||||
keyboard.press_and_release(FishEvent.action_key)
|
||||
|
||||
if FishEvent.collect_allow_auto:
|
||||
time.sleep(0.1)
|
||||
_fishing_sleep(0.1)
|
||||
keyboard.press_and_release('r')
|
||||
time.sleep(0.1)
|
||||
_fishing_sleep(0.1)
|
||||
_fishing_sleep(0.0, upper_limit=48)
|
||||
|
||||
|
||||
def on_look():
|
||||
|
@ -53,6 +53,7 @@ def start_semifisher_config(gui: 'GUI'):
|
||||
gui.config.set("collect_key", collect_key_entry.get(), False)
|
||||
gui.config.set("collect_allow_auto", collect_allow_auto.instate(['selected']), False)
|
||||
gui.config.set("borderless", borderless.instate(['selected']), False)
|
||||
gui.config.set("jitter", jitter.instate(['selected']), False)
|
||||
gui.config.set("sound_notification", sound.instate(['selected']), False)
|
||||
gui.config.save_config()
|
||||
|
||||
@ -107,5 +108,9 @@ def start_semifisher_config(gui: 'GUI'):
|
||||
sound = Checkbutton(controls_frame, var=BooleanVar(value=config.get("sound_notification")))
|
||||
sound.grid(row=5, column=1)
|
||||
|
||||
Label(controls_frame, text="Human-Like Delay: ").grid(row=4, column=0, pady=(5, 5))
|
||||
jitter = Checkbutton(controls_frame, var=BooleanVar(value=config.get("jitter")))
|
||||
jitter.grid(row=4, column=1)
|
||||
|
||||
controls_frame.pack(padx=(5, 5), pady=(5, 5))
|
||||
top.start()
|
||||
|
Loading…
Reference in New Issue
Block a user