From a9e6d53672d4ec3963060bd82dfd61108c8406d2 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Fri, 27 Mar 2026 15:25:36 +0800 Subject: [PATCH] =?UTF-8?q?rft:=20=E9=87=8D=E6=9E=84battle=5Fdata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Common/AsstBattleDef.h | 1 + .../Config/Miscellaneous/BattleDataConfig.cpp | 3 ++ tools/ResourceUpdater/main.cpp | 35 ++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/MaaCore/Common/AsstBattleDef.h b/src/MaaCore/Common/AsstBattleDef.h index d6bb2e8b7e..24c658fec2 100644 --- a/src/MaaCore/Common/AsstBattleDef.h +++ b/src/MaaCore/Common/AsstBattleDef.h @@ -375,6 +375,7 @@ struct OperProps std::string name_jp; std::string name_kr; std::string name_tw; + std::string name_display; Role role = Role::Unknown; std::array ranges; int rarity = 0; // 稀有度 1-6 diff --git a/src/MaaCore/Config/Miscellaneous/BattleDataConfig.cpp b/src/MaaCore/Config/Miscellaneous/BattleDataConfig.cpp index 75d7feacfa..f6f2c1d251 100644 --- a/src/MaaCore/Config/Miscellaneous/BattleDataConfig.cpp +++ b/src/MaaCore/Config/Miscellaneous/BattleDataConfig.cpp @@ -12,6 +12,9 @@ bool asst::BattleDataConfig::parse(const json::value& json) m_ranges.clear(); m_opers.clear(); m_drones_confusing.clear(); + m_opers.clear(); + m_chars.clear(); + m_ranges.clear(); for (const auto& [id, char_data_json] : json.at("chars").as_object()) { std::shared_ptr data_ptr = std::make_shared(); data_ptr->id = id; diff --git a/tools/ResourceUpdater/main.cpp b/tools/ResourceUpdater/main.cpp index 4947142f7f..0f329c3635 100644 --- a/tools/ResourceUpdater/main.cpp +++ b/tools/ResourceUpdater/main.cpp @@ -929,11 +929,14 @@ bool update_battle_chars_info(const fs::path& official_dir, const fs::path& over json::value char_new_data; for (auto& [data, name] : chars_json) { + if (data.get(id, "name", "_unavailable_") != "_unavailable_") { char_new_data[name] = data.get(id, "name", char_data["name"].as_string()); - if (data.get(id, "name", "_unavailable_") == "_unavailable_") { + } + else { char_new_data[name + "_unavailable"] = true; } } + char_new_data["name_display"] = char_new_data["name"]; char_new_data["profession"] = char_data["profession"]; const std::string& default_range = char_data.get("phases", 0, "rangeId", "0-1"); @@ -974,6 +977,7 @@ bool update_battle_chars_info(const fs::path& official_dir, const fs::path& over Amiya_data["name_jp"] = "アーミヤ-WARRIOR"; Amiya_data["name_kr"] = "아미야-WARRIOR"; Amiya_data["name_tw"] = "阿米婭-WARRIOR"; + Amiya_data["name_display"] = "阿米娅-WARRIOR"; Amiya_data["profession"] = "WARRIOR"; Amiya_data["rangeId"] = json::array { "1-1", "1-1", "1-1" }; Amiya_data["rarity"] = 5; @@ -986,6 +990,7 @@ bool update_battle_chars_info(const fs::path& official_dir, const fs::path& over Amiya_data3["name_jp"] = "アーミヤ-MEDIC"; Amiya_data3["name_kr"] = "아미야-MEDIC"; Amiya_data3["name_tw"] = "阿米婭-MEDIC"; + Amiya_data3["name_display"] = "阿米娅-MEDIC"; Amiya_data3["profession"] = "MEDIC"; Amiya_data3["rangeId"] = json::array { "3-1", "3-3", "3-3" }; Amiya_data3["rarity"] = 5; @@ -997,6 +1002,34 @@ bool update_battle_chars_info(const fs::path& official_dir, const fs::path& over ofs << result.format() << '\n'; ofs.close(); + std::vector> overseas_paths = { + { "name_en", "global/YoStarEN/resource/battle_data.json" }, + { "name_jp", "global/YoStarJP/resource/battle_data.json" }, + { "name_kr", "global/YoStarKR/resource/battle_data.json" }, + { "name_tw", "global/txwy/resource/battle_data.json" }, + }; + + for (const auto& [client_name, path] : overseas_paths) { + json::value overseas_result; + overseas_result["ranges"] = result["ranges"]; + auto& overseas_chars = overseas_result["chars"]; + + for (auto& [id, char_data] : chars.as_object()) { + auto name_opt = char_data.find(client_name); + if (!name_opt) { + continue; + } + auto data = char_data; + data.emplace("name_display", *name_opt); + overseas_chars.emplace(id, std::move(data)); + } + + const auto& overseas_file = output_dir / path; + std::ofstream overseas_ofs(overseas_file, std::ios::out); + overseas_ofs << overseas_result.format() << '\n'; + overseas_ofs.close(); + } + return true; }