def tansuo_new(self, mode=0): """ 重写探索:刷/打最上可行的关卡 mode=0 刷最上关卡(适合大号) mode=1 刷最上关卡,若无法点进则刷次上关卡(适合小号推探索图) mode=2 刷次上关卡,若无法点进则刷最上关卡(适合小号日常探索) """ def tryfun(): if mode == 0: ec = [(539, 146)] elif mode == 1: ec = [(539, 146), (541, 255)] else: ec = [(541, 255), (539, 146)] t = 0 while t < 2: out = self.lock_img(FIGHT_BTN["xuanguan_quxiao"], elseclick=ec, elsedelay=8, is_raise=False, retry=2, elseafter=0.5) if out: c = self.get_upperright_stars(self.last_screen) if c == 3: swc = self.switch self.switch = 0 self.zhandouzuobiao( 30, 30, 2, use_saodang=True, saodang_ok2=MAIN_BTN["tansuo_saodangok2"]) self.switch = swc # 这样写非常糟糕的 t += 2 else: self.log.write_log("info", "最上的关卡还没有三星通关,即将进入战斗。") swc = self.switch self.switch = 0 s = self.zhandouzuobiao(30, 30, 1, use_saodang=False, buy_tili=1) self.switch = swc if s == 0: self.log.write_log("warning", "探索战斗失败!") elif s == 1: self.log.write_log("info", "探索战斗成功!") else: self.log.write_log( "warning", f"探索战斗出现未知的错误:s={s}, info={self._zdzb_info}") t += 1 else: self.log.write_log("warning", "无法进入探索!") t += 2 ts = self.AR.get("time_status", UDD["time_status"]) if not diffday(time.time(), ts["tansuo"]): self.log.write_log("info", "今天已经探索过!") return self.lock_home() self.click_btn(MAIN_BTN["maoxian"], until_appear=MAIN_BTN["zhuxian"]) self.click_btn(MAIN_BTN["tansuo"], until_appear=MAIN_BTN["jingyanzhiguanqia"]) # 经验 self.click_btn(MAIN_BTN["jingyanzhiguanqia"], until_appear=MAIN_BTN["tansuo_sytzcs"]) if self.is_exists(MAIN_BTN["tansuo_zero"], screen=self.last_screen): self.log.write_log("info", "无经验挑战次数。") else: tryfun() self.click_btn(MAIN_BTN["tansuo_back"], until_appear=MAIN_BTN["jingyanzhiguanqia"]) # mana self.click_btn(MAIN_BTN["managuanqia"], until_appear=MAIN_BTN["tansuo_sytzcs"]) if self.is_exists(MAIN_BTN["tansuo_zero"], screen=self.last_screen): self.log.write_log("info", "无玛娜挑战次数。") else: tryfun() self.click_btn(MAIN_BTN["tansuo_back"], until_appear=MAIN_BTN["jingyanzhiguanqia"]) ts["tansuo"] = time.time() self.AR.set("time_status", ts) self.lock_home()
def dianzan(self, sortflag=0): """ 2020/8/6 By:CyiceK 检查完毕 2020/8/18 TheAutumnOfRice:加了一点点at。 ↑@CyiceK真的,加了at之后的运算速度飞升,不能为了图方便而不加at的。 :param sortflag: :return: """ # 行会点赞 # 一天只能点一次 ts = self.AR.get("time_status", UDD["time_status"]) cur = time.time() if not diffday(cur, ts["dianzan"]): self.log.write_log("info", "今日已经点过赞!") return self.lock_home() # 进入行会 out = self.lock_img(PCRelement(img='img/zhiyuansheding.bmp', at=(16, 338, 159, 380)), ifclick=[(230, 351), (1, 1)], elseclick=[(1, 1), (688, 432)], elsedelay=8, retry=6, is_raise=False) if not out: self.log.write_log("error", "无法进入行会") self.lock_home() return self.lock_no_img('img/zhandou_ok.jpg', elseclick=[(239, 351)], retry=5) self.click_btn(HANGHUI_BTN["chengyuanxinxi"], elsedelay=5, timeout=20) if sortflag == 1: self.lock_img('img/queren.jpg', elseclick=[(720, 97)], retry=3) # 点击排序 self.lock_no_img('img/queren.jpg', elseclick=[(289, 303), (587, 372)], elsedelay=self.change_time, retry=3) # 按战力降序 这里可以加一步调降序 if self.is_exists('img/dianzan.bmp'): click_list = [(826, 198), (826, 316), (826, 428)] for i in click_list: if self.lock_img('img/dianzan.bmp', ifclick=[i], elseclick=[(480, 374)], retry=10): if self.lock_img('img/queren.jpg', retry=8): self.lock_no_img('img/queren.jpg', elseclick=[(480, 374)], retry=10) continue else: self.log.write_log("warning", "已经没有点赞次数了") self.lock_home() break else: self.log.write_log("error", "找不到点赞按钮") self.lock_home() break # 点赞 战力降序第一/第二/第三个人 # (480, 374) 是ok的坐标 else: if self.is_exists('img/dianzan.bmp'): click_list = [(818, 198), (826, 316), (826, 428)] for i in click_list: if self.lock_img('img/dianzan.bmp', ifclick=[i], elseclick=[(480, 374)], retry=10): if self.lock_img('img/queren.jpg', retry=8): self.lock_no_img('img/queren.jpg', elseclick=[(480, 374)], retry=10) continue else: self.log.write_log("warning", "已经没有点赞次数了") self.lock_home() break else: self.log.write_log("error", "找不到点赞按钮") self.lock_home() break # 点赞 职务降序(默认) 第二/第三个人,副会长 self.click(479, 381) screen_shot_ = self.getscreen() self.click_img(screen_shot_, 'img/queren.jpg') # 保存点赞时间 ts["dianzan"] = time.time() self.AR.set("time_status", ts) # self.lock_img('img/liwu.bmp', elseclick=[(131, 533), (1, 1), (480, 374)], elsedelay=self.change_time, # at=(891, 413, 930, 452)) # 回首页 self.lock_home()
def dianzan(self, sortflag=0): """ 2020/8/6 By:CyiceK 检查完毕 2020/8/18 TheAutumnOfRice:加了一点点at。 ↑@CyiceK真的,加了at之后的运算速度飞升,不能为了图方便而不加at的。 :param sortflag: :return: """ # 行会点赞 # 一天只能点一次 ts = self.AR.get("time_status", UDD["time_status"]) cur = time.time() if not diffday(cur, ts["dianzan"]): self.log.write_log("info", "今日已经点过赞!") return self.lock_home() # 进入行会 out = self.lock_img(PCRelement(img='img/zhiyuansheding.bmp', at=(16, 338, 159, 380)), ifclick=[(230, 351), (1, 1)], elseclick=[(1, 1), (688, 432)], elsedelay=8, retry=6, is_raise=False) if not out: self.log.write_log("error", "无法进入行会") self.lock_home() return self.lock_no_img('img/zhandou_ok.jpg', elseclick=[(239, 351)], retry=5) self.lock_no_img(PCRelement(img='img/zhiyuansheding.bmp', at=(16, 338, 159, 380)), elseclick=[(230, 351)], retry=5) if sortflag == 1: self.lock_img('img/ok.bmp', elseclick=[(720, 97)], retry=3) # 点击排序 self.lock_no_img('img/ok.bmp', elseclick=[(289, 303), (587, 372)], elsedelay=self.change_time, retry=3) # 按战力降序 这里可以加一步调降序 if not self.lock_img('img/dianzan.bmp', ifclick=[(818, 198), (480, 374), (826, 316), (480, 374), (826, 428)], elseclick=[(1, 1)], ifbefore=self.change_time, elsedelay=self.change_time, ifdelay=self.change_time, retry=10, is_raise=False): self.log.write_log("error", "找不到点赞按钮") self.lock_home() return # 点赞 战力降序第一/第二/第三个人 # (480, 374) 是ok的坐标 else: if not self.lock_img(PCRelement(img='img/dianzan.bmp', at=(756, 184, 857, 227)), ifclick=[(829, 316), (480, 374), (826, 428)], elseclick=[(1, 1)], elsedelay=self.change_time, ifbefore=self.change_time, ifdelay=self.change_time, retry=10, is_raise=False): self.log.write_log("error", "找不到点赞按钮") self.lock_home() return # 点赞 职务降序(默认) 第二/第三个人,副会长 self.click(479, 381) screen_shot_ = self.getscreen() self.click_img(screen_shot_, 'img/ok.bmp') # 保存点赞时间 ts["dianzan"] = time.time() self.AR.set("time_status", ts) self.lock_img('img/liwu.bmp', elseclick=[(131, 533), (1, 1), (480, 374)], elsedelay=self.change_time, at=(891, 413, 930, 452)) # 回首页
def shengji(self, mode=0, times=5, tili=False): """ mode = 0 刷1+2(适合大号) mode = 1 只刷1(适合小号日常) mode = 2 只刷2(适合活动关) """ def tryfun_shengji(): def sj1(): self.click(541, 260) time.sleep(3) self.zhandouzuobiao(30, 30, times, use_saodang=True, buy_tili=tili) self.clearFCHeader("KarinFC") time.sleep(0.5) def sj2(): self.click(539, 146) time.sleep(3) self.zhandouzuobiao(30, 30, times, use_saodang=True, buy_tili=tili) self.clearFCHeader("KarinFC") time.sleep(0.5) if mode == 0: sj1() sj2() elif mode == 1: sj1() else: sj2() ts = self.AR.get("time_status", UDD["time_status"]) if not diffday(time.time(), ts["shengji"]): self.log.write_log("info", "今天已经圣迹调查过了!") return if tili: self.start_shuatu() if not self.check_shuatu(): return def KarinFun(): self.ES.clear("KarinFC") self.chulijiaocheng(None) raise RetryNow(name="Karin") def KarinFC(FC): FC.getscreen().exist(MAIN_BTN["karin_middle"], KarinFun) self.setFCHeader("KarinFC", KarinFC) @PCRRetry(name="Karin") def KarinLoop(): self.lock_home() self.click_btn(MAIN_BTN["maoxian"], elsedelay=4, until_appear=MAIN_BTN["zhuxian"]) self.setFCHeader("KarinFC", KarinFC) self.click_btn(MAIN_BTN["shengji"], elsedelay=4, until_appear=MAIN_BTN["shengjiguanqia"]) tryfun_shengji() KarinLoop() ts["shengji"] = time.time() self.AR.set("time_status", ts) self.lock_home()
def _run(self): # self._get_status() _time_start = time.time() # 第一次直接输出初始状态 if len(s_sckey) != 0 and self.name != "": acc_state = f"Schedule {self.name} 开始运行!\n" from CreateUser import _show_schedule acc_state += PrintToStr(_show_schedule, self.schedule) acc_state += PrintToStr(self.show_device) acc_state += PrintToStr(self.show_schedule) pcr_log("admin").server_bot("STATE", acc_state=acc_state) while self.state == 1: # PCRInitializer information while True: p = self.pcr.get_log() if p is None: break self.log("info", p) # Report Information if not self.is_free() and len(s_sckey) != 0: _time_end = time.time() _time = int(_time_end - _time_start) / 60 if _time >= s_sentstate: self.log("info", "server_bot 播报当前状态") pcr_log("admin").server_bot("STATE", acc_state=PrintToStr(self.show_everything)) _time_start = time.time() if "restart" in self.config: last_time = self._get_last_time() cur_time = time.time() # flag: 一个是否需要restart的标记 if last_time == 0 or diffday(cur_time, last_time, self.config["restart"]): self.log("info", "Config-清除全部运行记录") self.restart() self._set_time(cur_time) for ind, t5 in enumerate(self.SL): typ, nam, bat, cond, rec = t5 # 已经完成、跳过 if self.run_status[rec] != 0 and (nam, bat) in self.always_restart_name: self.log("info", f"计划 {nam} 重置。") self.restart(nam) if self.run_status[rec] != 0: continue # 检查是否已经完成 if self.is_complete(rec): # 记录设置2:运行完成后立刻restart self.run_status[rec] = 1 self.log("info", f"计划** {nam} - {bat} **已经完成") self._set_status() self.checked_status[rec] = True continue # 已经处理过 if self.checked_status[rec] is True: continue if self._check(cond): # 满足条件 self.checked_status[rec] = True self._add(nam, bat) self.log("info", f"开始执行计划:** {nam} - {bat} **") else: if typ == "asap": self.run_status[rec] = 2 self.log("info", f"跳过计划:** {nam} **") time.sleep(1)