76 lines
1.7 KiB
Plaintext
76 lines
1.7 KiB
Plaintext
|
#!/usr/bin/env python
|
||
|
|
||
|
import json
|
||
|
import sys
|
||
|
|
||
|
raw_json = json.load(sys.stdin)
|
||
|
|
||
|
tags = {
|
||
|
1: "Guard",
|
||
|
2: "Sniper",
|
||
|
3: "Defender",
|
||
|
4: "Medic",
|
||
|
5: "Supporter",
|
||
|
6: "Caster",
|
||
|
7: "Specialist",
|
||
|
8: "Vanguard",
|
||
|
9: "Melee",
|
||
|
10: "Ranged",
|
||
|
11: "Top Operator",
|
||
|
12: "Crowd-Control",
|
||
|
13: "Nuker",
|
||
|
14: "Senior Operator",
|
||
|
15: "Healing",
|
||
|
16: "Support",
|
||
|
17: "Starter",
|
||
|
18: "DP-Recovery",
|
||
|
19: "DPS",
|
||
|
20: "Survival",
|
||
|
21: "AoE",
|
||
|
22: "Defense",
|
||
|
23: "Slow",
|
||
|
24: "Debuff",
|
||
|
25: "Fast-Redeploy",
|
||
|
26: "Shift",
|
||
|
27: "Summon",
|
||
|
28: "Robot"
|
||
|
}
|
||
|
|
||
|
char_data = {}
|
||
|
en_recruitable = {}
|
||
|
cn_recruitable = {}
|
||
|
for key, entry in raw_json.items():
|
||
|
parsed_data = {
|
||
|
"stars": entry["star"],
|
||
|
"tags": entry["tags"],
|
||
|
# 0 = headhunt only, 1 = china only, 2 = global
|
||
|
"recruitment": min(len(entry["recruitment"]), 2)
|
||
|
}
|
||
|
op_name = entry["appellation"]
|
||
|
char_data[op_name] = parsed_data
|
||
|
|
||
|
if parsed_data["recruitment"] == 2:
|
||
|
for tag in entry["tags"]:
|
||
|
if tags[tag] not in en_recruitable:
|
||
|
en_recruitable[tags[tag]] = []
|
||
|
if tags[tag] not in cn_recruitable:
|
||
|
cn_recruitable[tags[tag]] = []
|
||
|
|
||
|
en_recruitable[tags[tag]].append(op_name)
|
||
|
cn_recruitable[tags[tag]].append(op_name)
|
||
|
elif parsed_data["recruitment"] == 1:
|
||
|
for tag in entry["tags"]:
|
||
|
if tags[tag] not in cn_recruitable:
|
||
|
cn_recruitable[tags[tag]] = []
|
||
|
cn_recruitable[tags[tag]].append(op_name)
|
||
|
|
||
|
project_root = sys.argv[1]
|
||
|
|
||
|
with open(project_root + "/aux/char_data.json", "w") as f:
|
||
|
f.write(json.dumps(char_data))
|
||
|
|
||
|
with open(project_root + "/aux/en_recruitable.json", "w") as f:
|
||
|
f.write(json.dumps(en_recruitable))
|
||
|
|
||
|
with open(project_root + "/aux/cn_recruitable.json", "w") as f:
|
||
|
f.write(json.dumps(cn_recruitable))
|