def improve_click(): for improve_click_count in xrange(4): # 4 times dc.sleep(0.6) dc.humanbeing_click(lt_a2c.impression_classX, lt_a2c.impression_classY) dc.sleep(0.3) # 点击红色的确认按键 dc.humanbeing_click(lt_a2c.improve_impression_confirmX, lt_a2c.improve_impression_confirmY) dc.sleep(0.2) dc.back() dc.sleeptime(1) # 点击最后一个S class 按键,由于这个位置不确定,使用图像匹配的方法来确认位置 # 图像匹配 S class ims.image_match(image.s_class, 0.8) dc.humanbeing_click_point(ims.point(zoom=0.2, x_add=0, y_add=-58)) dc.sleep(0.5) # 点击红色的确认按键 dc.humanbeing_click(lt_a2c.improve_impression_confirmX, lt_a2c.improve_impression_confirmY) ims.whileset(image.improve_finish, 4.5, 4.6, threshold=0.7) dc.humanbeing_click_point(ims.point(zoom=0)) dc.back() dc.sleep(0.3) # 获取奖励 dc.humanbeing_click(lt_a2c.rewardX, lt_a2c.rewardY) dc.sleep(0.2) # 返回天子选择界面 # 方法一,一步步图像匹配然后返回 ims.backtopage(image.flag_selcte_interface, a=0.5, b=0.6)
def start(): """ 从战斗配置主界面开始,进行连续战斗 """ time.sleep(1) # 配置自动战斗系统 # 选择自动战斗的方式,我们选择重新开始(分别有暂停、下一场、重新开始) humanbeing_click(lt.battle_styleX, lt.battle_styleY) time.sleep(0.3) humanbeing_click(lt.loopX,lt.loopY) back() sleeptime(0.2, 0.51) # 匹配开始按键 如果必要,匹配loading(转圈圈那个图案) start_button = image.start_button res = ims.image_match(start_button)[0] if res == 1: sleeptime(0.3, 0.7) humanbeing_click_point(ims.point(0.1))
def select_boss_battle(): """main funtion: select level-40 boss to beat""" # dc.sleep(1) res = ims.image_match(imageraid.level40) if res[0] == 0: # 不存在level40 # refresh refresh() select_boss_battle() if res[0] == 1: # 存在40级的 # 点击 level40 标志 point = ims.point(zoom=0.3) dc.humanbeing_click_point(point) dc.sleeptime(0.3, 0.6) # 确认进入到raid配置界面 res = ims.whileset(imageraid.raid_battle, 0.8, 1, loop=False) if res == 0: # 未进入到 raid_battle icon 界面 再点一次 refresh() select_boss_battle() # battle-button icon battle_icon = ims.point(zoom=0.3) dc.humanbeing_click_point(battle_icon) # auto buy tickets function buy_ticket(battle_icon) check_done()
def refresh(): """点击右侧刷新按键""" dc.sleeptime(5,6) dc.humanbeing_click(lt_raid.raid_refreshX, lt_raid.raid_refreshY)
# 将屏幕中角色选择区域右侧截取 next_chara_cropped = ims.capture_adb() next_chara_cropped = next_chara_cropped[ lt_gl.cropped_rightsideY[0]:lt_gl.cropped_rightsideY[1], lt_gl.cropped_rightsideX[0]:lt_gl.cropped_rightsideX[1]] res = ims.image_match(image.none_charater, threshold=0.6, screen_image=next_chara_cropped) if res[0] == 1: # 右边没有角色 print " All charater improved" sys.exit(0) else: # print res[1] # 向右点击,获取下一位child dc.humanbeing_click(lt_gl.rightsideX, lt_gl.rightsideY, a=0, b=0.1) if __name__ == '__main__': dc.log_settin(log.ERROR) # TODO 存在的问题 在升级一个橘色后,角色顺序会变 os.chdir("../adb") os.system("adb connect 127.0.0.1:21503") # initil() # TODO 修改排序 dc.sleep(0.5) while True: # 点击角色下方查看属性并进入友好度提升界面 get_money() dc.sleeptime(0.2, 0.3) next_chara()