Merge pull request #3568 from WLLEGit/ReclamationAlgorithm

fix: 修复 生息演算 初始无干员卡住的问题,添加集成文档
This commit is contained in:
MistEO
2023-02-03 23:35:12 +08:00
committed by GitHub
8 changed files with 108 additions and 6 deletions

View File

@@ -229,6 +229,16 @@ AsstTaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const cha
}
```
- `ReclamationAlgorithm`
生息演算
```jsonc
{
"enable": bool
}
```
### `AsstSetTaskParams`
#### 接口原型

View File

@@ -217,6 +217,16 @@ For more details about auto-copilot JSON, please refer to [Copilot Schema](3.3-C
}
```
- `ReclamationAlgorithm`
ReclamationAlgorithm
```jsonc
{
"enable": bool
}
```
### `AsstSetTaskParams`
#### Prototype

View File

@@ -216,6 +216,14 @@ TaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const char* p
}
```
- `ReclamationAlgorithm`
```jsonc
{
"enable": bool
}
```
### `AsstSetTaskParams`
#### Prototype

View File

@@ -216,6 +216,15 @@ TaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const char* p
}
```
- `ReclamationAlgorithm`
生息演算
```jsonc
{
"enable": bool
}
```
### `AsstSetTaskParams`
#### 介面原型

View File

@@ -9896,11 +9896,62 @@
"action": "ClickSelf",
"postDelay": 500,
"next": [
"Reclamation@EmptyInitUnits",
"Reclamation@InitSupplyAll",
"Reclamation@ClickChooseInitUnits",
"Reclamation@ReturnTo"
]
},
"Reclamation@EmptyInitUnits":{
"algorithm": "OcrDetect",
"roi": [
592, 595, 336, 125
],
"text": [
"请选择", "参加", "演算"
],
"next": [
"Reclamation@QuickFormation",
"Reclamation@QuickFormationSelectOneUnit"
]
},
"Reclamation@QuickFormation":{
"roi": [
958, 0, 175, 144
],
"action": "ClickSelf",
"next": [
"Reclamation@QuickFormationSelectOneUnit",
"Reclamation@QuickFormation"
]
},
"Reclamation@FormationConfirmBase":{
"template": "Reclamation@FormationConfirm.png",
"roi": [
862, 604, 358, 116
]
},
"Reclamation@QuickFormationSelectOneUnit":{
"baseTask": "Reclamation@FormationConfirmBase",
"template": "Reclamation@FormationConfirm.png",
"action": "ClickRect",
"specificRect": [
506, 116, 186, 57
],
"next": [
"Reclamation@QuickFormationConfirm"
]
},
"Reclamation@QuickFormationConfirm":{
"baseTask": "Reclamation@FormationConfirmBase",
"template": "Reclamation@FormationConfirm.png",
"action": "ClickSelf",
"next": [
"Reclamation@EmptyInitUnits",
"Reclamation@InitSupplyAll",
"Reclamation@ConfirmStart"
]
},
"Reclamation@InitSupplyAll": {
"roi": [
862,

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -38,23 +38,37 @@ bool asst::ReclamationBattlePlugin::_run()
wait_until_start(false);
while (!need_exit()) {
int retry = 0;
while (!need_exit()) {
bool stage1 = ProcessTask(*this, { "Reclamation@ClickExitLevel" }).run();
bool stage2 = ProcessTask(*this, { "Reclamation@ExitLevelConfirm" }).run();
bool stage1 = ProcessTask(*this, { "Reclamation@ClickExitLevel" }).set_retry_times(0).run();
bool stage2 = ProcessTask(*this, { "Reclamation@ExitLevelConfirm" }).set_retry_times(3).run();
Log.info(__FUNCTION__, "| click exit level perform ", stage1, stage2);
if (stage2) break;
if (!stage1 && !stage2) {
Log.info(__FUNCTION__, "| fail to operate");
retry++; // stage1==true&&stage2==false应该是手动按了确定或是没按到退出
if ((!stage1 && !stage2) || retry > 5) {
// 已经到了结算界面,或是用户手动操作了
Log.error(__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);
bool check1 = check_in_battle(img, false);
OcrImageAnalyzer confirmAnalyzer(img);
confirmAnalyzer.set_task_info("Reclamation@ExitLevelConfirm");
bool check2 = confirmAnalyzer.analyze();
if (!check1 && !check2) break;
// 出现Loading转一会儿就结算了没结算还有error_next
OcrImageAnalyzer loadingAnalyzer(img);
loadingAnalyzer.set_task_info("Loading");
bool check3 = loadingAnalyzer.analyze();
Log.info(__FUNCTION__, "| click exit level check ", check1, check2, check3);
if ((!check1 && !check2) || check3) break;
}
sleep(Task.get("Reclamation@BattleStart")->special_params.at(1));