mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 18:47:55 +08:00
feat: 自动更新器添加版本号
This commit is contained in:
6
resource/global/YoStarEN/resource/version.json
Normal file
6
resource/global/YoStarEN/resource/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gacha": {
|
||||
"pool": "Great Axe and Pen Nib",
|
||||
"time": 1673611200
|
||||
}
|
||||
}
|
||||
6
resource/global/YoStarJP/resource/version.json
Normal file
6
resource/global/YoStarJP/resource/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gacha": {
|
||||
"pool": "戦斧と万年筆",
|
||||
"time": 1673575200
|
||||
}
|
||||
}
|
||||
6
resource/global/YoStarKR/resource/version.json
Normal file
6
resource/global/YoStarKR/resource/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gacha": {
|
||||
"pool": "그레이트 액스와 펜닙",
|
||||
"time": 1673575200
|
||||
}
|
||||
}
|
||||
6
resource/global/txwy/resource/version.json
Normal file
6
resource/global/txwy/resource/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gacha": {
|
||||
"pool": "海蝕",
|
||||
"time": 1675150200
|
||||
}
|
||||
}
|
||||
6
resource/version.json
Normal file
6
resource/version.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gacha": {
|
||||
"pool": "真理孑然",
|
||||
"time": 1682913600
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ bool check_roguelike_replace_for_overseas(const std::filesystem::path& input_dir
|
||||
const std::filesystem::path& base_dir,
|
||||
const std::filesystem::path& output_dir);
|
||||
|
||||
bool update_version_info(const std::filesystem::path& input_dir, const std::filesystem::path& output_dir);
|
||||
|
||||
int main([[maybe_unused]] int argc, char** argv)
|
||||
{
|
||||
const char* str_exec_path = argv[0];
|
||||
@@ -163,7 +165,7 @@ int main([[maybe_unused]] int argc, char** argv)
|
||||
}
|
||||
|
||||
// gamedata 繁中不更新了,自己下载一下
|
||||
std::string gamedata_tw_exec = cur_path.string() + "/gamedata-tw.exe";
|
||||
std::string gamedata_tw_exec = "\"" + cur_path.string() + "/gamedata-tw.exe" + "\"";
|
||||
if (!std::filesystem::exists(gamedata_tw_exec)) {
|
||||
std::string download_zhtw = "curl --ssl-no-revoke "
|
||||
"https://raw.githubusercontent.com/MaaAssistantArknights/"
|
||||
@@ -233,6 +235,22 @@ int main([[maybe_unused]] int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "------------Update version info------------" << std::endl;
|
||||
|
||||
if (!update_version_info(arkbot_res_dir / "gamedata" / "excel", resource_dir)) {
|
||||
std::cerr << "Update version info failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (const auto& [in, out] : global_dirs) {
|
||||
std::cout << "------------Update version info for " << out << "------------" << std::endl;
|
||||
if (!update_version_info(game_data_dir / in / "gamedata" / "excel",
|
||||
resource_dir / "global" / out / "resource")) {
|
||||
std::cerr << "Update version info failed" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "------------All success------------" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -1010,3 +1028,36 @@ bool check_roguelike_replace_for_overseas(const std::filesystem::path& input_dir
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
uint64_t time = 0;
|
||||
std::string pool;
|
||||
for (auto& gacha_info : gacha_json["gachaPoolClient"].as_array()) {
|
||||
if (gacha_info["gachaRuleType"].as_string() != "LIMITED") {
|
||||
continue;
|
||||
}
|
||||
auto cur_time = gacha_info["openTime"].as_unsigned_long_long();
|
||||
if (time < cur_time) {
|
||||
time = cur_time;
|
||||
pool = gacha_info["gachaPoolName"].as_string();
|
||||
}
|
||||
}
|
||||
|
||||
json::value result;
|
||||
result["gacha"]["time"] = time;
|
||||
result["gacha"]["pool"] = pool;
|
||||
|
||||
std::ofstream ofs(output_dir / "version.json", std::ios::out);
|
||||
ofs << result.format(true) << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user