def set_mode_explore(): chk_explore = _bs.match_image_box('../images/uis/chk_Explore.png', [10, 238, 60, 288], precision=0.99) if type(chk_explore) is list: print('already explore mode') elif not chk_explore: click_mouse([36, 260]) print('click explore mode')
def get_viewmode(): #cityview = _bs.get_center_match_image(get_image_path('btn_GoWorldView'), precision=0.9) cityview = _bs.match_image_box(template=get_image_path('btn_GoWorldView'), image=[10, 902, 174, 1070], precision=0.95) print('cityview: {}'.format(cityview)) if type(cityview) is list: return 'CITY_VIEW' else: return 'WORLD_VIEW'
def search_objects_in_map(obj='village_unvisited', location=[500, 300], box=_MAP['SCAN_BOX'], precision=0.62, ms='min'): #go_by_coordinate(location) #delay_secs(3) #yellow filter: cvScalar(23,41,133), cvScalar(40,150,255) # yellow_lower = [20, 100, 100] # yellow_upper = [30, 255, 255] yellow_lower = [15, 70, 70] yellow_upper = [28, 255, 255] #template = '../images/uis/img_ExploreVillage.png' ##@@@@@@@@@@@@ template = _PATH['OBJECTS'] + ui_obj[obj]['img_' + ms] + _ENV['IMG_EXT'] mask = None if 'msk_' + ms in ui_obj[obj]: mask = _PATH['OBJECTS'] + ui_obj[obj]['msk_' + ms] + _ENV['IMG_EXT'] return _bs.match_image_box(template=template, image=box, mask=mask, precision=precision, show=True, multi=1, color=(yellow_lower, yellow_upper))
def visit_village(coord={'loc': [1166, 682], 'center': [250, 250]}): go_by_coordinate(coord['center']) click_mouse(coord['loc']) delay_secs(0.1) click_mouse2([_ENV['MAX_X']//2, _ENV['MAX_Y']//2]) delay_secs(0.1) great = _bs.match_image_box() if type(great) is list: click_mouse(great) _coord = get_coordinate() click_mouse([_ENV['MAX_X']//2 - 200, _ENV['MAX_Y']//2]) delay_secs(0.1) zoom_out() delay_secs(0.01) return _coord return False
def search_villages(location, box): go_by_coordinate(location) template = '../images/uis/img_ExploreVillage.png' ##@@@@@@@@@@@@ #return _bs.match_image_box(template=template, image=box, precision=0.97, show=True, multi=1) return _bs.match_image_box(template=template, image=box, precision=0.97, multi=1)
def find_verification_verify(): # return _bs.match_image_box(get_image_path('btn_VerificationVerify', 'UIS'), precision=0.9) return _bs.match_image_box(get_image_path('btn_VerificationVerify', 'UIS'), [830, 470, 1738, 648], precision=0.9)