mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 16:47:03 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
@@ -41,11 +41,21 @@ class CampaignOcr(ModuleBase):
|
||||
@staticmethod
|
||||
def _campaign_ocr_result_process(result):
|
||||
# The result will be like '7--2', because tha dash in game is '–' not '-'
|
||||
result = result.lower().replace('--', '-').replace('--', '-')
|
||||
if result.startswith('-'):
|
||||
result = result[1:]
|
||||
result = result.replace('--', '-').replace('--', '-').lstrip('-')
|
||||
|
||||
# Replace wrong 'I' from results like 'I1-1', '1I-1', 'I-I', '11-I', 'I4-4', to '1'
|
||||
# while keeping results like 'isp-2', 'sp1'
|
||||
def replace_func(match):
|
||||
segment = match.group(0)
|
||||
return segment.replace('I', '1')
|
||||
|
||||
result = re.sub(r'[0-9I]+-[0-9I]+', replace_func, result, count=1)
|
||||
|
||||
# Convert '72' to '7-2'
|
||||
if len(result) == 2 and result[0].isdigit():
|
||||
result = '-'.join(result)
|
||||
|
||||
result = result.lower()
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -20,7 +20,7 @@ from module.os.assets import FLEET_EMP_DEBUFF, MAP_EXIT, MAP_GOTO_GLOBE, STRONGH
|
||||
from module.os.camera import OSCamera
|
||||
from module.os.map_base import OSCampaignMap
|
||||
from module.os_ash.ash import OSAsh
|
||||
from module.os_combat.combat import Combat
|
||||
from module.os_combat.combat import Combat, BATTLE_PREPARATION, SIREN_PREPARATION
|
||||
from module.os_handler.assets import AUTO_SEARCH_REWARD, CLICK_SAFE_AREA, IN_MAP, PORT_ENTER
|
||||
from module.os_shop.assets import PORT_SUPPLY_CHECK
|
||||
from module.ui.assets import BACK_ARROW
|
||||
@@ -319,6 +319,13 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
|
||||
clicked_story_count = 0
|
||||
stuck_timer = Timer(20, count=5).start()
|
||||
confirm_timer.reset()
|
||||
|
||||
def abyssal_expected_end():
|
||||
# add handle_map_event() because OSCombat.combat_status() removes get_items
|
||||
if self.handle_map_event(drop=drop):
|
||||
return False
|
||||
return self.is_in_map()
|
||||
|
||||
for _ in self.loop(skip_first=skip_first_screenshot):
|
||||
# Map event
|
||||
event = self.handle_map_event(drop=drop)
|
||||
@@ -395,7 +402,7 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
|
||||
if self.combat_appear():
|
||||
# Use ui_back() for testing, because there are too few abyssal loggers every month.
|
||||
# self.ui_back(check_button=self.is_in_map)
|
||||
self.combat(expected_end=self.is_in_map, fleet_index=self.fleet_show_index, save_get_items=drop)
|
||||
self.combat(expected_end=abyssal_expected_end, fleet_index=self.fleet_show_index, save_get_items=drop)
|
||||
confirm_timer.reset()
|
||||
stuck_timer.reset()
|
||||
result.add('event')
|
||||
@@ -760,6 +767,7 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
|
||||
logger.hr('BOSS leave')
|
||||
# Update local view
|
||||
self.update_os()
|
||||
self.predict()
|
||||
|
||||
click_timer = Timer(3)
|
||||
pause_interval = Timer(0.5, count=1)
|
||||
@@ -773,8 +781,13 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
|
||||
|
||||
# Re-enter boss accidentally
|
||||
if pause_interval.reached():
|
||||
if self.combat_appear():
|
||||
logger.info(f'combat_appear -> {BACK_ARROW}')
|
||||
if self.appear(BATTLE_PREPARATION):
|
||||
logger.info(f'{BATTLE_PREPARATION} -> {BACK_ARROW}')
|
||||
self.device.click(BACK_ARROW)
|
||||
pause_interval.reset()
|
||||
continue
|
||||
if self.appear(SIREN_PREPARATION, offset=(20, 20)):
|
||||
logger.info(f'{SIREN_PREPARATION} -> {BACK_ARROW}')
|
||||
self.device.click(BACK_ARROW)
|
||||
pause_interval.reset()
|
||||
continue
|
||||
|
||||
@@ -50,20 +50,16 @@ def patch_mimetype():
|
||||
all deployment, we use the builtin mimetype table only.
|
||||
"""
|
||||
import mimetypes
|
||||
if mimetypes.inited:
|
||||
# ohno mimetypes already inited
|
||||
db = mimetypes.MimeTypes()
|
||||
mimetypes._db = db
|
||||
# override global variable
|
||||
mimetypes.encodings_map = db.encodings_map
|
||||
mimetypes.suffix_map = db.suffix_map
|
||||
mimetypes.types_map = db.types_map[True]
|
||||
mimetypes.common_types = db.types_map[False]
|
||||
else:
|
||||
# init db with the default table
|
||||
db = mimetypes.MimeTypes()
|
||||
mimetypes._db = db
|
||||
mimetypes.inited = True
|
||||
# lock as inited
|
||||
mimetypes.inited = True
|
||||
# create a new clean instance
|
||||
db = mimetypes.MimeTypes(filenames=())
|
||||
mimetypes._db = db
|
||||
# override global variable
|
||||
mimetypes.encodings_map = db.encodings_map
|
||||
mimetypes.suffix_map = db.suffix_map
|
||||
mimetypes.types_map = db.types_map[True]
|
||||
mimetypes.common_types = db.types_map[False]
|
||||
|
||||
|
||||
def fix_py37_subprocess_communicate():
|
||||
|
||||
Reference in New Issue
Block a user