def on_looking(): if GetWindowText(GetForegroundWindow()) != "Elder Scrolls Online": logger.log("ESO window is not focused", LogMessageType.Warning) return FishEvent.__fishing_sleep__() keyboard.press_and_release(FishEvent.action_key)
def run(self): FishEvent.init() self.client = WindowClient() self.event(True) if self.event: logger.log( "Starting the bot engine, look at the fishing hole to start fishing", LogMessageType.Info) Thread(target=self.__wait_and_check__).start() while self.start and WindowClient.running(): capture = self.client.get_capture() if capture is None: self.event(False) self.toggle_start() continue self.client.crop = None FishingMode.loop(capture[0][0]) logger.log("Fishing engine stopped", LogMessageType.Info) self.event(False) FishEvent.unsubscribe() self.client.destroy()
def on_reelin(): if GetWindowText(GetForegroundWindow()) != "Elder Scrolls Online": logger.log("ESO window is not focused", LogMessageType.Warning) return Thread(target=connection.fishing_transaction).start() FishEvent.__fishing_sleep__() keyboard.press_and_release(FishEvent.action_key) FishEvent.__fishing_sleep__(500)
def loop(): box = (0, 0, GetSystemMetrics(0), GetSystemMetrics(1)) screen = np.array(ImageGrab.grab(bbox=box)) rectangle = win32gui.GetWindowRect(WindowServer.hwnd) crop = (rectangle[0] + WindowServer.window_offset, rectangle[1] + WindowServer.title_offset, rectangle[2] - WindowServer.window_offset, rectangle[3] - WindowServer.window_offset) WindowServer.Screen = screen[crop[1]:crop[3], crop[0]:crop[2]] if WindowServer.Screen.size == 0: logger.log("Don't minimize or drag game window outside the screen", LogMessageType.Error) WindowServer.status = Status.Crashed
def init(): try: WindowServer.hwnd = win32gui.FindWindow(None, "Elder Scrolls Online") rectangle = win32gui.GetWindowRect(WindowServer.hwnd) client_rectangle = win32gui.GetClientRect(WindowServer.hwnd) WindowServer.window_offset = math.floor( ((rectangle[2] - rectangle[0]) - client_rectangle[2]) / 2) WindowServer.title_offset = ( (rectangle[3] - rectangle[1]) - client_rectangle[3]) - WindowServer.window_offset if helper.config.config.get("borderless"): WindowServer.title_offset = 0 WindowServer.status = Status.Running except pywintypes.error: logger.log("Game window not found", LogMessageType.Warning) WindowServer.status = Status.Crashed
def unhandled_exception_logging(*exc_info): text = "".join(traceback.format_exception(*exc_info)) logger.log(f"Unhandled exception: {text}", LogMessageType.Error)
def not_implemented(): logger.log("Not Implemented", LogMessageType.Error)
def __wait_and_check__(self): time.sleep(10) if not FishEvent.started and self.start: logger.log("Doesn't look like fishing has started", LogMessageType.Warning)
def on_idle(): if FishEvent.state in (State["FISHING"], State["REELIN"]): logger.log("FISHING INTERRUPTED", LogMessageType.Info)
def on_dead(): logger.log("Character is dead!", LogMessageType.Warning)
def on_fight(): logger.log("Fighting!", LogMessageType.Warning)
def on_invfull(): logger.log("Inventory full!", LogMessageType.Warning)
def on_nobait(): logger.log("No bait equipped!", LogMessageType.Warning)
def on_depleted(): logger.log("Hole depleted", LogMessageType.Warning)