mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 02:23:01 +08:00
Merge branch 'dev' of https://github.com/MaaAssistantArknights/MaaAssistantArknights into dev
This commit is contained in:
@@ -181,7 +181,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Castle-3",
|
||||
"level": 2,
|
||||
"level": 1,
|
||||
"skill": 0
|
||||
},
|
||||
{
|
||||
@@ -391,7 +391,7 @@
|
||||
},
|
||||
{
|
||||
"name": "黑角",
|
||||
"level": 3,
|
||||
"level": 2,
|
||||
"skill": 0
|
||||
},
|
||||
{
|
||||
@@ -462,7 +462,7 @@
|
||||
},
|
||||
{
|
||||
"name": "拜松",
|
||||
"level": 4,
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
},
|
||||
{
|
||||
@@ -499,6 +499,11 @@
|
||||
"name": "吽",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
},
|
||||
{
|
||||
"name": "车尔尼",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
}
|
||||
],
|
||||
"Sniper": [
|
||||
@@ -689,6 +694,16 @@
|
||||
"name": "正义骑士号",
|
||||
"level": 1,
|
||||
"skill": 0
|
||||
},
|
||||
{
|
||||
"name": "承曦格雷伊",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
},
|
||||
{
|
||||
"name": "迷迭香",
|
||||
"level": 6,
|
||||
"skill": 2
|
||||
}
|
||||
],
|
||||
"Caster": [
|
||||
@@ -856,6 +871,16 @@
|
||||
"name": "特米米",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
},
|
||||
{
|
||||
"name": "星源",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
},
|
||||
{
|
||||
"name": "黑键",
|
||||
"level": 6,
|
||||
"skill": 2
|
||||
}
|
||||
],
|
||||
"Special": [
|
||||
@@ -992,8 +1017,13 @@
|
||||
},
|
||||
{
|
||||
"name": "THRM-EX",
|
||||
"level": 2,
|
||||
"level": 1,
|
||||
"skill": 0
|
||||
},
|
||||
{
|
||||
"name": "多萝西_N",
|
||||
"level": 6,
|
||||
"skill": 2
|
||||
}
|
||||
],
|
||||
"Medic": [
|
||||
@@ -1116,8 +1146,13 @@
|
||||
},
|
||||
{
|
||||
"name": "Lancet-2",
|
||||
"level": 2,
|
||||
"level": 1,
|
||||
"skill": 0
|
||||
},
|
||||
{
|
||||
"name": "濯尘芙蓉",
|
||||
"level": 5,
|
||||
"skill": 2
|
||||
}
|
||||
],
|
||||
"Support": [
|
||||
@@ -1262,4 +1297,4 @@
|
||||
"skill": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ bool cvt_single_item_template(const std::filesystem::path& input, const std::fil
|
||||
|
||||
bool update_infrast_data(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir);
|
||||
bool update_stages_data(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir);
|
||||
bool update_roguelike_recruit(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir, const std::filesystem::path& solution_dir);
|
||||
|
||||
bool update_infrast_templates(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir);
|
||||
bool generate_english_roguelike_stage_name_replacement(const std::filesystem::path& ch_file, const std::filesystem::path& en_file);
|
||||
@@ -72,6 +73,13 @@ int main([[maybe_unused]] int argc, char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update roguelike recruit data from Arknights-Bot-Resource*/
|
||||
std::cout << "------------Update roguelike recruit data------------" << std::endl;
|
||||
if (!update_roguelike_recruit(input_dir, resource_dir, solution_dir)) {
|
||||
std::cerr << "Update roguelike recruit data failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Update stage.json from Penguin Stats*/
|
||||
std::cout << "------------Update stage.json------------" << std::endl;
|
||||
if (!update_stages_data(cur_path, solution_dir / "resource")) {
|
||||
@@ -421,6 +429,18 @@ bool update_infrast_templates(const std::filesystem::path& input_dir, const std:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool update_roguelike_recruit(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir, const std::filesystem::path& solution_dir)
|
||||
{
|
||||
std::string python_cmd;
|
||||
std::filesystem::path python_file = solution_dir / "tools" / "RoguelikeResourceUpdater" / "generate_roguelike_recruit.py";
|
||||
python_cmd = "python " + python_file.string() + " --input=\"" + input_dir.string() + "\" --output=\"" + output_dir.string() + "\"";
|
||||
int python_ret = system(python_cmd.c_str());
|
||||
if (python_ret != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool generate_english_roguelike_stage_name_replacement(const std::filesystem::path& ch_file, const std::filesystem::path& en_file)
|
||||
{
|
||||
auto ch_opt = json::open(ch_file);
|
||||
|
||||
117
tools/RoguelikeResourceUpdater/generate_roguelike_recruit.py
Normal file
117
tools/RoguelikeResourceUpdater/generate_roguelike_recruit.py
Normal file
@@ -0,0 +1,117 @@
|
||||
from argparse import ArgumentParser
|
||||
import json
|
||||
import requests
|
||||
import os
|
||||
|
||||
def ArgParser():
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument("--input", help="input dir", metavar="I", dest="src", required=True)
|
||||
parser.add_argument("--output", help="output dir", metavar="O", dest="det", required=True)
|
||||
return parser
|
||||
|
||||
args = ArgParser().parse_args()
|
||||
|
||||
input_dir = args.src
|
||||
output_dir = args.det
|
||||
input_file = os.path.join(input_dir, "gamedata/excel/character_table.json")
|
||||
output_file = os.path.join(output_dir, "roguelike_recruit.json")
|
||||
|
||||
with open(input_file, "r", encoding="utf8") as f:
|
||||
raw_employee_infos = json.load(f)
|
||||
with open(output_file, "r", encoding="utf8") as f:
|
||||
old_res = json.load(f)
|
||||
|
||||
old_dic = {
|
||||
"Warrior": {},
|
||||
"Pioneer": {},
|
||||
"Caster": {},
|
||||
"Sniper": {},
|
||||
"Medic": {},
|
||||
"Special": {},
|
||||
"Tank": {},
|
||||
"Support": {}
|
||||
}
|
||||
|
||||
name_replace_map = {}
|
||||
|
||||
for profession in ["Warrior", "Pioneer", "Caster", "Sniper", "Medic", "Special", "Tank", "Support"]:
|
||||
for item in old_res[profession]:
|
||||
if "_N" in item["name"]:
|
||||
name_replace_map[item["name"]] = item["name"].replace("_N", "")
|
||||
old_dic[profession][name_replace_map[item["name"]]] = item
|
||||
else:
|
||||
old_dic[profession][item["name"]] = item
|
||||
|
||||
res = old_res
|
||||
|
||||
default_position = {
|
||||
"Warrior": "MELEE",
|
||||
"Pioneer": "MELEE",
|
||||
"Caster": "RANGED",
|
||||
"Sniper": "RANGED",
|
||||
"Medic": "RANGED",
|
||||
"Special": "MELEE",
|
||||
"Tank": "MELEE",
|
||||
"Support": "RANGED"
|
||||
}
|
||||
|
||||
for x, y in raw_employee_infos.items():
|
||||
if y["profession"] not in [
|
||||
"WARRIOR","PIONEER","CASTER","SNIPER",
|
||||
"MEDIC", "SPECIAL", "TANK", "SUPPORT"
|
||||
]: continue
|
||||
if "预备干员" in y["name"]:
|
||||
continue
|
||||
profession = y["profession"].title()
|
||||
if profession not in res:
|
||||
res[profession] = []
|
||||
|
||||
employee_info = {
|
||||
"name": y["name"],
|
||||
"level": y["rarity"] + 1,
|
||||
# "position": y["position"]
|
||||
}
|
||||
# 和默认位置不同,直接禁用
|
||||
if default_position[profession] != y["position"]:
|
||||
employee_info["name"] += "_N"
|
||||
|
||||
# 四星以上的干员设二技能
|
||||
if y["rarity"] + 1 >= 4:
|
||||
employee_info["skill"] = 2
|
||||
# 三星的干员设一技能
|
||||
elif y["rarity"] + 1 == 3:
|
||||
employee_info["skill"] = 1
|
||||
# 二星以下的干员不设技能
|
||||
else:
|
||||
employee_info["skill"] = 0
|
||||
|
||||
if y["name"] in old_dic[profession]:
|
||||
old_employee_info = old_dic[profession][y["name"]]
|
||||
if "skill" in old_employee_info:
|
||||
employee_info["skill"] = old_employee_info["skill"]
|
||||
if "alternate_skill" in old_employee_info:
|
||||
employee_info["alternate_skill"] = old_employee_info["alternate_skill"]
|
||||
if "skill_usage" in old_employee_info:
|
||||
employee_info["skill_usage"] = old_employee_info["skill_usage"]
|
||||
for employee in res[profession]:
|
||||
if employee["name"] == y["name"]:
|
||||
employee.update(employee_info)
|
||||
elif employee["name"] in name_replace_map and name_replace_map[employee["name"]] == y["name"]:
|
||||
employee_info["name"] = employee["name"]
|
||||
employee.update(employee_info)
|
||||
else: continue
|
||||
break
|
||||
else:
|
||||
res[profession].append(employee_info)
|
||||
|
||||
|
||||
## FUCKING CRLF
|
||||
## 处理 CRLF 和 LF 大概有更好的办法,但是我不知道.jpg
|
||||
|
||||
# with open(output_file, "w", encoding="utf8") as f:
|
||||
# # json.dump(dic, f, ensure_ascii=False, indent=4)
|
||||
# json.dump(res, f, ensure_ascii=False, indent=4)
|
||||
|
||||
dump_cache = json.dumps(res, ensure_ascii=False, indent=4).encode("utf8").replace(b"\r\n", b"\n")
|
||||
with open(output_file, "wb") as f:
|
||||
f.write(dump_cache)
|
||||
Reference in New Issue
Block a user