def run(self): if not self.resourcesToFarm: self.resourcesToFarm = self.patterns.keys() self.disconnectedObs.start() env.focusDofusWindow(self.name) s = perf_counter() self.updatePos() print(self.currPos) while not self.killsig.is_set(): try: if self.fullPods(): self.discharge() if self.currPos not in self.zone: self.goToZaap(self.startZaap) self.moveToZone(self.zone) self.updatePos() self.tmpIgnore.append(self.currPos) Timer(self.memoTime, self.onTimer).start() self.harvest() if self.combatStarted.is_set(): self.combatEnded.wait() self.randomWalk(self.zone) except Exception as e: if self.disconnected.is_set(): self.connected.wait() else: logging.error("Fatal error!", exc_info=True) self.interrupt() break total_time = str(datetime.timedelta(seconds=perf_counter() - s)) logging.info(f"farmed for total time: {total_time}.") logging.info("Goodbye cruel world!")
import random import threading from time import sleep import cv2 from core import utils from core.bot import Fighter from core import env, Region env.focusDofusWindow() rcenter = Region(1185, 466, 80, 71) rup = Region(1066, 538, 34, 19) rout = Region(1126, 264, 41, 40) resource_r = Region(1166, 338, 127, 118) spots = [ Region(1166, 339, 40, 73), Region(1215, 362, 32, 67), Region(1255, 385, 38, 64) ] empty_spot_ptrn = [ cv2.imread(f"empty_spot{idx}.png", cv2.IMREAD_GRAYSCALE) for idx in range(3) ] am = {"range": 2, "nbr": 2, "shortcut": "r"} class AntiSaveScreen(threading.Thread):
def window(): env.focusDofusWindow() app = QApplication(sys.argv) win = MainWindow() win.show() sys.exit(app.exec_())
from core import env from core.bot import Walker character_name = "John-shooter" bot = Walker(character_name) env.focusDofusWindow(character_name) # bot.moveToMap((-20, -20)) # bot.moveToMap((-19, -11)) bot.moveToMap((-17, -47))