Skip to content

Commit 34490c1

Browse files
committed
重构逻辑
1 parent 0f5d34f commit 34490c1

23 files changed

Lines changed: 392 additions & 244 deletions

assets/images/1.png

14.7 KB
Loading

assets/result.json

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,46 +50,50 @@
5050
},
5151
{
5252
"id": 1,
53-
"name": "lv_text"
53+
"name": "drop_item_2000"
5454
},
5555
{
5656
"id": 2,
57-
"name": "percentage_icon"
57+
"name": "lv_text"
5858
},
5959
{
6060
"id": 3,
61-
"name": "quit_big_icon"
61+
"name": "percentage_icon"
6262
},
6363
{
6464
"id": 4,
65-
"name": "quit_icon"
65+
"name": "quit_big_icon"
6666
},
6767
{
6868
"id": 5,
69-
"name": "retry_icon"
69+
"name": "quit_icon"
7070
},
7171
{
7272
"id": 6,
73-
"name": "rogue_dialog"
73+
"name": "retry_icon"
7474
},
7575
{
7676
"id": 7,
77-
"name": "rogue_gift"
77+
"name": "rogue_dialog"
7878
},
7979
{
8080
"id": 8,
81-
"name": "serum_icon"
81+
"name": "rogue_gift"
8282
},
8383
{
8484
"id": 9,
85+
"name": "serum_icon"
86+
},
87+
{
88+
"id": 10,
8589
"name": "start_icon"
8690
}
8791
],
8892
"annotations": [
8993
{
9094
"id": 0,
9195
"image_id": 0,
92-
"category_id": 1,
96+
"category_id": 2,
9397
"segmentation": [],
9498
"bbox": [
9599
118.0636168317864,
@@ -119,7 +123,7 @@
119123
{
120124
"id": 2,
121125
"image_id": 1,
122-
"category_id": 9,
126+
"category_id": 10,
123127
"segmentation": [],
124128
"bbox": [
125129
1310.1749049429657,
@@ -133,8 +137,23 @@
133137
},
134138
{
135139
"id": 3,
140+
"image_id": 1,
141+
"category_id": 1,
142+
"segmentation": [],
143+
"bbox": [
144+
1711.8403831039573,
145+
623.1010910848565,
146+
95.35907513336606,
147+
63.57271675557723
148+
],
149+
"ignore": 0,
150+
"iscrowd": 0,
151+
"area": 6062.235473527289
152+
},
153+
{
154+
"id": 4,
136155
"image_id": 2,
137-
"category_id": 5,
156+
"category_id": 6,
138157
"segmentation": [],
139158
"bbox": [
140159
1648.912547528517,
@@ -147,9 +166,9 @@
147166
"area": 2004.8602119446582
148167
},
149168
{
150-
"id": 4,
169+
"id": 5,
151170
"image_id": 2,
152-
"category_id": 4,
171+
"category_id": 5,
153172
"segmentation": [],
154173
"bbox": [
155174
2084.988593155894,
@@ -162,9 +181,9 @@
162181
"area": 1591.7604707311048
163182
},
164183
{
165-
"id": 5,
184+
"id": 6,
166185
"image_id": 3,
167-
"category_id": 3,
186+
"category_id": 4,
168187
"segmentation": [],
169188
"bbox": [
170189
2322.494296577947,
@@ -177,9 +196,9 @@
177196
"area": 6503.478494701384
178197
},
179198
{
180-
"id": 6,
199+
"id": 7,
181200
"image_id": 4,
182-
"category_id": 2,
201+
"category_id": 3,
183202
"segmentation": [],
184203
"bbox": [
185204
451.6147162797465,
@@ -192,9 +211,9 @@
192211
"area": 1006.7143877706319
193212
},
194213
{
195-
"id": 7,
214+
"id": 8,
196215
"image_id": 5,
197-
"category_id": 6,
216+
"category_id": 7,
198217
"segmentation": [],
199218
"bbox": [
200219
1504.8517110266162,
@@ -207,9 +226,9 @@
207226
"area": 1288.5680001156572
208227
},
209228
{
210-
"id": 8,
229+
"id": 9,
211230
"image_id": 5,
212-
"category_id": 7,
231+
"category_id": 8,
213232
"segmentation": [],
214233
"bbox": [
215234
1504.8517110266162,
@@ -222,9 +241,9 @@
222241
"area": 1515.962353077242
223242
},
224243
{
225-
"id": 9,
244+
"id": 10,
226245
"image_id": 6,
227-
"category_id": 8,
246+
"category_id": 9,
228247
"segmentation": [],
229248
"bbox": [
230249
56.108457166215146,
@@ -243,6 +262,6 @@
243262
"description": "",
244263
"contributor": "Label Studio",
245264
"url": "",
246-
"date_created": "2025-11-06 05:31:40.249476"
265+
"date_created": "2025-11-08 02:02:35.391865"
247266
}
248267
}

src/config.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
'Geniemon Key': 'z',
1313
}, description='In Game Hotkey for Skills')
1414

15-
hint_config_option = ConfigOption('挂机设置', { #全局配置示例
15+
afk_config_option = ConfigOption('挂机设置', { #全局配置示例
1616
'提示音': 2,
17+
'弹出通知': True,
18+
'防止鼠标干扰': False,
1719
}, description='挂机相关设置', config_description={
1820
'提示音': '单次提示响几次',
21+
'弹出通知': '是否弹出windows通知',
22+
'防止鼠标干扰': '推荐在不使用电脑时开启,启动任务时会将鼠标移动到安全位置',
1923
})
2024

2125

@@ -57,7 +61,7 @@ def make_bottom_right_black(frame): #可选. 某些游戏截图时遮挡UID使
5761
'debug': False, # Optional, default: False
5862
'use_gui': True, # 目前只支持True
5963
'config_folder': 'configs', #最好不要修改
60-
'global_configs': [key_config_option, hint_config_option],
64+
'global_configs': [key_config_option, afk_config_option],
6165
'screenshot_processor': make_bottom_right_black, # 在截图的时候对frame进行修改, 可选
6266
'gui_icon': 'icons/icon.png', #窗口图标, 最好不需要修改文件名
6367
'wait_until_before_delay': 0,

src/tasks/Auto65ArtifactTask.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ def __init__(self, *args, **kwargs):
2525
'任务超时时间': '放弃任务前等待的秒数',
2626
})
2727
self.setup_commission_config()
28-
self.default_config.pop('启用自动穿引共鸣', None)
28+
self.default_config.pop("启用自动穿引共鸣", None)
29+
self.default_config.pop("自动选择首个密函和密函奖励", None)
2930
self.name = "自动65级魔之楔本"
3031
self.action_timeout = 10
3132

3233
def run(self):
3334
DNAOneTimeTask.run(self)
35+
self.move_mouse_to_safe_position()
3436
try:
3537
return self.do_run()
3638
except TaskDisabledException as e:

src/tasks/Auto70jjbTask.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,22 @@ def __init__(self, *args, **kwargs):
2929
'波次超时时间': '超时后将重启',
3030
}
3131
self.setup_commission_config()
32+
self.default_config.pop("启用自动穿引共鸣", None)
33+
self.default_config.pop("自动选择首个密函和密函奖励", None)
3234
self.name = "自动70级皎皎币本"
3335
self.action_timeout = 10
3436
self.quick_move_task = QuickMoveTask(self)
3537

3638
def run(self):
3739
DNAOneTimeTask.run(self)
40+
self.move_mouse_to_safe_position()
3841
try:
3942
return self.do_run()
4043
except TaskDisabledException as e:
4144
pass
4245
except Exception as e:
4346
logger.error('AutoDefence error', e)
4447
raise
45-
self.quick_move_task.stop()
4648

4749
def do_run(self):
4850
self.init_param()
@@ -51,7 +53,6 @@ def do_run(self):
5153
_wait_next_wave = False
5254
_skill_time = 0
5355
_wave_start = 0
54-
self.quick_move_task.stop()
5556
if self.in_team():
5657
self.open_in_mission_menu()
5758
self.sleep(0.5)
@@ -76,9 +77,10 @@ def do_run(self):
7677
_status = self.handle_mission_interface(stop_func=self.stop_func)
7778
if _status == Mission.START or _status == Mission.STOP:
7879
if _status == Mission.STOP:
79-
self.restart_mission()
80-
self.log_info('任务中止,已重启')
80+
self.quit_mission()
81+
self.log_info('任务中止')
8182
self.init_param()
83+
continue
8284
else:
8385
self.log_info('任务完成')
8486
self.wait_until(self.in_team, time_out=30)
@@ -97,7 +99,6 @@ def init_param(self):
9799
self.stop_mission = False
98100
self.current_round = -1
99101
self.current_wave = -1
100-
self.quick_move_task.stop()
101102

102103
def stop_func(self):
103104
self.get_round_info()

src/tasks/AutoDefence.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from qfluentwidgets import FluentIcon
22
import time
3-
import cv2
4-
import re
53

64
from ok import Logger, TaskDisabledException, Box
75
from src.tasks.DNAOneTimeTask import DNAOneTimeTask
@@ -21,24 +19,24 @@ def __init__(self, *args, **kwargs):
2119
'波次超时时间': 90,
2220
})
2321
self.config_description = {
24-
'轮次': '打几个轮次',
25-
'波次超时时间': '超时后将发出提示',
22+
"轮次": "打几个轮次",
23+
"波次超时时间": "超时后将发出提示",
2624
}
2725
self.setup_commission_config()
2826
self.name = "自动扼守"
2927
self.action_timeout = 10
3028
self.quick_move_task = QuickMoveTask(self)
31-
29+
3230
def run(self):
3331
DNAOneTimeTask.run(self)
32+
self.move_mouse_to_safe_position()
3433
try:
3534
return self.do_run()
3635
except TaskDisabledException as e:
3736
pass
3837
except Exception as e:
39-
logger.error('AutoDefence error', e)
38+
logger.error("AutoDefence error", e)
4039
raise
41-
self.quick_move_task.stop()
4240

4341
def do_run(self):
4442
self.init_param()
@@ -51,34 +49,35 @@ def do_run(self):
5149
if self.in_team():
5250
self.get_wave_info()
5351
if self.current_wave != -1:
54-
self.quick_move_task.stop()
5552
if self.current_wave != _wave:
5653
_wave = self.current_wave
5754
_wave_start = time.time()
5855
_wait_next_wave = False
56+
self.quick_move_task.reset()
5957

60-
if not _wait_next_wave and time.time() - _wave_start >= self.config.get('波次超时时间', 120):
61-
self.log_info('任务超时', notify=True)
58+
if (not _wait_next_wave
59+
and time.time() - _wave_start >= self.config.get("波次超时时间", 120)
60+
):
61+
self.log_info_notify("任务超时")
6262
self.soundBeep()
6363
_wait_next_wave = True
6464

6565
if not _wait_next_wave:
6666
_skill_time = self.use_skill(_skill_time)
6767
else:
6868
self.quick_move_task.run()
69-
69+
7070
_status = self.handle_mission_interface(stop_func=self.stop_func)
7171
if _status == Mission.START:
72-
self.log_info('任务完成', notify=True)
73-
self.soundBeep()
7472
self.init_param()
75-
elif _status == Mission.STOP:
76-
self.restart_mission()
77-
self.log_info('任务中止,已重启', notify=True)
73+
self.log_info_notify("任务完成")
7874
self.soundBeep()
75+
elif _status == Mission.STOP:
76+
self.quit_mission()
7977
self.init_param()
78+
self.log_info("任务中止")
8079
elif _status == Mission.CONTINUE:
81-
self.log_info('任务继续')
80+
self.log_info("任务继续")
8281
self.wait_until(self.in_team, time_out=30)
8382
self.current_wave = -1
8483

@@ -88,10 +87,9 @@ def init_param(self):
8887
self.stop_mission = False
8988
self.current_round = -1
9089
self.current_wave = -1
91-
self.quick_move_task.stop()
9290

9391
def stop_func(self):
9492
self.get_round_info()
95-
n = self.config.get('轮次', 3)
93+
n = self.config.get("轮次", 3)
9694
if n == 1 or self.current_round >= n:
9795
return True

0 commit comments

Comments
 (0)