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:
19
module/war_archives/war_archives.py
Normal file
19
module/war_archives/war_archives.py
Normal 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()
|
||||
Reference in New Issue
Block a user