|
@@ -152,9 +152,9 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
|
|
|
# 开始循环
|
|
# 开始循环
|
|
|
success = True
|
|
success = True
|
|
|
last_battle = True # 记录上一次战斗的结果
|
|
last_battle = True # 记录上一次战斗的结果
|
|
|
|
|
+ # 更改循环顺序
|
|
|
while 1:
|
|
while 1:
|
|
|
self.screenshot()
|
|
self.screenshot()
|
|
|
-
|
|
|
|
|
# 检查票数
|
|
# 检查票数
|
|
|
if not self.check_ticket(con.raid_config.number_base):
|
|
if not self.check_ticket(con.raid_config.number_base):
|
|
|
break
|
|
break
|
|
@@ -162,25 +162,6 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
|
|
|
if self.current_count >= con.raid_config.number_attack:
|
|
if self.current_count >= con.raid_config.number_attack:
|
|
|
logger.info(f'Current count {self.current_count}, max count {con.raid_config.number_attack}')
|
|
logger.info(f'Current count {self.current_count}, max count {con.raid_config.number_attack}')
|
|
|
break
|
|
break
|
|
|
- # 检查是否每三次领一个奖励
|
|
|
|
|
- if self.reward_detect_click(False):
|
|
|
|
|
- continue
|
|
|
|
|
- # 刷新 >> 如果勾选了三次刷新并且到达了三次,就刷新
|
|
|
|
|
- if con.raid_config.three_refresh and self.appear(self.I_RR_THREE, threshold=0.8):
|
|
|
|
|
- logger.info('Three refresh')
|
|
|
|
|
- if self.check_refresh():
|
|
|
|
|
- continue
|
|
|
|
|
- else:
|
|
|
|
|
- success = False
|
|
|
|
|
- break
|
|
|
|
|
- # 刷新 >> 如果上一轮的失败并且勾选了失败刷新,就刷新
|
|
|
|
|
- if not last_battle and con.raid_config.when_attack_fail == WhenAttackFail.REFRESH:
|
|
|
|
|
- logger.info('Battle lost and then refresh')
|
|
|
|
|
- if self.check_refresh():
|
|
|
|
|
- continue
|
|
|
|
|
- else:
|
|
|
|
|
- success = False
|
|
|
|
|
- break
|
|
|
|
|
# ----------------------------------------开始进攻
|
|
# ----------------------------------------开始进攻
|
|
|
medal, index = self.find_one(False)
|
|
medal, index = self.find_one(False)
|
|
|
if not medal and not index:
|
|
if not medal and not index:
|
|
@@ -217,6 +198,27 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
|
|
|
last_battle = self.run_general_battle(con.general_battle_config)
|
|
last_battle = self.run_general_battle(con.general_battle_config)
|
|
|
if lock_before:
|
|
if lock_before:
|
|
|
con.general_battle_config.lock_team_enable = lock_before
|
|
con.general_battle_config.lock_team_enable = lock_before
|
|
|
|
|
+ # 检查是否每三次领一个奖励
|
|
|
|
|
+ if self.reward_detect_click(False):
|
|
|
|
|
+ logger.info('Rewards of three wins')
|
|
|
|
|
+ continue
|
|
|
|
|
+ # 刷新 >> 如果勾选了三次刷新并且到达了三次,就刷新
|
|
|
|
|
+ if con.raid_config.three_refresh and self.appear(self.I_RR_THREE, threshold=0.8):
|
|
|
|
|
+ logger.info('Three refresh')
|
|
|
|
|
+ if self.check_refresh():
|
|
|
|
|
+ continue
|
|
|
|
|
+ else:
|
|
|
|
|
+ success = False
|
|
|
|
|
+ break
|
|
|
|
|
+ # 刷新 >> 如果上一轮的失败并且勾选了失败刷新,就刷新
|
|
|
|
|
+ if not last_battle and con.raid_config.when_attack_fail == WhenAttackFail.REFRESH:
|
|
|
|
|
+ logger.info('Battle lost and then refresh')
|
|
|
|
|
+ if self.check_refresh():
|
|
|
|
|
+ continue
|
|
|
|
|
+ else:
|
|
|
|
|
+ success = False
|
|
|
|
|
+ break
|
|
|
|
|
+
|
|
|
|
|
|
|
|
self.ui_click(self.I_BACK_RED, self.I_CHECK_EXPLORATION)
|
|
self.ui_click(self.I_BACK_RED, self.I_CHECK_EXPLORATION)
|
|
|
self.ui_get_current_page()
|
|
self.ui_get_current_page()
|
|
@@ -288,6 +290,11 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
|
|
|
self.wait_until_appear(self.I_BACK_RED)
|
|
self.wait_until_appear(self.I_BACK_RED)
|
|
|
self.screenshot()
|
|
self.screenshot()
|
|
|
cu, res, total = self.O_NUMBER.ocr(self.device.image)
|
|
cu, res, total = self.O_NUMBER.ocr(self.device.image)
|
|
|
|
|
+
|
|
|
|
|
+ if total == 0:
|
|
|
|
|
+ self.reward_detect_click(False)
|
|
|
|
|
+ # 增加出现聊天框遮挡,处理奖励之后,重新识别票数
|
|
|
|
|
+ cu, res, total = self.O_NUMBER.ocr(self.device.image)
|
|
|
if cu == 0 and cu + res == total:
|
|
if cu == 0 and cu + res == total:
|
|
|
logger.warning(f'Execute raid failed, no ticket')
|
|
logger.warning(f'Execute raid failed, no ticket')
|
|
|
return False
|
|
return False
|
|
@@ -388,18 +395,32 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
|
|
|
"""
|
|
"""
|
|
|
if screenshot:
|
|
if screenshot:
|
|
|
self.screenshot()
|
|
self.screenshot()
|
|
|
- if self.appear(self.I_SOUL_RAID):
|
|
|
|
|
- self.screenshot()
|
|
|
|
|
- # 稳定一次的截图时间
|
|
|
|
|
- # 再次判断是否出现的
|
|
|
|
|
- if not self.appear(self.I_SOUL_RAID):
|
|
|
|
|
- return False
|
|
|
|
|
- while 1:
|
|
|
|
|
- self.screenshot()
|
|
|
|
|
- if not self.appear(self.I_SOUL_RAID, threshold=0.7):
|
|
|
|
|
- return True
|
|
|
|
|
- if self.appear_then_click(self.I_SOUL_RAID, interval=1.5):
|
|
|
|
|
- continue
|
|
|
|
|
|
|
+ # 由于更改识别顺序,退出战斗之后,需要先等待回到个人突破界面,即识别到红色退出按钮,再进行奖励判断
|
|
|
|
|
+ self.wait_until_appear(self.I_BACK_RED)
|
|
|
|
|
+ text = self.O_TEXT.ocr(self.device.image)
|
|
|
|
|
+ # 识别突破卷区域,如果识别到了且其中含有文字,即有聊天框遮挡则进入循环,等待三胜奖励出现并点击,循环退出条件为识别到票(即*/*的形式)
|
|
|
|
|
+ if text != "":
|
|
|
|
|
+ if re.search(r'[\u4e00-\u9fff]', text):
|
|
|
|
|
+ while 1:
|
|
|
|
|
+ self.screenshot()
|
|
|
|
|
+ result = self.O_TEXT.ocr(self.device.image)
|
|
|
|
|
+ if not re.search(r'[\u4e00-\u9fff]', result) and re.search(r'(\d+)/(\d+)', result):
|
|
|
|
|
+ return True
|
|
|
|
|
+ if self.appear_then_click(self.I_SOUL_RAID, interval=1.5):
|
|
|
|
|
+ continue
|
|
|
|
|
+
|
|
|
|
|
+ # if self.appear(self.I_SOUL_RAID):
|
|
|
|
|
+ # self.screenshot()
|
|
|
|
|
+ # # 稳定一次的截图时间
|
|
|
|
|
+ # # 再次判断是否出现的
|
|
|
|
|
+ # if not self.appear(self.I_SOUL_RAID):
|
|
|
|
|
+ # return False
|
|
|
|
|
+ # while 1:
|
|
|
|
|
+ # self.screenshot()
|
|
|
|
|
+ # if not self.appear(self.I_SOUL_RAID, threshold=0.7):
|
|
|
|
|
+ # return True
|
|
|
|
|
+ # if self.appear_then_click(self.I_SOUL_RAID, interval=1.5):
|
|
|
|
|
+ # continue
|
|
|
|
|
|
|
|
def check_refresh(self, screenshot: bool=True) -> bool:
|
|
def check_refresh(self, screenshot: bool=True) -> bool:
|
|
|
"""
|
|
"""
|