mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
feat: 版本号json新增活动名
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"activity": {
|
||||
"name": "Near Light - Rerun",
|
||||
"time": 1681491600
|
||||
},
|
||||
"gacha": {
|
||||
"pool": "Bearings And Sparks",
|
||||
"time": 1682614800
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"activity": {
|
||||
"name": "ニアーライト·復刻",
|
||||
"time": 1681455600
|
||||
},
|
||||
"gacha": {
|
||||
"pool": "軸受×火花",
|
||||
"time": 1682578800
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"activity": {
|
||||
"name": "니어 라이트 (재개방)",
|
||||
"time": 1681455600
|
||||
},
|
||||
"gacha": {
|
||||
"pool": "베어링 앤 스파크",
|
||||
"time": 1682578800
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"activity": {
|
||||
"name": "日暮尋路",
|
||||
"time": 1684216800
|
||||
},
|
||||
"gacha": {
|
||||
"pool": "巨斧與筆尖",
|
||||
"time": 1687246200
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{
|
||||
"activity": {
|
||||
"name": "尖灭测试作战",
|
||||
"time": 1684742400
|
||||
},
|
||||
"gacha": {
|
||||
"pool": "真理孑然",
|
||||
"time": 1682913600
|
||||
|
||||
@@ -1011,36 +1011,64 @@ bool check_roguelike_replace_for_overseas(const std::filesystem::path& input_dir
|
||||
|
||||
bool update_version_info(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir)
|
||||
{
|
||||
const auto json_path = input_dir / "gacha_table.json";
|
||||
auto gacha_json_opt = json::open(json_path);
|
||||
if (!gacha_json_opt) {
|
||||
std::cerr << "faild to parse " << json_path;
|
||||
return false;
|
||||
}
|
||||
auto& gacha_json = *gacha_json_opt;
|
||||
|
||||
std::unordered_map<std::string, size_t> pool_count;
|
||||
for (auto& gacha_info : gacha_json["gachaPoolClient"].as_array()) {
|
||||
pool_count[gacha_info["gachaPoolName"].as_string()]++;
|
||||
}
|
||||
|
||||
uint64_t time = 0;
|
||||
std::string pool;
|
||||
for (auto& gacha_info : gacha_json["gachaPoolClient"].as_array()) {
|
||||
const auto& pool_name = gacha_info["gachaPoolName"].as_string();
|
||||
if (pool_count[pool_name] > 5) { // 把常驻池过滤掉
|
||||
continue;
|
||||
}
|
||||
auto cur_time = gacha_info["openTime"].as_unsigned_long_long();
|
||||
if (time < cur_time) {
|
||||
time = cur_time;
|
||||
pool = pool_name;
|
||||
}
|
||||
}
|
||||
|
||||
json::value result;
|
||||
result["gacha"]["time"] = time;
|
||||
result["gacha"]["pool"] = pool;
|
||||
{
|
||||
const auto json_path = input_dir / "gacha_table.json";
|
||||
auto gacha_json_opt = json::open(json_path);
|
||||
if (!gacha_json_opt) {
|
||||
std::cerr << "faild to parse " << json_path;
|
||||
return false;
|
||||
}
|
||||
auto& gacha_json = *gacha_json_opt;
|
||||
|
||||
std::unordered_map<std::string, size_t> pool_count;
|
||||
for (auto& gacha_info : gacha_json["gachaPoolClient"].as_array()) {
|
||||
pool_count[gacha_info["gachaPoolName"].as_string()]++;
|
||||
}
|
||||
|
||||
uint64_t time = 0;
|
||||
std::string pool;
|
||||
for (auto& gacha_info : gacha_json["gachaPoolClient"].as_array()) {
|
||||
const auto& pool_name = gacha_info["gachaPoolName"].as_string();
|
||||
if (pool_count[pool_name] > 5) { // 把常驻池过滤掉
|
||||
continue;
|
||||
}
|
||||
auto cur_time = gacha_info["openTime"].as_unsigned_long_long();
|
||||
if (time < cur_time) {
|
||||
time = cur_time;
|
||||
pool = pool_name;
|
||||
}
|
||||
}
|
||||
|
||||
result["gacha"]["time"] = time;
|
||||
result["gacha"]["pool"] = pool;
|
||||
}
|
||||
{
|
||||
const auto json_path = input_dir / "activity_table.json";
|
||||
auto activity_json_opt = json::open(json_path);
|
||||
if (!activity_json_opt) {
|
||||
std::cerr << "faild to parse " << json_path;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t time = 0;
|
||||
std::string name;
|
||||
|
||||
auto& activity_json = *activity_json_opt;
|
||||
for (const auto& [_, act] : activity_json["basicInfo"].as_object()) {
|
||||
if (!act.at("displayOnHome").as_boolean()) {
|
||||
continue;
|
||||
}
|
||||
auto cur_time = act.at("startTime").as_unsigned_long_long();
|
||||
if (time < cur_time) {
|
||||
time = cur_time;
|
||||
name = act.at("name").as_string();
|
||||
}
|
||||
}
|
||||
|
||||
result["activity"]["time"] = time;
|
||||
result["activity"]["name"] = name;
|
||||
}
|
||||
|
||||
std::ofstream ofs(output_dir / "version.json", std::ios::out);
|
||||
ofs << result.format(true) << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user