- Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathmain.py
More file actions
Latest commit
56 lines (46 loc) · 1.5 KB
/
Copy pathmain.py
File metadata and controls
56 lines (46 loc) · 1.5 KB
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
importtime
fromcommonimporthelper, logger, globle, file
fromgameimportinit, mem
defcheck_windows(model_name) ->int:
"""
读窗口句柄
"""
whileTrue:
result=helper.find_window("地下城与勇士", "地下城与勇士:创新世纪")
ifresultisnotNone:
process_id=helper.get_process_id_by_name(model_name)
ifprocess_id!=0:
logger.info("附加游戏成功", 1)
returnprocess_id
time.sleep(0.2)
definit_config():
"""
全局刷图计次初始化
"""
count_cfg_name="C:\\config.ini"
conf_exists=file.path_exists(count_cfg_name)
ifnotconf_exists:
file.write_ini(count_cfg_name, "default", "count", "0")
defmain():
globle.cmd="cmd"
model_name="DNF.exe"
process_id=helper.get_process_id_by_name(model_name)
ifprocess_id==0:
logger.info("等待游戏运行...", 1)
process_id=check_windows(model_name)
mem.set_process_id(process_id)
# 判断是否有图标
ifmem.read_int(0x140000000) !=9460301:
raiseException("无读写权限")
# 初始化全局空白地址
init.init_empty_addr()
logger.info("加载成功-欢迎使用", 1)
logger.info("当前时间:{}".format(helper.get_now_date()), 1)
init.hotkey()
if__name__=='__main__':
try:
main()
exceptKeyboardInterruptase:
print("信道推出")
exceptExceptionaserr:
helper.print_trace("main", err)