From 2aa63c77e69198988d247413f075fe0dd9239495 Mon Sep 17 00:00:00 2001 From: Lemon-miaow Date: Sat, 2 Aug 2025 20:32:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=BA=BF=E7=B4=A2=E4=BA=A4=E6=B5=81=E9=80=89?= =?UTF-8?q?=E9=A1=B9=20(#13368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 新增是否进行线索交流选项 * chore: Auto update by pre-commit hooks [skip changelog] * docs: 文档添加参数 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- docs/zh-cn/protocol/integration.md | 1 + resource/tasks/tasks.json | 11 ++------- .../Task/Infrast/InfrastReceptionTask.cpp | 24 ++++++++++++++++--- .../Task/Infrast/InfrastReceptionTask.h | 3 +++ src/MaaCore/Task/Interface/InfrastTask.cpp | 3 +++ src/MaaWpfGui/Constants/ConfigurationKeys.cs | 1 + .../Models/AsstTasks/AsstInfrastTask.cs | 6 +++++ src/MaaWpfGui/Res/Localizations/en-us.xaml | 1 + src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 1 + src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 1 + .../InfrastSettingsUserControlModel.cs | 13 ++++++++++ .../TaskQueue/InfrastSettingsUserControl.xaml | 3 +++ 14 files changed, 58 insertions(+), 12 deletions(-) diff --git a/docs/zh-cn/protocol/integration.md b/docs/zh-cn/protocol/integration.md index 3c9fb106c3..23696c83fa 100644 --- a/docs/zh-cn/protocol/integration.md +++ b/docs/zh-cn/protocol/integration.md @@ -174,6 +174,7 @@ AsstTaskId ASSTAPI AsstAppendTask(AsstHandle handle, const char* type, const cha "dorm_notstationed_enabled": bool, // 是否启用宿舍“未进驻”选项,可选,默认 false "dorm_trust_enabled": bool, // 是否将宿舍剩余位置填入信赖未满干员,可选,默认 false "reception_message_board": bool, // 是否领取会客室信息板信用,可选,默认 true + "reception_clue_exchange": bool, // 是否进行线索交流,可选,默认 true /* 以下参数仅在 mode = 10000 时生效,否则会被忽略 */ "filename": string, // 自定义配置路径,必选。不支持运行中设置 diff --git a/resource/tasks/tasks.json b/resource/tasks/tasks.json index 62976ce25d..0ef809e9c9 100644 --- a/resource/tasks/tasks.json +++ b/resource/tasks/tasks.json @@ -3165,8 +3165,7 @@ "algorithm": "OcrDetect", "text": ["已达线索上限", "无法获取新的线索", "上限", "无法"], "reduceOtherTimes": ["SelectClue*3"], - "roi": [286, 550, 366, 130], - "next": ["CloseCluePageThenSendClue"] + "roi": [286, 550, 366, 130] }, "BackToReceptionMain": { "algorithm": "JustReturn", @@ -3209,13 +3208,7 @@ "CloseCluePage": { "action": "ClickSelf", "roi": [930, 50, 120, 120], - "next": ["CloseCluePage", "SendClueFlag", "InfrastClueFriendNew", "ReceptionFlag"] - }, - "SendClueFlag": { - "Doc": "这里识别的是自己的线索的new:如果获取完自己的线索、再获取完好友送的线索,自己的线索new还亮着,则说明自己的线索没获取成功,即线索满了", - "next": ["SendClues"], - "roi": [1150, 100, 130, 80], - "template": "ClueNew.png" + "next": ["CloseCluePage", "InfrastClueFriendNew", "ReceptionFlag"] }, "UnlockClues": { "action": "ClickSelf", diff --git a/src/MaaCore/Task/Infrast/InfrastReceptionTask.cpp b/src/MaaCore/Task/Infrast/InfrastReceptionTask.cpp index 37cf613be3..c23a55a67d 100644 --- a/src/MaaCore/Task/Infrast/InfrastReceptionTask.cpp +++ b/src/MaaCore/Task/Infrast/InfrastReceptionTask.cpp @@ -83,8 +83,22 @@ bool asst::InfrastReceptionTask::get_friend_clue() bool asst::InfrastReceptionTask::get_self_clue() { - ProcessTask task_temp(*this, { "InfrastClueSelfNew", "InfrastClueSelfMaybeFull", "ReceptionFlag" }); - return task_temp.set_retry_times(ProcessTask::RetryTimesDefault).run(); + auto run_with_retries = [&](const std::vector& tasks) { + ProcessTask task(*this, tasks); + task.set_retry_times(ProcessTask::RetryTimesDefault); + return task.run(); + }; + + run_with_retries({ "InfrastClueSelfNew", "InfrastClueSelfMaybeFull", "ReceptionFlag" }); + + if (!ProcessTask(*this, { "InfrastClueSelfFull" }).set_retry_times(0).run()) { + return run_with_retries({ "CloseCluePage", "ReceptionFlag" }); + } + if (m_enable_clue_exchange) { + return run_with_retries({ "CloseCluePageThenSendClue" }); + } + + return run_with_retries({ "CloseCluePage", "ReceptionFlag" }); } bool asst::InfrastReceptionTask::use_clue() @@ -95,10 +109,14 @@ bool asst::InfrastReceptionTask::use_clue() proc_clue_vacancy(); sleep(1000); - if (unlock_clue_exchange()) { + if (m_enable_clue_exchange && unlock_clue_exchange()) { proc_clue_vacancy(); } + if (!m_enable_clue_exchange) { + return true; + } + cv::Mat image = ctrler()->get_image(); // 所有的空位分析一次,看看还缺哪些线索 diff --git a/src/MaaCore/Task/Infrast/InfrastReceptionTask.h b/src/MaaCore/Task/Infrast/InfrastReceptionTask.h index d2485f0cbe..eb14b4389a 100644 --- a/src/MaaCore/Task/Infrast/InfrastReceptionTask.h +++ b/src/MaaCore/Task/Infrast/InfrastReceptionTask.h @@ -13,6 +13,8 @@ public: void set_receive_message_board(bool value) noexcept { m_receive_message_board = value; } + void set_enable_clue_exchange(bool value) noexcept { m_enable_clue_exchange = value; } + protected: virtual bool _run() override; @@ -32,5 +34,6 @@ private: bool shift(); bool m_receive_message_board = true; + bool m_enable_clue_exchange = true; }; } diff --git a/src/MaaCore/Task/Interface/InfrastTask.cpp b/src/MaaCore/Task/Interface/InfrastTask.cpp index 4f9f862b01..8343372109 100644 --- a/src/MaaCore/Task/Interface/InfrastTask.cpp +++ b/src/MaaCore/Task/Interface/InfrastTask.cpp @@ -167,6 +167,9 @@ bool asst::InfrastTask::set_params(const json::value& params) bool reception_message_board = params.get("reception_message_board", true); m_reception_task_ptr->set_receive_message_board(reception_message_board); + bool reception_clue_exchange = params.get("reception_clue_exchange", true); + m_reception_task_ptr->set_enable_clue_exchange(reception_clue_exchange); + bool replenish = params.get("replenish", false); m_replenish_task_ptr->set_enable(replenish); diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs index 93b46db6af..e13516c210 100644 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -115,6 +115,7 @@ namespace MaaWpfGui.Constants public const string DormThreshold = "Infrast.DormThreshold"; public const string UsesOfDrones = "Infrast.UsesOfDrones"; public const string InfrastReceptionMessageBoardReceive = "Infrast.ReceptionMessageBoardReceive"; + public const string InfrastReceptionClueExchange = "Infrast.ReceptionClueExchange"; public const string ContinueTraining = "Infrast.ContinueTraining"; public const string DefaultInfrast = "Infrast.DefaultInfrast"; public const string IsCustomInfrastFileReadOnly = "Infrast.IsCustomInfrastFileReadOnly"; // 已废弃 diff --git a/src/MaaWpfGui/Models/AsstTasks/AsstInfrastTask.cs b/src/MaaWpfGui/Models/AsstTasks/AsstInfrastTask.cs index dc8c8afa64..0912269ec9 100644 --- a/src/MaaWpfGui/Models/AsstTasks/AsstInfrastTask.cs +++ b/src/MaaWpfGui/Models/AsstTasks/AsstInfrastTask.cs @@ -80,6 +80,11 @@ public class AsstInfrastTask : AsstBaseTask /// public bool ReceptionMessageBoard { get; set; } = true; + /// + /// Gets or sets a value indicating whether 启用线索交流 + /// + public bool ReceptionClueExchange { get; set; } = true; + /// /// Gets or sets 自定义配置文件路径 /// @@ -102,6 +107,7 @@ public class AsstInfrastTask : AsstBaseTask ["dorm_trust_enabled"] = DormTrustEnabled, ["replenish"] = OriginiumShardAutoReplenishment, ["reception_message_board"] = ReceptionMessageBoard, + ["reception_clue_exchange"] = ReceptionClueExchange, ["mode"] = (int)Mode, }; diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index 38acb13ba4..f72876e38a 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -115,6 +115,7 @@ Checking this box will not remove {key=Operator}s like Irene from the Training Room; this will also prevent {key=Operator}s from the Workshop from entering the Dormitory. Originium Shard auto replenishment Credit collection from message board in Reception Room + Conduct Clue Exchange After training is complete, try to continue mastering the current skill Training room is vacant Training completed diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 09d96a9b97..6f9e270189 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -115,6 +115,7 @@ チェックした場合、アイリーニのような{key=Operator}が訓練室から外れなくなり、また、加工所の{key=Operator}が宿舎に送られることを防止します。 源石の欠片を自動で補充 受付室の掲示板からのクレジット収集 + 手がかり交換を実施 訓練完了後に現在スキルの継続特化を試みます 訓練室は空いています 訓練が完了しました diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index fbb7d81818..f556ebb399 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -115,6 +115,7 @@ 체크할 경우 아이린과 같은 {key=Operator}를 훈련실에서 제거하지 않고, 가공소의 {key=Operator}가 숙소에 배치되는 것을 방지합니다. 오리지늄 조각 자동 보충 응접실 게시판에서 크레딧 수집 + 단서 교환 수행 스킬 훈련 완료 시 이어서 훈련 시도 훈련실이 비어 있습니다 훈련 완료 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 647350385a..933612ad81 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -115,6 +115,7 @@ 勾选则不会将艾丽妮等{key=Operator}从训练室移除,但也会导致加工站{key=Operator}不能进入宿舍。 源石碎片自动补货 会客室信息板收取信用 + 进行线索交流 训练完成后继续尝试专精当前技能 训练室空闲中 训练完成 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index e70bc4d71a..70591cc8ad 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -114,6 +114,7 @@ 勾選則不會將艾麗妮等{key=Operator}從訓練室移除,但也會導致加工站{key=Operator}不能進入宿舍。 源石碎片自動補貨 會客室資訊板收取信用 + 進行線索交流 訓練完成後繼續嘗試專精當前技能 訓練室空閒中 訓練完成 diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs index bc88d69400..9d2b0e37dd 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/InfrastSettingsUserControlModel.cs @@ -273,6 +273,18 @@ public class InfrastSettingsUserControlModel : TaskViewModel } } + private bool _receptionClueExchange = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.InfrastReceptionClueExchange, bool.TrueString)); + + public bool ReceptionClueExchange + { + get => _receptionClueExchange; + set + { + SetAndNotify(ref _receptionClueExchange, value); + ConfigurationHelper.SetValue(ConfigurationKeys.InfrastReceptionClueExchange, value.ToString()); + } + } + private bool _continueTraining = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ContinueTraining, bool.FalseString)); /// @@ -656,6 +668,7 @@ public class InfrastSettingsUserControlModel : TaskViewModel DormTrustEnabled = DormTrustEnabled, OriginiumShardAutoReplenishment = OriginiumShardAutoReplenishment, ReceptionMessageBoard = ReceptionMessageBoardReceive, + ReceptionClueExchange = ReceptionClueExchange, Filename = CustomInfrastFile, PlanIndex = CustomInfrastPlanIndex, }.Serialize(); diff --git a/src/MaaWpfGui/Views/UserControl/TaskQueue/InfrastSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/TaskQueue/InfrastSettingsUserControl.xaml index 3e24d200a7..382161f510 100644 --- a/src/MaaWpfGui/Views/UserControl/TaskQueue/InfrastSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/TaskQueue/InfrastSettingsUserControl.xaml @@ -198,6 +198,9 @@ + + +