import re import sys from util.logger import Logger from util.adb import Adb from util.config import Config from modules.seal import Seal from util.utils import Utils, Region, globals_region from time import sleep config = Config("config.ini") Adb.service = config.network["service"] Adb.device = "-d" if (Adb.service == "PHONE") else "-e" adb = Adb() adb.init() # Utils.update_screen("tmp/2020-03-29 16:47:46.068835.png") # Utils.find("explore/22", 0.5, True) def swipeTest(): Utils.swipe(385, 1037, 1671, 1037, 1000) sleep(2) Utils.swipe(1689, 878, 1172, 483, 1000) sleep(2) Utils.swipe(1689, 878, 1828, 483, 1000) def find_max_levels(): Utils.update_screen("tmp/2020-03-29 17:29:48.594597.png") result = Utils.find_all("combat/level_max", 0.8)
config = Config('config.ini') if args.debug: Logger.log_info("Enabled debugging.") Logger.enable_debugging(Logger) if args.legacy: Logger.log_info("Enabled sed usage.") Adb.enable_legacy(Adb) script = ALAuto(config) script.run_update_check() Adb.service = config.network['service'] Adb.device = '-d' if (Adb.service == 'PHONE') else '-e' adb = Adb() if adb.init(): Logger.log_msg('Successfully connected to the service.') output = Adb.exec_out('wm size').decode('utf-8').strip() if not re.search('1920x1080|1080x1920', output): Logger.log_error("Resolution is not 1920x1080, please change it.") sys.exit() Utils.assets = config.assets['server'] else: Logger.log_error('Unable to connect to the service.') sys.exit() try: while True: Utils.update_screen()
# exit() # check run-time args parser = argparse.ArgumentParser() parser.add_argument('-c', '--config', metavar=('CONFIG_FILE'), help='Use the specified configuration file instead ' + 'of the default config.ini') parser.add_argument('-d', '--debug', nargs=2, metavar=('IMAGE_FILE', 'SIMILARITY'), help='Finds the specified image on the screen at ' + 'the specified similarity') parser.add_argument('--copyright',) args = parser.parse_args() # check args, and if none provided, load default config if args and args.config: config = Config(args.config) else: config = Config('config.ini') script = ALAuto(config) Adb.init() while True: script.run_test() script.run_commission_cycle() script.run_combat_cycle() script.run_mission_cycle() script.print_cycle_stats()