opt.优化关卡掉落识别,修复一些识别错误的问题

This commit is contained in:
MistEO
2022-01-12 23:04:12 +08:00
parent c563760bb1
commit b4587b449e
4 changed files with 21 additions and 4 deletions

Binary file not shown.

View File

@@ -41,7 +41,7 @@
"7": "3ffc3ffc3ffc3ffc007800f801f001e003e003c007c007800f801f001e003e00",
"8": "7e00ff01ff81c781c381e781ff00fe01ff83ffc3c3c3c3c3e7c3ffc1ff807e0",
"9": "7e01ff83ff83ffc3c3c383c3c3c3e7c3ffc1ff80ff801f003e007c007800f00",
"0": "7e01ff03ff83ffc7c3e783e781e781e781e781e783e7c3e3ffc3ffc1ff007e0",
"0": "0ff01ff83ffc7ffe7c1e781e781ff81ff81f781f781e7c3e7ffe3ffc1ff80ff0",
"-": "ffffffffffffffffffffffff00000000000000000000"
},
"dropType": {

View File

@@ -624,9 +624,14 @@
"zh": "龙门币"
}
},
"5001": {
"name_i18n": {
"zh": "经验"
}
},
"furni": {
"name_i18n": {
"zh": "家具"
}
}
}
}

View File

@@ -35,6 +35,8 @@ void asst::StageDropsTaskPlugin::set_task_ptr(AbstractTask* ptr)
bool asst::StageDropsTaskPlugin::_run()
{
LogTraceFunction;
set_startbutton_delay();
if (!recognize_drops()) {
@@ -55,17 +57,23 @@ bool asst::StageDropsTaskPlugin::_run()
bool asst::StageDropsTaskPlugin::recognize_drops()
{
LogTraceFunction;
sleep(Task.get("PRTS")->rear_delay);
if (need_exit()) {
return false;
}
cv::Mat image = Ctrler.get_image(true);
m_cur_drops = json::parse(Resrc.penguin().recognize(image)).value();
std::string res = Resrc.penguin().recognize(image);
Log.trace("Results of penguin recognition:\n", res);
m_cur_drops = json::parse(res).value();
return true;
}
void asst::StageDropsTaskPlugin::drop_info_callback()
{
LogTraceFunction;
json::value drops_details = m_cur_drops;
auto& item = Resrc.item();
for (json::value& drop : drops_details["drops"].as_array()) {
@@ -100,6 +108,8 @@ void asst::StageDropsTaskPlugin::drop_info_callback()
void asst::StageDropsTaskPlugin::set_startbutton_delay()
{
LogTraceFunction;
if (!m_startbutton_delay_setted) {
int64_t start_times = Status.get("LastStartButton2");
@@ -114,6 +124,8 @@ void asst::StageDropsTaskPlugin::set_startbutton_delay()
void asst::StageDropsTaskPlugin::upload_to_penguin()
{
LogTraceFunction;
auto& opt = Resrc.cfg().get_options();
if (!opt.penguin_report.enable) {
return;
@@ -125,7 +137,7 @@ void asst::StageDropsTaskPlugin::upload_to_penguin()
// Doc: https://developer.penguin-stats.io/public-api/api-v2-instruction/report-api
std::string stage_id = m_cur_drops["stage"]["stageId"].as_string();
if (stage_id.empty()) {
info["why"] = "关卡错误,可能是资源未更新。";
info["why"] = "未知关卡";
callback(AsstMsg::SubTaskError, info);
return;
}