diff --git a/resource/tasks.json b/resource/tasks.json index a9139f7404..930e7c5868 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -9727,5 +9727,333 @@ "BattleStartPreFlag": { "baseTask": "BattleStartPre", "action": "DoNothing" + }, + + "Reclamation@Begin":{ + "algorithm": "JustReturn", + "next":[ + "Reclamation@GiveupAlgorithm", + "Reclamation@StartAlgorithm" + ] + }, + "Reclamation@StartAlgorithm":{ + "roi": [ + 844, + 569, + 436, + 151 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@ClickChooseInitUnits", + "Reclamation@StartAlgorithm" + ] + }, + "Reclamation@ClickChooseInitUnits":{ + "roi": [ + 1055, + 0, + 225, + 178 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@InitSupplyAll", + "Reclamation@ClickChooseInitUnits" + ] + }, + "Reclamation@InitSupplyAll":{ + "roi": [ + 862, + 572, + 418, + 148 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@ConfirmStart", + "Reclamation@InitSupplyAll" + ] + }, + "Reclamation@ConfirmStart":{ + "roi": [ + 874, + 503, + 350, + 212 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@SkipAnnounce", + "Reclamation@SkipDailyReport", + "Reclamation@Emergency", + "Reclamation@ClickCenterBase", + "Reclamation@ResetScope" + ] + }, + "Reclamation@SkipAnnounce":{ + "algorithm": "OcrDetect", + "roi": [ + 1109, 0, 171, 151 + ], + "text": [ + "跳过" + ], + "action": "ClickSelf", + "next": [ + "Reclamation@ConfirmStart#next" + ] + }, + "Reclamation@SkipDailyReport":{ + "algorithm": "OcrDetect", + "cache": false, + "roi": [ + 539,39,207,134 + ], + "text": [ + "今日", + "日报" + ], + "action": "ClickRect", + "specificRect": [ + 1190, + 651, + 52, + 48 + ], + "next": [ + "Reclamation@ConfirmStart#next" + ] + }, + "Reclamation@ClickCenterBase":{ + "roi": [ + 557, 281, 162, 155 + ], + "action": "ClickSelf", + "postDelay": 1000, + "next": [ + "Reclamation@ClickAnyZoneOcr", + "Reclamation@SkipAnnounce", + "Reclamation@SkipDailyReport", + "Reclamation@ResetScope", + "Reclamation@ClickCenterBase" + ] + }, + "Reclamation@ClickAnyZoneOcr":{ + "algorithm": "OcrDetect", + "cache": false, + "roi": [ + 308, 73, 739, 567 + ], + "text": [ + "区", + "Zone" + ], + "action": "ClickSelf", + "next": [ + "Reclamation@StartActionEnter", + "Reclamation@ClickAnyZoneOcr" + ] + }, + "Reclamation@StartActionEnter":{ + "algorithm": "OcrDetect", + "cache": false, + "roi": [ + 995, 550, 285, 130 + ], + "text": [ + "开始行动", + "决断" + ], + "action": "ClickSelf", + "next": [ + "Reclamation@PrepareAction", + "Reclamation@StartActionEnter" + ] + }, + "Reclamation@PrepareAction":{ + "algorithm": "OcrDetect", + "roi": [ + 996,590,254,130 + ], + "text": [ + "行动准备" + ], + "action": "ClickSelf", + "next": [ + "Reclamation@StartActionConfirm", + "Reclamation@PrepareAction" + ] + }, + "Reclamation@StartActionConfirm":{ + "roi": [ + 962, 65, 311, 522 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@StartActionPopupConfirm", + "Reclamation@StartActionConfirm" + ] + }, + "Reclamation@StartActionPopupConfirm":{ + "template": "PopupConfirm.png", + "action": "ClickSelf", + "roi": [ + 630, + 400, + 650, + 160 + ], + "next": [ + "Reclamation@ClickExitLevel", + "Reclamation@StartActionPopupConfirm" + ] + }, + "Reclamation@ClickExitLevel":{ + "action": "ClickRect", + "roi": [ + 100, 0, 164, 166 + ], + "specificRect": [ + 46, 28, 59, 61 + ], + "next": [ + "Reclamation@ExitLevelConfirm", + "Reclamation@ExitLevelWithEnermyConfirm", + "Reclamation@ClickExitLevel" + ] + }, + "Reclamation@ExitLevelConfirm":{ + "roi": [ + 857, 337, 370, 177 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@LevelComplete", + "Reclamation@ExitLevelConfirm" + ] + }, + "Reclamation@ExitLevelWithEnermyConfirm":{ + "roi": [ + 855, 335, 372, 181 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@LevelComplete", + "Reclamation@ExitLevelWithEnermyConfirm" + ] + }, + "Reclamation@LevelComplete":{ + "algorithm": "OcrDetect", + "cache": false, + "roi": [ + 0, 197, 469, 224 + ], + "action": "ClickSelf", + "text": [ + "结束", + "MISSON", + "RESULTS" + ], + "next": [ + "Reclamation@NextDay", + "Reclamation@ResetScope", + "Reclamation@LevelComplete" + ] + }, + "Reclamation@ResetScope":{ + "roi": [ + 0, 605, 141, 115 + ], + "action": "ClickSelf", + "postDelay": 500, + "next": [ + "Reclamation@ClickCenterBase", + "Reclamation@ResetScope" + ] + }, + "Reclamation@NextDay":{ + "roi": [ + 1055, 0, 225, 177 + ], + "action": "ClickSelf", + "postDelay": 1000, + "next": [ + "Reclamation@Emergency", + "Reclamation@NextDay", + "Reclamation@ConfirmStart#next" + ] + }, + "Reclamation@Emergency":{ + "action": "DoNothing", + "roi": [ + 1055, 0, 225, 181 + ], + "next": [ + "Reclamation@ExitAlgorithm" + ] + }, + "Reclamation@ExitAlgorithm":{ + "roi": [ + 0, 0, 160, 154 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@GiveupAlgorithm", + "Reclamation@ExitAlgorithm" + ] + }, + "Reclamation@GiveupAlgorithm":{ + "roi": [ + 684, 569, 273, 151 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@GiveupAlgorithmConfirm", + "Reclamation@GiveupAlgorithm" + ] + }, + "Reclamation@GiveupAlgorithmConfirm":{ + "template": "PopupConfirm.png", + "action": "ClickSelf", + "roi": [ + 630, + 400, + 650, + 160 + ], + "next": [ + "Reclamation@GiveupReportSkip", + "Reclamation@GiveupAlgorithmConfirm" + ] + }, + "Reclamation@GiveupReportSkip":{ + "roi": [ + 1074, 537, 183, 180 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@GiveupReportSkip", + "Reclamation@GiveupSkipConfirm" + ] + }, + "Reclamation@GiveupSkipConfirm":{ + "roi": [ + 1082, 547, 198, 157 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@GainReword", + "Reclamation@GiveupSkipConfirm" + ] + }, + "Reclamation@GainReword":{ + "roi": [ + 556, 559, 179, 161 + ], + "action": "ClickSelf", + "next": [ + "Reclamation@Begin" + ] } } diff --git a/resource/template/Reclamation@ClickCenterBase.png b/resource/template/Reclamation@ClickCenterBase.png new file mode 100644 index 0000000000..f9a137827d Binary files /dev/null and b/resource/template/Reclamation@ClickCenterBase.png differ diff --git a/resource/template/Reclamation@ClickChooseInitUnits.png b/resource/template/Reclamation@ClickChooseInitUnits.png new file mode 100644 index 0000000000..ec7ce71583 Binary files /dev/null and b/resource/template/Reclamation@ClickChooseInitUnits.png differ diff --git a/resource/template/Reclamation@ClickExitLevel.png b/resource/template/Reclamation@ClickExitLevel.png new file mode 100644 index 0000000000..cd145ba689 Binary files /dev/null and b/resource/template/Reclamation@ClickExitLevel.png differ diff --git a/resource/template/Reclamation@ConfirmStart.png b/resource/template/Reclamation@ConfirmStart.png new file mode 100644 index 0000000000..f5ca518efc Binary files /dev/null and b/resource/template/Reclamation@ConfirmStart.png differ diff --git a/resource/template/Reclamation@Emergency.png b/resource/template/Reclamation@Emergency.png new file mode 100644 index 0000000000..8fd05d9c04 Binary files /dev/null and b/resource/template/Reclamation@Emergency.png differ diff --git a/resource/template/Reclamation@ExitAlgorithm.png b/resource/template/Reclamation@ExitAlgorithm.png new file mode 100644 index 0000000000..c20049b3f0 Binary files /dev/null and b/resource/template/Reclamation@ExitAlgorithm.png differ diff --git a/resource/template/Reclamation@ExitLevelConfirm.png b/resource/template/Reclamation@ExitLevelConfirm.png new file mode 100644 index 0000000000..eb219f919a Binary files /dev/null and b/resource/template/Reclamation@ExitLevelConfirm.png differ diff --git a/resource/template/Reclamation@ExitLevelWithEnermyConfirm.png b/resource/template/Reclamation@ExitLevelWithEnermyConfirm.png new file mode 100644 index 0000000000..2872002536 Binary files /dev/null and b/resource/template/Reclamation@ExitLevelWithEnermyConfirm.png differ diff --git a/resource/template/Reclamation@GainReword.png b/resource/template/Reclamation@GainReword.png new file mode 100644 index 0000000000..0adec74e0c Binary files /dev/null and b/resource/template/Reclamation@GainReword.png differ diff --git a/resource/template/Reclamation@GiveupAlgorithm.png b/resource/template/Reclamation@GiveupAlgorithm.png new file mode 100644 index 0000000000..61280a317e Binary files /dev/null and b/resource/template/Reclamation@GiveupAlgorithm.png differ diff --git a/resource/template/Reclamation@GiveupReportSkip.png b/resource/template/Reclamation@GiveupReportSkip.png new file mode 100644 index 0000000000..92d3385f26 Binary files /dev/null and b/resource/template/Reclamation@GiveupReportSkip.png differ diff --git a/resource/template/Reclamation@GiveupSkipConfirm.png b/resource/template/Reclamation@GiveupSkipConfirm.png new file mode 100644 index 0000000000..3b660c4fea Binary files /dev/null and b/resource/template/Reclamation@GiveupSkipConfirm.png differ diff --git a/resource/template/Reclamation@InitSupplyAll.png b/resource/template/Reclamation@InitSupplyAll.png new file mode 100644 index 0000000000..ecdfcbc720 Binary files /dev/null and b/resource/template/Reclamation@InitSupplyAll.png differ diff --git a/resource/template/Reclamation@NextDay.png b/resource/template/Reclamation@NextDay.png new file mode 100644 index 0000000000..6522c5cdd4 Binary files /dev/null and b/resource/template/Reclamation@NextDay.png differ diff --git a/resource/template/Reclamation@ResetScope.png b/resource/template/Reclamation@ResetScope.png new file mode 100644 index 0000000000..c75b1cf33b Binary files /dev/null and b/resource/template/Reclamation@ResetScope.png differ diff --git a/resource/template/Reclamation@StartActionConfirm.png b/resource/template/Reclamation@StartActionConfirm.png new file mode 100644 index 0000000000..5a195ee35c Binary files /dev/null and b/resource/template/Reclamation@StartActionConfirm.png differ diff --git a/resource/template/Reclamation@StartAlgorithm.png b/resource/template/Reclamation@StartAlgorithm.png new file mode 100644 index 0000000000..9ac8a442fe Binary files /dev/null and b/resource/template/Reclamation@StartAlgorithm.png differ diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index bc40b674ea..7ebde35da1 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -17,6 +17,7 @@ #include "Task/Interface/SingleStepTask.h" #include "Task/Interface/MallTask.h" #include "Task/Interface/RecruitTask.h" +#include "Task/Interface/ReclamationTask.h" #include "Task/Interface/RoguelikeTask.h" #include "Task/Interface/SSSCopilotTask.h" #include "Task/Interface/StartUpTask.h" @@ -162,6 +163,7 @@ asst::Assistant::TaskId asst::Assistant::append_task(const std::string& type, co ASST_ASSISTANT_APPEND_TASK_FROM_STRING_IF_BRANCH(SSSCopilotTask) ASST_ASSISTANT_APPEND_TASK_FROM_STRING_IF_BRANCH(SingleStepTask) ASST_ASSISTANT_APPEND_TASK_FROM_STRING_IF_BRANCH(DepotTask) + ASST_ASSISTANT_APPEND_TASK_FROM_STRING_IF_BRANCH(ReclamationTask) #ifdef ASST_DEBUG ASST_ASSISTANT_APPEND_TASK_FROM_STRING_IF_BRANCH(DebugTask) #endif diff --git a/src/MaaCore/MaaCore.vcxproj b/src/MaaCore/MaaCore.vcxproj index 8eec06d02f..c808bef8b7 100644 --- a/src/MaaCore/MaaCore.vcxproj +++ b/src/MaaCore/MaaCore.vcxproj @@ -32,6 +32,7 @@ + @@ -158,6 +159,7 @@ + diff --git a/src/MaaCore/MaaCore.vcxproj.filters b/src/MaaCore/MaaCore.vcxproj.filters index f1a98154f8..3d11d92f3a 100644 --- a/src/MaaCore/MaaCore.vcxproj.filters +++ b/src/MaaCore/MaaCore.vcxproj.filters @@ -492,6 +492,9 @@ 源文件\Task\Interface + + 源文件\Task\Interface + @@ -809,5 +812,8 @@ 源文件\Task\Interface + + 源文件\Task\Interface + \ No newline at end of file diff --git a/src/MaaCore/Task/Interface/ReclamationTask.cpp b/src/MaaCore/Task/Interface/ReclamationTask.cpp new file mode 100644 index 0000000000..95d05d9575 --- /dev/null +++ b/src/MaaCore/Task/Interface/ReclamationTask.cpp @@ -0,0 +1,16 @@ +#include "Task/Interface/ReclamationTask.h" + +#include "Common/AsstBattleDef.h" +#include "Status.h" +#include "Task/ProcessTask.h" +#include "Utils/Logger.hpp" + + +asst::ReclamationTask::ReclamationTask(const AsstCallback& callback, Assistant* inst) + : InterfaceTask(callback, inst, TaskType), + m_reclamation_task_ptr(std::make_shared(callback, inst, TaskType)) +{ + m_reclamation_task_ptr->set_tasks({ "Reclamation@Begin" }); + m_subtasks.emplace_back(m_reclamation_task_ptr); + +} diff --git a/src/MaaCore/Task/Interface/ReclamationTask.h b/src/MaaCore/Task/Interface/ReclamationTask.h new file mode 100644 index 0000000000..39f592c9ba --- /dev/null +++ b/src/MaaCore/Task/Interface/ReclamationTask.h @@ -0,0 +1,26 @@ +#pragma once +#include "Task/InterfaceTask.h" + +namespace asst +{ + class ProcessTask; + class RoguelikeRecruitTaskPlugin; + class RoguelikeSkillSelectionTaskPlugin; + class RoguelikeBattleTaskPlugin; + class RoguelikeCustomStartTaskPlugin; + class RoguelikeDebugTaskPlugin; + + class ReclamationTask : public InterfaceTask + { + public: + inline static constexpr std::string_view TaskType = "ReclamationAlgorithm"; + + ReclamationTask(const AsstCallback& callback, Assistant* inst); + virtual ~ReclamationTask() override = default; + + //virtual bool set_params(const json::value& params) override; + + private: + std::shared_ptr m_reclamation_task_ptr = nullptr; + }; +} diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index f2ffa0b67a..904e1bcc90 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -1503,6 +1503,17 @@ namespace MaaWpfGui return id != 0; } + /// + /// 自动生息演算。 + /// + /// 是否成功。 + public bool AsstAppendReclamation() + { + AsstTaskId id = AsstAppendTaskWithEncoding("ReclamationAlgorithm"); + _latestTaskId[TaskType.Recruit] = id; + return id != 0; + } + /// /// 公招识别。 /// diff --git a/src/MaaWpfGui/Main/TaskQueueViewModel.cs b/src/MaaWpfGui/Main/TaskQueueViewModel.cs index a969a5af25..c648243e02 100644 --- a/src/MaaWpfGui/Main/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/Main/TaskQueueViewModel.cs @@ -192,6 +192,7 @@ namespace MaaWpfGui "Mall", "Mission", "AutoRoguelike", + "ReclamationAlgorithm", }; ActionAfterCompletedList = new List> { @@ -654,6 +655,10 @@ namespace MaaWpfGui { ret &= AppendRoguelike(); } + else if(item.OriginalName == "ReclamationAlgorithm") + { + ret &= AppendReclamation(); + } else { --count; @@ -919,6 +924,12 @@ namespace MaaWpfGui settings.RoguelikeEnableNonfriendSupport, settings.RoguelikeTheme); } + private bool AppendReclamation() + { + var asstProxy = _container.Get(); + return asstProxy.AsstAppendReclamation(); + } + [DllImport("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 54544501e7..5ab8c52b8b 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -241,6 +241,7 @@ 获取信用及购物 领取日常奖励 自动肉鸽 + 自动生息演算 全选 反选