Add: dungeon goto forgotten hall

This commit is contained in:
Hengyu 2023-06-29 12:56:05 +08:00
parent e312ff80f6
commit 4f8c1f89c3
7 changed files with 168 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -1,8 +1,8 @@
import os
import re
import typing as t
from functools import cached_property
from collections import namedtuple
from functools import cached_property
from module.base.code_generator import CodeGenerator
from module.config.utils import deep_get, read_file
@ -97,8 +97,8 @@ class KeywordExtract:
for data in read_file(file).values():
hash_ = deep_get(data, keys='Name.Hash')
_, name = self.find_keyword(hash_, lang='cn')
if '忘却之庭' in name or '遗秘' in name:
continue
# if '忘却之庭' in name:
# continue
yield hash_
def find_keyword(self, keyword, lang) -> tuple[int, str]:
@ -158,8 +158,8 @@ class KeywordExtract:
def generate_assignment_keywords(self):
KeywordFromFile = namedtuple('KeywordFromFile', ('file', 'class_name', 'output_file'))
for keyword in (
KeywordFromFile('ExpeditionGroup.json', 'AssignmentGroup', './tasks/assignment/keywords/group.py'),
KeywordFromFile('ExpeditionData.json', 'AssignmentEntry','./tasks/assignment/keywords/entry.py')
KeywordFromFile('ExpeditionGroup.json', 'AssignmentGroup', './tasks/assignment/keywords/group.py'),
KeywordFromFile('ExpeditionData.json', 'AssignmentEntry', './tasks/assignment/keywords/entry.py')
):
file = os.path.join(TextMap.DATA_FOLDER, 'ExcelOutput', keyword.file)
self.load_keywords(deep_get(data, 'Name.Hash') for data in read_file(file).values())

View File

@ -164,7 +164,7 @@ class DraggableList:
self.drag_page('down', main=main)
# Wait for bottoming out
main.wait_until_stable(self.search_button, timer=Timer(
0, count=0), timeout=Timer(1.5, count=5))
0.3, count=1), timeout=Timer(1.5, count=5))
skip_first_screenshot = True
return True

View File

@ -63,6 +63,16 @@ EVENT_CHECK = ButtonWrapper(
button=(39, 19, 75, 56),
),
)
FORGOTTEN_HALL_CHECK = ButtonWrapper(
name='FORGOTTEN_HALL_CHECK',
share=Button(
file='./assets/share/base/page/FORGOTTEN_HALL_CHECK.png',
area=(44, 27, 71, 47),
search=(24, 7, 91, 67),
color=(91, 87, 90),
button=(44, 27, 71, 47),
),
)
GACHA_CHECK = ButtonWrapper(
name='GACHA_CHECK',
share=Button(

View File

@ -42,6 +42,10 @@ class DungeonList(Keyword):
def is_Simulated_Universe(self):
return 'Simulated_Universe' in self.name
@property
def is_Forgotten_Hall(self):
return 'Forgotten_Hall' or 'Last_Vestiges' in self.name
@property
def is_daily_dungeon(self):
return self.is_Calyx_Golden or self.is_Calyx_Crimson or self.is_Stagnant_Shadow or self.is_Cavern_of_Corrosion

View File

@ -259,3 +259,139 @@ Simulated_Universe_World_6 = DungeonList(
en='Simulated Universe — World 6',
jp='第六世界・模擬宇宙',
)
The_Last_Vestiges_of_Towering_Citadel = DungeonList(
id=33,
name='The_Last_Vestiges_of_Towering_Citadel',
cn='永屹之城遗秘',
cht='永屹之城遺秘',
en='The Last Vestiges of Towering Citadel',
jp='永屹の城の秘密',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=34,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Frostscar_Reverie_Forgotten_Hall = DungeonList(
id=35,
name='Frostscar_Reverie_Forgotten_Hall',
cn='霜痕旧梦•忘却之庭',
cht='霜痕舊夢•忘卻之庭',
en='Frostscar Reverie — Forgotten Hall',
jp='霜跡に旧夢・忘却の庭',
)
Everwinter_Trials_Forgotten_Hall = DungeonList(
id=36,
name='Everwinter_Trials_Forgotten_Hall',
cn='永冬试炼•忘却之庭',
cht='永冬試煉•忘卻之庭',
en='Everwinter Trials — Forgotten Hall',
jp='常冬の試練・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=37,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Frostscar_Reverie_Forgotten_Hall = DungeonList(
id=38,
name='Frostscar_Reverie_Forgotten_Hall',
cn='霜痕旧梦•忘却之庭',
cht='霜痕舊夢•忘卻之庭',
en='Frostscar Reverie — Forgotten Hall',
jp='霜跡に旧夢・忘却の庭',
)
Everwinter_Trials_Forgotten_Hall = DungeonList(
id=39,
name='Everwinter_Trials_Forgotten_Hall',
cn='永冬试炼•忘却之庭',
cht='永冬試煉•忘卻之庭',
en='Everwinter Trials — Forgotten Hall',
jp='常冬の試練・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=40,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Frostscar_Reverie_Forgotten_Hall = DungeonList(
id=41,
name='Frostscar_Reverie_Forgotten_Hall',
cn='霜痕旧梦•忘却之庭',
cht='霜痕舊夢•忘卻之庭',
en='Frostscar Reverie — Forgotten Hall',
jp='霜跡に旧夢・忘却の庭',
)
Everwinter_Trials_Forgotten_Hall = DungeonList(
id=42,
name='Everwinter_Trials_Forgotten_Hall',
cn='永冬试炼•忘却之庭',
cht='永冬試煉•忘卻之庭',
en='Everwinter Trials — Forgotten Hall',
jp='常冬の試練・忘却の庭',
)
ColdironTribulation = DungeonList(
id=43,
name='ColdironTribulation',
cn='寒铁砥砺•忘却之庭',
cht='寒鐵砥礪•忘卻之庭',
en='ColdironTribulation',
jp='寒鉄練磨・忘却の庭',
)
Hyperborean_Search_for_Warmth = DungeonList(
id=44,
name='Hyperborean_Search_for_Warmth',
cn='蹈冰寻火•忘却之庭',
cht='蹈冰尋火•忘卻之庭',
en='Hyperborean Search for Warmth',
jp='氷踏みて炎求む・忘却の庭',
)
Stormquell = DungeonList(
id=45,
name='Stormquell',
cn='风暴止息•忘却之庭',
cht='風暴止息•忘卻之庭',
en='Stormquell',
jp='止息せし嵐・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=46,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=47,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=48,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)
Favor_of_Amber_Forgotten_Hall = DungeonList(
id=49,
name='Favor_of_Amber_Forgotten_Hall',
cn='琥珀恩赐•忘却之庭',
cht='琥珀恩賜•忘卻之庭',
en='Favor of Amber — Forgotten Hall',
jp='琥珀の賜物・忘却の庭',
)

View File

@ -9,6 +9,7 @@ from module.ocr.ocr import Ocr, OcrResultButton
from module.ocr.utils import split_and_pair_button_attr
from module.ui.draggable_list import DraggableList
from module.ui.switch import Switch
from tasks.base.assets.assets_base_page import FORGOTTEN_HALL_CHECK
from tasks.base.page import page_guide
from tasks.base.ui import UI
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
@ -174,7 +175,10 @@ class DungeonUI(UI):
if dungeon not in [tp.matched_keyword for tp in DUNGEON_LIST.teleports]:
# Dungeon name is insight but teleport button is not
logger.info('Dungeon name is insight, swipe down a little bit to find the teleport button')
DUNGEON_LIST.drag_vector = (0.2, 0.4)
if dungeon.is_Forgotten_Hall:
DUNGEON_LIST.drag_vector = (-0.4, -0.2) # Keyword loaded is reversed
else:
DUNGEON_LIST.drag_vector = (0.2, 0.4)
DUNGEON_LIST.ocr_class = OcrDungeonListLimitEntrance
DUNGEON_LIST.insight_row(dungeon, main=self)
DUNGEON_LIST.drag_vector = DraggableList.drag_vector
@ -192,7 +196,7 @@ class DungeonUI(UI):
"""
Pages:
in: page_guide, Survival_Index, nav including dungeon
out: COMBAT_PREPARE
out: COMBAT_PREPARE, FORGOTTEN_HALL_CHECK
"""
logger.hr('Dungeon enter', level=2)
skip_first_load = True
@ -203,7 +207,7 @@ class DungeonUI(UI):
self.device.screenshot()
# End
if self.appear(COMBAT_PREPARE):
if self.appear(COMBAT_PREPARE) or self.appear(FORGOTTEN_HALL_CHECK):
logger.info('Arrive COMBAT_PREPARE')
break
@ -272,6 +276,11 @@ class DungeonUI(UI):
self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon)
return True
if dungeon.is_Forgotten_Hall:
DUNGEON_NAV_LIST.select_row(KEYWORDS_DUNGEON_NAV.Forgotten_Hall, main=self)
self._dungeon_insight(dungeon)
self._dungeon_enter(dungeon)
return True
logger.error(f'Goto dungeon {dungeon} is not supported')
return False