fishyboteso/init.py

118 lines
2.8 KiB
Python
Raw Normal View History

"""Fishy
Usage:
fishy.py -h | --help
fishy.py -v | --version
fishy.py [--debug] [--ip=<ipv4>] [--hook-threshold=<int>] [--check-frequency=<hz>] [--no-resize]
Options:
-h, --help Show this screen.
-v, --version Show version.
--ip=<ipv4> Local Ip Address of the android phone.
--hook-threshold=<int> Threshold amount for classifier after which label changes [default: 1].
--check-frequency=<hz> Sleep after loop in s [default: 1].
--debug Start program in debug controls.
"""
VERSION = "0.1.0"
print("Fishy " + VERSION + " for Elder Scrolls Online")
try:
from docopt import docopt
arguments = docopt(__doc__)
if arguments["--version"]:
quit()
print("Loading, Please Wait...")
import imutils as imutils
import numpy as np
from PIL import ImageGrab
import cv2
import pyautogui
import time
import fishy_network as net
from fishy_config import config_win
from pynput.keyboard import Key, Listener
from decimal import Decimal
from win32api import GetSystemMetrics
import pickle
import win32gui
import pywintypes
from abc import ABC, abstractmethod
from enum import Enum
import sys
import numpy as np
import math
except Exception:
raise
'''
import stack
fishy
pixel_loc
fishing_event
fishing_mode
window
log
controls
init
'''
class G:
fishCaught = 0
stickInitTime = 0
stop = False
pause = True
debug = False
configPL = False
def round_float(v, ndigits=2, rt_str=False):
d = Decimal(v)
v_str = ("{0:.%sf}" % ndigits).format(round(d, ndigits))
if rt_str:
return v_str
return Decimal(v_str)
def draw_keypoints(vis, keypoints, color=(0, 0, 255)):
for kp in keypoints:
x, y = kp.pt
cv2.circle(vis, (int(x), int(y)), 5, color, -1)
def image_resize(image, width=None, height=None, inter = cv2.INTER_AREA):
# initialize the dimensions of the image to be resized and
# grab the image size
dim = None
(h, w) = image.shape[:2]
# if both the width and height are None, then return the
# original image
if width is None and height is None:
return image
# check to see if the width is None
if width is None:
# calculate the ratio of the height and construct the
# dimensions
r = height / float(h)
dim = (int(w * r), height)
# otherwise, the height is None
else:
# calculate the ratio of the width and construct the
# dimensions
r = width / float(w)
dim = (width, int(h * r))
# resize the image
resized = cv2.resize(image, dim, interpolation = inter)
# return the resized image
return resized
# np.set_printoptions(threshold=sys.maxsize)