Merge pull request #562 from LmeSzinc/dev

Bug fix
This commit is contained in:
LmeSzinc 2024-07-06 02:05:28 +08:00 committed by GitHub
commit ef892a1bdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 25 additions and 4 deletions

View File

@ -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):

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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):

View File

@ -90,6 +90,7 @@ class RogueBuffOcr(Ocr):
"阅下": "阈下",
'未日': '末日',
'尚末': '尚未',
'进裂晶格': '迸裂晶格',
}
elif self.lang == 'en':
replace_pattern_dict = {

View File

@ -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+.*'),

View File

@ -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):