mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
commit
ef892a1bdc
@ -7,7 +7,7 @@ import module.config.server as server
|
||||
from module.exception import ScriptError
|
||||
|
||||
# ord('.') = 65294
|
||||
REGEX_PUNCTUATION = re.compile(r'[ ,..\'"“”,。…::;;!!??·・•●〇°*※\-—–-/\\|丨\n\t()\[\]()「」『』【】《》[]]')
|
||||
REGEX_PUNCTUATION = re.compile(r'[ ,..\'"“”,。、…::;;!!??·・•●〇°*※\-—–-/\\|丨\n\t()\[\]()「」『』【】《》[]]')
|
||||
|
||||
|
||||
def parse_name(n):
|
||||
|
@ -16,7 +16,7 @@ class SecondaryMaatouchBuilder(maatouch.MaatouchBuilder):
|
||||
"""
|
||||
Click on secondary contact to avoid interruption of real-person contact
|
||||
"""
|
||||
super().__init__(device, contact=1, handle_orientation=handle_orientation)
|
||||
super().__init__(device, contact=2, handle_orientation=handle_orientation)
|
||||
|
||||
|
||||
maatouch.MaatouchBuilder = SecondaryMaatouchBuilder
|
||||
|
@ -280,6 +280,10 @@ class CharacterSwitch(UI):
|
||||
logger.hr('Character switch to ranged')
|
||||
if update:
|
||||
self.character_update()
|
||||
if self.character_current is None:
|
||||
# Cannot switch, keep None to retry at next call
|
||||
self.character_is_ranged = None
|
||||
return None
|
||||
|
||||
character = self._get_ranged_character()
|
||||
if character is True:
|
||||
|
@ -5,6 +5,7 @@ import numpy as np
|
||||
|
||||
from module.base.base import ModuleBase
|
||||
from module.base.button import ClickButton
|
||||
from module.base.decorator import run_once
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import get_color
|
||||
from module.exception import ScriptError
|
||||
@ -614,7 +615,12 @@ class DungeonUI(DungeonState):
|
||||
"""
|
||||
logger.hr('Dungeon enter', level=2)
|
||||
DUNGEON_LIST.use_plane = bool(dungeon.is_Calyx_Crimson)
|
||||
skip_first_load = True
|
||||
skip_first_load = skip_first_screenshot
|
||||
|
||||
@run_once
|
||||
def screenshot_interval_set():
|
||||
self.device.screenshot_interval_set('combat')
|
||||
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
@ -624,11 +630,13 @@ class DungeonUI(DungeonState):
|
||||
# End
|
||||
if self.appear(enter_check_button):
|
||||
logger.info(f'Arrive {enter_check_button.name}')
|
||||
self.device.screenshot_interval_set()
|
||||
break
|
||||
|
||||
# Additional
|
||||
# Popup that confirm character switch
|
||||
if self.handle_popup_confirm():
|
||||
self.interval_reset(page_guide.check_button)
|
||||
continue
|
||||
|
||||
# Click teleport
|
||||
@ -640,6 +648,7 @@ class DungeonUI(DungeonState):
|
||||
entrance = DUNGEON_LIST.keyword2button(dungeon)
|
||||
if entrance is not None:
|
||||
self.device.click(entrance)
|
||||
screenshot_interval_set()
|
||||
self.interval_reset(page_guide.check_button)
|
||||
continue
|
||||
else:
|
||||
|
@ -303,6 +303,7 @@ class InventoryManager:
|
||||
loca = item
|
||||
|
||||
interval = Timer(2, count=6)
|
||||
clicked = False
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
@ -319,13 +320,14 @@ class InventoryManager:
|
||||
continue
|
||||
|
||||
# End
|
||||
if item.is_selected:
|
||||
if clicked and item.is_selected:
|
||||
logger.info('Inventory item selected')
|
||||
break
|
||||
# Click
|
||||
if interval.reached():
|
||||
self.main.device.click(item)
|
||||
interval.reset()
|
||||
clicked = True
|
||||
continue
|
||||
|
||||
def wait_selected(self, skip_first_screenshot=True):
|
||||
|
@ -90,6 +90,7 @@ class RogueBuffOcr(Ocr):
|
||||
"阅下": "阈下",
|
||||
'未日': '末日',
|
||||
'尚末': '尚未',
|
||||
'进裂晶格': '迸裂晶格',
|
||||
}
|
||||
elif self.lang == 'en':
|
||||
replace_pattern_dict = {
|
||||
|
@ -96,6 +96,8 @@ class OcrRogueEventOption(OcrRogueEvent):
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.Choose_number_two_It_snores_like_Andatur_Zazzalo, '.*二号.*安达.*'),
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.Choose_number_three_Its_teeth_are_rusted, '.*三号.*牙齿.*'),
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.Believe_in_THEM_with_pure_devotion, '虔诚信仰'),
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.A_box_of_expired_doughnuts_6308, '^盒过期甜甜圈'),
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.A_box_of_expired_doughnuts_cc8c, '^盒过期甜甜圈'),
|
||||
],
|
||||
'en': [
|
||||
(KEYWORDS_ROGUE_EVENT_OPTION.Deposit_2_Cosmic_Fragments, 'Deposit \d+.*'),
|
||||
|
@ -261,6 +261,7 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
|
||||
or page_rogue if rogue cleared
|
||||
"""
|
||||
logger.info('Wait next domain')
|
||||
self.device.screenshot_interval_set('combat')
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
@ -270,10 +271,12 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
|
||||
# End
|
||||
if self.is_in_main():
|
||||
logger.info('Entered another domain')
|
||||
self.device.screenshot_interval_set()
|
||||
self.wait_until_minimap_stabled()
|
||||
break
|
||||
if self.is_page_rogue_main():
|
||||
logger.info('Rogue cleared')
|
||||
self.device.screenshot_interval_set()
|
||||
break
|
||||
|
||||
if self.match_template_color(ROGUE_REPORT, interval=2):
|
||||
|
Loading…
Reference in New Issue
Block a user