mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Upd: click left/right to wrong path
This commit is contained in:
parent
ff48ba74dd
commit
93400b525e
BIN
assets/cn/rogue/path/PAGE_ROGUE_PATH.png
Normal file
BIN
assets/cn/rogue/path/PAGE_ROGUE_PATH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
assets/en/rogue/path/PAGE_ROGUE_PATH.png
Normal file
BIN
assets/en/rogue/path/PAGE_ROGUE_PATH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
assets/share/rogue/path/CHECK_PROPAGATION.png
Normal file
BIN
assets/share/rogue/path/CHECK_PROPAGATION.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
BIN
assets/share/rogue/path/CHOOSE_LEFT.png
Normal file
BIN
assets/share/rogue/path/CHOOSE_LEFT.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
assets/share/rogue/path/CHOOSE_RIGHT.png
Normal file
BIN
assets/share/rogue/path/CHOOSE_RIGHT.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -1206,7 +1206,8 @@
|
||||
"Abundance",
|
||||
"The_Hunt",
|
||||
"Destruction",
|
||||
"Elation"
|
||||
"Elation",
|
||||
"Propagation"
|
||||
]
|
||||
},
|
||||
"Bonus": {
|
||||
|
@ -212,7 +212,7 @@ RogueWorld:
|
||||
]
|
||||
Path:
|
||||
value: The_Hunt
|
||||
option: [ Preservation, Remembrance, Nihility, Abundance, The_Hunt, Destruction, Elation ]
|
||||
option: [ Preservation, Remembrance, Nihility, Abundance, The_Hunt, Destruction, Elation, Propagation ]
|
||||
Bonus:
|
||||
value: Blessing Cosmos
|
||||
option: [ Blessing Cosmos, Miracle Cosmos, Fragmented Cosmos ]
|
||||
|
@ -119,7 +119,7 @@ class GeneratedConfig:
|
||||
|
||||
# Group `RogueWorld`
|
||||
RogueWorld_World = 'Simulated_Universe_World_7' # Simulated_Universe_World_3, Simulated_Universe_World_4, Simulated_Universe_World_5, Simulated_Universe_World_6, Simulated_Universe_World_7, Simulated_Universe_World_8
|
||||
RogueWorld_Path = 'The_Hunt' # Preservation, Remembrance, Nihility, Abundance, The_Hunt, Destruction, Elation
|
||||
RogueWorld_Path = 'The_Hunt' # Preservation, Remembrance, Nihility, Abundance, The_Hunt, Destruction, Elation, Propagation
|
||||
RogueWorld_Bonus = 'Blessing Cosmos' # Blessing Cosmos, Miracle Cosmos, Fragmented Cosmos
|
||||
RogueWorld_DomainStrategy = 'occurrence' # combat, occurrence
|
||||
RogueWorld_ImmersionReward = 'immersifier' # do_not_claim, immersifier, immersifier_trailblaze_power
|
||||
|
@ -804,7 +804,8 @@
|
||||
"Abundance": "Abundance",
|
||||
"The_Hunt": "The Hunt",
|
||||
"Destruction": "Destruction",
|
||||
"Elation": "Elation"
|
||||
"Elation": "Elation",
|
||||
"Propagation": "Propagation"
|
||||
},
|
||||
"Bonus": {
|
||||
"name": "Blessings of Trailblaze",
|
||||
|
@ -804,7 +804,8 @@
|
||||
"Abundance": "Abundancia",
|
||||
"The_Hunt": "Cacería",
|
||||
"Destruction": "Destrucción",
|
||||
"Elation": "Exultación"
|
||||
"Elation": "Exultación",
|
||||
"Propagation": "Propagación"
|
||||
},
|
||||
"Bonus": {
|
||||
"name": "Bendiciones",
|
||||
|
@ -804,7 +804,8 @@
|
||||
"Abundance": "Abundance",
|
||||
"The_Hunt": "The_Hunt",
|
||||
"Destruction": "Destruction",
|
||||
"Elation": "Elation"
|
||||
"Elation": "Elation",
|
||||
"Propagation": "Propagation"
|
||||
},
|
||||
"Bonus": {
|
||||
"name": "RogueWorld.Bonus.name",
|
||||
|
@ -804,7 +804,8 @@
|
||||
"Abundance": "丰饶",
|
||||
"The_Hunt": "巡猎",
|
||||
"Destruction": "毁灭",
|
||||
"Elation": "欢愉"
|
||||
"Elation": "欢愉",
|
||||
"Propagation": "繁育"
|
||||
},
|
||||
"Bonus": {
|
||||
"name": "开拓祝福三选一",
|
||||
|
@ -804,7 +804,8 @@
|
||||
"Abundance": "豐饒",
|
||||
"The_Hunt": "巡獵",
|
||||
"Destruction": "毀滅",
|
||||
"Elation": "歡愉"
|
||||
"Elation": "歡愉",
|
||||
"Propagation": "繁育"
|
||||
},
|
||||
"Bonus": {
|
||||
"name": "開拓祝福三選一",
|
||||
|
@ -63,6 +63,16 @@ CHECK_PRESERVATION = ButtonWrapper(
|
||||
button=(220, 308, 270, 358),
|
||||
),
|
||||
)
|
||||
CHECK_PROPAGATION = ButtonWrapper(
|
||||
name='CHECK_PROPAGATION',
|
||||
share=Button(
|
||||
file='./assets/share/rogue/path/CHECK_PROPAGATION.png',
|
||||
area=(206, 308, 286, 372),
|
||||
search=(186, 288, 306, 392),
|
||||
color=(126, 104, 75),
|
||||
button=(206, 308, 286, 372),
|
||||
),
|
||||
)
|
||||
CHECK_REMEMBRANCE = ButtonWrapper(
|
||||
name='CHECK_REMEMBRANCE',
|
||||
share=Button(
|
||||
@ -83,6 +93,26 @@ CHECK_THE_HUNT = ButtonWrapper(
|
||||
button=(221, 324, 271, 374),
|
||||
),
|
||||
)
|
||||
CHOOSE_LEFT = ButtonWrapper(
|
||||
name='CHOOSE_LEFT',
|
||||
share=Button(
|
||||
file='./assets/share/rogue/path/CHOOSE_LEFT.png',
|
||||
area=(44, 292, 102, 365),
|
||||
search=(24, 272, 122, 385),
|
||||
color=(30, 33, 42),
|
||||
button=(44, 292, 102, 365),
|
||||
),
|
||||
)
|
||||
CHOOSE_RIGHT = ButtonWrapper(
|
||||
name='CHOOSE_RIGHT',
|
||||
share=Button(
|
||||
file='./assets/share/rogue/path/CHOOSE_RIGHT.png',
|
||||
area=(1177, 291, 1236, 364),
|
||||
search=(1157, 271, 1256, 384),
|
||||
color=(32, 33, 39),
|
||||
button=(1177, 291, 1236, 364),
|
||||
),
|
||||
)
|
||||
CLICK_ABUNDANCE = ButtonWrapper(
|
||||
name='CLICK_ABUNDANCE',
|
||||
share=Button(
|
||||
@ -163,3 +193,20 @@ CONFIRM_PATH = ButtonWrapper(
|
||||
button=(865, 640, 1139, 675),
|
||||
),
|
||||
)
|
||||
PAGE_ROGUE_PATH = ButtonWrapper(
|
||||
name='PAGE_ROGUE_PATH',
|
||||
cn=Button(
|
||||
file='./assets/cn/rogue/path/PAGE_ROGUE_PATH.png',
|
||||
area=(713, 87, 759, 109),
|
||||
search=(693, 67, 779, 129),
|
||||
color=(122, 120, 119),
|
||||
button=(713, 87, 759, 109),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/rogue/path/PAGE_ROGUE_PATH.png',
|
||||
area=(606, 89, 656, 108),
|
||||
search=(586, 69, 676, 128),
|
||||
color=(114, 112, 112),
|
||||
button=(606, 89, 656, 108),
|
||||
),
|
||||
)
|
||||
|
@ -40,6 +40,7 @@ class RoguePathHandler(RogueUI):
|
||||
KEYWORDS_ROGUE_PATH.The_Hunt: CHECK_THE_HUNT,
|
||||
KEYWORDS_ROGUE_PATH.Destruction: CHECK_DESTRUCTION,
|
||||
KEYWORDS_ROGUE_PATH.Elation: CHECK_ELATION,
|
||||
KEYWORDS_ROGUE_PATH.Propagation: CHECK_PROPAGATION
|
||||
}
|
||||
return buttons
|
||||
|
||||
@ -60,11 +61,7 @@ class RoguePathHandler(RogueUI):
|
||||
return buttons
|
||||
|
||||
def _get_path_click(self, path: RoguePath) -> ButtonWrapper:
|
||||
try:
|
||||
return self._rogue_path_clicks[path]
|
||||
except KeyError:
|
||||
logger.critical(f'Invalid rogue path: {path}')
|
||||
raise ScriptError
|
||||
return self._rogue_path_clicks.get(path, CLICK_ELATION)
|
||||
|
||||
def _get_selected_path(self, skip_first_screenshot=True) -> RoguePath | None:
|
||||
timeout = Timer(1, count=5).start()
|
||||
@ -86,8 +83,8 @@ class RoguePathHandler(RogueUI):
|
||||
return None
|
||||
|
||||
def _is_page_rogue_path(self) -> bool:
|
||||
appear = [self.appear(button) for button in self._rogue_path_clicks.values()]
|
||||
return all(appear)
|
||||
appear = self.appear(PAGE_ROGUE_PATH)
|
||||
return appear
|
||||
|
||||
def _is_team_prepared(self) -> bool:
|
||||
"""
|
||||
@ -110,7 +107,7 @@ class RoguePathHandler(RogueUI):
|
||||
or page_main if previous rogue run had bonus selected but didn't finish any domain
|
||||
"""
|
||||
logger.hr('Rogue path select', level=2)
|
||||
path: RoguePath = RoguePath.find(path)
|
||||
path: RoguePath = RoguePath.find_path(path)
|
||||
logger.info(f'Select path: {path}')
|
||||
entry = self._get_path_click(path)
|
||||
while 1:
|
||||
@ -143,10 +140,13 @@ class RoguePathHandler(RogueUI):
|
||||
continue
|
||||
# Confirm path
|
||||
if self.appear(CONFIRM_PATH, interval=2):
|
||||
if self._get_selected_path() == path:
|
||||
selected_path = self._get_selected_path()
|
||||
if selected_path == path:
|
||||
self.device.click(CONFIRM_PATH)
|
||||
continue
|
||||
else:
|
||||
logger.warning('Selected to the wrong path')
|
||||
self.device.click(BACK)
|
||||
elif selected_path.id < path.id:
|
||||
self.device.click(CHOOSE_RIGHT)
|
||||
continue
|
||||
else:
|
||||
self.device.click(CHOOSE_LEFT)
|
||||
continue
|
||||
|
@ -2,6 +2,7 @@ from dataclasses import dataclass
|
||||
from typing import ClassVar
|
||||
|
||||
from dev_tools.keyword_extract import UI_LANGUAGES
|
||||
from module.exception import ScriptError
|
||||
from module.ocr.keyword import Keyword
|
||||
|
||||
|
||||
@ -35,6 +36,14 @@ class RoguePath(Keyword):
|
||||
return [self.__getattribute__(f"{server}_parsed").replace("the", '')
|
||||
for server in UI_LANGUAGES if hasattr(self, f"{server}_parsed")]
|
||||
|
||||
@classmethod
|
||||
def find_path(cls, name):
|
||||
for instance in cls.instances.values():
|
||||
if name == instance.name:
|
||||
return instance
|
||||
# Not found
|
||||
raise ScriptError(f'Cannot find a {cls.__name__} instance that matches "{name}"')
|
||||
|
||||
|
||||
@dataclass(repr=False)
|
||||
class RogueResonance(Keyword):
|
||||
|
Loading…
Reference in New Issue
Block a user