1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-19 06:03:34 +08:00

Add: retry logic for some ui elements, override triggered_stop_condition for remaining data keys

This commit is contained in:
nEEtdo0d
2020-11-11 21:30:24 -05:00
parent 94e763b26e
commit 124521ddc0
6 changed files with 62 additions and 41 deletions

View File

@@ -0,0 +1,19 @@
from campaign.campaign_war_archives.campaign_base import CampaignBase, CampaignNameError
from module.campaign.run import CampaignRun
from module.ocr.ocr import DigitCounter
from module.war_archives.assets import OCR_DATA_KEY_CAMPAIGN
from module.logger import logger
DATA_KEY_CAMPAIGN = DigitCounter(OCR_DATA_KEY_CAMPAIGN, letter=(255, 247, 247), threshold=64)
class CampaignWarArchives(CampaignRun, CampaignBase):
def triggered_stop_condition(self):
# Check for 0 data keys left to use
current, remain, total = DATA_KEY_CAMPAIGN.ocr(self.device.image)
logger.info(f'Inventory: {current} / {total}, Remain: {current}')
if remain == total:
logger.hr('Triggered out of data keys')
return True
# Else, check other stop conditions
super().triggered_stop_condition()