1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-05-10 01:11:17 +08:00

DEBUG: save screenshots of Daily

This commit is contained in:
positnuec
2026-05-09 16:48:21 +08:00
parent c6acd48b83
commit e7060b45e1
9 changed files with 87 additions and 42 deletions

View File

@@ -99,6 +99,7 @@
"SaveFolder": "./screenshots",
"AzurStatsID": null,
"API": "default",
"DailyRecord": "do_not",
"ResearchRecord": "do_not",
"CommissionRecord": "do_not",
"CombatRecord": "do_not",

View File

@@ -454,6 +454,14 @@
"cn_gz_reverse_proxy"
]
},
"DailyRecord": {
"type": "select",
"value": "do_not",
"option": [
"do_not",
"save"
]
},
"ResearchRecord": {
"type": "select",
"value": "do_not",

View File

@@ -103,6 +103,9 @@ DropRecord:
API:
value: default
option: [ default, cn_gz_reverse_proxy]
DailyRecord:
value: do_not
option: [ do_not, save ]
ResearchRecord:
value: do_not
option: [ do_not, save, upload, save_and_upload ]

View File

@@ -48,6 +48,7 @@ class GeneratedConfig:
DropRecord_SaveFolder = './screenshots'
DropRecord_AzurStatsID = None
DropRecord_API = 'default' # default, cn_gz_reverse_proxy
DropRecord_DailyRecord = 'do_not' # do_not, save
DropRecord_ResearchRecord = 'do_not' # do_not, save, upload, save_and_upload
DropRecord_CommissionRecord = 'do_not' # do_not, save, upload, save_and_upload
DropRecord_CombatRecord = 'do_not' # do_not, save

View File

@@ -567,6 +567,12 @@
"default": "Default (Cloudflare)",
"cn_gz_reverse_proxy": "Reverse proxy (Guangzhou, South China)"
},
"DailyRecord": {
"name": "Daily Record",
"help": "",
"do_not": "Do nothing",
"save": "Save"
},
"ResearchRecord": {
"name": "Research Record",
"help": "",

View File

@@ -567,6 +567,12 @@
"default": "default",
"cn_gz_reverse_proxy": "cn_gz_reverse_proxy"
},
"DailyRecord": {
"name": "DropRecord.DailyRecord.name",
"help": "DropRecord.DailyRecord.help",
"do_not": "do_not",
"save": "save"
},
"ResearchRecord": {
"name": "DropRecord.ResearchRecord.name",
"help": "DropRecord.ResearchRecord.help",

View File

@@ -583,6 +583,12 @@
"upload": "上传",
"save_and_upload": "保存并上传"
},
"DailyRecord": {
"name": "每日挑战截图",
"help": "",
"do_not": "无操作",
"save": "保存"
},
"CombatRecord": {
"name": "战斗掉落截图",
"help": "启用后会放缓结算时的点击速度\n在自律寻敌下不生效",

View File

@@ -567,6 +567,12 @@
"default": "默認 (Cloudflare)",
"cn_gz_reverse_proxy": "國內反向代理 (廣州)"
},
"DailyRecord": {
"name": "每日任務截圖",
"help": "",
"do_not": "無操作",
"save": "保存"
},
"ResearchRecord": {
"name": "科研截圖",
"help": "",

View File

@@ -153,12 +153,13 @@ class Daily(Combat, DailyEquipment):
else:
return 4
def daily_execute(self, remain=3, stage=1, fleet=1):
def daily_execute(self, remain=3, stage=1, fleet=1, drop=None):
"""
Args:
remain (int): Remain daily challenge count.
stage (int): Index of stage counted from top, 1 to 3.
fleet (int): Index of fleet to use.
drop (DropImage):
Returns:
bool: True if success, False if daily locked.
@@ -189,7 +190,7 @@ class Daily(Combat, DailyEquipment):
button = DAILY_MISSION_LIST[stage - 1]
for n in range(remain):
logger.hr(f'Count {n + 1}')
result = self.daily_enter(button)
result = self.daily_enter(button, drop=drop)
if not result:
break
if self.daily_current == self.supply_line_disruption_index:
@@ -199,18 +200,19 @@ class Daily(Combat, DailyEquipment):
# Execute classic daily run
self.ui_ensure_index(fleet, letter=OCR_DAILY_FLEET_INDEX, prev_button=DAILY_FLEET_PREV,
next_button=DAILY_FLEET_NEXT, fast=False, skip_first_screenshot=True)
self.combat(emotion_reduce=False, save_get_items=False, expected_end=daily_end, balance_hp=False)
self.combat(emotion_reduce=False, save_get_items=drop, expected_end=daily_end, balance_hp=False)
self.ui_click(click_button=BACK_ARROW, check_button=DAILY_CHECK, additional=self.handle_daily_additional,
skip_first_screenshot=True)
self.device.sleep((1, 1.2))
return True
def daily_enter(self, button, skip_first_screenshot=True):
def daily_enter(self, button, skip_first_screenshot=True, drop=None):
"""
Args:
button (Button): Daily entrance
skip_first_screenshot (bool):
drop (DropImage):
Returns:
bool: True if combat appear. False if daily skip unlocked, skipped daily, received rewards.
@@ -229,7 +231,7 @@ class Daily(Combat, DailyEquipment):
if self.appear(DAILY_ENTER_CHECK, threshold=30, interval=5):
self.device.click(button)
continue
if self.handle_get_items():
if self.handle_get_items(drop=drop):
reward_received = True
continue
if self.config.Daily_UseDailySkip:
@@ -280,43 +282,49 @@ class Daily(Combat, DailyEquipment):
while 1:
if self.daily_current > 7:
break
if self.daily_current == self.empty_index:
logger.info('This daily is not open now')
self.daily_check()
self.next()
continue
stage, fleet = self.get_daily_stage_and_fleet()
if self.daily_current == self.supply_line_disruption_index and not self.config.Daily_UseDailySkip:
logger.info('Skip supply line disruption if UseDailySkip disabled')
self.daily_check()
self.next()
continue
if not stage:
logger.info(f'No stage set on daily_current: {self.daily_current}, skip')
self.daily_check()
self.next()
continue
if self.daily_current != self.supply_line_disruption_index and not fleet:
logger.info(f'No fleet set on daily_current: {self.daily_current}, skip')
self.daily_check()
self.next()
continue
if not self.is_active():
self.daily_check()
self.next()
continue
remain = OCR_REMAIN.ocr(self.device.image)
if remain == 0:
self.daily_check()
self.next()
continue
else:
self.daily_execute(remain=remain, stage=stage, fleet=fleet)
self.daily_check()
# The order of daily tasks will be disordered after execute a daily, exit and re-enter to reset.
# 打完一次之后每日任务的顺序会乱掉, 退出再进入来重置顺序.
self.ui_goto(page_campaign_menu)
break
with self.stat.new(
genre='daily',
method=self.config.DropRecord_DailyRecord,
info=f'daily_{self.daily_current}'
) as drop:
drop.add(self.device.image)
if self.daily_current == self.empty_index:
logger.info('This daily is not open now')
self.daily_check()
self.next()
continue
stage, fleet = self.get_daily_stage_and_fleet()
if self.daily_current == self.supply_line_disruption_index and not self.config.Daily_UseDailySkip:
logger.info('Skip supply line disruption if UseDailySkip disabled')
self.daily_check()
self.next()
continue
if not stage:
logger.info(f'No stage set on daily_current: {self.daily_current}, skip')
self.daily_check()
self.next()
continue
if self.daily_current != self.supply_line_disruption_index and not fleet:
logger.info(f'No fleet set on daily_current: {self.daily_current}, skip')
self.daily_check()
self.next()
continue
if not self.is_active():
self.daily_check()
self.next()
continue
remain = OCR_REMAIN.ocr(self.device.image)
if remain == 0:
self.daily_check()
self.next()
continue
else:
self.daily_execute(remain=remain, stage=stage, fleet=fleet, drop=drop)
self.daily_check()
# The order of daily tasks will be disordered after execute a daily, exit and re-enter to reset.
# 打完一次之后每日任务的顺序会乱掉, 退出再进入来重置顺序.
self.ui_goto(page_campaign_menu)
break
def daily_run(self):
self.daily_checked = [0]