科研有概率停在00:00,导致触发Research duration reached, but requirements not satisfied
Describe the bug 有一定概率在处于空闲的alas收科研的时候,在检查剩余时间时为00:00,导致收科研失败,从而推迟30分钟
To Reproduce
Steps to reproduce the behavior:
为research_get_remain方法下seconds == 0条件添加raise RuntimeError,在收科研失败时会进行记录
Expected behavior A clear and concise description of what you expected to happen. 应该尝试识别当前科研项目,如果不是需要额外条件的科研应尝试重启游戏,再进行一次收科研操作
Screenshots
If applicable, add screenshots to help explain your problem.

Log Post the entire log snippet that caused you to receive the error
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
RESEARCH
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
2022-01-21 20:06:27.409 | INFO | <<< UI ENSURE >>>
2022-01-21 20:06:27.418 | INFO | [UI] page_reward
2022-01-21 20:06:27.421 | INFO | Already at page_reward
2022-01-21 20:06:27.530 | INFO | <<< RESEARCH GET REMAIN >>>
2022-01-21 20:06:27.532 | INFO | <<< UI CLICK >>>
2022-01-21 20:06:28.058 | INFO | Click ( 105, 533) @ RESEARCH_LAB
2022-01-21 20:06:28.945 | INFO | [RESEARCH_LAB_DURATION_REMAIN 0.024s] 00:00:00
2022-01-21 20:06:28.948 | INFO | Research project remain: 0:00:00
2022-01-21 20:06:28.951 | WARNING | Research duration reached, but requirements not satisfied
2022-01-21 20:06:28.954 | ERROR |
┌───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────┐
│ │
│ C:\fakepath\AzurLaneAutoScript\alas.py:52 in run │
│ │
│ 49 │ │
│ 50 │ def run(self, command): │
│ 51 │ │ try: │
│ > 52 │ │ │ self.__getattribute__(command)() │
│ 53 │ │ │ return True │
│ 54 │ │ except TaskEnd: │
│ 55 │ │ │ return True │
│ │
│ ┌───────────────────────────── locals ─────────────────────────────┐ │
│ │ command = 'research' │ │
│ │ e = RuntimeError() │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x0000017519399788> │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ C:\fakepath\AzurLaneAutoScript\alas.py:127 in research │
│ │
│ 124 │ │
│ 125 │ def research(self): │
│ 126 │ │ from module.research.research import RewardResearch │
│ > 127 │ │ RewardResearch(config=self.config, device=self.device).run() │
│ 128 │ │
│ 129 │ def commission(self): │
│ 130 │ │ from module.commission.commission import RewardCommission │
│ │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ RewardResearch = <class 'module.research.research.RewardResearch'> │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x0000017519399788> │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\fakepath\AzurLaneAutoScript\module\research\research.py:372 in run │
│ │
│ 369 │ │ │ │ # Project requirements are not satisfied │
│ 370 │ │ │ │ self.config.task_delay(success=False) │
│ 371 │ │ else: │
│ > 372 │ │ │ research_duration_remain = self.research_get_remain() │
│ 373 │ │ │ if research_duration_remain is not None: │
│ 374 │ │ │ │ self.config.task_delay(minute=float(research_duration_remain) * 60) │
│ 375 │ │ │ else: │
│ │
│ ┌─────────────────────────────────── locals ────────────────────────────────────┐ │
│ │ self = <module.research.research.RewardResearch object at 0x0000017578B8AEC8> │ │
│ └───────────────────────────────────────────────────────────────────────────────┘ │
│ │
│ C:\fakepath\AzurLaneAutoScript\module\research\research.py:334 in research_get_remain │
│ │
│ 331 │ │ │ return research_duration_remain │
│ 332 │ │ if seconds == 0: │
│ 333 │ │ │ logger.warning('Research duration reached, but requirements not satisfied') │
│ > 334 │ │ │ raise RuntimeError │
│ 335 │ │ │ return None │
│ 336 │ │ else: │
│ 337 │ │ │ logger.warning(f'Invalid research duration: {seconds} ') │
│ │
│ ┌───────────────────────────────────── locals ─────────────────────────────────────┐ │
│ │ remain = datetime.timedelta(0) │ │
│ │ seconds = 0.0 │ │
│ │ self = <module.research.research.RewardResearch object at 0x0000017578B8AEC8> │ │
│ └──────────────────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
RuntimeError
2022-01-21 20:06:29.266 | WARNING | Saving error: ./log/error/1642766789266
是科研已完成,但是游戏界面bug显示停在00:00:00,没有变成已完成的状态?
是科研已完成,但是游戏界面bug显示停在00:00:00,没有变成已完成的状态?
是的,我重新打开科研界面的时候就会显示已完成。 以前在手机后台挂的时候会出现完成了,但是这边bug,显示还有xx:xx,必须重启才会显示已完成
@railzy 不可以这么改,真要遇到前置条件未完成的科研时,会进到科研列表里尝试收获但收获不了,导致无限重启,然后报错
@railzy 不可以这么改,真要遇到前置条件未完成的科研时,会进到科研列表里尝试收获但收获不了,导致无限重启,然后报错
啊确实,因为默认跳过我都忘了有前置条件的科研了
b58ef2a 这个应该能正确处理了