mirror of
https://github.com/W1NDes/M-AzurLaneAutoScript.git
synced 2026-05-14 01:07:59 +08:00
Fix(SmallEvent): 添加新的入口和领取界面,同时修复任务延迟逻辑以避免超过24小时限制。
This commit is contained in:
parent
0c8b5c766a
commit
d11c32a8be
BIN
assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png
Normal file
BIN
assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
BIN
assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png
Normal file
BIN
assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@ -1,6 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(r'C:/Users/W1NDe/Documents/GitHub/M-AzurLaneAutoScript')
|
||||
sys.path.append(r'D:/M-AzurLaneAutoScript')
|
||||
import imageio
|
||||
import numpy as np
|
||||
from tqdm.contrib.concurrent import process_map
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import sys
|
||||
sys.path.append(r'C:/Users/W1NDe/Documents/GitHub/M-AzurLaneAutoScript')
|
||||
sys.path.append(r'D:/M-AzurLaneAutoScript')
|
||||
import re
|
||||
import typing as t
|
||||
from copy import deepcopy
|
||||
|
||||
@ -13,7 +13,9 @@ ACTIVITY_SELECTED_GRID = Button(area={'cn': (4, 241, 30, 344), 'en': (4, 241, 30
|
||||
EVENT_NOTIFY_ENTRY = Button(area={'cn': (1182, 164, 1258, 186), 'en': (1182, 164, 1258, 186), 'jp': (1182, 164, 1258, 186), 'tw': (1182, 164, 1258, 186)}, color={'cn': (110, 112, 115), 'en': (110, 112, 115), 'jp': (110, 112, 115), 'tw': (110, 112, 115)}, button={'cn': (1182, 164, 1258, 186), 'en': (1182, 164, 1258, 186), 'jp': (1182, 164, 1258, 186), 'tw': (1182, 164, 1258, 186)}, file={'cn': './assets/cn/smallevent/EVENT_NOTIFY_ENTRY.png', 'en': './assets/cn/smallevent/EVENT_NOTIFY_ENTRY.png', 'jp': './assets/cn/smallevent/EVENT_NOTIFY_ENTRY.png', 'tw': './assets/cn/smallevent/EVENT_NOTIFY_ENTRY.png'})
|
||||
EVENT_NOTIFY_PAGE = Button(area={'cn': (117, 9, 337, 46), 'en': (117, 9, 337, 46), 'jp': (117, 9, 337, 46), 'tw': (117, 9, 337, 46)}, color={'cn': (82, 90, 118), 'en': (82, 90, 118), 'jp': (82, 90, 118), 'tw': (82, 90, 118)}, button={'cn': (117, 9, 337, 46), 'en': (117, 9, 337, 46), 'jp': (117, 9, 337, 46), 'tw': (117, 9, 337, 46)}, file={'cn': './assets/cn/smallevent/EVENT_NOTIFY_PAGE.png', 'en': './assets/cn/smallevent/EVENT_NOTIFY_PAGE.png', 'jp': './assets/cn/smallevent/EVENT_NOTIFY_PAGE.png', 'tw': './assets/cn/smallevent/EVENT_NOTIFY_PAGE.png'})
|
||||
EVENT_PREPARE_ENTRY = Button(area={'cn': (1077, 165, 1145, 188), 'en': (1077, 165, 1145, 188), 'jp': (1077, 165, 1145, 188), 'tw': (1077, 165, 1145, 188)}, color={'cn': (125, 126, 129), 'en': (125, 126, 129), 'jp': (125, 126, 129), 'tw': (125, 126, 129)}, button={'cn': (1077, 165, 1145, 188), 'en': (1077, 165, 1145, 188), 'jp': (1077, 165, 1145, 188), 'tw': (1077, 165, 1145, 188)}, file={'cn': './assets/cn/smallevent/EVENT_PREPARE_ENTRY.png', 'en': './assets/cn/smallevent/EVENT_PREPARE_ENTRY.png', 'jp': './assets/cn/smallevent/EVENT_PREPARE_ENTRY.png', 'tw': './assets/cn/smallevent/EVENT_PREPARE_ENTRY.png'})
|
||||
EVENT_PREPARE_ENTRY_2 = Button(area={'cn': (1073, 165, 1147, 186), 'en': (1073, 165, 1147, 186), 'jp': (1073, 165, 1147, 186), 'tw': (1073, 165, 1147, 186)}, color={'cn': (127, 126, 130), 'en': (127, 126, 130), 'jp': (127, 126, 130), 'tw': (127, 126, 130)}, button={'cn': (1073, 165, 1147, 186), 'en': (1073, 165, 1147, 186), 'jp': (1073, 165, 1147, 186), 'tw': (1073, 165, 1147, 186)}, file={'cn': './assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png', 'en': './assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png', 'jp': './assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png', 'tw': './assets/cn/smallevent/EVENT_PREPARE_ENTRY_2.png'})
|
||||
EVENT_PREPARE_PAGE = Button(area={'cn': (92, 18, 213, 48), 'en': (92, 18, 213, 48), 'jp': (92, 18, 213, 48), 'tw': (92, 18, 213, 48)}, color={'cn': (100, 105, 116), 'en': (100, 105, 116), 'jp': (100, 105, 116), 'tw': (100, 105, 116)}, button={'cn': (92, 18, 213, 48), 'en': (92, 18, 213, 48), 'jp': (92, 18, 213, 48), 'tw': (92, 18, 213, 48)}, file={'cn': './assets/cn/smallevent/EVENT_PREPARE_PAGE.png', 'en': './assets/cn/smallevent/EVENT_PREPARE_PAGE.png', 'jp': './assets/cn/smallevent/EVENT_PREPARE_PAGE.png', 'tw': './assets/cn/smallevent/EVENT_PREPARE_PAGE.png'})
|
||||
EVENT_PREPARE_PAGE_2 = Button(area={'cn': (92, 18, 213, 48), 'en': (92, 18, 213, 48), 'jp': (92, 18, 213, 48), 'tw': (92, 18, 213, 48)}, color={'cn': (97, 102, 111), 'en': (97, 102, 111), 'jp': (97, 102, 111), 'tw': (97, 102, 111)}, button={'cn': (92, 18, 213, 48), 'en': (92, 18, 213, 48), 'jp': (92, 18, 213, 48), 'tw': (92, 18, 213, 48)}, file={'cn': './assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png', 'en': './assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png', 'jp': './assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png', 'tw': './assets/cn/smallevent/EVENT_PREPARE_PAGE_2.png'})
|
||||
SEVEND_TASK_20250320 = Button(area={'cn': (323, 103, 823, 271), 'en': (323, 103, 823, 271), 'jp': (323, 103, 823, 271), 'tw': (323, 103, 823, 271)}, color={'cn': (215, 164, 151), 'en': (215, 164, 151), 'jp': (215, 164, 151), 'tw': (215, 164, 151)}, button={'cn': (323, 103, 823, 271), 'en': (323, 103, 823, 271), 'jp': (323, 103, 823, 271), 'tw': (323, 103, 823, 271)}, file={'cn': './assets/cn/smallevent/SEVEND_TASK_20250320.png', 'en': './assets/cn/smallevent/SEVEND_TASK_20250320.png', 'jp': './assets/cn/smallevent/SEVEND_TASK_20250320.png', 'tw': './assets/cn/smallevent/SEVEND_TASK_20250320.png'})
|
||||
SEVEND_TASK_FINISH_20250320 = Button(area={'cn': (322, 293, 373, 341), 'en': (322, 293, 373, 341), 'jp': (322, 293, 373, 341), 'tw': (322, 293, 373, 341)}, color={'cn': (219, 214, 211), 'en': (219, 214, 211), 'jp': (219, 214, 211), 'tw': (219, 214, 211)}, button={'cn': (322, 293, 373, 341), 'en': (322, 293, 373, 341), 'jp': (322, 293, 373, 341), 'tw': (322, 293, 373, 341)}, file={'cn': './assets/cn/smallevent/SEVEND_TASK_FINISH_20250320.png', 'en': './assets/cn/smallevent/SEVEND_TASK_FINISH_20250320.png', 'jp': './assets/cn/smallevent/SEVEND_TASK_FINISH_20250320.png', 'tw': './assets/cn/smallevent/SEVEND_TASK_FINISH_20250320.png'})
|
||||
SEVEND_TASK_GET1_20250320 = Button(area={'cn': (704, 381, 866, 425), 'en': (704, 381, 866, 425), 'jp': (704, 381, 866, 425), 'tw': (704, 381, 866, 425)}, color={'cn': (157, 86, 79), 'en': (157, 86, 79), 'jp': (157, 86, 79), 'tw': (157, 86, 79)}, button={'cn': (704, 381, 866, 425), 'en': (704, 381, 866, 425), 'jp': (704, 381, 866, 425), 'tw': (704, 381, 866, 425)}, file={'cn': './assets/cn/smallevent/SEVEND_TASK_GET1_20250320.png', 'en': './assets/cn/smallevent/SEVEND_TASK_GET1_20250320.png', 'jp': './assets/cn/smallevent/SEVEND_TASK_GET1_20250320.png', 'tw': './assets/cn/smallevent/SEVEND_TASK_GET1_20250320.png'})
|
||||
|
||||
@ -364,8 +364,10 @@ class SmallEvent(UI):
|
||||
self.device.screenshot()
|
||||
if self.appear_then_click(EVENT_PREPARE_ENTRY, offset=(5, 5), interval=3):
|
||||
continue
|
||||
if self.appear_then_click(EVENT_PREPARE_ENTRY_2, offset=(5, 5), interval=3):
|
||||
continue
|
||||
|
||||
if self.appear(EVENT_PREPARE_PAGE, offset=(5,5)):
|
||||
if self.appear(EVENT_PREPARE_PAGE, offset=(5,5)) or self.appear(EVENT_PREPARE_PAGE_2, offset=(5,5)):
|
||||
all_words = self.recognize_activity_page(self.device.image,page_area,orc_api)
|
||||
# all_words = None
|
||||
if not all_words:
|
||||
@ -373,7 +375,7 @@ class SmallEvent(UI):
|
||||
if isinstance(event_pre_button_location, dict):
|
||||
event_pre_button = self.location_2_button(event_pre_button_location, button_text, base_loc=page_area)
|
||||
self.device.click(event_pre_button)
|
||||
self.device.sleep(0.3)
|
||||
self.device.sleep(1.5)#wait for the page to load
|
||||
continue
|
||||
elif event_pre_button_location == "cooldowning":
|
||||
# 冷却中,等待
|
||||
@ -452,9 +454,19 @@ class SmallEvent(UI):
|
||||
else:
|
||||
logger.info('7day task expired')
|
||||
|
||||
# tomorrow 13pm
|
||||
# tomorrow 13pm - 但要避免超过24小时限制
|
||||
tomorrow_13pm = (datetime.now() + timedelta(days=1)).replace(hour=13, minute=0, second=0, microsecond=0)
|
||||
self.config.task_delay(target=tomorrow_13pm)
|
||||
now = datetime.now()
|
||||
|
||||
# 如果目标时间超过24小时,则延迟到接近24小时的时间点
|
||||
if tomorrow_13pm - now > timedelta(hours=24):
|
||||
# 延迟到23小时50分钟后,避免触发24小时限制
|
||||
delay_time = now + timedelta(hours=23, minutes=50)
|
||||
logger.info(f'Target time {tomorrow_13pm} exceeds 24h limit, delay to {delay_time} instead')
|
||||
self.config.task_delay(target=delay_time)
|
||||
else:
|
||||
self.config.task_delay(target=tomorrow_13pm)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
self = SmallEvent('zTTT')
|
||||
|
||||
@ -8,7 +8,7 @@ from module.retire.assets import DOCK_CHECK,IN_RETIREMENT_CHECK
|
||||
from module.ui.assets import *
|
||||
from module.ui_white.assets import *
|
||||
from module.ship_ir.assets import HANDBOOK_CHECK,MAIN_GOTO_COLLECTION,MAIN_GOTO_COLLECTION_WHITE,COLLECTION_CHECK,COLLECTION_GOTO_HANDBOOK
|
||||
from module.smallevent.assets import EVENT_PREPARE_PAGE,EVENT_PREPARE_ENTRY
|
||||
from module.smallevent.assets import EVENT_PREPARE_PAGE,EVENT_PREPARE_PAGE_2
|
||||
class Page:
|
||||
# Key: str, page name like "page_main"
|
||||
# Value: Page, page instance
|
||||
@ -360,4 +360,8 @@ page_campaign_menu.link(button=CAMPAIGN_MENU_GOTO_EVENT, destination=page_hospit
|
||||
|
||||
#event prepare page
|
||||
page_event_prepare = Page(EVENT_PREPARE_PAGE)
|
||||
page_event_prepare.link(button=EVENTPRE_GOTO_MAIN, destination=page_main)
|
||||
page_event_prepare.link(button=EVENTPRE_GOTO_MAIN, destination=page_main)
|
||||
|
||||
#event prepare page_2
|
||||
page_event_prepare_2 = Page(EVENT_PREPARE_PAGE_2)
|
||||
page_event_prepare_2.link(button=EVENTPRE_GOTO_MAIN, destination=page_main)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user