feat: 干员识别加了个稀有度字段

This commit is contained in:
MistEO
2023-04-25 23:48:16 +08:00
parent 12d8bbe027
commit daa016bb7e
3 changed files with 17 additions and 10 deletions

View File

@@ -22,8 +22,8 @@ bool asst::OperBoxRecognitionTask::_run()
bool asst::OperBoxRecognitionTask::swipe_and_analyze()
{
LogTraceFunction;
std::string current_page_last_oper_name = "";
std::string current_page_first_oper_name = "";
std::string current_page_last_oper_name;
std::string current_page_first_oper_name;
m_own_opers.clear();
while (!need_exit()) {
@@ -74,10 +74,11 @@ void asst::OperBoxRecognitionTask::callback_analyze_result(bool done)
all_opers.emplace_back(json::object {
{ "id", BattleData.get_id(name) },
{ "name", name },
{ "rarity", BattleData.get_rarity(name) },
{ "own", own },
});
}
for (const auto& [name,box_info] : m_own_opers) {
for (const auto& [name, box_info] : m_own_opers) {
own_opers.emplace_back(json::object {
{ "id", box_info.id },
{ "name", box_info.name },
@@ -85,7 +86,7 @@ void asst::OperBoxRecognitionTask::callback_analyze_result(bool done)
{ "elite", box_info.elite },
{ "level", box_info.level },
{ "potential", box_info.potential },
// TODO
{ "rarity", box_info.rarity },
});
}

View File

@@ -77,11 +77,15 @@ bool asst::OperBoxImageAnalyzer::opers_analyze()
const auto& flag_rect = flag_list[i];
const auto& name_tr = name_list[i];
const std::string& name = name_tr.text;
OperBoxInfo box;
box.id = BattleData.get_id(name_tr.text);
box.name = name_tr.text;
box.own = true;
box.id = BattleData.get_id(name);
box.name = name;
box.rarity = BattleData.get_rarity(name);
box.rect = flag_rect;
box.own = true;
#ifdef ASST_DEBUG
cv::rectangle(m_image_draw, make_rect<cv::Rect>(flag_rect), cv::Scalar(0, 255, 0), 2);

View File

@@ -8,11 +8,13 @@ namespace asst
{
std::string id;
std::string name;
int level = 0; // 等级
int elite = 0; // 精英度
bool own = false;
int level = 0; // 等级
int elite = 0; // 精英度
int potential = 0; // 潜能
int rarity = 0; // 稀有度
Rect rect;
bool own = false;
};
class OperBoxImageAnalyzer final : public AbstractImageAnalyzer
{