Skip to content

Commit 65af4db

Browse files
authored
Merge pull request #1703 from LmeSzinc/bug_fix
Bug fix
2 parents 166862e + 436d8ab commit 65af4db

9 files changed

Lines changed: 39 additions & 8 deletions

File tree

1.2 KB
Loading
1.2 KB
Loading
1.2 KB
Loading
1.2 KB
Loading

module/map_detection/os_grid.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class OSGridInfo(GridInfo):
1818
is_akashi = False # White question mark '?'
1919
is_scanning_device = False
2020
is_logging_tower = False
21+
is_exploration_reward = False
2122
is_fleet_mechanism = False
2223

2324
is_fleet = False
@@ -35,6 +36,7 @@ def encode(self):
3536
'AK': 'is_akashi',
3637
'SD': 'is_scanning_device',
3738
'LT': 'is_logging_tower',
39+
'ER': 'is_exploration_reward',
3840
'FM': 'is_fleet_mechanism',
3941
}
4042
for key, value in dic.items():
@@ -88,6 +90,9 @@ def merge(self, info, mode='normal'):
8890
if info.is_logging_tower:
8991
self.is_logging_tower = True
9092
return True
93+
if info.is_exploration_reward:
94+
self.is_exploration_reward = True
95+
return True
9196
if info.is_fleet_mechanism:
9297
self.is_fleet_mechanism = True
9398
return True
@@ -131,6 +136,7 @@ def wipe_out(self):
131136
self.is_question = False
132137
self.is_scanning_device = False
133138
self.is_logging_tower = False
139+
self.is_exploration_reward = False
134140
self.is_fleet_mechanism = False
135141

136142
def reset(self):
@@ -154,6 +160,7 @@ def predict(self):
154160
self.is_akashi = self.enemy_genre == 'Akashi'
155161
self.is_scanning_device = self.enemy_genre == 'ScanningDevice'
156162
self.is_logging_tower = self.enemy_genre == 'LoggingTower'
163+
self.is_exploration_reward = self.enemy_genre == 'ExplorationReward'
157164
self.is_current_fleet = self.predict_current_fleet()
158165
self.is_fleet = self.is_current_fleet
159166
self.is_fleet_mechanism = self.predict_fleet_mechanism()
@@ -202,6 +209,7 @@ def predict_sea(self):
202209
'Akashi': TEMPLATE_SIREN_Akashi,
203210
'ScanningDevice': TEMPLATE_ScanningDevice,
204211
'LoggingTower': TEMPLATE_LoggingTower,
212+
'ExplorationReward': TEMPLATE_ExplorationReward,
205213
}
206214
_os_template_enemy_upper = {
207215
'ScanningDevice': TEMPLATE_ScanningDeviceUpper,

module/meowfficer/enhance.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from module.base.button import ButtonGrid
22
from module.base.timer import Timer
3+
from module.handler.assets import GAME_TIPS
34
from module.logger import logger
45
from module.meowfficer.assets import *
56
from module.meowfficer.base import MeowfficerBase
@@ -246,6 +247,9 @@ def meow_enhance_enter(self, skip_first_screenshot=True):
246247
continue
247248
if self.meow_additional():
248249
continue
250+
# Meowfficer enhance tips
251+
if self.appear_then_click(GAME_TIPS, offset=(20, 20), interval=2):
252+
continue
249253

250254
def _meow_enhance(self):
251255
"""

module/os/assets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
SELECT_STRONGHOLD = Button(area={'cn': (89, 251, 166, 269), 'en': (81, 252, 175, 272), 'jp': (89, 251, 167, 269), 'tw': (88, 250, 167, 270)}, color={'cn': (113, 114, 118), 'en': (81, 83, 87), 'jp': (115, 116, 119), 'tw': (103, 105, 108)}, button={'cn': (89, 251, 166, 269), 'en': (81, 252, 175, 272), 'jp': (89, 251, 167, 269), 'tw': (88, 250, 167, 270)}, file={'cn': './assets/cn/os/SELECT_STRONGHOLD.png', 'en': './assets/en/os/SELECT_STRONGHOLD.png', 'jp': './assets/jp/os/SELECT_STRONGHOLD.png', 'tw': './assets/tw/os/SELECT_STRONGHOLD.png'})
2626
STRONGHOLD_PERCENTAGE = Button(area={'cn': (293, 125, 340, 143), 'en': (293, 125, 340, 143), 'jp': (293, 125, 340, 143), 'tw': (293, 125, 340, 143)}, color={'cn': (132, 135, 146), 'en': (132, 135, 146), 'jp': (132, 135, 146), 'tw': (132, 135, 146)}, button={'cn': (293, 125, 340, 143), 'en': (293, 125, 340, 143), 'jp': (293, 125, 340, 143), 'tw': (293, 125, 340, 143)}, file={'cn': './assets/cn/os/STRONGHOLD_PERCENTAGE.png', 'en': './assets/en/os/STRONGHOLD_PERCENTAGE.png', 'jp': './assets/jp/os/STRONGHOLD_PERCENTAGE.png', 'tw': './assets/tw/os/STRONGHOLD_PERCENTAGE.png'})
2727
TEMPLATE_EMPTY_HP = Template(file={'cn': './assets/cn/os/TEMPLATE_EMPTY_HP.png', 'en': './assets/en/os/TEMPLATE_EMPTY_HP.png', 'jp': './assets/jp/os/TEMPLATE_EMPTY_HP.png', 'tw': './assets/tw/os/TEMPLATE_EMPTY_HP.png'})
28+
TEMPLATE_ExplorationReward = Template(file={'cn': './assets/cn/os/TEMPLATE_ExplorationReward.png', 'en': './assets/en/os/TEMPLATE_ExplorationReward.png', 'jp': './assets/jp/os/TEMPLATE_ExplorationReward.png', 'tw': './assets/tw/os/TEMPLATE_ExplorationReward.png'})
2829
TEMPLATE_FleetMechanism = Template(file={'cn': './assets/cn/os/TEMPLATE_FleetMechanism.png', 'en': './assets/en/os/TEMPLATE_FleetMechanism.png', 'jp': './assets/jp/os/TEMPLATE_FleetMechanism.png', 'tw': './assets/tw/os/TEMPLATE_FleetMechanism.png'})
2930
TEMPLATE_LoggingTower = Template(file={'cn': './assets/cn/os/TEMPLATE_LoggingTower.png', 'en': './assets/en/os/TEMPLATE_LoggingTower.png', 'jp': './assets/jp/os/TEMPLATE_LoggingTower.png', 'tw': './assets/tw/os/TEMPLATE_LoggingTower.png'})
3031
TEMPLATE_LoggingTowerUpper = Template(file={'cn': './assets/cn/os/TEMPLATE_LoggingTowerUpper.png', 'en': './assets/en/os/TEMPLATE_LoggingTowerUpper.png', 'jp': './assets/jp/os/TEMPLATE_LoggingTowerUpper.png', 'tw': './assets/tw/os/TEMPLATE_LoggingTowerUpper.png'})

module/os/map.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ def os_map_goto_globe(self, *args, **kwargs):
160160
super().os_map_goto_globe(*args, **kwargs)
161161
return
162162
except RewardUncollectedError:
163-
self.run_auto_search()
163+
# Disable after_auto_search since it will exit current zone.
164+
# Or will cause RecursionError: maximum recursion depth exceeded
165+
self.run_auto_search(rescan=True, after_auto_search=False)
164166
continue
165167

166168
logger.error('Failed to solve uncollected rewards')
@@ -384,7 +386,7 @@ def os_auto_search_daemon(self, drop=None, skip_first_screenshot=True):
384386
"""
385387
logger.hr('OS auto search', level=2)
386388
self._auto_search_battle_count = 0
387-
unlock_checked = True
389+
unlock_checked = False
388390
unlock_check_timer = Timer(5, count=10).start()
389391
self.ash_popup_canceled = False
390392

@@ -501,7 +503,7 @@ def clear_question(self, drop):
501503
'this might be 2 adjacent fleet mechanism, stopped')
502504
return False
503505

504-
def run_auto_search(self, question=True, rescan=None):
506+
def run_auto_search(self, question=True, rescan=None, after_auto_search=True):
505507
"""
506508
Clear current zone by running auto search.
507509
OpSi story mode must be cleared to unlock auto search.
@@ -514,6 +516,8 @@ def run_auto_search(self, question=True, rescan=None):
514516
visit akashi's shop that auto search missed, and unlock mechanism that requires 2 fleets.
515517
516518
This option should be disabled in special tasks like OpsiObscure, OpsiAbyssal, OpsiStronghold.
519+
after_auto_search (bool):
520+
Whether to call handle_after_auto_search() after auto search
517521
"""
518522
if rescan is None:
519523
rescan = self.config.OpsiGeneral_DoRandomMapEvent
@@ -532,11 +536,12 @@ def run_auto_search(self, question=True, rescan=None):
532536

533537
self.hp_reset()
534538
self.hp_get()
535-
if self.is_in_task_explore and not self.zone.is_port:
536-
prev = self.zone
537-
if self.handle_after_auto_search():
538-
self.globe_goto(prev, types='DANGEROUS')
539-
continue
539+
if after_auto_search:
540+
if self.is_in_task_explore and not self.zone.is_port:
541+
prev = self.zone
542+
if self.handle_after_auto_search():
543+
self.globe_goto(prev, types='DANGEROUS')
544+
continue
540545
break
541546

542547
# Rescan
@@ -562,6 +567,17 @@ def map_rescan_current(self, drop=None):
562567
Returns:
563568
bool: If solved a map random event
564569
"""
570+
grids = self.view.select(is_exploration_reward=True)
571+
if 'is_exploration_reward' not in self._solved_map_event and grids and grids[0].is_exploration_reward:
572+
grid = grids[0]
573+
logger.info(f'Found exploration reward on {grid}')
574+
result = self.wait_until_walk_stable(drop=drop, walk_out_of_step=False, confirm_timer=Timer(1.5, count=4))
575+
if 'event' in result:
576+
self._solved_map_event.add('is_exploration_reward')
577+
return True
578+
else:
579+
return False
580+
565581
grids = self.view.select(is_akashi=True)
566582
if 'is_akashi' not in self._solved_map_event and grids and grids[0].is_akashi:
567583
grid = grids[0]

module/os/operation_siren.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def end():
208208
with self.config.multi_set():
209209
self.config.OpsiExplore_LastZone = 0
210210
self.config.task_delay(target=next_reset)
211+
self.config.task_call('OpsiDaily', force_call=False)
212+
self.config.task_call('OpsiShop', force_call=False)
211213
self.config.task_stop()
212214

213215
logger.hr('OS explore', level=1)

0 commit comments

Comments
 (0)