def start_once(self): i = 0 while (i < len(self.operation_sequence)): for j in range(2): whether_enter = function_ark.confirm_where(self.handle, config_ark.guanqia_pic[self.guanqia]) or \ function_ark.confirm_where(self.handle, config_ark.guanqia_pic[self.guanqia + '_confirm']) if whether_enter: break if whether_enter: function_ark.enter_zhuxian(self.handle, self.guanqia, daili_confirm=True) i = self.operation_mapping["确认使用代理并开始战斗"] else: i = self.find_where() print("now {}".format(self.operation_sequence[i])) if self.operation_sequence[i] == "进入战斗界面": function_ark.enter_where(self.handle, "zhandou_xuanze") #i += 1 elif self.operation_sequence[ i] == "选择并进入对应章节,选择关卡,确认选择正确,使用代理,进入队伍配置界面": function_ark.enter_chapter(self.handle, self.guanqia) time.sleep(1) function_ark.enter_zhuxian(self.handle, self.guanqia, daili_confirm=True) elif self.operation_sequence[i] == "确认使用代理并开始战斗": if function_ark.confirm_where( self.handle, config_ark.pic_where['zhandou_start'], confirm_once=4): if function_ark.confirm_where( self.handle, config_ark.pic_confirm["daili_confirm"]): function_ark.mouse_click( self.handle, config_ark.points["zhandou_start"]) time.sleep(3) #i += 1 else: raise config_ark.ExitError else: #上一步操作点击被吞了 #i = self.operation_mapping["进入队伍配置界面"] pass elif self.operation_sequence[i] == "确认进入战斗,确认没有暂停并等待战斗结束": if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_ing"], confirm_once=20): i += 1 else: #从新定位当前位置 continue while (1): if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_ing"], confirm_once=2): print("正在战斗中") position = function_ark.pic_position( self.handle, config_ark.pic_confirm["zhandou_pause"], once=True) if position != None: function_ark.mouse_click(self.handle, position["result"]) print("检测到暂停,继续战斗") time.sleep(config_ark.BATTLE_WAIT) else: #结束 #i += 1 break elif self.operation_sequence[i] == "判断战役成功": if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_end"], confirm_once=10): function_ark.mouse_click(self.handle, config_ark.points["kongbai"]) temp_list = list(config_ark.pic_where.keys()) temp_list.remove('zhandou_end') temp_list.remove('zhandou_failed') if function_ark.judge_where( self.handle, 5) in config_ark.pic_where.keys(): print('返回到上一级') return True pass else: #从新定位当前位置 #判断是否代理未满3星 #self.find_where() pass
def start_once(self): i = 0 while (i < len(self.operation_sequence)): if function_ark.confirm_where( self.handle, config_ark.guanqia_pic[self.guanqia]): function_ark.enter_zhuxian(self.handle, self.guanqia) i = self.operation_mapping["开始战斗"] else: i = self.find_where() if self.operation_sequence[i] == "进入战斗界面": function_ark.enter_where(self.handle, "zhandou_xuanze") # i += 1 elif self.operation_sequence[ i] == "选择并进入对应章节,选择关卡,确认选择正确,进入队伍配置界面": function_ark.enter_chapter(self.handle, self.guanqia) function_ark.enter_zhuxian(self.handle, self.guanqia) elif self.operation_sequence[i] == "开始战斗": if function_ark.confirm_where( self.handle, config_ark.pic_where['zhandou_start'], confirm_once=4): if function_ark.confirm_where( self.handle, config_ark.pic_confirm["daili_confirm"]): function_ark.mouse_click( self.handle, config_ark.points["zhandou_start"]) print("进入战斗") time.sleep(3) # i += 1 else: raise config_ark.ExitError else: # 上一步操作点击被吞了 # i = self.operation_mapping["进入队伍配置界面"] pass elif self.operation_sequence[ i] == "确认进入战斗,跳过剧情,开启2倍速,干员部署,确认没有暂停并等待战斗结束": # if function_ark.confirm_where(self.handle,config_ark.pic_where["zhandou_ing"],confirm_once=20): # pass # else: # #从新定位当前位置 # continue position = function_ark.pic_position( self.handle, config_ark.pic_confirm["skip"]) function_ark.mouse_click(self.handle, position["result"]) if function_ark.confirm_where( self.handle, config_ark.pic_confirm["skip_confirm"], confirm_once=3): function_ark.mouse_click(self.handle, config_ark.points["skip_yes"]) print("跳过剧情") time.sleep(5) else: return False #意想不到的错误,之后再考虑处理方式 while (1): if function_ark.battle_speed_set(self.handle, speed=2) == True: print("开启二倍速") break #开始部署干员 function_ark.staff_set(self.handle, "hj", config_ark.points["1-11-target-xy"][0], "right") function_ark.staff_set(self.handle, "longmenbi", config_ark.points["1-11-target-xy"][1], "right") function_ark.staff_set(self.handle, "12F", config_ark.points["1-11-target-xy"][2], "right") function_ark.staff_set(self.handle, "sdhd", config_ark.points["1-11-target-xy"][3], "right") function_ark.staff_set(self.handle, "mgl", config_ark.points["1-11-target-xy"][4], "right") function_ark.staff_set(self.handle, "ase", config_ark.points["1-11-target-xy"][5], "up") while (1): if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_ing"], confirm_once=2): print("正在战斗中") position = function_ark.pic_position( self.handle, config_ark.pic_confirm["zhandou_pause"], once=True) if position != None: function_ark.mouse_click(self.handle, position["result"]) print("检测到暂停,继续战斗") time.sleep(config_ark.BATTLE_WAIT) else: position = function_ark.pic_position( self.handle, config_ark.pic_confirm["zhandou_pause"], once=True) if position != None: function_ark.mouse_click(self.handle, position["result"]) print("检测到暂停,继续战斗") else: break time.sleep(config_ark.BATTLE_WAIT) #结束 #i += 1 elif self.operation_sequence[i] == "判断战役成功": if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_end"], confirm_once=2): print("战斗胜利") function_ark.mouse_click(self.handle, config_ark.points["kongbai"]) temp_list = list(config_ark.pic_where.keys()) temp_list.remove('zhandou_end') temp_list.remove('zhandou_failed') if function_ark.judge_where( self.handle, 5) in config_ark.pic_where.keys(): print('返回到上一级') pass return True else: function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_failed"], confirm_once=2) print("因未知原因战斗失败,请不要最小化模拟器") function_ark.mouse_click(self.handle, config_ark.points["kongbai"]) #从新定位当前位置 #判断是否代理未满3星 #self.find_where() return False return False
def start_once(self): i = 0 while (i < len(self.operation_sequence)): for j in range(2): whether_enter = function_ark.confirm_where(self.handle, config_ark.pic_huodong[self.guanqia]) or \ function_ark.confirm_where(self.handle, config_ark.pic_huodong[self.guanqia + '_confirm']) if whether_enter: break if whether_enter: function_ark.enter_zhuxian(self.handle, self.guanqia, daili_confirm=True) i = self.operation_mapping["确认使用代理并开始战斗"] else: i = self.find_where() print("now {}".format(self.operation_sequence[i])) if self.operation_sequence[i] == "进入战斗界面": function_ark.enter_where(self.handle, "zhandou_xuanze") #i += 1 elif self.operation_sequence[i] == "选择并进入活动界面": tmp = self.guanqia.split('-')[-1] if len(tmp) == 1: tmp = 'huodong_enter1' else: tmp = 'huodong_enter2' position = function_ark.pic_position( self.handle, config_ark.pic_huodong['huodong'], once=3) if position != None: function_ark.mouse_click(self.handle, position["result"]) position1 = function_ark.pic_position( self.handle, config_ark.pic_huodong[tmp], once=3) if position1 != None: function_ark.mouse_click(self.handle, position1["result"]) else: pass #i += 1 else: #i = self.find_where() pass elif self.operation_sequence[i] == "选择关卡,确认选择正确,使用代理,进入队伍配置界面": function_ark.mouse_click(self.handle, config_ark.points["kongbai"]) time.sleep(1) function_ark.enter_zhuxian(self.handle, self.guanqia) """ verified at 2019-9-2 删除原有逻辑,增加全局搜索关卡功能 """ #verified at 2019-9-2 # current_position = function_ark.pic_position(self.handle,config_ark.pic_huodong[self.guanqia],once=4) # if current_position==None: # print("当前非选择关卡") # continue # function_ark.mouse_click(self.handle,current_position["result"]) # time.sleep(1) #i += 1 #确认选择正确 # if function_ark.confirm_where(self.handle,config_ark.pic_confirm[self.guanqia],confirm_once=True): # print("关卡信息正确") # pass # #i += 1 # else: # continue # #没有选择正确的关卡,重新进入‘选择关卡’ # #i = self.operation_mapping["选择关卡,确认选择正确,使用代理,进入队伍配置界面"] # pass # #使用代理 # position = function_ark.pic_position(self.handle,config_ark.pic_confirm["daili_do"],once=True) # if position != None: # print("代理已使用") # #i += 1 # pass # else: # function_ark.mouse_click(self.handle,config_ark.points['daili']) # print("使用代理") # #i += 1 # #进入队伍配置界面 # time.sleep(1) # function_ark.mouse_click(self.handle,config_ark.points["peizhi_enter"]) # print("进入队伍配置界面") # time.sleep(3) #i += 1 elif self.operation_sequence[i] == "确认使用代理并开始战斗": if function_ark.confirm_where( self.handle, config_ark.pic_where['zhandou_start'], confirm_once=4): if function_ark.confirm_where( self.handle, config_ark.pic_confirm["daili_confirm"]): function_ark.mouse_click( self.handle, config_ark.points["zhandou_start"]) time.sleep(3) #i += 1 else: raise config_ark.ExitError else: #上一步操作点击被吞了 #i = self.operation_mapping["进入队伍配置界面"] pass elif self.operation_sequence[i] == "确认进入战斗,确认没有暂停并等待战斗结束": if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_ing"], confirm_once=20): i += 1 else: #从新定位当前位置 continue while (1): if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_ing"], confirm_once=2): print("正在战斗中") position = function_ark.pic_position( self.handle, config_ark.pic_confirm["zhandou_pause"], once=True) if position != None: function_ark.mouse_click(self.handle, position["result"]) print("检测到暂停,继续战斗") time.sleep(config_ark.BATTLE_WAIT) else: #结束 #i += 1 break elif self.operation_sequence[i] == "判断战役成功": if function_ark.confirm_where( self.handle, config_ark.pic_where["zhandou_end"], confirm_once=10): function_ark.mouse_click(self.handle, config_ark.points["kongbai"]) i += 1 else: #从新定位当前位置 #判断是否代理未满3星 #self.find_where() pass