mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
fix:修复循环点击退出关卡按钮导致的卡死问题
纠正错别字 更改while循环条件: true->!need_exit()
This commit is contained in:
@@ -9833,7 +9833,9 @@
|
||||
"next": [
|
||||
"Reclamation@AtHomePageFlag",
|
||||
"Reclamation@ResetScope",
|
||||
"Reclamation@ClickExitLevel",
|
||||
"Reclamation@LevelForceExitConfirm",
|
||||
"Reclamation@LevelForceExit",
|
||||
"Reclamation@LevelComplete",
|
||||
"Reclamation@ExitAlgorithm",
|
||||
"Reclamation@SmallReturn",
|
||||
"Reclamation@ReturnInFocus",
|
||||
@@ -9860,16 +9862,16 @@
|
||||
"Reclamation@StartAlgorithm",
|
||||
"Reclamation@ConfirmStart#next",
|
||||
"Reclamation@ReturnTo#next",
|
||||
"Reclamation@ClickExitLevel#next",
|
||||
"Reclamation@BattleStart#next",
|
||||
"Reclamation@LevelComplete",
|
||||
"Reclamation@GiveupReportSkip",
|
||||
"Reclamation@GiveupSkipConfirm",
|
||||
"Reclamation@GainReword",
|
||||
"Reclamation@GainReward",
|
||||
"Reclamation@StartUpThemes#next"
|
||||
]
|
||||
},
|
||||
"Reclamation@StartAlgorithm": {
|
||||
"Doc": "继续演算的图标也能match,所以就单独写了",
|
||||
"Doc": "继续演算的图标也能match,所以就不单独写了",
|
||||
"roi": [
|
||||
844,
|
||||
569,
|
||||
@@ -10061,7 +10063,7 @@
|
||||
],
|
||||
"action": "ClickSelf",
|
||||
"next": [
|
||||
"Reclamation@ClickExitLevel",
|
||||
"Reclamation@BattleStart",
|
||||
"Reclamation@StartActionPopupConfirm",
|
||||
"Reclamation@StartActionConfirm"
|
||||
]
|
||||
@@ -10071,61 +10073,70 @@
|
||||
"baseTask": "Reclamation@PopupConfirm",
|
||||
"postDelay": 4000,
|
||||
"next": [
|
||||
"Reclamation@ClickExitLevel",
|
||||
"Reclamation@BattleStart",
|
||||
"Reclamation@StartActionPopupConfirm"
|
||||
]
|
||||
},
|
||||
"Reclamation@ClickExitLevel": {
|
||||
"action": "ClickRect",
|
||||
"Reclamation@BattlePackIconTemplate":{
|
||||
"template": "Reclamation@ClickExitLevel.png",
|
||||
"roi": [
|
||||
100,
|
||||
0,
|
||||
164,
|
||||
166
|
||||
]
|
||||
},
|
||||
"Reclamation@BattleStart":{
|
||||
"baseTask": "Reclamation@BattlePackIconTemplate",
|
||||
"template": "Reclamation@ClickExitLevel.png",
|
||||
"Doc": "注册插件ReclamationBattlePlugin",
|
||||
"onErrorNext": [
|
||||
"Reclamation@Begin"
|
||||
],
|
||||
"next": [
|
||||
"Reclamation@LevelComplete"
|
||||
],
|
||||
"specialParams_Doc": "二次复核前的delay,完成后的delay",
|
||||
"specialParams": [
|
||||
1000,
|
||||
2000
|
||||
]
|
||||
},
|
||||
"Reclamation@ClickExitLevel": {
|
||||
"action": "ClickRect",
|
||||
"baseTask": "Reclamation@BattlePackIconTemplate",
|
||||
"template": "Reclamation@ClickExitLevel.png",
|
||||
"specificRect": [
|
||||
46,
|
||||
28,
|
||||
59,
|
||||
61
|
||||
],
|
||||
"next": [
|
||||
"Reclamation@ExitLevelConfirm",
|
||||
"Reclamation@ExitLevelWithEnermyConfirm",
|
||||
"Reclamation@ClickExitLevel"
|
||||
]
|
||||
},
|
||||
"Reclamation@ExitLevelConfirm": {
|
||||
"algorithm": "OcrDetect",
|
||||
"roi": [
|
||||
857,
|
||||
337,
|
||||
370,
|
||||
177
|
||||
856, 336, 371, 177
|
||||
],
|
||||
"action": "ClickSelf",
|
||||
"postDelay": 2000,
|
||||
"exceededNext": [
|
||||
"Reclamation@ClickExitLevelSlowly"
|
||||
"text": [
|
||||
"确认", "离开"
|
||||
],
|
||||
"action": "ClickSelf"
|
||||
},
|
||||
"Reclamation@LevelForceExit":{
|
||||
"baseTask": "Reclamation@ClickExitLevel",
|
||||
"template": "Reclamation@ClickExitLevel.png",
|
||||
"postDelay": 3000,
|
||||
"next": [
|
||||
"Reclamation@LevelComplete",
|
||||
"Reclamation@ExitLevelConfirm",
|
||||
"Reclamation@ClickExitLevel"
|
||||
"Reclamation@LevelForceExitConfirm",
|
||||
"Reclamation@LevelForceExit",
|
||||
"Reclamation@ReturnTo#next"
|
||||
]
|
||||
},
|
||||
"Reclamation@ExitLevelWithEnermyConfirm": {
|
||||
"roi": [
|
||||
855,
|
||||
335,
|
||||
372,
|
||||
181
|
||||
],
|
||||
"action": "ClickSelf",
|
||||
"postDelay": 2000,
|
||||
"Reclamation@LevelForceExitConfirm":{
|
||||
"baseTask":"Reclamation@ExitLevelConfirm",
|
||||
"next": [
|
||||
"Reclamation@LevelComplete",
|
||||
"Reclamation@ExitLevelWithEnermyConfirm",
|
||||
"Reclamation@ClickExitLevel"
|
||||
"Reclamation@ReturnTo#next"
|
||||
]
|
||||
},
|
||||
"Reclamation@LevelComplete": {
|
||||
@@ -10256,13 +10267,13 @@
|
||||
],
|
||||
"action": "ClickSelf",
|
||||
"next": [
|
||||
"Reclamation@GainReword",
|
||||
"Reclamation@GainReward",
|
||||
"Reclamation@AtHomePageFlag",
|
||||
"Reclamation@GiveupSkipConfirm",
|
||||
"Reclamation@ClickChooseInitUnits"
|
||||
]
|
||||
},
|
||||
"Reclamation@GainReword": {
|
||||
"Reclamation@GainReward": {
|
||||
"roi": [
|
||||
556,
|
||||
559,
|
||||
@@ -10272,7 +10283,7 @@
|
||||
"action": "ClickSelf",
|
||||
"next": [
|
||||
"Reclamation@Begin#next",
|
||||
"Reclamation@GainReword"
|
||||
"Reclamation@GainReward"
|
||||
]
|
||||
},
|
||||
"Reclamation@GiveupCrossdomainPageFlag":{
|
||||
|
||||
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
@@ -32,6 +32,7 @@
|
||||
<ClInclude Include="Config\Miscellaneous\SSSCopilotConfig.h" />
|
||||
<ClInclude Include="Controller.h" />
|
||||
<ClInclude Include="InstHelper.h" />
|
||||
<ClInclude Include="Task\Reclamation\ReclamationBattlePlugin.h" />
|
||||
<ClInclude Include="Task\Interface\ReclamationTask.h" />
|
||||
<ClInclude Include="Task\BattleHelper.h" />
|
||||
<ClInclude Include="Task\Interface\SingleStepTask.h" />
|
||||
@@ -159,6 +160,7 @@
|
||||
<ClCompile Include="Config\Miscellaneous\SSSCopilotConfig.cpp" />
|
||||
<ClCompile Include="Controller.cpp" />
|
||||
<ClCompile Include="InstHelper.cpp" />
|
||||
<ClCompile Include="Task\Reclamation\ReclamationBattlePlugin.cpp" />
|
||||
<ClCompile Include="Task\Interface\ReclamationTask.cpp" />
|
||||
<ClCompile Include="Task\BattleHelper.cpp" />
|
||||
<ClCompile Include="Task\Interface\SingleStepTask.cpp" />
|
||||
|
||||
@@ -77,6 +77,9 @@
|
||||
<Filter Include="源文件\Task\SingleStep">
|
||||
<UniqueIdentifier>{987541fc-58f0-40eb-8b93-c0cb38881d92}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="源文件\Task\Reclamation">
|
||||
<UniqueIdentifier>{97f7690d-5924-405f-a332-831e7dad3f1e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\resource\config.json">
|
||||
@@ -495,6 +498,9 @@
|
||||
<ClInclude Include="Task\Interface\ReclamationTask.h">
|
||||
<Filter>源文件\Task\Interface</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Task\Reclamation\ReclamationBattlePlugin.h">
|
||||
<Filter>源文件\Task\Reclamation</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Vision\AbstractImageAnalyzer.cpp">
|
||||
@@ -815,5 +821,8 @@
|
||||
<ClCompile Include="Task\Interface\ReclamationTask.cpp">
|
||||
<Filter>源文件\Task\Interface</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Task\Reclamation\ReclamationBattlePlugin.cpp">
|
||||
<Filter>源文件\Task\Reclamation</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "Task/ProcessTask.h"
|
||||
#include "Utils/Logger.hpp"
|
||||
|
||||
#include "Task/Reclamation/ReclamationBattlePlugin.h"
|
||||
|
||||
|
||||
asst::ReclamationTask::ReclamationTask(const AsstCallback& callback, Assistant* inst)
|
||||
: InterfaceTask(callback, inst, TaskType),
|
||||
@@ -12,6 +14,7 @@ asst::ReclamationTask::ReclamationTask(const AsstCallback& callback, Assistant*
|
||||
{
|
||||
m_reclamation_task_ptr->set_tasks({ "Reclamation@Begin" });
|
||||
m_reclamation_task_ptr->set_ignore_error(true);
|
||||
m_reclamation_task_ptr->register_plugin<ReclamationBattlePlugin>();
|
||||
for (int i = 0; i != 100; ++i) {
|
||||
m_subtasks.emplace_back(m_reclamation_task_ptr);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
namespace asst
|
||||
{
|
||||
class ProcessTask;
|
||||
class RoguelikeRecruitTaskPlugin;
|
||||
class RoguelikeSkillSelectionTaskPlugin;
|
||||
class RoguelikeBattleTaskPlugin;
|
||||
class RoguelikeCustomStartTaskPlugin;
|
||||
class RoguelikeDebugTaskPlugin;
|
||||
|
||||
class ReclamationTask : public InterfaceTask
|
||||
{
|
||||
|
||||
67
src/MaaCore/Task/Reclamation/ReclamationBattlePlugin.cpp
Normal file
67
src/MaaCore/Task/Reclamation/ReclamationBattlePlugin.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "ReclamationBattlePlugin.h"
|
||||
|
||||
#include "Utils/NoWarningCV.h"
|
||||
|
||||
#include "Controller.h"
|
||||
#include "Status.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Vision/OcrImageAnalyzer.h"
|
||||
#include "Vision/MatchImageAnalyzer.h"
|
||||
#include "Config/TaskData.h"
|
||||
|
||||
asst::ReclamationBattlePlugin::ReclamationBattlePlugin(const AsstCallback& callback, Assistant* inst,
|
||||
std::string_view task_chain)
|
||||
: AbstractTaskPlugin(callback, inst, task_chain), BattleHelper(inst)
|
||||
{}
|
||||
|
||||
bool asst::ReclamationBattlePlugin::verify(AsstMsg msg, const json::value& details) const
|
||||
{
|
||||
if (msg != AsstMsg::SubTaskCompleted || details.get("subtask", std::string()) != "ProcessTask") {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view == "Reclamation@BattleStart") {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool asst::ReclamationBattlePlugin::_run()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
wait_until_start(false);
|
||||
|
||||
while (!need_exit()) {
|
||||
while (!need_exit()) {
|
||||
bool stage1 = ProcessTask(*this, { "Reclamation@ClickExitLevel" }).run();
|
||||
bool stage2 = ProcessTask(*this, { "Reclamation@ExitLevelConfirm" }).run();
|
||||
if (stage2) break;
|
||||
if (!stage1 && !stage2) {
|
||||
Log.info(__FUNCTION__, "| fail to operate");
|
||||
return ProcessTask(*this, { "Reclamation@Begin" }).run();
|
||||
}
|
||||
}
|
||||
|
||||
sleep(Task.get("Reclamation@BattleStart")->special_params.front());
|
||||
const auto img = ctrler()->get_image();
|
||||
bool check1 = check_in_battle(img, false);
|
||||
OcrImageAnalyzer confirmAnalyzer(img);
|
||||
confirmAnalyzer.set_task_info("Reclamation@ExitLevelConfirm");
|
||||
bool check2 = confirmAnalyzer.analyze();
|
||||
if (!check1 && !check2) break;
|
||||
}
|
||||
|
||||
sleep(Task.get("Reclamation@BattleStart")->special_params.at(1));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::ReclamationBattlePlugin::do_strategic_action(const cv::Mat&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
21
src/MaaCore/Task/Reclamation/ReclamationBattlePlugin.h
Normal file
21
src/MaaCore/Task/Reclamation/ReclamationBattlePlugin.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "Task/Miscellaneous/BattleProcessTask.h"
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/BattleHelper.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class ReclamationBattlePlugin : public AbstractTaskPlugin, private BattleHelper
|
||||
{
|
||||
public:
|
||||
ReclamationBattlePlugin(const AsstCallback& callback, Assistant* inst, std::string_view task_chain);
|
||||
virtual ~ReclamationBattlePlugin() override = default;
|
||||
|
||||
virtual bool verify(AsstMsg msg, const json::value& details) const override;
|
||||
|
||||
protected:
|
||||
virtual bool _run() override;
|
||||
virtual bool do_strategic_action(const cv::Mat& reusable = cv::Mat()) override;
|
||||
virtual AbstractTask& this_task() override { return *this; }
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user