def get_support(self): if analyze(self.screenshot, self.support_scene, self.threshold) == 1: support_interface = Support() support_interface.scene = screenshot_path support_interface.select_support() out = "[SUPPORT] Position: " + str(support_interface.crd) print(out) output_log(out)
def get_basic(self): for basic_scene in self.basic_scenes: if analyze(self.screenshot, basic_scene, self.threshold) == 1: basic_interface = Basic() basic_interface.scene = basic_scene basic_interface.sh = self.screenshot basic_interface.get_button() out = "[BASIC] Buttons: " + str(basic_interface.btn_crd) print(out) output_log(out) return basic_interface.end
def get_cards(self): rank = [self.card_crd[0], self.card_crd[1], self.card_crd[2]] print(rank) out = "[BATTLE] Cards: " + str(self.card_crd[0]) + " " + str( self.card_crd[1]) + " " + str(self.card_crd[2]) output_log(out) for i in range(3): tap_card(rank[i][0], rank[i][1]) time.sleep(random.uniform(0.1, 0.2)) time.sleep(3.5)
def get_basic(self): for basic_scene in self.basic_scenes: x, y = basic_scene.shape[0:2] xx, yy = self.screenshot.shape[0:2] factor = min(1., 1. * xx / x, 1. * yy / y) resized_scene = cv2.resize(basic_scene, int(x * factor), int(y * factor)) if analyze(self.screenshot, resized_scene, self.threshold) == 1: basic_interface = Basic() basic_interface.scene = basic_scene basic_interface.sh = self.screenshot basic_interface.get_button() out = "[BASIC] Buttons: " + str(basic_interface.btn_crd) print(out) output_log(out) return basic_interface.end
def pass_finish(self): for finish_scene in finish_scenes: scene_path = f"./assets/scene/{finish_scene}.png" if check(self.scene, scene_path, 0.9) == 1: im = Image.open(f"./{self.scene}") im_size = im.size x0 = im_size[0] / 4 y0 = im_size[0] / 4 x = random.randrange(-x0, x0) + (im_size[0] / 2) y = random.randrange(-y0, y0) + (im_size[1] / 2) self.crd = [x, y] out = "[FINISH] Checked: " + str(finish_scene) + " " + str(x) + " " + str(y) print(out) output_log(out) basic_tap(self.crd[0], self.crd[1])
def have_fun(self): im = Image.open(f"./{self.scene}") im_size = im.size x = im_size[0] / 4 y = im_size[1] / 4 # create random action list max_act = [] if self.mark == 1: max_act = 2 elif self.mark == 0: max_act = 5 action = [] press = "tap" swipes = "swipe" for i in range(5): action.append(press) action.append(swipes) random.shuffle(action) # do random actions for j in range(random.randrange(1, max_act)): if action[j] == press: x0 = 2 * x + random.randrange(-x, x) y0 = 2 * y + random.randrange(-y, y - 100) out = "[LOADING] Tap: [" + \ str(self.mark) + "] " + str(x0) + " " + str(y0) print(out) output_log(out) basic_tap(x0, y0) if action[j] == swipes: time.sleep(0.1) x0 = 2 * x + random.randrange(-x, x) y0 = 2 * y + random.randrange(-y, y) x1 = 2 * x + random.randrange(-x / 3, x / 3) y1 = 2 * y + random.randrange(-y / 3, y / 3) delay = random.randrange(100, 1000) out = "[LOADING] Swipe: [" + str(self.mark) + "] " + str(x0) + " " + str(y0) + " " +\ str(x1) + " " + str(y1) + " " + str(delay) print(out) output_log(out) swipe(x0, y0, x1, y1, random.randrange(50, 500))