mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 08:37:42 +00:00
Fix: Handle starting from trial and rogue
This commit is contained in:
parent
6212b081ce
commit
6e00043526
BIN
assets/share/base/main_page/ROGUE_LEAVE_FOR_NOW.png
Normal file
BIN
assets/share/base/main_page/ROGUE_LEAVE_FOR_NOW.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
@ -265,8 +265,9 @@ class KeywordExtract:
|
||||
|
||||
def generate_map_planes(self):
|
||||
planes = {
|
||||
'Herta': ['黑塔的办公室',
|
||||
'观景车厢', '主控舱段', '基座舱段', '收容舱段', '支援舱段'],
|
||||
'Special': ['黑塔的办公室', '锋芒崭露'],
|
||||
'Rogue': [ '区域-战斗', '区域-事件', '区域-遭遇', '区域-休整', '区域-精英', '区域-首领', '区域-交易'],
|
||||
'Herta': ['观景车厢', '主控舱段', '基座舱段', '收容舱段', '支援舱段'],
|
||||
'Jarilo': ['行政区', '城郊雪原', '边缘通路', '铁卫禁区', '残响回廊', '永冬岭',
|
||||
'磐岩镇', '大矿区', '铆钉镇', '机械聚落'],
|
||||
'Luofu': ['星槎海中枢', '流云渡', '迴星港', '长乐天', '金人巷', '太卜司', '工造司', '丹鼎司', '鳞渊境'],
|
||||
|
@ -13,3 +13,13 @@ OCR_MAP_NAME = ButtonWrapper(
|
||||
button=(48, 15, 373, 32),
|
||||
),
|
||||
)
|
||||
ROGUE_LEAVE_FOR_NOW = ButtonWrapper(
|
||||
name='ROGUE_LEAVE_FOR_NOW',
|
||||
share=Button(
|
||||
file='./assets/share/base/main_page/ROGUE_LEAVE_FOR_NOW.png',
|
||||
area=(729, 475, 765, 519),
|
||||
search=(709, 455, 785, 539),
|
||||
color=(82, 74, 59),
|
||||
button=(729, 475, 765, 519),
|
||||
),
|
||||
)
|
||||
|
@ -2,13 +2,15 @@ import re
|
||||
from typing import Optional
|
||||
|
||||
import module.config.server as server
|
||||
from module.base.base import ModuleBase
|
||||
from module.config.server import VALID_LANG
|
||||
from module.exception import RequestHumanTakeover, ScriptError
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Ocr
|
||||
from tasks.base.assets.assets_base_main_page import OCR_MAP_NAME
|
||||
from tasks.base.page import Page, page_main
|
||||
from tasks.base.assets.assets_base_main_page import OCR_MAP_NAME, ROGUE_LEAVE_FOR_NOW
|
||||
from tasks.base.assets.assets_base_page import CLOSE, MAP_EXIT
|
||||
from tasks.base.page import Page, page_gacha, page_main
|
||||
from tasks.base.popup import PopupHandler
|
||||
from tasks.daily.assets.assets_daily_trial import START_TRIAL
|
||||
from tasks.map.keywords import KEYWORDS_MAP_PLANE, MapPlane
|
||||
|
||||
|
||||
@ -18,10 +20,13 @@ class OcrPlaneName(Ocr):
|
||||
result = re.sub(r'-[Ii1]$', '', result)
|
||||
result = re.sub(r'\d+$', '', result)
|
||||
|
||||
# 累塔的办公室
|
||||
result = result.replace('累塔', '黑塔')
|
||||
|
||||
return super().after_process(result)
|
||||
|
||||
|
||||
class MainPage(ModuleBase):
|
||||
class MainPage(PopupHandler):
|
||||
# Same as BigmapPlane class
|
||||
# Current plane
|
||||
plane: MapPlane = KEYWORDS_MAP_PLANE.Herta_ParlorCar
|
||||
@ -93,3 +98,51 @@ class MainPage(ModuleBase):
|
||||
|
||||
self.handle_lang_check(page=page_main)
|
||||
return True
|
||||
|
||||
def ui_leave_special(self):
|
||||
"""
|
||||
Leave from:
|
||||
- Rogue domains
|
||||
- Character trials
|
||||
|
||||
Returns:
|
||||
bool: If left a special plane
|
||||
|
||||
Pages:
|
||||
in: Any
|
||||
out: page_main
|
||||
"""
|
||||
if not self.appear(MAP_EXIT):
|
||||
return False
|
||||
|
||||
logger.info('UI leave special')
|
||||
skip_first_screenshot = True
|
||||
clicked = False
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
# End
|
||||
if clicked:
|
||||
if self.appear(page_main.check_button):
|
||||
logger.info(f'Leave to {page_main}')
|
||||
break
|
||||
|
||||
if self.appear_then_click(MAP_EXIT, interval=2):
|
||||
continue
|
||||
if self.handle_popup_confirm():
|
||||
continue
|
||||
if self.match_template_color(START_TRIAL, interval=2):
|
||||
logger.info(f'{START_TRIAL} -> {CLOSE}')
|
||||
self.device.click(CLOSE)
|
||||
clicked = True
|
||||
continue
|
||||
if self.appear(page_gacha.check_button, interval=2):
|
||||
logger.info(f'{page_gacha} -> {CLOSE}')
|
||||
self.device.click(CLOSE)
|
||||
continue
|
||||
if self.appear_then_click(ROGUE_LEAVE_FOR_NOW, interval=2):
|
||||
clicked = True
|
||||
continue
|
||||
|
@ -7,12 +7,12 @@ from module.ocr.ocr import Ocr
|
||||
from tasks.base.assets.assets_base_page import CLOSE, MAP_EXIT
|
||||
from tasks.base.main_page import MainPage
|
||||
from tasks.base.page import Page, page_main
|
||||
from tasks.base.popup import PopupHandler
|
||||
from tasks.combat.assets.assets_combat_finish import COMBAT_EXIT
|
||||
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
||||
from tasks.daily.assets.assets_daily_trial import INFO_CLOSE
|
||||
|
||||
|
||||
class UI(PopupHandler, MainPage):
|
||||
class UI( MainPage):
|
||||
ui_current: Page
|
||||
ui_main_confirm_timer = Timer(0.2, count=0)
|
||||
|
||||
@ -156,6 +156,8 @@ class UI(PopupHandler, MainPage):
|
||||
logger.hr("UI ensure")
|
||||
self.ui_get_current_page(skip_first_screenshot=skip_first_screenshot)
|
||||
|
||||
self.ui_leave_special()
|
||||
|
||||
if acquire_lang_checked:
|
||||
if self.acquire_lang_checked():
|
||||
self.ui_get_current_page(skip_first_screenshot=skip_first_screenshot)
|
||||
@ -297,6 +299,8 @@ class UI(PopupHandler, MainPage):
|
||||
self.device.click(CLOSE)
|
||||
if self.appear_then_click(COMBAT_EXIT, interval=5):
|
||||
return True
|
||||
if self.appear_then_click(INFO_CLOSE, interval=5):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
@ -3,16 +3,80 @@ from .classes import MapPlane
|
||||
# This file was auto-generated, do not modify it manually. To generate:
|
||||
# ``` python -m dev_tools.keyword_extract ```
|
||||
|
||||
Herta_HertaOffice = MapPlane(
|
||||
Special_HertaOffice = MapPlane(
|
||||
id=1,
|
||||
name='Herta_HertaOffice',
|
||||
name='Special_HertaOffice',
|
||||
cn='黑塔的办公室',
|
||||
cht='黑塔的辦公室',
|
||||
en="Herta's Office",
|
||||
jp='ヘルタのオフィス',
|
||||
)
|
||||
Herta_ParlorCar = MapPlane(
|
||||
Special_AptitudeShowcase = MapPlane(
|
||||
id=2,
|
||||
name='Special_AptitudeShowcase',
|
||||
cn='锋芒崭露',
|
||||
cht='鋒芒嶄露',
|
||||
en='Aptitude Showcase',
|
||||
jp='躍進する新星',
|
||||
)
|
||||
Rogue_DomainCombat = MapPlane(
|
||||
id=3,
|
||||
name='Rogue_DomainCombat',
|
||||
cn='区域-战斗',
|
||||
cht='區域-戰鬥',
|
||||
en='Domain — Combat',
|
||||
jp='エリア-戦闘',
|
||||
)
|
||||
Rogue_DomainOccurrence = MapPlane(
|
||||
id=4,
|
||||
name='Rogue_DomainOccurrence',
|
||||
cn='区域-事件',
|
||||
cht='區域-事件',
|
||||
en='Domain — Occurrence',
|
||||
jp='エリア-イベント',
|
||||
)
|
||||
Rogue_DomainEncounter = MapPlane(
|
||||
id=5,
|
||||
name='Rogue_DomainEncounter',
|
||||
cn='区域-遭遇',
|
||||
cht='區域-遭遇',
|
||||
en='Domain — Encounter',
|
||||
jp='エリア-遭遇',
|
||||
)
|
||||
Rogue_DomainRespite = MapPlane(
|
||||
id=6,
|
||||
name='Rogue_DomainRespite',
|
||||
cn='区域-休整',
|
||||
cht='區域-整備',
|
||||
en='Domain — Respite',
|
||||
jp='エリア-休憩',
|
||||
)
|
||||
Rogue_DomainElite = MapPlane(
|
||||
id=7,
|
||||
name='Rogue_DomainElite',
|
||||
cn='区域-精英',
|
||||
cht='區域-菁英',
|
||||
en='Domain — Elite',
|
||||
jp='エリア-精鋭',
|
||||
)
|
||||
Rogue_DomainBoss = MapPlane(
|
||||
id=8,
|
||||
name='Rogue_DomainBoss',
|
||||
cn='区域-首领',
|
||||
cht='區域-頭目',
|
||||
en='Domain — Boss',
|
||||
jp='エリア-ボス',
|
||||
)
|
||||
Rogue_DomainTransaction = MapPlane(
|
||||
id=9,
|
||||
name='Rogue_DomainTransaction',
|
||||
cn='区域-交易',
|
||||
cht='區域-交易',
|
||||
en='Domain — Transaction',
|
||||
jp='エリア-取引',
|
||||
)
|
||||
Herta_ParlorCar = MapPlane(
|
||||
id=10,
|
||||
name='Herta_ParlorCar',
|
||||
cn='观景车厢',
|
||||
cht='觀景車廂',
|
||||
@ -20,7 +84,7 @@ Herta_ParlorCar = MapPlane(
|
||||
jp='列車のラウンジ',
|
||||
)
|
||||
Herta_MasterControlZone = MapPlane(
|
||||
id=3,
|
||||
id=11,
|
||||
name='Herta_MasterControlZone',
|
||||
cn='主控舱段',
|
||||
cht='主控艙段',
|
||||
@ -28,7 +92,7 @@ Herta_MasterControlZone = MapPlane(
|
||||
jp='主制御部分',
|
||||
)
|
||||
Herta_BaseZone = MapPlane(
|
||||
id=4,
|
||||
id=12,
|
||||
name='Herta_BaseZone',
|
||||
cn='基座舱段',
|
||||
cht='基座艙段',
|
||||
@ -36,7 +100,7 @@ Herta_BaseZone = MapPlane(
|
||||
jp='ベース部分',
|
||||
)
|
||||
Herta_StorageZone = MapPlane(
|
||||
id=5,
|
||||
id=13,
|
||||
name='Herta_StorageZone',
|
||||
cn='收容舱段',
|
||||
cht='收容艙段',
|
||||
@ -44,7 +108,7 @@ Herta_StorageZone = MapPlane(
|
||||
jp='収容部分',
|
||||
)
|
||||
Herta_SupplyZone = MapPlane(
|
||||
id=6,
|
||||
id=14,
|
||||
name='Herta_SupplyZone',
|
||||
cn='支援舱段',
|
||||
cht='支援艙段',
|
||||
@ -52,7 +116,7 @@ Herta_SupplyZone = MapPlane(
|
||||
jp='サポート部分',
|
||||
)
|
||||
Jarilo_AdministrativeDistrict = MapPlane(
|
||||
id=7,
|
||||
id=15,
|
||||
name='Jarilo_AdministrativeDistrict',
|
||||
cn='行政区',
|
||||
cht='行政區',
|
||||
@ -60,7 +124,7 @@ Jarilo_AdministrativeDistrict = MapPlane(
|
||||
jp='行政区',
|
||||
)
|
||||
Jarilo_OutlyingSnowPlains = MapPlane(
|
||||
id=8,
|
||||
id=16,
|
||||
name='Jarilo_OutlyingSnowPlains',
|
||||
cn='城郊雪原',
|
||||
cht='城郊雪原',
|
||||
@ -68,7 +132,7 @@ Jarilo_OutlyingSnowPlains = MapPlane(
|
||||
jp='郊外雪原',
|
||||
)
|
||||
Jarilo_BackwaterPass = MapPlane(
|
||||
id=9,
|
||||
id=17,
|
||||
name='Jarilo_BackwaterPass',
|
||||
cn='边缘通路',
|
||||
cht='邊緣通道',
|
||||
@ -76,7 +140,7 @@ Jarilo_BackwaterPass = MapPlane(
|
||||
jp='外縁通路',
|
||||
)
|
||||
Jarilo_SilvermaneGuardRestrictedZone = MapPlane(
|
||||
id=10,
|
||||
id=18,
|
||||
name='Jarilo_SilvermaneGuardRestrictedZone',
|
||||
cn='铁卫禁区',
|
||||
cht='鐵衛禁區',
|
||||
@ -84,7 +148,7 @@ Jarilo_SilvermaneGuardRestrictedZone = MapPlane(
|
||||
jp='シルバーメイン禁区',
|
||||
)
|
||||
Jarilo_CorridorofFadingEchoes = MapPlane(
|
||||
id=11,
|
||||
id=19,
|
||||
name='Jarilo_CorridorofFadingEchoes',
|
||||
cn='残响回廊',
|
||||
cht='殘響迴廊',
|
||||
@ -92,7 +156,7 @@ Jarilo_CorridorofFadingEchoes = MapPlane(
|
||||
jp='残響回廊',
|
||||
)
|
||||
Jarilo_EverwinterHill = MapPlane(
|
||||
id=12,
|
||||
id=20,
|
||||
name='Jarilo_EverwinterHill',
|
||||
cn='永冬岭',
|
||||
cht='永冬嶺',
|
||||
@ -100,7 +164,7 @@ Jarilo_EverwinterHill = MapPlane(
|
||||
jp='常冬峰',
|
||||
)
|
||||
Jarilo_BoulderTown = MapPlane(
|
||||
id=13,
|
||||
id=21,
|
||||
name='Jarilo_BoulderTown',
|
||||
cn='磐岩镇',
|
||||
cht='磐岩鎮',
|
||||
@ -108,7 +172,7 @@ Jarilo_BoulderTown = MapPlane(
|
||||
jp='ボルダータウン',
|
||||
)
|
||||
Jarilo_GreatMine = MapPlane(
|
||||
id=14,
|
||||
id=22,
|
||||
name='Jarilo_GreatMine',
|
||||
cn='大矿区',
|
||||
cht='大礦區',
|
||||
@ -116,7 +180,7 @@ Jarilo_GreatMine = MapPlane(
|
||||
jp='大鉱区',
|
||||
)
|
||||
Jarilo_RivetTown = MapPlane(
|
||||
id=15,
|
||||
id=23,
|
||||
name='Jarilo_RivetTown',
|
||||
cn='铆钉镇',
|
||||
cht='鉚釘鎮',
|
||||
@ -124,7 +188,7 @@ Jarilo_RivetTown = MapPlane(
|
||||
jp='リベットタウン',
|
||||
)
|
||||
Jarilo_RobotSettlement = MapPlane(
|
||||
id=16,
|
||||
id=24,
|
||||
name='Jarilo_RobotSettlement',
|
||||
cn='机械聚落',
|
||||
cht='機械聚落',
|
||||
@ -132,7 +196,7 @@ Jarilo_RobotSettlement = MapPlane(
|
||||
jp='機械集落',
|
||||
)
|
||||
Luofu_CentralStarskiffHaven = MapPlane(
|
||||
id=17,
|
||||
id=25,
|
||||
name='Luofu_CentralStarskiffHaven',
|
||||
cn='星槎海中枢',
|
||||
cht='星槎海中樞',
|
||||
@ -140,7 +204,7 @@ Luofu_CentralStarskiffHaven = MapPlane(
|
||||
jp='星槎海中枢',
|
||||
)
|
||||
Luofu_Cloudford = MapPlane(
|
||||
id=18,
|
||||
id=26,
|
||||
name='Luofu_Cloudford',
|
||||
cn='流云渡',
|
||||
cht='流雲渡',
|
||||
@ -148,7 +212,7 @@ Luofu_Cloudford = MapPlane(
|
||||
jp='流雲渡し',
|
||||
)
|
||||
Luofu_StargazerNavalia = MapPlane(
|
||||
id=19,
|
||||
id=27,
|
||||
name='Luofu_StargazerNavalia',
|
||||
cn='迴星港',
|
||||
cht='迴星港',
|
||||
@ -156,7 +220,7 @@ Luofu_StargazerNavalia = MapPlane(
|
||||
jp='廻星港',
|
||||
)
|
||||
Luofu_ExaltingSanctum = MapPlane(
|
||||
id=20,
|
||||
id=28,
|
||||
name='Luofu_ExaltingSanctum',
|
||||
cn='长乐天',
|
||||
cht='長樂天',
|
||||
@ -164,7 +228,7 @@ Luofu_ExaltingSanctum = MapPlane(
|
||||
jp='長楽天',
|
||||
)
|
||||
Luofu_AurumAlley = MapPlane(
|
||||
id=21,
|
||||
id=29,
|
||||
name='Luofu_AurumAlley',
|
||||
cn='金人巷',
|
||||
cht='金人巷',
|
||||
@ -172,7 +236,7 @@ Luofu_AurumAlley = MapPlane(
|
||||
jp='金人巷',
|
||||
)
|
||||
Luofu_DivinationCommission = MapPlane(
|
||||
id=22,
|
||||
id=30,
|
||||
name='Luofu_DivinationCommission',
|
||||
cn='太卜司',
|
||||
cht='太卜司',
|
||||
@ -180,7 +244,7 @@ Luofu_DivinationCommission = MapPlane(
|
||||
jp='太卜司',
|
||||
)
|
||||
Luofu_ArtisanshipCommission = MapPlane(
|
||||
id=23,
|
||||
id=31,
|
||||
name='Luofu_ArtisanshipCommission',
|
||||
cn='工造司',
|
||||
cht='工造司',
|
||||
@ -188,7 +252,7 @@ Luofu_ArtisanshipCommission = MapPlane(
|
||||
jp='工造司',
|
||||
)
|
||||
Luofu_AlchemyCommission = MapPlane(
|
||||
id=24,
|
||||
id=32,
|
||||
name='Luofu_AlchemyCommission',
|
||||
cn='丹鼎司',
|
||||
cht='丹鼎司',
|
||||
@ -196,7 +260,7 @@ Luofu_AlchemyCommission = MapPlane(
|
||||
jp='丹鼎司',
|
||||
)
|
||||
Luofu_ScalegorgeWaterscape = MapPlane(
|
||||
id=25,
|
||||
id=33,
|
||||
name='Luofu_ScalegorgeWaterscape',
|
||||
cn='鳞渊境',
|
||||
cht='鱗淵境',
|
||||
|
Loading…
Reference in New Issue
Block a user