Skip to content

Commit 9977012

Browse files
committed
bug fix
1 parent d3224d5 commit 9977012

5 files changed

Lines changed: 33 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ jobs:
7474
- name: Build with PyAppify Action
7575
id: build-app
7676
uses: ok-oldking/pyappify-action@master #使用pyappify打包exe
77-
# with:
78-
# # 使用上一个稳定版本的 Release 来获取已打包的启动器,从而跳过耗时的打包过程
79-
# use_release: https://api.github.com/repos/BnanZ0/ok-duet-night-abyss/releases/tags/v1.0.12
77+
with:
78+
# 使用上一个稳定版本的 Release 来获取已打包的启动器,从而跳过耗时的打包过程
79+
use_release: https://api.github.com/repos/BnanZ0/ok-duet-night-abyss/releases/tags/v1.0.18
8080

8181
- name: Release
8282
uses: softprops/action-gh-release@v2

src/tasks/AutoDefence.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ def do_run(self):
9191
if _status == Mission.START:
9292
self.wait_until(self.in_team, time_out=30)
9393
self.sleep(2)
94-
if self.external_movement() == False:
94+
if self.external_movement is not _default_movement:
95+
self.log_info("任务开始")
96+
if not self.external_movement():
97+
self.open_in_mission_menu()
98+
else:
9599
self.log_info_notify("任务开始")
96100
self.soundBeep()
97-
else:
98-
self.log_info("任务开始")
99101
self.init_param()
100102
elif _status == Mission.STOP:
101103
self.quit_mission()

src/tasks/AutoExploration.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ def do_run(self):
8787
if _status == Mission.START:
8888
self.wait_until(self.in_team, time_out=30)
8989
self.sleep(2)
90-
if self.external_movement() == False:
90+
if self.external_movement is not _default_movement:
91+
self.log_info("任务开始")
92+
if not self.external_movement():
93+
self.open_in_mission_menu()
94+
else:
9195
self.log_info_notify("任务开始")
9296
self.soundBeep()
93-
else:
94-
self.log_info("任务开始")
9597
_start_time = 0
9698
elif _status == Mission.STOP:
9799
self.quit_mission()

src/tasks/BaseDNATask.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def move_back_from_safe_position(self):
104104

105105
def check_for_monthly_card(self):
106106
if self.should_check_monthly_card():
107-
self.handle_monthly_card()
107+
start = time.time()
108+
ret = self.handle_monthly_card()
109+
cost = time.time() - start
110+
return ret, cost
108111
# start = time.time()
109112
# logger.info(f'check_for_monthly_card start check')
110113
# if self.in_combat():
@@ -116,7 +119,7 @@ def check_for_monthly_card(self):
116119
# logger.info(f'wait monthly card end {monthly_card}')
117120
# cost = time.time() - start
118121
# return cost
119-
return 0
122+
return False, 0
120123

121124
def should_check_monthly_card(self):
122125
if self.next_monthly_card_start > 0:

src/tasks/ImportTask.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
logger = Logger.get_logger(__name__)
2424

25+
class MacroFailedException(Exception):
26+
"""外部脚本失败异常。"""
27+
pass
2528

2629
class ImportTask(DNAOneTimeTask, CommissionsTask, BaseCombatTask):
2730

@@ -74,6 +77,7 @@ def run(self):
7477
self.img = self.load_png_files(f'{path}\mod\{self.config.get('外部文件夹')}\map')
7578
DNAOneTimeTask.run(self)
7679
self.move_mouse_to_safe_position()
80+
self.set_check_monthly_card()
7781
_to_do_task = self
7882
try:
7983
if self.config.get('副本类型') == '扼守无尽':
@@ -131,7 +135,8 @@ def do_run(self):
131135
self.log_info('任务完成')
132136
self.wait_until(self.in_team, time_out=30)
133137
self.sleep(2)
134-
self.walk_to_aim()
138+
if not self.walk_to_aim():
139+
self.open_in_mission_menu()
135140
_wave_start = time.time()
136141
_delay_task_start = _wave_start + 1
137142
self.current_wave = -1
@@ -198,7 +203,13 @@ def walk_to_aim(self, former_index = None):
198203
return True
199204
if map_index is not None:
200205
self.log_info(f'执行{map_index}')
201-
self.play_macro_actions(map_index)
206+
try:
207+
self.play_macro_actions(map_index)
208+
except MacroFailedException:
209+
return False
210+
except Exception as e:
211+
logger.error("ImportTask error", e)
212+
raise
202213
former_index = map_index
203214
else:
204215
return True
@@ -249,6 +260,8 @@ def play_macro_actions(self, map_index):
249260
start = time.time()
250261
for i, action in enumerate(actions):
251262
while time.time()-start < action['time']:
263+
if self.check_for_monthly_card()[0]:
264+
raise MacroFailedException
252265
self.next_frame()
253266
if action['type'] == "delay":
254267
self.delay_index = map_index

0 commit comments

Comments
 (0)