Skip to content

Commit

Permalink
Merge branch 'MaaAssistantArknights:dev' into dev-3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yumi0606 authored Sep 16, 2023
2 parents 4f8990a + 8fa95e4 commit a793d9a
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 75 deletions.
6 changes: 5 additions & 1 deletion resource/global/YoStarEN/resource/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,10 @@
"Rubble",
"碎石"
],
[
"High-Energy Originium Barrel.*",
"High-Energy Originium Barrel Bomb"
],
[
"High-Energy Originium Bomb",
"高能源石炸弹"
Expand Down Expand Up @@ -5968,4 +5972,4 @@
"Headhunt x10"
]
}
}
}
47 changes: 24 additions & 23 deletions resource/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4653,6 +4653,7 @@
},
"Award": {
"template": "Task.png",
"templThreshold": 0.7,
"action": "ClickSelf",
"roi": [
700,
Expand Down Expand Up @@ -7100,29 +7101,29 @@
],
"postDelay": 500
},
"BattleQuickFormationFilter-Trust": {
"action": "ClickSelf",
"roi": [
1010,
70,
35,
580
],
"postDelay": 500,
"next": [
"BattleQuickFormationFilter-Click2"
]
},
"BattleQuickFormationFilter-Click2": {
"action": "ClickSelf",
"roi": [
1125,
60,
150,
600
],
"postDelay": 500
},
"BattleQuickFormationFilter-Trust": {
"action": "ClickSelf",
"roi": [
1010,
70,
35,
580
],
"postDelay": 500,
"next": [
"BattleQuickFormationFilter-Click2"
]
},
"BattleQuickFormationFilter-Click2": {
"action": "ClickSelf",
"roi": [
1125,
60,
150,
600
],
"postDelay": 500
},
"BattleQuickFormationFilterClose": {
"algorithm": "JustReturn",
"action": "ClickRect",
Expand Down
73 changes: 41 additions & 32 deletions src/MaaCore/Task/Infrast/InfrastAbstractTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ void asst::InfrastAbstractTask::clear_custom_config() noexcept
m_custom_config.clear();
}

void asst::InfrastAbstractTask::clear_opers_for_group()
{
m_opers_for_groups.clear();
}

asst::infrast::CustomRoomConfig& asst::InfrastAbstractTask::current_room_config()
{
static infrast::CustomRoomConfig empty;
Expand All @@ -91,49 +96,53 @@ bool asst::InfrastAbstractTask::match_operator_groups()
int swipe_times = 0;
bool pre_result_no_changes = false, retried = false;

std::set<std::string> oper_list;
std::vector<std::string> temp, pre_temp;
while (true) {
if (need_exit()) {
return false;
}
temp.clear();
if (!get_opers(temp, m_mood_threshold)) {
return false;
}
if (pre_temp == temp) {
if (pre_result_no_changes) {
Log.warn("partial result is not changed, reset the page");
if (retried) {
Log.error("already retring");
break;
if (m_opers_for_groups.size() == 0) {
std::vector<std::string> temp, pre_temp;
while (true) {
if (need_exit()) {
return false;
}
temp.clear();
if (!get_opers(temp, m_mood_threshold)) {
return false;
}
if (pre_temp == temp) {
if (pre_result_no_changes) {
Log.warn("partial result is not changed, reset the page");
if (retried) {
Log.error("already retring");
break;
}
swipe_to_the_left_of_operlist(swipe_times + 1);
swipe_times = 0;
retried = true;
}
else {
pre_result_no_changes = true;
}
swipe_to_the_left_of_operlist(swipe_times + 1);
swipe_times = 0;
retried = true;
}
else {
pre_result_no_changes = true;
pre_result_no_changes = false;
}
m_opers_for_groups.insert(temp.begin(), temp.end());
pre_temp = temp;
swipe_of_operlist();
swipe_times++;
}
else {
pre_result_no_changes = false;
}
oper_list.insert(temp.begin(), temp.end());
pre_temp = temp;
swipe_of_operlist();
swipe_times++;
}
swipe_to_the_left_of_operlist(swipe_times + 1);
swipe_times = 0;
// 筛选第一个满足要求的干员组
for (auto it = current_room_config().operator_groups.begin(); it != current_room_config().operator_groups.end();
++it) {
if (ranges::all_of(it->second, [oper_list](std::string& oper) { return oper_list.contains(oper); })) {
current_room_config().names.insert(current_room_config().names.end(), it->second.begin(), it->second.end());
for (const auto& oper_group_pair : current_room_config().operator_groups) {
if (ranges::all_of(oper_group_pair.second,
[](const std::string& oper) { return m_opers_for_groups.contains(oper); })) {

ranges::for_each(oper_group_pair.second, [](const std::string& oper) { m_opers_for_groups.erase(oper); });
current_room_config().names.insert(current_room_config().names.end(), oper_group_pair.second.begin(),
oper_group_pair.second.end());

json::value sanity_info = basic_info_with_what("CustomInfrastRoomGroupsMatch");
sanity_info["details"]["group"] = it->first;
sanity_info["details"]["group"] = oper_group_pair.first;
callback(AsstMsg::SubTaskExtraInfo, sanity_info);
break;
}
Expand Down
5 changes: 5 additions & 0 deletions src/MaaCore/Task/Infrast/InfrastAbstractTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace asst

void set_custom_config(infrast::CustomFacilityConfig config) noexcept;
void clear_custom_config() noexcept;
// 清空编组匹配用的可用干员列表
static void clear_opers_for_group();

static constexpr int OperSelectRetryTimes = 3;
static constexpr int TaskRetryTimes = 3;
Expand All @@ -41,6 +43,7 @@ namespace asst
void swipe_of_operlist();
bool is_use_custom_opers();
infrast::CustomRoomConfig& current_room_config();
// 将定义的干员编组解释为具体干员,每次基建换班任务的第一次调用时缓存可用干员列表
bool match_operator_groups();
bool swipe_and_select_custom_opers(bool is_dorm_order = false);
bool select_custom_opers(std::vector<std::string>& partial_result);
Expand Down Expand Up @@ -72,5 +75,7 @@ namespace asst
int m_cur_facility_index = 0;
bool m_is_custom = false;
infrast::CustomFacilityConfig m_custom_config;
// 编组匹配用的可用干员列表,每次基建换班前清空。按照第一次调用match_operator_groups()时设置的心情阈值进行缓存
inline static std::set<std::string> m_opers_for_groups;
};
} // namespace asst
2 changes: 1 addition & 1 deletion src/MaaCore/Task/Infrast/InfrastProductionTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace asst
{
// 生产类设施的任务,适用于制造站/贸易站
// 生产类设施的任务,适用于制造站贸易站、控制中枢
class InfrastProductionTask : public InfrastAbstractTask
{
public:
Expand Down
1 change: 1 addition & 0 deletions src/MaaCore/Task/Interface/InfrastTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ asst::InfrastTask::InfrastTask(const AsstCallback& callback, Assistant* inst)
m_dorm_task_ptr(std::make_shared<InfrastDormTask>(callback, inst, TaskType))
{
LogTraceFunction;
clear_opers_for_group();

m_infrast_begin_task_ptr->set_tasks({ "InfrastBegin" }).set_ignore_error(true);
m_replenish_task_ptr = m_mfg_task_ptr->register_plugin<ReplenishOriginiumShardTaskPlugin>();
Expand Down
12 changes: 9 additions & 3 deletions src/MaaWpfGui/Models/ResourceUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,15 @@ public static async Task<UpdateResult> UpdateFileWithETage(string baseUrl, strin
});
}

var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
using var fileStream = new FileStream(saveTo, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true);
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
var tempFile = saveTo + ".tmp";
using (var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
using var fileStream = new FileStream(tempFile, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true);
await stream.CopyToAsync(fileStream).ConfigureAwait(false);
}

File.Copy(tempFile, saveTo, true);
File.Delete(tempFile);

ETagCache.Set(url, response.Headers.ETag.Tag);
return UpdateResult.Success;
Expand Down
4 changes: 2 additions & 2 deletions src/MaaWpfGui/Res/Localizations/en-us.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla
<system:String x:Key="Drop" xml:space="preserve">Drops: </system:String>
<system:String x:Key="TotalDrop" xml:space="preserve">Total Drops: </system:String>
<system:String x:Key="ThisFacility" xml:space="preserve">Current Facility: </system:String>
<system:String x:Key="RoomGroupsMatch" xml:space="preserve">Match to Group: </system:String>
<system:String x:Key="RoomGroupsMatch" xml:space="preserve">Match Group: </system:String>
<system:String x:Key="RoomGroupsMatchFailed" xml:space="preserve">Failed to match operator groups, group list: </system:String>
<system:String x:Key="RoomOperators" xml:space="preserve">preferred operators: </system:String>
<system:String x:Key="ProductIncorrect">Product does NOT match the configuration.</system:String>
Expand All @@ -564,7 +564,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla
<system:String x:Key="BattleFormation">Start formation</system:String>
<system:String x:Key="BattleFormationSelected" xml:space="preserve">Selection of operator: </system:String>
<system:String x:Key="CurrentSteps">Current step: {0} {1}</system:String>
<system:String x:Key="UnsupportedLevel">Unsupported stage. Please check the stage name.</system:String>
<system:String x:Key="UnsupportedLevel">Unsupported stage. Please check the stage name!</system:String>
<system:String x:Key="RecruitTagsDetected" xml:space="preserve">Identification results: </system:String>
<system:String x:Key="ConnectFailed">Connection Failed</system:String>
<system:String x:Key="TryToStartEmulator">Trying to start the emulator</system:String>
Expand Down
6 changes: 4 additions & 2 deletions src/MaaWpfGui/Res/Localizations/ja-jp.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,8 @@ Bilibili: ログイン インターフェイスに表示されるアカウント
<system:String x:Key="ExternalNotificationTips">注:外部通知機能は現在、「すべてのタスクが完了しました」という通知のみを送信します。</system:String>
<system:String x:Key="Off">シャットダウン</system:String>
<system:String x:Key="ExternalNotificationSettings">外部通知</system:String>
<system:String x:Key="ExternalNotificationSmtpSsl">[SMTP] SSL を使用します</system:String>
<system:String x:Key="ExternalNotificationSmtpAuth">[SMTP] にはログインが必要です</system:String>
<system:String x:Key="ExternalNotificationSmtpSsl">[SMTP] SSL を使用します</system:String>
<system:String x:Key="ExternalNotificationSmtpAuth">[SMTP] ログインが必要です</system:String>
<system:String x:Key="ExternalNotificationSmtpUser">[SMTP] ユーザー名</system:String>
<system:String x:Key="ExternalNotificationSmtpPassword">[SMTP] パスワード</system:String>
<system:String x:Key="ExternalNotificationSmtpFrom">[SMTP] 送信者</system:String>
Expand All @@ -644,4 +644,6 @@ Bilibili: ログイン インターフェイスに表示されるアカウント
<system:String x:Key="GameResourceUpdated">ゲームリソースが更新されました。MAAを再起動してください</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateHello">ドクター、新しいお知らせがあります!</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateFooterLineOne">このメッセージが表示されるのは、MAA で SMTP サーバーをセットアップし、メール通知サービスを有効にしているためです。</system:String>
<system:String x:Key="GameResourceUpdating">ゲームリソースは更新されていますので、しばらくお待ちください</system:String>
<system:String x:Key="Processing">処理ステーション</system:String>
</ResourceDictionary>
40 changes: 33 additions & 7 deletions src/MaaWpfGui/Res/Localizations/ko-kr.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- .Net 8 -->
<system:String x:Key="Dotnet8">MAA가 곧 업그레이드될 예정입니다. 업그레이드된 버전은 .NET 8.0 런타임이 설치되지 않은 컴퓨터는 지원되지 않으므로 수동으로 다운로드해야 합니다.\n\nWindows 7 운영체제 또한 더 이상 지원되지 않을 것입니다.\n\n'예'를 클릭하면 새로운 런타임 다운로드 링크가 열립니다. '아니요'를 클릭하면 원치 않는 소프트웨어 업데이트를 방지하기 위해 자동 다운로드가 비활성화됩니다. 자동 다운로드를 비활성화하더라도 소프트웨어 설정에서 수동으로 다시 기능을 활성화할 수 있습니다.</system:String>
<system:String x:Key="Dotnet8Caption">소프트웨어 버전 업그레이드 및 지원 변경 사항</system:String>
Expand Down Expand Up @@ -80,7 +77,7 @@
<system:String x:Key="SecondResolution">분할 화면</system:String>
<system:String x:Key="GeneralWithoutScreencapErr">일반 모드 (차단됨 예외 출력)</system:String>
<system:String x:Key="DormThreshold">오퍼레이터 컨디션 한계점</system:String>
<system:String x:Key="InfrastThresholdTip">커스텀 기반시설이 활성화되어 있다면, 이 설정은 자동배치 시설에만 유효합니다</system:String>
<system:String x:Key="InfrastThresholdTip">사용자 지정 교대 근무 변경이 활성화된 경우 이 필드는 자동 채우기 및 운영자 마샬링을 사용하는 회의실에만 유효합니다</system:String>
<system:String x:Key="RoguelikeStrategyExp">레벨 우선, 최대한 많은 구역 클리어</system:String>
<system:String x:Key="RoguelikeStrategyGold">오리지늄각뿔 우선, 2번째 구역 도달 즉시 탐험 중도 포기</system:String>
<system:String x:Key="RoguelikeLastReward">전기주전자 획득, 3번째 구역 도달 즉시 탐험 중도 포기</system:String>
Expand Down Expand Up @@ -254,8 +251,9 @@ OF-1을 해금하지 않았다면 선택하지 말아 주세요.</system:String>
<system:String x:Key="CustomInfrastPlanShowInFightSettings">기반시설 계획 표시</system:String>
<system:String x:Key="MainViewButtonFeature">메인 화면 버튼의 기능</system:String>
<system:String x:Key="CustomStageCode">스테이지 코드 수동 입력</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">대부분의 메인 스테이지와 원래 목록(예: 4-10, AP-5, H10-1-Hard)에 있는 스테이지 이름을 지원합니다.
레벨 끝에서 「Normal / Hard」를 입력하여 일반 및 터프 난이도 간 전환</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">대부분의 기본 레벨 이름과 원래 레벨 이름 목록 지원(예: 4-10, AP-5, H10-1-Hard)
레벨 끝에 "Normal/Hard"를 입력하여 표준 난이도와 환난 난이도 사이를 전환해야 함을 나타낼 수 있습니다
"SSReopen-XX" 일회성 프록시 SS 포크의 일반 수준을 입력할 수 있습니다</system:String>
<system:String x:Key="AutoDetectConnection">연결 자동 감지</system:String>
<system:String x:Key="AutoDetectConnectionTip">이 체크박스는 감지가 끝나면 자동으로 체크가 해제됩니다. 다시 감지하려면 다시 체크해주세요</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">매번 재감지</system:String>
Expand Down Expand Up @@ -625,4 +623,32 @@ Bilibili: 로그인 인터페이스에 표시되는 계정 이름(예: Zhang San
<!-- Api -->
<system:String x:Key="ApiUpdateSuccess">스테이지 데이터 획득 성공</system:String>
<!-- Api -->
<system:String x:Key="GameResourceUpdating">게임 리소스가 업데이트되고 있으니 기다려 주십시오</system:String>
<system:String x:Key="Processing">처리 스테이션</system:String>
<system:String x:Key="ExternalNotificationSettings">외부 알림</system:String>
<system:String x:Key="ExternalNotificationSendSuccess">성공적으로 보내기</system:String>
<system:String x:Key="ExternalNotificationSendFail">전송 실패</system:String>
<system:String x:Key="ExternalNotificationSendTest">테스트 보내기</system:String>
<system:String x:Key="ExternalNotificationSendTestTitle">MAA 외부 알림 테스트</system:String>
<system:String x:Key="ExternalNotificationSendTestContent">MAA 외부 알림 테스트 정보입니다. 이 콘텐츠가 표시되면 알림이 성공적으로 전송된 것입니다!</system:String>
<system:String x:Key="ExternalNotificationServerChanSendKey">[Server Chan]이 키를 보냅니다.</system:String>
<system:String x:Key="ExternalNotificationSmtpServer">[SMTP] 서버</system:String>
<system:String x:Key="ExternalNotificationSmtpPort">[SMTP] 포트</system:String>
<system:String x:Key="ExternalNotificationSmtpSsl">[SMTP]는 SSL을 사용합니다.</system:String>
<system:String x:Key="ExternalNotificationSmtpAuth">[SMTP]에 로그인해야 합니다.</system:String>
<system:String x:Key="ExternalNotificationSmtpUser">[SMTP] 사용자 이름</system:String>
<system:String x:Key="ExternalNotificationSmtpPassword">[SMTP] 비밀번호</system:String>
<system:String x:Key="ExternalNotificationSmtpFrom">[SMTP] 보낸 사람</system:String>
<system:String x:Key="ExternalNotificationSmtpTo">[SMTP] 받는 사람</system:String>
<system:String x:Key="ExternalNotificationTips">참고: 외부 알림 기능은 현재 "모든 작업 완료" 알림만 보냅니다.</system:String>
<system:String x:Key="Off">끄세요</system:String>
<system:String x:Key="ExternalNotificationEnabled">알림 구성 사용</system:String>
<system:String x:Key="AllTaskCompleteContent">MAA는 {Datetime}의 {Preset} 구성에서 모든 사전 설정 작업을 완료했습니다.</system:String>
<system:String x:Key="UnsupportedLevel">지원되지 않는 레벨은 레벨 이름을 확인하세요!</system:String>
<system:String x:Key="GameResourceUpdated">게임 리소스가 업데이트되었으니 MAA를 다시 시작해주세요.</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateHello">박사님, 새로운 발표가 있습니다!</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateFooterLineOne">MAA에서 SMTP 서버를 설정하고 메일 알림 서비스가 켜져 있기 때문에 이 메시지가 표시됩니다.</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateFooterLineTwo">이 이메일은 자동으로 전송되므로 회신하지 마십시오.</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateLinkOfficialSite">공식 홈페이지</system:String>
<system:String x:Key="ExternalNotificationEmailTemplateLinkCopilotSite">워크 스테이션</system:String>
</ResourceDictionary>
Loading

0 comments on commit a793d9a

Please sign in to comment.