perf: 基建信息板收取信用增加开关 (#12050)

* perf: 基建信息板收取开关

* feat(core): 基建任务会客室领取留言板信用

* i18n: wpf

* fix: 补回遗漏传参,简化调用

* chore: Auto update by pre-commit hooks [skip changelog]

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
status102
2025-03-12 09:04:28 +08:00
committed by GitHub
parent aeb557d004
commit 8a85df4a36
15 changed files with 62 additions and 52 deletions

View File

@@ -168,6 +168,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
/* 以下参数仅在 mode=10000 时生效,否则会被忽略 */
"filename": string, // 自定义配置路径,必选。不支持运行中设置

View File

@@ -19,7 +19,9 @@ bool asst::InfrastReceptionTask::_run()
return false;
}
receive_message_board();
if (m_receive_message_board) {
receive_message_board();
}
click_bottom_left_tab();
close_end_of_clue_exchange();

View File

@@ -11,6 +11,8 @@ public:
virtual size_t max_num_of_opers() const noexcept override { return 2ULL; }
void set_receive_message_board(bool value) noexcept { m_receive_message_board = value; }
protected:
virtual bool _run() override;
@@ -27,5 +29,7 @@ private:
bool back_to_reception_main();
bool send_clue();
bool shift();
bool m_receive_message_board = true;
};
}

View File

@@ -141,6 +141,9 @@ bool asst::InfrastTask::set_params(const json::value& params)
bool dorm_trust_enabled = params.get("dorm_trust_enabled", false);
m_dorm_task_ptr->set_trust_enabled(dorm_trust_enabled);
bool reception_message_board = params.get("reception_message_board", true);
m_reception_task_ptr->set_receive_message_board(reception_message_board);
bool replenish = params.get("replenish", false);
m_replenish_task_ptr->set_enable(replenish);

View File

@@ -102,6 +102,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 ContinueTraining = "Infrast.ContinueTraining";
public const string DefaultInfrast = "Infrast.DefaultInfrast";
public const string IsCustomInfrastFileReadOnly = "Infrast.IsCustomInfrastFileReadOnly";

View File

@@ -2167,17 +2167,7 @@ namespace MaaWpfGui.Main
return MaaService.AsstBackToHome(_handle);
}
public bool AsstSetInfrastTaskParams(
IEnumerable<string> order,
string usesOfDrones,
bool continueTraining,
double dormThreshold,
bool dormFilterNotStationedEnabled,
bool dormDormTrustEnabled,
bool originiumShardAutoReplenishment,
bool isCustom,
string filename,
int planIndex)
public bool AsstSetInfrastTaskParams()
{
const TaskType Type = TaskType.Infrast;
int id = _taskStatus.FirstOrDefault(i => i.Value == Type).Key;
@@ -2186,19 +2176,7 @@ namespace MaaWpfGui.Main
return false;
}
var taskParams = new AsstInfrastTask
{
Facilitys = order.ToList(),
UsesOfDrones = usesOfDrones,
ContinueTraining = continueTraining,
DormThreshold = dormThreshold,
DormFilterNotStationedEnabled = dormFilterNotStationedEnabled,
DormDormTrustEnabled = dormDormTrustEnabled,
OriginiumShardAutoReplenishment = originiumShardAutoReplenishment,
IsCustom = isCustom,
Filename = filename,
PlanIndex = planIndex,
}.Serialize().Params;
var taskParams = InfrastSettingsUserControlModel.Instance.Serialize().Params;
return AsstSetTaskParamsWithEncoding(id, taskParams);
}

View File

@@ -68,6 +68,11 @@ public class AsstInfrastTask : AsstBaseTask
/// </summary>
public bool OriginiumShardAutoReplenishment { get; set; }
/// <summary>
/// Gets or sets a value indicating whether 领取基建会客室留言板奖励
/// </summary>
public bool ReceptionMessageBoard { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether 是否开启自定义配置
/// </summary>
@@ -94,6 +99,7 @@ public class AsstInfrastTask : AsstBaseTask
["dorm_notstationed_enabled"] = DormFilterNotStationedEnabled,
["dorm_trust_enabled"] = DormDormTrustEnabled,
["replenish"] = OriginiumShardAutoReplenishment,
["reception_message_board"] = ReceptionMessageBoard,
["mode"] = IsCustom ? 10000 : 0,
};

View File

@@ -92,6 +92,7 @@
<system:String x:Key="DormFilterNotStationedEnabled">Do not put stationed operators in Dormitory</system:String>
<system:String x:Key="DormFilterNotStationedTips">Checking this box will not remove operators like Irene from the Training Room,this will also prevent operators from the Workshop from entering the Dormitory.</system:String>
<system:String x:Key="OriginiumShardAutoReplenishment">Originium Shard auto replenishment</system:String>
<system:String x:Key="InfrastReceptionMessageBoardReceive">Credit collection from message board in Reception Room</system:String>
<system:String x:Key="ContinueTraining">After training is complete, try to continue mastering the current skill</system:String>
<system:String x:Key="TrainingIdle">Training room is vacant</system:String>
<system:String x:Key="TrainingCompleted">Training completed</system:String>

View File

@@ -92,6 +92,7 @@
<system:String x:Key="DormFilterNotStationedEnabled">作業中の人員を宿舎に移動しない(例:訓練所でのアイリーニなど)</system:String>
<system:String x:Key="DormFilterNotStationedTips">チェックした場合、アイリーニのようなオペレーターが訓練室から外れなくなり、また、加工所のオペレーターが宿舎に送られることを防止します。</system:String>
<system:String x:Key="OriginiumShardAutoReplenishment">源石の欠片を自動で補充</system:String>
<system:String x:Key="InfrastReceptionMessageBoardReceive">受付室の掲示板からのクレジット収集</system:String>
<system:String x:Key="ContinueTraining">訓練完了後に現在スキルの継続特化を試みます</system:String>
<system:String x:Key="TrainingIdle">訓練室は空いています</system:String>
<system:String x:Key="TrainingCompleted">訓練が完了しました</system:String>

View File

@@ -92,6 +92,7 @@
<system:String x:Key="DormFilterNotStationedEnabled">이미 배치된 오퍼레이터 숙소 배치 X</system:String>
<system:String x:Key="DormFilterNotStationedTips">체크할 경우 아이린과 같은 오퍼레이터를 훈련실에서 제거하지 않고, 가공소의 오퍼레이터가 숙소에 배치되는 것을 방지합니다.</system:String>
<system:String x:Key="OriginiumShardAutoReplenishment">오리지늄 조각 자동 보충</system:String>
<system:String x:Key="InfrastReceptionMessageBoardReceive">접견실 게시판에서 크레딧 수집</system:String>
<system:String x:Key="ContinueTraining">훈련 완료 시 스킬 마스터리를 훈련</system:String>
<system:String x:Key="TrainingIdle">훈련실이 비어 있습니다</system:String>
<system:String x:Key="TrainingCompleted">훈련 완료</system:String>

View File

@@ -92,6 +92,7 @@
<system:String x:Key="DormFilterNotStationedEnabled">不将已进驻的干员放入宿舍</system:String>
<system:String x:Key="DormFilterNotStationedTips">勾选则不会将艾丽妮等干员从训练室移除,但也会导致加工站干员不能进入宿舍。</system:String>
<system:String x:Key="OriginiumShardAutoReplenishment">源石碎片自动补货</system:String>
<system:String x:Key="InfrastReceptionMessageBoardReceive">会客室信息板收取信用</system:String>
<system:String x:Key="ContinueTraining">训练完成后继续尝试专精当前技能</system:String>
<system:String x:Key="TrainingIdle">训练室空闲中</system:String>
<system:String x:Key="TrainingCompleted">训练完成</system:String>

View File

@@ -92,6 +92,7 @@
<system:String x:Key="DormFilterNotStationedEnabled">不將已進駐的幹員放入宿舍</system:String>
<system:String x:Key="DormFilterNotStationedTips">勾選則不會將艾麗妮等幹員從訓練室移除,但也會導致加工站幹員不能進入宿舍。</system:String>
<system:String x:Key="OriginiumShardAutoReplenishment">源石碎片自動補貨</system:String>
<system:String x:Key="InfrastReceptionMessageBoardReceive">會客室資訊板收取信用</system:String>
<system:String x:Key="ContinueTraining">訓練完成後繼續嘗試專精當前技能</system:String>
<system:String x:Key="TrainingIdle">訓練室空閒中</system:String>
<system:String x:Key="TrainingCompleted">訓練完成</system:String>

View File

@@ -27,7 +27,6 @@ using MaaWpfGui.Extensions;
using MaaWpfGui.Helper;
using MaaWpfGui.Main;
using MaaWpfGui.Models;
using MaaWpfGui.Models.AsstTasks;
using MaaWpfGui.Services;
using MaaWpfGui.States;
using MaaWpfGui.Utilities;
@@ -1684,18 +1683,7 @@ namespace MaaWpfGui.ViewModels.UI
return;
}
var order = InfrastTask.GetInfrastOrderList();
Instances.AsstProxy.AsstSetInfrastTaskParams(
order,
InfrastTask.UsesOfDrones,
InfrastTask.ContinueTraining,
InfrastTask.DormThreshold / 100.0,
InfrastTask.DormFilterNotStationedEnabled,
InfrastTask.DormTrustEnabled,
InfrastTask.OriginiumShardAutoReplenishment,
InfrastTask.CustomInfrastEnabled,
InfrastTask.CustomInfrastFile,
InfrastTask.CustomInfrastPlanIndex);
Instances.AsstProxy.AsstSetInfrastTaskParams();
}
private bool AppendInfrast()
@@ -1707,20 +1695,7 @@ namespace MaaWpfGui.ViewModels.UI
return false;
}
var (type, param) = new AsstInfrastTask
{
Facilitys = InfrastTask.GetInfrastOrderList(),
UsesOfDrones = InfrastTask.UsesOfDrones,
ContinueTraining = InfrastTask.ContinueTraining,
DormThreshold = InfrastTask.DormThreshold / 100.0,
DormFilterNotStationedEnabled = InfrastTask.DormFilterNotStationedEnabled,
DormDormTrustEnabled = InfrastTask.DormTrustEnabled,
OriginiumShardAutoReplenishment = InfrastTask.OriginiumShardAutoReplenishment,
IsCustom = InfrastTask.CustomInfrastEnabled,
Filename = InfrastTask.CustomInfrastFile,
PlanIndex = InfrastTask.CustomInfrastPlanIndex,
}.Serialize();
var (type, param) = InfrastTask.Serialize();
return Instances.AsstProxy.AsstAppendTaskWithEncoding(AsstProxy.TaskType.Infrast, type, param);
}

View File

@@ -20,6 +20,8 @@ using System.Linq;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
using MaaWpfGui.Models;
using MaaWpfGui.Models.AsstTasks;
using MaaWpfGui.Services;
using MaaWpfGui.Utilities.ValueType;
using Microsoft.Win32;
using Newtonsoft.Json;
@@ -221,6 +223,18 @@ public class InfrastSettingsUserControlModel : TaskViewModel
}
}
private bool _receptionMessageBoardReceive = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.InfrastReceptionMessageBoardReceive, bool.TrueString));
public bool ReceptionMessageBoardReceive
{
get => _receptionMessageBoardReceive;
set
{
SetAndNotify(ref _receptionMessageBoardReceive, value);
ConfigurationHelper.SetValue(ConfigurationKeys.InfrastReceptionMessageBoardReceive, value.ToString());
}
}
private bool _continueTraining = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ContinueTraining, bool.FalseString));
/// <summary>
@@ -620,4 +634,22 @@ public class InfrastSettingsUserControlModel : TaskViewModel
++CustomInfrastPlanIndex;
}
public override (AsstTaskType Type, JObject Params) Serialize()
{
return new AsstInfrastTask
{
Facilitys = GetInfrastOrderList(),
UsesOfDrones = UsesOfDrones,
ContinueTraining = ContinueTraining,
DormThreshold = DormThreshold / 100.0,
DormFilterNotStationedEnabled = DormFilterNotStationedEnabled,
DormDormTrustEnabled = DormTrustEnabled,
OriginiumShardAutoReplenishment = OriginiumShardAutoReplenishment,
IsCustom = CustomInfrastEnabled,
ReceptionMessageBoard = ReceptionMessageBoardReceive,
Filename = CustomInfrastFile,
PlanIndex = CustomInfrastPlanIndex,
}.Serialize();
}
}

View File

@@ -50,6 +50,9 @@
<CheckBox Margin="0,10" IsChecked="{Binding OriginiumShardAutoReplenishment}">
<controls:TextBlock Text="{DynamicResource OriginiumShardAutoReplenishment}" TextWrapping="Wrap" />
</CheckBox>
<CheckBox Margin="0,10" IsChecked="{Binding ReceptionMessageBoardReceive}">
<controls:TextBlock Text="{DynamicResource InfrastReceptionMessageBoardReceive}" TextWrapping="Wrap" />
</CheckBox>
<CheckBox Margin="0,10" IsChecked="{Binding ContinueTraining}">
<controls:TextBlock Text="{DynamicResource ContinueTraining}" TextWrapping="Wrap" />
</CheckBox>