mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-27 02:27:12 +00:00
Fix: 修复开荒
- 修复低级图出BOSS后报错的问题 - 修复了开荒进度0%时的章节名OCR - 修复打完BOSS有时会卡住的问题
This commit is contained in:
parent
57f578686e
commit
fc84f5e610
@ -94,7 +94,7 @@ class CampaignOcr:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extract_stage_name(image):
|
def extract_stage_name(image):
|
||||||
x_skip = 7
|
x_skip = 10
|
||||||
interval = 5
|
interval = 5
|
||||||
x_color = np.convolve(np.mean(image, axis=0), np.ones(interval), 'valid') / interval
|
x_color = np.convolve(np.mean(image, axis=0), np.ones(interval), 'valid') / interval
|
||||||
x_list = np.where(x_color[x_skip:] > 235)[0]
|
x_list = np.where(x_color[x_skip:] > 235)[0]
|
||||||
|
@ -309,7 +309,7 @@ class Combat(HPBalancer, UrgentCommissionHandler, EnemySearchingHandler, Retirem
|
|||||||
break
|
break
|
||||||
if expected_end == 'with_searching' and self.handle_in_map_with_enemy_searching():
|
if expected_end == 'with_searching' and self.handle_in_map_with_enemy_searching():
|
||||||
break
|
break
|
||||||
if expected_end == 'no_searching' and self.handle_in_map():
|
if expected_end == 'no_searching' and self.handle_in_map_no_enemy_searching():
|
||||||
break
|
break
|
||||||
if expected_end == 'in_ui' and self.appear(BACK_ARROW, offset=(20, 20)):
|
if expected_end == 'in_ui' and self.appear(BACK_ARROW, offset=(20, 20)):
|
||||||
break
|
break
|
||||||
|
@ -319,7 +319,7 @@ class AzurLaneConfig:
|
|||||||
self.SCREEN_SHOT_SAVE_FOLDER = self.SCREEN_SHOT_SAVE_FOLDER_BASE + '/' + self.CAMPAIGN_NAME
|
self.SCREEN_SHOT_SAVE_FOLDER = self.SCREEN_SHOT_SAVE_FOLDER_BASE + '/' + self.CAMPAIGN_NAME
|
||||||
for folder in [self.SCREEN_SHOT_SAVE_FOLDER_BASE, self.ASSETS_FOLDER, self.SCREEN_SHOT_SAVE_FOLDER,
|
for folder in [self.SCREEN_SHOT_SAVE_FOLDER_BASE, self.ASSETS_FOLDER, self.SCREEN_SHOT_SAVE_FOLDER,
|
||||||
self.PERSPECTIVE_ERROR_LOG_FOLDER, self.ERROR_LOG_FOLDER]:
|
self.PERSPECTIVE_ERROR_LOG_FOLDER, self.ERROR_LOG_FOLDER]:
|
||||||
if not os.path.exists(folder):
|
if folder and not os.path.exists(folder):
|
||||||
os.mkdir(folder)
|
os.mkdir(folder)
|
||||||
|
|
||||||
def merge(self, other):
|
def merge(self, other):
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import time
|
import time
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
|
from retrying import retry
|
||||||
|
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.base.utils import *
|
from module.base.utils import *
|
||||||
from module.device.connection import Connection
|
from module.device.connection import Connection
|
||||||
from module.logger import logger
|
|
||||||
from module.exception import ScriptError
|
from module.exception import ScriptError
|
||||||
|
from module.logger import logger
|
||||||
|
|
||||||
|
|
||||||
class Control(Connection):
|
class Control(Connection):
|
||||||
@ -62,11 +64,11 @@ class Control(Connection):
|
|||||||
self._click_uiautomator2(x, y)
|
self._click_uiautomator2(x, y)
|
||||||
self.sleep(self.config.SLEEP_AFTER_CLICK)
|
self.sleep(self.config.SLEEP_AFTER_CLICK)
|
||||||
|
|
||||||
# @retry()
|
@retry()
|
||||||
def _click_uiautomator2(self, x, y):
|
def _click_uiautomator2(self, x, y):
|
||||||
self.device.click(int(x), int(y))
|
self.device.click(int(x), int(y))
|
||||||
|
|
||||||
# @retry()
|
@retry()
|
||||||
def _click_adb(self, x, y):
|
def _click_adb(self, x, y):
|
||||||
self.adb_shell(['input', 'tap', str(x), str(y)], serial=self.serial)
|
self.adb_shell(['input', 'tap', str(x), str(y)], serial=self.serial)
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class Screenshot(Connection):
|
|||||||
screenshot = self.adb_shell(['screencap', '-p'], serial=self.serial)
|
screenshot = self.adb_shell(['screencap', '-p'], serial=self.serial)
|
||||||
return self._process_screenshot(screenshot)
|
return self._process_screenshot(screenshot)
|
||||||
|
|
||||||
# @retry()
|
@retry()
|
||||||
# @timer
|
# @timer
|
||||||
def screenshot(self):
|
def screenshot(self):
|
||||||
"""
|
"""
|
||||||
|
@ -42,6 +42,8 @@ class EnemySearchingHandler(InfoBarHandler):
|
|||||||
def handle_in_map_with_enemy_searching(self):
|
def handle_in_map_with_enemy_searching(self):
|
||||||
if not self.is_in_map():
|
if not self.is_in_map():
|
||||||
return False
|
return False
|
||||||
|
if self.handle_in_stage():
|
||||||
|
return True
|
||||||
|
|
||||||
timeout = Timer(self.MAP_ENEMY_SEARCHING_TIMEOUT_SECOND)
|
timeout = Timer(self.MAP_ENEMY_SEARCHING_TIMEOUT_SECOND)
|
||||||
appeared = False
|
appeared = False
|
||||||
@ -67,9 +69,11 @@ class EnemySearchingHandler(InfoBarHandler):
|
|||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def handle_in_map(self):
|
def handle_in_map_no_enemy_searching(self):
|
||||||
if not self.is_in_map():
|
if not self.is_in_map():
|
||||||
return False
|
return False
|
||||||
|
if self.handle_in_stage():
|
||||||
|
return True
|
||||||
|
|
||||||
self.device.sleep((1, 1.2))
|
self.device.sleep((1, 1.2))
|
||||||
return True
|
return True
|
||||||
|
@ -267,7 +267,8 @@ class Map(Fleet):
|
|||||||
logger.info('Brute clear BOSS')
|
logger.info('Brute clear BOSS')
|
||||||
if self.brute_fleet_meet():
|
if self.brute_fleet_meet():
|
||||||
return True
|
return True
|
||||||
grids = self.brute_find_roadblocks(boss[0], fleet=self.config.FLEET_BOSS)
|
fleet = 2 if self.config.FLEET_BOSS == 2 and self.config.FLEET_2 else 1
|
||||||
|
grids = self.brute_find_roadblocks(boss[0], fleet=fleet)
|
||||||
if grids:
|
if grids:
|
||||||
logger.info('Brute clear BOSS roadblocks')
|
logger.info('Brute clear BOSS roadblocks')
|
||||||
grids = grids.sort(cost=True, weight=True)
|
grids = grids.sort(cost=True, weight=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user