mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-01 01:10:34 +08:00
feat: 更新界园肉鸽商品列表 (#14882)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@ bool asst::RoguelikeShoppingConfig::parse(const json::value& json)
|
||||
goods.roles = std::move(roles);
|
||||
goods.chars = std::move(chars);
|
||||
goods.promotion = goods_json.get("promotion", 0);
|
||||
goods.promotion_rarity = goods_json.get("promotion_rarity", 6);
|
||||
goods.no_longer_buy = goods_json.get("no_longer_buy", false);
|
||||
goods.ignore_no_longer_buy = goods_json.get("ignore_no_longer_buy", false);
|
||||
goods.decrease_collapse = goods_json.get("decrease_collapse", false);
|
||||
|
||||
@@ -13,7 +13,8 @@ struct RoguelikeGoods
|
||||
std::string name;
|
||||
std::vector<battle::Role> roles;
|
||||
std::vector<std::string> chars;
|
||||
int promotion = 0; // 晋升 N 个干员
|
||||
int promotion = 0; // 晋升 N 个干员
|
||||
int promotion_rarity = 6; // 晋升 N 星及以下成员
|
||||
bool no_longer_buy = false;
|
||||
bool ignore_no_longer_buy = false;
|
||||
bool decrease_collapse = false;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "RoguelikeShoppingTaskPlugin.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Config/Miscellaneous/BattleDataConfig.h"
|
||||
#include "Config/Roguelike/RoguelikeShoppingConfig.h"
|
||||
#include "Config/TaskData.h"
|
||||
@@ -66,7 +68,7 @@ bool asst::RoguelikeShoppingTaskPlugin::buy_once()
|
||||
bool no_longer_buy = m_config->status().trader_no_longer_buy;
|
||||
|
||||
std::unordered_map<battle::Role, size_t> map_roles_count;
|
||||
std::unordered_map<battle::Role, size_t> map_wait_promotion;
|
||||
std::unordered_map<battle::Role, std::array<size_t, 6>> map_wait_promotion;
|
||||
size_t total_wait_promotion = 0;
|
||||
std::unordered_set<std::string> chars_list;
|
||||
for (const auto& [name, oper] : m_config->status().opers) {
|
||||
@@ -87,9 +89,9 @@ bool asst::RoguelikeShoppingTaskPlugin::buy_once()
|
||||
map_roles_count[battle::Role::Medic] += 1;
|
||||
if (elite == 1 && level == 70) {
|
||||
total_wait_promotion += 1;
|
||||
map_wait_promotion[battle::Role::Caster] += 1;
|
||||
map_wait_promotion[battle::Role::Warrior] += 1;
|
||||
map_wait_promotion[battle::Role::Medic] += 1;
|
||||
map_wait_promotion[battle::Role::Caster][5 - 1] += 1;
|
||||
map_wait_promotion[battle::Role::Warrior][5 - 1] += 1;
|
||||
map_wait_promotion[battle::Role::Medic][5 - 1] += 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -102,7 +104,7 @@ bool asst::RoguelikeShoppingTaskPlugin::buy_once()
|
||||
int rarity = BattleData.get_rarity(name);
|
||||
if (elite == 1 && level >= RarityPromotionLevel.at(rarity)) {
|
||||
total_wait_promotion += 1;
|
||||
map_wait_promotion[role] += 1;
|
||||
map_wait_promotion[role][rarity - 1] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,7 +168,11 @@ bool asst::RoguelikeShoppingTaskPlugin::buy_once()
|
||||
if (!goods.roles.empty()) {
|
||||
bool role_matched = false;
|
||||
for (const auto& role : goods.roles) {
|
||||
if (map_wait_promotion[role] != 0) {
|
||||
size_t sum_wait_promotion = 0;
|
||||
for (int rarity = 0; rarity < goods.promotion_rarity; ++rarity) {
|
||||
sum_wait_promotion += map_wait_promotion[role][rarity];
|
||||
}
|
||||
if (sum_wait_promotion != 0) {
|
||||
role_matched = true;
|
||||
break;
|
||||
}
|
||||
@@ -176,6 +182,18 @@ bool asst::RoguelikeShoppingTaskPlugin::buy_once()
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
size_t sum_wait_promotion = 0;
|
||||
for (const auto& [role, arr] : map_wait_promotion) {
|
||||
for (int rarity = 0; rarity < goods.promotion_rarity; ++rarity) {
|
||||
sum_wait_promotion += arr[rarity];
|
||||
}
|
||||
}
|
||||
if (sum_wait_promotion == 0) {
|
||||
Log.trace("Ready to buy", goods.name, ", but there is no one waiting for promotion, skip");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!goods.chars.empty()) {
|
||||
|
||||
@@ -1,22 +1,40 @@
|
||||
import json
|
||||
|
||||
with open("roguelike_topic_table.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
items = data["details"]["rogue_5"]["archiveComp"]["relic"]["relic"]
|
||||
item_details = data["details"]["rogue_5"]["items"]
|
||||
item_exports = []
|
||||
for item in items.values():
|
||||
item_unique_id = item["relicId"]
|
||||
item_id = int(item["orderId"])
|
||||
item_detail = item_details[item_unique_id]
|
||||
item_name = item_detail["name"]
|
||||
item_usage = item_detail["usage"]
|
||||
item_exports.append({"name": item_name, "effect": item_usage, "No": item_id})
|
||||
final_data = {
|
||||
"theme": "JieGarden",
|
||||
"priority": item_exports,
|
||||
"other": [{"doc": "不会主动购买的藏品"}],
|
||||
}
|
||||
with open("shopping.json", "w", encoding="utf-8") as f:
|
||||
json.dump(final_data, f, ensure_ascii=False, indent=4)
|
||||
def main():
|
||||
with open("roguelike_topic_table.json", "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
|
||||
items = data["details"]["rogue_5"]["archiveComp"]["relic"]["relic"]
|
||||
item_details = data["details"]["rogue_5"]["items"]
|
||||
item_exports = []
|
||||
for item in items.values():
|
||||
item_unique_id = item["relicId"]
|
||||
item_id = int(item["orderId"])
|
||||
item_detail = item_details[item_unique_id]
|
||||
item_name = item_detail["name"]
|
||||
item_usage = item_detail["usage"]
|
||||
item_exports.append({"name": item_name, "effect": item_usage, "No": item_id})
|
||||
tickets_seen = set()
|
||||
for item in item_details.values():
|
||||
item_id = item["id"]
|
||||
item_name = item["name"]
|
||||
if item_name in tickets_seen:
|
||||
continue
|
||||
if item_id.startswith("rogue_5_recruit_ticket") or item_id.startswith(
|
||||
"rogue_5_upgrade_ticket"
|
||||
):
|
||||
item_usage = item["usage"]
|
||||
item_exports.append({"name": item_name, "effect": item_usage})
|
||||
tickets_seen.add(item_name)
|
||||
final_data = {
|
||||
"theme": "JieGarden",
|
||||
"priority": item_exports,
|
||||
"other": [{"doc": "不会主动购买的藏品"}],
|
||||
}
|
||||
with open("shopping.json", "w", encoding="utf-8") as f:
|
||||
json.dump(final_data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user