def run(self): anti_macro_popup = crop_original_frame(self.frame) target = cv2.cvtColor(cv2.resize(anti_macro_popup[ expected_number_y_min:expected_number_y_max, expected_number_x_min:expected_number_x_max ], (69, 69)), cv2.COLOR_BGR2GRAY) tiles = [ cv2.cvtColor( anti_macro_popup[ p[1]:p[1] + tile_size, p[0]:p[0] + tile_size ], cv2.COLOR_BGR2GRAY ) for p in tiles_coordinates ] # print(distances) for i in range(len(tiles)): m = self.mse (target, tiles[i]) # s = ssim(target, tiles[i]) if m < 5610: mobile.initTouch() mobile.actionDuringTouch( tiles_position_on_mobile[i][0] + random.randint(20, 40), tiles_position_on_mobile[i][1] + random.randint(20, 40), ) mobile.clearTouch() sleep(0.1) mobile.initTouch() mobile.actionDuringTouch( confirm_button[0] + random.randint(20, 40), confirm_button[1] + random.randint(20, 40), ) mobile.clearTouch()
def run(self): bonus_text_image = self.frame[bonus_name_y_min:bonus_name_y_max, bonus_name_x_min:bonus_name_x_max] try: bonus_text = detect_text(bonus_text_image).strip() logging.info(bonus_text) if bonus_text in allowed_bonuses: mobile.initTouch() mobile.actionDuringTouch( mobile_confirm_button_x + random.randint(10, 20), mobile_confirm_button_y + random.randint(10, 20) ) mobile.clearTouch() sleep(32) # leave ad mobile.click_back_button() else: mobile.initTouch() mobile.actionDuringTouch( mobile_decline_button_x + random.randint(10, 20), mobile_decline_button_y + random.randint(10, 20) ) mobile.clearTouch() sleep(0.5) except ValueError: pass except IndexError: pass pass
def process_mode(self): mobile.initTouch() for step in range(21): x = (self.stepSize * step) + random.randint(0, 70) y = self.collectMagnetRowY + random.randint(0, 70) mobile.actionDuringTouch(x, y) mobile.clearTouch() pass
def process_mode(self): mobile.initTouch() for step in range(14): x = (self.stepSize * step) + random.randint(0, 10) y = self.collectSteelFirstRowY + random.randint(0, 10) mobile.actionDuringTouch(x, y) for step in range(14): x = (self.stepSize * step) + random.randint(0, 10) y = self.collectSteelSecondRowY + random.randint(0, 10) mobile.actionDuringTouch(x, y) mobile.clearTouch()
def is_mode_active(frame): ad_button = crop_ad_button(frame) ad_button_average_color = [ad_button[:, :, i].mean() for i in range(ad_button.shape[-1])] opened_ad = crop_opened_ad(frame) opened_ad_average_color = [opened_ad[:, :, i].mean() for i in range(opened_ad.shape[-1])] if opened_ad_min_blue < opened_ad_average_color[0] < opened_ad_max_blue \ and opened_ad_min_green < opened_ad_average_color[1] < opened_ad_max_green \ and opened_ad_min_red < opened_ad_average_color[2] < opened_ad_max_red: return True if button_min_blue < ad_button_average_color[0] < button_max_blue \ and button_min_green < ad_button_average_color[1] < button_max_green \ and button_min_red < ad_button_average_color[2] < button_max_red: mobile.initTouch() mobile.actionDuringTouch( mobile_ad_button_x + random.randint(5, 10), mobile_ad_button_y + random.randint(5, 10) ) mobile.clearTouch() return True return False
def remove_barrel(self, position_to_remove): element_position = self.elements[position_to_remove] mobile.initTouch() mobile.actionDuringTouch( element_position[0] - self.distance_from_final_position_1 + random.randint(0, 10), element_position[1] - self.distance_from_final_position_1 + random.randint(0, 10)) mobile.clearTouch() mobile.initTouch() mobile.actionDuringTouch( element_position[0] - self.distance_from_final_position_1 + random.randint(0, 10), element_position[1] - self.distance_from_final_position_1 + random.randint(0, 10)) mobile.clearTouch() sleep(0.2) place_to_confirm = self.elements[ self.position_under_remove_confirm_button] mobile.initTouch() mobile.actionDuringTouch( place_to_confirm[0] - self.distance_from_final_position_1 + random.randint(0, 10), place_to_confirm[1] - self.distance_from_final_position_1 + random.randint(0, 10)) mobile.clearTouch()
def process_mode(self, frame): pairs = self.find_pairs(frame) for pair in pairs: mobile.initTouch() element_position_1 = self.elements[pair[0]] element_position_2 = self.elements[pair[1]] mobile.actionDuringTouch( element_position_1[0] + random.randint(0, 10), element_position_1[1] + random.randint(0, 10)) mobile.actionDuringTouch( element_position_2[0] - self.distance_from_final_position_1 + random.randint(0, 10), element_position_2[1] - self.distance_from_final_position_1 + random.randint(0, 10)) mobile.actionDuringTouch( element_position_2[0] - self.distance_from_final_position_2 + random.randint(0, 10), element_position_2[1] - self.distance_from_final_position_2 + random.randint(0, 10)) mobile.actionDuringTouch( element_position_2[0] - self.distance_from_final_position_3 + random.randint(0, 10), element_position_2[1] - self.distance_from_final_position_3 + random.randint(0, 10)) mobile.actionDuringTouch( element_position_2[0] + random.randint(0, 10), element_position_2[1] + random.randint(0, 10)) mobile.clearTouch() # random touch to avoid cheat detector mobile.initTouch() mobile.actionDuringTouch(0, random.randint(200, 1000)) mobile.clearTouch()