mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-23 17:55:56 +08:00
@@ -54,6 +54,13 @@ class Config(ConfigBase):
|
|||||||
MAP_HAS_AMBUSH = False
|
MAP_HAS_AMBUSH = False
|
||||||
MAP_HAS_MYSTERY = True
|
MAP_HAS_MYSTERY = True
|
||||||
# ===== End of generated config =====
|
# ===== End of generated config =====
|
||||||
|
HOMO_EDGE_COLOR_RANGE = (0, 12)
|
||||||
|
HOMO_EDGE_HOUGHLINES_THRESHOLD = 210
|
||||||
|
MAP_SWIPE_MULTIPLY = (1.101, 1.122)
|
||||||
|
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.065, 1.085)
|
||||||
|
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.034, 1.053)
|
||||||
|
HOMO_STORAGE = ((6, 5), [(211, 175), (782, 175), (158, 569), (800, 569)])
|
||||||
|
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'top'
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
|
|||||||
@@ -58,6 +58,13 @@ class Config(ConfigBase):
|
|||||||
MAP_HAS_AMBUSH = False
|
MAP_HAS_AMBUSH = False
|
||||||
MAP_HAS_MYSTERY = False
|
MAP_HAS_MYSTERY = False
|
||||||
# ===== End of generated config =====
|
# ===== End of generated config =====
|
||||||
|
HOMO_EDGE_COLOR_RANGE = (0, 12)
|
||||||
|
HOMO_EDGE_HOUGHLINES_THRESHOLD = 210
|
||||||
|
MAP_SWIPE_MULTIPLY = (1.101, 1.122)
|
||||||
|
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.065, 1.085)
|
||||||
|
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.034, 1.053)
|
||||||
|
HOMO_STORAGE = ((6, 4), [(448, 180), (1051, 180), (426, 513), (1100, 513)])
|
||||||
|
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'top'
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
|
|||||||
@@ -55,6 +55,13 @@ class Config(ConfigBase):
|
|||||||
MAP_HAS_AMBUSH = False
|
MAP_HAS_AMBUSH = False
|
||||||
MAP_HAS_MYSTERY = True
|
MAP_HAS_MYSTERY = True
|
||||||
# ===== End of generated config =====
|
# ===== End of generated config =====
|
||||||
|
HOMO_EDGE_COLOR_RANGE = (0, 12)
|
||||||
|
HOMO_EDGE_HOUGHLINES_THRESHOLD = 210
|
||||||
|
MAP_SWIPE_MULTIPLY = (1.101, 1.122)
|
||||||
|
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.065, 1.085)
|
||||||
|
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.034, 1.053)
|
||||||
|
HOMO_STORAGE = ((6, 5), [(211, 175), (782, 175), (158, 569), (800, 569)])
|
||||||
|
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'top'
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
|
|||||||
@@ -58,6 +58,13 @@ class Config(ConfigBase):
|
|||||||
MAP_HAS_AMBUSH = False
|
MAP_HAS_AMBUSH = False
|
||||||
MAP_HAS_MYSTERY = False
|
MAP_HAS_MYSTERY = False
|
||||||
# ===== End of generated config =====
|
# ===== End of generated config =====
|
||||||
|
HOMO_EDGE_COLOR_RANGE = (0, 12)
|
||||||
|
HOMO_EDGE_HOUGHLINES_THRESHOLD = 210
|
||||||
|
MAP_SWIPE_MULTIPLY = (1.101, 1.122)
|
||||||
|
MAP_SWIPE_MULTIPLY_MINITOUCH = (1.065, 1.085)
|
||||||
|
MAP_SWIPE_MULTIPLY_MAATOUCH = (1.034, 1.053)
|
||||||
|
HOMO_STORAGE = ((6, 4), [(448, 180), (1051, 180), (426, 513), (1100, 513)])
|
||||||
|
MAP_ENSURE_EDGE_INSIGHT_CORNER = 'top'
|
||||||
|
|
||||||
|
|
||||||
class Campaign(CampaignBase):
|
class Campaign(CampaignBase):
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def retry(func):
|
|||||||
if callable(init):
|
if callable(init):
|
||||||
retry_sleep(_)
|
retry_sleep(_)
|
||||||
init()
|
init()
|
||||||
return self.ev_run_sync(func, self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
# Can't handle
|
# Can't handle
|
||||||
except RequestHumanTakeover:
|
except RequestHumanTakeover:
|
||||||
break
|
break
|
||||||
@@ -237,7 +237,10 @@ class NemuIpcImpl:
|
|||||||
return
|
return
|
||||||
|
|
||||||
with CaptureNemuIpc():
|
with CaptureNemuIpc():
|
||||||
connect_id = self.lib.nemu_connect(self.nemu_folder, self.instance_id)
|
connect_id = self.ev_run_sync(
|
||||||
|
self.lib.nemu_connect,
|
||||||
|
self.nemu_folder, self.instance_id
|
||||||
|
)
|
||||||
if connect_id == 0:
|
if connect_id == 0:
|
||||||
raise NemuIpcError(
|
raise NemuIpcError(
|
||||||
'Connection failed, please check if nemu_folder is correct and emulator is running'
|
'Connection failed, please check if nemu_folder is correct and emulator is running'
|
||||||
@@ -251,7 +254,10 @@ class NemuIpcImpl:
|
|||||||
return
|
return
|
||||||
|
|
||||||
with CaptureNemuIpc():
|
with CaptureNemuIpc():
|
||||||
self.lib.nemu_disconnect(self.connect_id)
|
self.ev_run_sync(
|
||||||
|
self.lib.nemu_disconnect,
|
||||||
|
self.connect_id
|
||||||
|
)
|
||||||
|
|
||||||
# logger.info(f'NemuIpc disconnected: {self.connect_id}')
|
# logger.info(f'NemuIpc disconnected: {self.connect_id}')
|
||||||
self.connect_id = 0
|
self.connect_id = 0
|
||||||
@@ -282,7 +288,7 @@ class NemuIpcImpl:
|
|||||||
asyncio.TimeoutError: If function call timeout
|
asyncio.TimeoutError: If function call timeout
|
||||||
"""
|
"""
|
||||||
func_wrapped = partial(func, *args, **kwargs)
|
func_wrapped = partial(func, *args, **kwargs)
|
||||||
result = await asyncio.wait_for(self._ev.run_in_executor(None, func_wrapped), timeout=0.2)
|
result = await asyncio.wait_for(self._ev.run_in_executor(None, func_wrapped), timeout=0.05)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def ev_run_sync(self, func, *args, **kwargs):
|
def ev_run_sync(self, func, *args, **kwargs):
|
||||||
@@ -310,8 +316,10 @@ class NemuIpcImpl:
|
|||||||
nullptr = ctypes.POINTER(ctypes.c_int)()
|
nullptr = ctypes.POINTER(ctypes.c_int)()
|
||||||
|
|
||||||
with CaptureNemuIpc():
|
with CaptureNemuIpc():
|
||||||
ret = self.lib.nemu_capture_display(
|
ret = self.ev_run_sync(
|
||||||
self.connect_id, self.display_id, 0, width_ptr, height_ptr, nullptr)
|
self.lib.nemu_capture_display,
|
||||||
|
self.connect_id, self.display_id, 0, width_ptr, height_ptr, nullptr
|
||||||
|
)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
raise NemuIpcError('nemu_capture_display failed during get_resolution()')
|
raise NemuIpcError('nemu_capture_display failed during get_resolution()')
|
||||||
self.width = width_ptr.contents.value
|
self.width = width_ptr.contents.value
|
||||||
@@ -335,8 +343,10 @@ class NemuIpcImpl:
|
|||||||
length = self.width * self.height * 4
|
length = self.width * self.height * 4
|
||||||
pixels_pointer = ctypes.pointer((ctypes.c_ubyte * length)())
|
pixels_pointer = ctypes.pointer((ctypes.c_ubyte * length)())
|
||||||
|
|
||||||
ret = self.lib.nemu_capture_display(
|
ret = self.ev_run_sync(
|
||||||
self.connect_id, self.display_id, length, width_ptr, height_ptr, pixels_pointer)
|
self.lib.nemu_capture_display,
|
||||||
|
self.connect_id, self.display_id, length, width_ptr, height_ptr, pixels_pointer
|
||||||
|
)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
raise NemuIpcError('nemu_capture_display failed during screenshot()')
|
raise NemuIpcError('nemu_capture_display failed during screenshot()')
|
||||||
|
|
||||||
@@ -369,7 +379,10 @@ class NemuIpcImpl:
|
|||||||
x, y = self.convert_xy(x, y)
|
x, y = self.convert_xy(x, y)
|
||||||
|
|
||||||
with CaptureNemuIpc():
|
with CaptureNemuIpc():
|
||||||
ret = self.lib.nemu_input_event_touch_down(self.connect_id, self.display_id, x, y)
|
ret = self.ev_run_sync(
|
||||||
|
self.lib.nemu_input_event_touch_down,
|
||||||
|
self.connect_id, self.display_id, x, y
|
||||||
|
)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
raise NemuIpcError('nemu_input_event_touch_down failed')
|
raise NemuIpcError('nemu_input_event_touch_down failed')
|
||||||
|
|
||||||
@@ -382,7 +395,10 @@ class NemuIpcImpl:
|
|||||||
self.connect()
|
self.connect()
|
||||||
|
|
||||||
with CaptureNemuIpc():
|
with CaptureNemuIpc():
|
||||||
ret = self.lib.nemu_input_event_touch_up(self.connect_id, self.display_id)
|
ret = self.ev_run_sync(
|
||||||
|
self.lib.nemu_input_event_touch_up,
|
||||||
|
self.connect_id, self.display_id
|
||||||
|
)
|
||||||
if ret > 0:
|
if ret > 0:
|
||||||
raise NemuIpcError('nemu_input_event_touch_up failed')
|
raise NemuIpcError('nemu_input_event_touch_up failed')
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Emulator(EmulatorBase):
|
|||||||
def path_to_type(cls, path: str) -> str:
|
def path_to_type(cls, path: str) -> str:
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
path: Path to .exe file
|
path: Path to .exe file, case insensitive
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: Emulator type, such as Emulator.NoxPlayer
|
str: Emulator type, such as Emulator.NoxPlayer
|
||||||
@@ -78,46 +78,49 @@ class Emulator(EmulatorBase):
|
|||||||
folder, exe = os.path.split(path)
|
folder, exe = os.path.split(path)
|
||||||
folder, dir1 = os.path.split(folder)
|
folder, dir1 = os.path.split(folder)
|
||||||
folder, dir2 = os.path.split(folder)
|
folder, dir2 = os.path.split(folder)
|
||||||
if exe == 'Nox.exe':
|
exe = exe.lower()
|
||||||
if dir2 == 'Nox':
|
dir1 = dir1.lower()
|
||||||
|
dir2 = dir2.lower()
|
||||||
|
if exe == 'nox.exe':
|
||||||
|
if dir2 == 'nox':
|
||||||
return cls.NoxPlayer
|
return cls.NoxPlayer
|
||||||
elif dir2 == 'Nox64':
|
elif dir2 == 'nox64':
|
||||||
return cls.NoxPlayer64
|
return cls.NoxPlayer64
|
||||||
else:
|
else:
|
||||||
return cls.NoxPlayer
|
return cls.NoxPlayer
|
||||||
if exe == 'Bluestacks.exe':
|
if exe == 'bluestacks.exe':
|
||||||
if dir1 in ['BlueStacks', 'BlueStacks_cn']:
|
if dir1 in ['bluestacks', 'bluestacks_cn']:
|
||||||
return cls.BlueStacks4
|
return cls.BlueStacks4
|
||||||
elif dir1 in ['BlueStacks_nxt', 'BlueStacks_nxt_cn']:
|
elif dir1 in ['bluestacks_nxt', 'bluestacks_nxt_cn']:
|
||||||
return cls.BlueStacks5
|
return cls.BlueStacks5
|
||||||
else:
|
else:
|
||||||
return cls.BlueStacks4
|
return cls.BlueStacks4
|
||||||
if exe == 'HD-Player.exe':
|
if exe == 'hd-player.exe':
|
||||||
if dir1 in ['BlueStacks', 'BlueStacks_cn']:
|
if dir1 in ['bluestacks', 'bluestacks_cn']:
|
||||||
return cls.BlueStacks4
|
return cls.BlueStacks4
|
||||||
elif dir1 in ['BlueStacks_nxt', 'BlueStacks_nxt_cn']:
|
elif dir1 in ['bluestacks_nxt', 'bluestacks_nxt_cn']:
|
||||||
return cls.BlueStacks5
|
return cls.BlueStacks5
|
||||||
else:
|
else:
|
||||||
return cls.BlueStacks5
|
return cls.BlueStacks5
|
||||||
if exe == 'dnplayer.exe':
|
if exe == 'dnplayer.exe':
|
||||||
if dir1 == 'LDPlayer':
|
if dir1 == 'ldplayer':
|
||||||
return cls.LDPlayer3
|
return cls.LDPlayer3
|
||||||
elif dir1 == 'LDPlayer4':
|
elif dir1 == 'ldplayer4':
|
||||||
return cls.LDPlayer4
|
return cls.LDPlayer4
|
||||||
elif dir1 == 'LDPlayer9':
|
elif dir1 == 'ldplayer9':
|
||||||
return cls.LDPlayer9
|
return cls.LDPlayer9
|
||||||
else:
|
else:
|
||||||
return cls.LDPlayer3
|
return cls.LDPlayer3
|
||||||
if exe == 'NemuPlayer.exe':
|
if exe == 'nemuplayer.exe':
|
||||||
if dir2 == 'nemu':
|
if dir2 == 'nemu':
|
||||||
return cls.MuMuPlayer
|
return cls.MuMuPlayer
|
||||||
elif dir2 == 'nemu9':
|
elif dir2 == 'nemu9':
|
||||||
return cls.MuMuPlayerX
|
return cls.MuMuPlayerX
|
||||||
else:
|
else:
|
||||||
return cls.MuMuPlayer
|
return cls.MuMuPlayer
|
||||||
if exe == 'MuMuPlayer.exe':
|
if exe == 'mumuplayer.exe':
|
||||||
return cls.MuMuPlayer12
|
return cls.MuMuPlayer12
|
||||||
if exe == 'MEmu.exe':
|
if exe == 'memu.exe':
|
||||||
return cls.MEmuPlayer
|
return cls.MEmuPlayer
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
@@ -143,7 +146,9 @@ class Emulator(EmulatorBase):
|
|||||||
elif 'NemuMultiPlayer.exe' in exe:
|
elif 'NemuMultiPlayer.exe' in exe:
|
||||||
yield exe.replace('NemuMultiPlayer.exe', 'NemuPlayer.exe')
|
yield exe.replace('NemuMultiPlayer.exe', 'NemuPlayer.exe')
|
||||||
elif 'MuMuMultiPlayer.exe' in exe:
|
elif 'MuMuMultiPlayer.exe' in exe:
|
||||||
yield exe.replace('MuMuMultiPlayer.exe', 'MuMuManager.exe')
|
yield exe.replace('MuMuMultiPlayer.exe', 'MuMuPlayer.exe')
|
||||||
|
elif 'MuMuManager.exe' in exe:
|
||||||
|
yield exe.replace('MuMuManager.exe', 'MuMuPlayer.exe')
|
||||||
elif 'MEmuConsole.exe' in exe:
|
elif 'MEmuConsole.exe' in exe:
|
||||||
yield exe.replace('MEmuConsole.exe', 'MEmu.exe')
|
yield exe.replace('MEmuConsole.exe', 'MEmu.exe')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -47,8 +47,18 @@ class PlatformBase(Connection, EmulatorManagerBase):
|
|||||||
@cached_property
|
@cached_property
|
||||||
def emulator_info(self) -> EmulatorInfo:
|
def emulator_info(self) -> EmulatorInfo:
|
||||||
emulator = self.config.EmulatorInfo_Emulator
|
emulator = self.config.EmulatorInfo_Emulator
|
||||||
name = str(self.config.EmulatorInfo_name).strip().replace('\n', '')
|
|
||||||
path = str(self.config.EmulatorInfo_path).strip().replace('\n', '')
|
def parse_info(value):
|
||||||
|
if isinstance(value, str):
|
||||||
|
value = value.strip().replace('\n', '')
|
||||||
|
if value in ['None', 'False', 'True']:
|
||||||
|
value = ''
|
||||||
|
return value
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
name = parse_info(self.config.EmulatorInfo_name)
|
||||||
|
path = parse_info(self.config.EmulatorInfo_path)
|
||||||
|
|
||||||
return EmulatorInfo(
|
return EmulatorInfo(
|
||||||
emulator=emulator,
|
emulator=emulator,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from module.base.timer import Timer
|
|||||||
from module.base.utils import *
|
from module.base.utils import *
|
||||||
from module.combat.level import LevelOcr
|
from module.combat.level import LevelOcr
|
||||||
from module.exception import ScriptError
|
from module.exception import ScriptError
|
||||||
from module.handler.assets import GET_MISSION, POPUP_CANCEL, POPUP_CONFIRM
|
from module.handler.assets import GET_MISSION, MISSION_POPUP_ACK, MISSION_POPUP_GO, POPUP_CANCEL, POPUP_CONFIRM
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from module.map.map_grids import SelectedGrids
|
from module.map.map_grids import SelectedGrids
|
||||||
from module.ocr.ocr import DigitCounter, Duration, Ocr
|
from module.ocr.ocr import DigitCounter, Duration, Ocr
|
||||||
@@ -445,6 +445,10 @@ class RewardTacticalClass(Dock):
|
|||||||
continue
|
continue
|
||||||
if self.ui_page_main_popups():
|
if self.ui_page_main_popups():
|
||||||
continue
|
continue
|
||||||
|
# Similar to handle_mission_popup_ack, but battle pass item expire popup has a different ACK button
|
||||||
|
if self.appear(MISSION_POPUP_GO, offset=self._popup_offset, interval=2):
|
||||||
|
self.device.click(MISSION_POPUP_ACK)
|
||||||
|
continue
|
||||||
if self.appear(TACTICAL_CLASS_CANCEL, offset=(30, 30), interval=2) \
|
if self.appear(TACTICAL_CLASS_CANCEL, offset=(30, 30), interval=2) \
|
||||||
and self.appear(TACTICAL_CLASS_START, offset=(30, 30)):
|
and self.appear(TACTICAL_CLASS_START, offset=(30, 30)):
|
||||||
if self._tactical_books_choose():
|
if self._tactical_books_choose():
|
||||||
|
|||||||
Reference in New Issue
Block a user