def toRightScreen(): width = Screens["size"]["ScreenWidth"] height = Screens["size"]["ScreenHeight"] x1 = width / 4 * 1 x2 = width / 4 * 3 y1 = height / 2 y2 = y1 swipe(x2, y2, x1, y1, 500) refreshCurrentScreen()
def enhance_ships(): Btn.sort.click(utils.screenshot()) if adb.screenshot(False)[820, 1144, 2] > 100: utils.click(384, 260, 57, 14, 1.0) Btn.universal_confirm.click(adb.screenshot()) utils.click(49, 53, 63, 56, 3.0) # click first ship Btn.enhance.click(utils.screenshot()) no_enhance = 0 while True: # click enhance if Btn.enhance.on_screen(utils.screenshot()): utils.click(483, 302, 58, 19, 0.5) # press fill button utils.click(567, 302, 58, 19, 2.0) # press enhance button if Btn.universal_confirm.click(adb.screenshot()): # press confirm no_enhance = 0 if Btn.enhance_break.click( utils.screenshot()): # press disassemble utils.click(434, 244, 164, 97, 2.0) # tap to continue else: # something went wrong log("No break button!") else: no_enhance += 1 else: no_enhance += 10 log("No enhance button!") if no_enhance >= 4: # stop if we can't enhance 4 times break adb.swipe( # swipe to next ship random.randint(900, 966), random.randint(501, 558), random.randint(210, 276), random.randint(501, 558)) time.sleep(1.0)
def swipeList(totalLength): top = 250 bottom = Screens["size"]["ScreenHeight"] - 250 stepmaxlength = bottom - top if stepmaxlength > totalLength: bottom = top + totalLength swipe(540, bottom, 540, top, 2000) else: steplength = stepmaxlength stepcount = int(totalLength / steplength) for i in range(0, stepcount): swipe(540, bottom, 540, top, 2000) residue = totalLength - steplength * stepcount bottom = top + residue swipe(540, bottom, 540, top, 2000) refreshCurrentScreen()
import utils import enemy_finder from data import Btn, Img from typing import List, Tuple from log import log def double_swap(): swap() swap() time.sleep(3.0) swipes = [ double_swap, lambda: adb.swipe(400, 400, 1720, 880), lambda: adb.swipe(1720, 200, 200, 880), lambda: adb.swipe(1720, 880, 200, 200), lambda: adb.swipe(200, 880, 1720, 200), lambda: adb.swipe(1720, 200, 1320, 600), ] def sort_near(ships: List[Tuple[int, int]], point: Tuple[int, int]): px, py = point def get_dist(pos: Tuple[int, int]) -> float: x, y = pos dx, dy = x - px, y - py return dx * dx + dy * dy
def scroll_down(): adb.swipe(1100, 900, 1100, 130) time.sleep(1.0)
def swipeIndex(): top = 250 length = Screens["list"]["properties"]["head"] bottom = top + length swipe(540, bottom, 540, top, 1000) refreshCurrentScreen()
def swipe_threading(): threading.Thread( target=lambda: adb.swipe(100, 100, 200, 200, 1000)).start() threading.Thread( target=lambda: adb.swipe(200, 200, 100, 300, 1000)).start()
def swipe(x1, x2, y1, y2, time): print('swipe', x1, x2, y1, y2, time) adb.swipe(x1, x2, y1, y2, time)
def keep_activate(): adb.swipe([random.choice(['up', 'down', 'left', 'right'])])