Skip to content

Commit 6f45c8b

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e761356 + ad623f6 commit 6f45c8b

13 files changed

Lines changed: 91 additions & 63 deletions

File tree

module/config/argument/args.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7933,7 +7933,8 @@
79337933
"option": [
79347934
2,
79357935
3,
7936-
4
7936+
4,
7937+
5
79377938
]
79387939
},
79397940
"ShipIndex": {
@@ -7968,7 +7969,8 @@
79687969
2,
79697970
3,
79707971
4,
7971-
5
7972+
5,
7973+
6
79727974
]
79737975
},
79747976
"ShipIndex": {

module/config/argument/argument.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ CoreShop:
553553
ShipyardDr:
554554
ResearchSeries:
555555
value: 2
556-
option: [ 2, 3, 4 ]
556+
option: [ 2, 3, 4, 5 ]
557557
ShipIndex:
558558
value: 0
559559
option: [ 0, 1, 2, 3, 4, 5, 6 ]
@@ -562,7 +562,7 @@ ShipyardDr:
562562
Shipyard:
563563
ResearchSeries:
564564
value: 1
565-
option: [ 1, 2, 3, 4, 5 ]
565+
option: [ 1, 2, 3, 4, 5, 6 ]
566566
ShipIndex:
567567
value: 0
568568
option: [ 0, 1, 2, 3, 4, 5, 6 ]

module/config/config_generated.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,13 @@ class GeneratedConfig:
299299
CoreShop_Filter = 'Array'
300300

301301
# Group `ShipyardDr`
302-
ShipyardDr_ResearchSeries = 2 # 2, 3, 4
302+
ShipyardDr_ResearchSeries = 2 # 2, 3, 4, 5
303303
ShipyardDr_ShipIndex = 0 # 0, 1, 2, 3, 4, 5, 6
304304
ShipyardDr_BuyAmount = 2
305305
ShipyardDr_LastRun = datetime.datetime(2020, 1, 1, 0, 0)
306306

307307
# Group `Shipyard`
308-
Shipyard_ResearchSeries = 1 # 1, 2, 3, 4, 5
308+
Shipyard_ResearchSeries = 1 # 1, 2, 3, 4, 5, 6
309309
Shipyard_ShipIndex = 0 # 0, 1, 2, 3, 4, 5, 6
310310
Shipyard_BuyAmount = 2
311311
Shipyard_LastRun = datetime.datetime(2020, 1, 1, 0, 0)

module/config/i18n/en-US.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,8 @@
18991899
"help": "",
19001900
"2": "DR2",
19011901
"3": "DR3",
1902-
"4": "DR4"
1902+
"4": "DR4",
1903+
"5": "DR5"
19031904
},
19041905
"ShipIndex": {
19051906
"name": "Ship Index",
@@ -1933,7 +1934,8 @@
19331934
"2": "PR2",
19341935
"3": "PR3",
19351936
"4": "PR4",
1936-
"5": "PR5"
1937+
"5": "PR5",
1938+
"6": "PR6"
19371939
},
19381940
"ShipIndex": {
19391941
"name": "Ship Index",

module/config/i18n/ja-JP.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,8 @@
18991899
"help": "ShipyardDr.ResearchSeries.help",
19001900
"2": "2",
19011901
"3": "3",
1902-
"4": "4"
1902+
"4": "4",
1903+
"5": "5"
19031904
},
19041905
"ShipIndex": {
19051906
"name": "ShipyardDr.ShipIndex.name",
@@ -1933,7 +1934,8 @@
19331934
"2": "2",
19341935
"3": "3",
19351936
"4": "4",
1936-
"5": "5"
1937+
"5": "5",
1938+
"6": "6"
19371939
},
19381940
"ShipIndex": {
19391941
"name": "Shipyard.ShipIndex.name",

module/config/i18n/zh-CN.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,8 @@
18991899
"help": "",
19001900
"2": "二期科研",
19011901
"3": "三期科研",
1902-
"4": "四期科研"
1902+
"4": "四期科研",
1903+
"5": "五期科研"
19031904
},
19041905
"ShipIndex": {
19051906
"name": "舰船序号",
@@ -1933,7 +1934,8 @@
19331934
"2": "二期科研",
19341935
"3": "三期科研",
19351936
"4": "四期科研",
1936-
"5": "五期科研"
1937+
"5": "五期科研",
1938+
"6": "六期科研"
19371939
},
19381940
"ShipIndex": {
19391941
"name": "舰船序号",

module/config/i18n/zh-TW.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,8 @@
18991899
"help": "",
19001900
"2": "二期科研",
19011901
"3": "三期科研",
1902-
"4": "四期科研"
1902+
"4": "四期科研",
1903+
"5": "五期科研"
19031904
},
19041905
"ShipIndex": {
19051906
"name": "艦船序號",
@@ -1933,7 +1934,8 @@
19331934
"2": "二期科研",
19341935
"3": "三期科研",
19351936
"4": "四期科研",
1936-
"5": "五期科研"
1937+
"5": "五期科研",
1938+
"6": "六期科研"
19371939
},
19381940
"ShipIndex": {
19391941
"name": "艦船序號",

module/handler/auto_search.py

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from module.base.button import ButtonGrid
44
from module.base.decorator import Config
5+
from module.base.timer import Timer
56
from module.handler.assets import *
67
from module.handler.enemy_searching import EnemySearchingHandler
78
from module.logger import logger
@@ -49,21 +50,14 @@ def _fleet_sidebar(self):
4950
origin=(1185, 155 + offset), delta=(0, 111),
5051
button_shape=(53, 104), grid_shape=(1, 3), name='FLEET_SIDEBAR')
5152

52-
def _fleet_preparation_sidebar_click(self, index):
53+
def _fleet_preparation_get(self):
5354
"""
54-
Args:
55-
index (int):
55+
Returns:
56+
int:
5657
1 for formation
5758
2 for meowfficers
5859
3 for auto search setting
59-
60-
Returns:
61-
bool: If changed.
6260
"""
63-
if index <= 0 or index > 3:
64-
logger.warning(f'Sidebar index cannot be clicked, {index}, limit to 1 through 5 only')
65-
return False
66-
6761
current = 0
6862
total = 0
6963
sidebar = self._fleet_sidebar()
@@ -81,46 +75,38 @@ def _fleet_preparation_sidebar_click(self, index):
8175
if not current:
8276
logger.warning('No fleet sidebar active.')
8377
logger.attr('Fleet_sidebar', f'{current}/{total}')
84-
if current == index:
85-
return False
78+
return current
8679

87-
self.device.click(sidebar[0, index - 1])
88-
return True
89-
90-
def fleet_preparation_sidebar_ensure(self, index, skip_first_screenshot=True):
80+
def fleet_preparation_sidebar_ensure(self, index):
9181
"""
9282
Args:
9383
index (int):
9484
1 for formation
9585
2 for meowfficers
9686
3 for auto search setting
97-
skip_first_screenshot (bool):
9887
99-
Returns:
100-
bool: whether sidebar could be ensured
101-
at most 3 attempts are made before
102-
return False otherwise True
88+
Returns:
89+
bool: whether sidebar could be ensured
90+
at most 3 attempts are made before
91+
return False otherwise True
10392
"""
10493
if index <= 0 or index > 5:
10594
logger.warning(f'Sidebar index cannot be ensured, {index}, limit 1 through 5 only')
10695
return False
10796

108-
counter = 0
109-
while 1:
110-
if skip_first_screenshot:
111-
skip_first_screenshot = False
112-
else:
113-
self.device.screenshot()
114-
115-
if self._fleet_preparation_sidebar_click(index):
116-
if counter >= 2:
117-
logger.warning('Sidebar could not be ensured')
118-
return False
119-
counter += 1
120-
self.device.sleep((0.3, 0.5))
121-
continue
122-
else:
97+
interval = Timer(1, count=2)
98+
sidebar = self._fleet_sidebar()
99+
for _ in self.loop(timeout=3):
100+
current = self._fleet_preparation_get()
101+
if current == index:
123102
return True
103+
if interval.reached():
104+
self.device.click(sidebar[0, index - 1])
105+
interval.reset()
106+
continue
107+
else:
108+
logger.warning('Sidebar could not be ensured')
109+
return False
124110

125111
def _auto_search_set_click(self, setting):
126112
"""

module/minigame/minigame.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from module.logger import logger
44
from module.minigame.assets import *
55
from module.ocr.ocr import Digit
6-
from module.ui.assets import GAME_ROOM_CHECK
7-
from module.ui.page import page_game_room
6+
from module.ui.assets import ACADEMY_GOTO_GAME_ROOM, GAME_ROOM_CHECK
7+
from module.ui.page import page_academy, page_game_room
88
from module.ui.scroll import Scroll
99
from module.ui.ui import UI
1010

@@ -131,6 +131,7 @@ def go_to_main_page(self, skip_first_screenshot=True):
131131
in: page_game_room main_page/choose_game_page
132132
out: page_game_room main_page
133133
"""
134+
logger.info('minigame go_to_main_page')
134135
while 1:
135136
if skip_first_screenshot:
136137
skip_first_screenshot = False
@@ -183,8 +184,19 @@ def run(self):
183184
in: Any page
184185
out: page_game_room
185186
"""
187+
# TEMP: 2026.02.18 separate self.ui_ensure(page_game_room) into 2 steps
188+
# EN has different page_academy detection, to use ui_ensure(page_game_room),
189+
# ui_goto must use `if self.ui_page_appear(page)` instead of `if self.appear(page.check_button)`
190+
# But that would cause page_main/page_main_white clicking a static switch button
191+
self.ui_ensure(page_academy)
192+
# page_academy -> page_game_room
193+
for _ in self.loop():
194+
if self.ui_page_appear(page_game_room):
195+
break
196+
if self.ui_page_appear(page_academy, interval=5):
197+
self.device.click(ACADEMY_GOTO_GAME_ROOM)
198+
continue
186199

187-
self.ui_ensure(page_game_room)
188200
# game room and choose game have same header, go to game room first
189201
self.go_to_main_page()
190202
coin_collected = False

module/os/map_operation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_zone_name(self):
4747
name = ocr.ocr(self.device.image)
4848
name = "".join(name.split())
4949
name = name.lower()
50-
name = name.strip('\\/-')
50+
name = name.strip('\\/-—–-')
5151
if '-' in name:
5252
name = name.split('-')[0]
5353
if 'é' in name: # Méditerranée name maps
@@ -80,7 +80,7 @@ def get_zone_name(self):
8080
# For JP only
8181
ocr = Ocr(MAP_NAME, lang='jp', letter=(157, 173, 192), threshold=127, name='OCR_OS_MAP_NAME')
8282
name = ocr.ocr(self.device.image)
83-
name = name.strip('\\/-')
83+
name = name.strip('\\/-—–-')
8484
self.is_zone_name_hidden = '安全' in name
8585
# Remove punctuations
8686
for char in '・':
@@ -109,7 +109,7 @@ def get_zone_name(self):
109109
# For TW only
110110
ocr = Ocr(MAP_NAME, lang='tw', letter=(198, 215, 239), threshold=127, name='OCR_OS_MAP_NAME')
111111
name = ocr.ocr(self.device.image)
112-
name = name.strip('\\/-')
112+
name = name.strip('\\/-—–-')
113113
self.is_zone_name_hidden = '安全' in name
114114
# Remove '塞壬要塞海域'
115115
if '塞' in name:
@@ -123,7 +123,7 @@ def get_zone_name(self):
123123
# For CN only
124124
ocr = Ocr(MAP_NAME, lang='cnocr', letter=(214, 231, 255), threshold=127, name='OCR_OS_MAP_NAME')
125125
name = ocr.ocr(self.device.image)
126-
name = name.strip('\\/-')
126+
name = name.strip('\\/-—–-')
127127
self.is_zone_name_hidden = '安全' in name
128128
if '-' in name:
129129
name = name.split('-')[0]

0 commit comments

Comments
 (0)