Merge pull request #324 from LmeSzinc/bug_fix

Bug fix
This commit is contained in:
LmeSzinc 2024-02-13 01:39:36 +08:00 committed by GitHub
commit b0a6745bc7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 24 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

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

@ -120,6 +120,8 @@ class Route(RouteBase):
Luofu_Cloudford_F1_X281Y873 is the same as Luofu_Cloudford_F1_X283Y865
but for wrong spawn point detected
"""
# Re-init position to be the same as origin
self.minimap.init_position(position=(283.4, 865.3), locked=True)
self.clear_enemy(enemy)
@locked_position

View File

@ -37,7 +37,7 @@ MAP_LOADING = ButtonWrapper(
share=Button(
file='./assets/share/combat/interact/MAP_LOADING.png',
area=(644, 367, 662, 389),
search=(639, 347, 667, 394),
search=(639, 357, 667, 405),
color=(159, 141, 149),
button=(644, 367, 662, 389),
),

View File

@ -4,7 +4,7 @@ from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
from tasks.combat.combat import Combat
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.dungeon.event import DungeonEvent
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.stamina import DungeonStamina
@ -211,10 +211,10 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if self.has_double_rogue_event():
rogue = self.get_double_event_remain()
if self.has_double_calyx_event():
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Calyx_Golden_Treasures_Jarilo_VI)
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Calyx_Golden)
calyx = self.get_double_event_remain()
if self.has_double_relic_event():
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Cavern_of_Corrosion_Path_of_Gelid_Wind)
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Cavern_of_Corrosion)
relic = self.get_double_event_remain()
with self.config.multi_set():
self.config.stored.DungeonDouble.calyx = calyx

View File

@ -351,17 +351,17 @@ class DungeonUI(DungeonState):
logger.info('No Echo_of_War in list skip waiting')
return False
def _dungeon_nav_goto(self, dungeon: DungeonList, skip_first_screenshot=True):
def _dungeon_nav_goto(self, nav: DungeonNav, skip_first_screenshot=True):
"""
Equivalent to `DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self)`
but with tricks to be faster
Args:
dungeon:
nav:
skip_first_screenshot:
"""
logger.hr('Dungeon nav goto', level=2)
logger.info(f'Dungeon nav goto {dungeon.dungeon_nav}')
logger.info(f'Dungeon nav goto {nav}')
# Wait rows
while 1:
@ -402,11 +402,11 @@ class DungeonUI(DungeonState):
else:
# To start from any list states.
logger.info('DUNGEON_NAV_LIST not at top')
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self)
DUNGEON_NAV_LIST.select_row(nav, main=self)
return True
# Check the first page
if dungeon.dungeon_nav in [
if nav in [
KEYWORDS_DUNGEON_NAV.Simulated_Universe,
KEYWORDS_DUNGEON_NAV.Calyx_Golden,
KEYWORDS_DUNGEON_NAV.Calyx_Crimson,
@ -415,9 +415,9 @@ class DungeonUI(DungeonState):
KEYWORDS_DUNGEON_NAV.Forgotten_Hall,
KEYWORDS_DUNGEON_NAV.Pure_Fiction,
]:
button = DUNGEON_NAV_LIST.keyword2button(dungeon.dungeon_nav)
button = DUNGEON_NAV_LIST.keyword2button(nav)
if button:
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self, insight=False)
DUNGEON_NAV_LIST.select_row(nav, main=self, insight=False)
return True
# Check the second page
@ -425,7 +425,7 @@ class DungeonUI(DungeonState):
DUNGEON_NAV_LIST.drag_page('down', main=self)
# No skip_first_screenshot since drag_page is just called
if self._dungeon_wait_until_echo_or_war_stabled(skip_first_screenshot=False):
DUNGEON_NAV_LIST.select_row(dungeon.dungeon_nav, main=self, insight=False)
DUNGEON_NAV_LIST.select_row(nav, main=self, insight=False)
return True
def _dungeon_world_set(self, dungeon: DungeonList, skip_first_screenshot=True):
@ -636,7 +636,7 @@ class DungeonUI(DungeonState):
if self.appear(SURVIVAL_INDEX_LOADED):
logger.info('Already at nav Simulated_Universe')
else:
self._dungeon_nav_goto(KEYWORDS_DUNGEON_LIST.Simulated_Universe_World_1)
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Simulated_Universe)
def dungeon_goto(self, dungeon: DungeonList):
"""
@ -662,13 +662,13 @@ class DungeonUI(DungeonState):
or dungeon.is_Stagnant_Shadow \
or dungeon.is_Cavern_of_Corrosion \
or dungeon.is_Echo_of_War:
self._dungeon_nav_goto(dungeon)
self._dungeon_nav_goto(dungeon.dungeon_nav)
self._dungeon_wait_until_dungeon_list_loaded()
self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon)
return True
if dungeon.is_Calyx_Golden:
self._dungeon_nav_goto(dungeon)
self._dungeon_nav_goto(dungeon.dungeon_nav)
self._dungeon_wait_until_dungeon_list_loaded()
self._dungeon_world_set_wrapper(dungeon)
self._dungeon_wait_until_dungeon_list_loaded()

View File

@ -3,7 +3,7 @@ from module.ocr.ocr import DigitCounter
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.dungeon.assets.assets_dungeon_ui import OCR_DUNGEON_LIST, OCR_WEEKLY_LIMIT
from tasks.dungeon.dungeon import Dungeon
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DUNGEON_LIST
@ -53,7 +53,7 @@ class WeeklyDungeon(Dungeon):
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Survival_Index)
# Equivalent to self.dungeon_goto(dungeon), but check limit remains
DUNGEON_LIST.search_button = OCR_DUNGEON_LIST
self._dungeon_nav_goto(dungeon)
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Echo_of_War)
# Check limit
remain = self.get_weekly_remain()

View File

@ -10,7 +10,7 @@ from module.ocr.keyword import Keyword
from module.ocr.ocr import Ocr, OcrResultButton
from module.ui.draggable_list import DraggableList
from tasks.base.assets.assets_base_page import FORGOTTEN_HALL_CHECK, MAP_EXIT
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DungeonUI
from tasks.forgotten_hall.assets.assets_forgotten_hall_nav import *
from tasks.forgotten_hall.assets.assets_forgotten_hall_ui import *
@ -187,7 +187,7 @@ class ForgottenHallUI(DungeonUI, ForgottenHallTeam):
logger.info('Already in forgotten hall')
else:
self.dungeon_tab_goto(KEYWORDS_DUNGEON_TAB.Treasures_Lightward)
self._dungeon_nav_goto(dungeon)
self._dungeon_nav_goto(KEYWORDS_DUNGEON_NAV.Forgotten_Hall)
self.stage_choose(dungeon)
logger.info(f'Stage list select: {stage_keyword}')

View File

@ -77,6 +77,8 @@ class OcrRogueWorld(Ocr):
center = color_similarity_2d(image, color=(255, 255, 255))
cv2.inRange(center, 180, 255, dst=center)
center = np.where(np.sum(center, axis=1) > 200)[0]
if len(center) < 2:
return image
up, down = center[0], center[-1]
image = image[up:down, :, :]
return image