-
Notifications
You must be signed in to change notification settings - Fork 93
/
start_task.py
126 lines (91 loc) · 2.46 KB
/
start_task.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# -*- coding: utf-8 -*-
"""
@file: start_task.py
@time: 2024/8/30 上午3:22
@author: sMythicalBird
"""
from threading import Thread
from pynput.keyboard import Key, Listener
from utils.task import task_zero, task_money, task_code, task_fight, task_daily
# 测试更新情况
def key_event(task):
def on_press(key):
if key == Key.f12:
task.stop()
return False
if key == Key.f11:
task.pause()
if key == Key.f10:
task.restart()
return None
with Listener(on_press=on_press) as listener:
listener.join()
# 任务——零号空洞
def zero_task():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_zero,))
key_thread.start()
# 导入任务
import event_handling.zero
import event_handling.fight.fight_zero
# 任务开始
task_zero.run()
# 任务-拿命验收
def money_task():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_money,))
key_thread.start()
# 导入任务
import event_handling.money
# 任务开始
task_money.run()
def fight_task():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_fight,))
key_thread.start()
# 导入任务
import event_handling.fight.fight_only
# 任务开始
task_fight.run()
# 任务——兑换码
def redemption_code():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_code,))
key_thread.start()
# 导入任务
import event_handling.code
# 任务开始
task_code.run()
# 自动化日常任务
def daily():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_daily,))
key_thread.start()
# 导入任务
import event_handling.daily
# 任务开始
task_daily.run()
def new_account():
# 监听运行状态
key_thread = Thread(target=key_event, args=(task_daily,))
key_thread.start()
# 导入任务
import event_handling.test
# 任务开始
task_daily.run()
def start_task(action):
if action == "zero":
print("start zero task")
zero_task()
elif action == "money":
print("start money task")
money_task()
elif action == "fight":
print("start fight task")
fight_task()
elif action == "daily":
print("start daily task")
daily()
if __name__ == '__main__':
start_task('daily')
# new_account()