-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtr.py
147 lines (141 loc) · 4.37 KB
/
tr.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 速通配置快速迁移工具
# 可以将速通的配置文件快速迁移到审判庭数据库中
# by DazeCake
import json
from operator import ne
import os
all = []
def transform(start,end,old):
data = json.load(old)
# 进行space[2]-space[1]+1次循环
for index in range(start,end+1):
print('=========================='+str(index)+'==========================')
newData= {
"id": 0,
"name": "string",
"account": "string",
"password": "string",
"server": 0,
"taskType": "daily",
"config": {
"daily": {
"fight": [
],
"sanity": {
"drug": 0,
"stone": 0
},
"mail": True,
"offer": {
"enable": True,
"car": True,
"star4": True,
"star5": False,
"star6": False,
"other": False
},
"friend": True,
"infrastructure": {
"harvest": True,
"shift": True,
"acceleration": True,
"communication": True,
"deputy": False
},
"credit": True,
"task": True,
"activity": True
},
"rogue": {
"operator": {
"index": 0,
"num": 0,
"skill": 0
},
"level": 0,
"coin": 0,
"skip": {
"coin": True,
"beast": True,
"daily": True,
"sensitive": True,
"illusion": True,
"survive": True
}
}
},
"active": {
"monday": {
"enable": True,
"detail": [
]
},
"tuesday": {
"enable": True,
"detail": [
]
},
"wednesday": {
"enable": True,
"detail": [
]
},
"thursday": {
"enable": True,
"detail": [
]
},
"friday": {
"enable": True,
"detail": [
]
},
"saturday": {
"enable": True,
"detail": [
]
},
"sunday": {
"enable": True,
"detail": [
]
}
},
"expireTime": "2022-06-23T04:58:06.454Z",
"delete": 0
}
print('username'+str(index))
for key, value in data.items():
# 遍历data中的每一个key包含“username”的value
if 'username'+str(index) == key:
print('username'+str(index))
# 去除value中#号和后面的内容
newData["account"] = value.split('#')[0]
newData["name"] = value.split('#')[1]
break
for key, value in data.items():
if 'server'+str(index) == key:
newData["server"] = value
break
for key, value in data.items():
if 'multi_account_user'+str(index)+'fight_ui' == key:
newFight = value.split(' ')
for fight in newFight:
# print(fight)
fightMap = {
"level": fight.split('*')[0],
"num": fight.split('*')[1]
}
newData["config"]["daily"]["fight"].append(fightMap)
break
for key, value in data.items():
# 遍历data中的每一个key包含“password”的value
if 'password'+str(index) == key:
newData["password"] = value
# 添加newData到all中
all.append(newData.copy())
break
# 保存all到new.json文件以utf-8编码
with open(os.path.join(os.path.dirname(__file__), 'new.json'), 'w', encoding='utf-8') as f:
# 将all转换为json格式
json.dump(all, f, ensure_ascii=False, indent=4)