Merge pull request #3636 from MaaAssistantArknights/dev

Release v4.10.7-beta.1
This commit is contained in:
MistEO
2023-02-07 23:20:17 +08:00
committed by GitHub
10 changed files with 102 additions and 37 deletions

View File

@@ -1,3 +1,9 @@
## v4.10.7-beta.1
- 优化 界面关卡选择及提示支持外服 @liuyifan-eric @ABA2396
- 修复 Unix 的 socket 连接错误 @HerrCai0907
- 修复 IssueBot 文档链接错误 @Rbqwow
## v4.10.6
- 新增 `生息演算` 流程支持,修复大量错误,优化界面支持等 @WLLEGit @hguandl @MistEO

View File

@@ -1,6 +1,6 @@
# Issue Bot 使用方法
Issue Bot 使用的 action 为 [issue-checker](https://github.com/zzyyyl/issue-checker),配置文件为 [issue-checker.yml](.github/issue-checker.yml)。
Issue Bot 使用的 action 为 [issue-checker](https://github.com/zzyyyl/issue-checker),配置文件为 [issue-checker.yml](../.github/issue-checker.yml)。
**注意:拉取请求被增加 `ambiguous` 标签是因为没有按照 commitizen 规范提交。**
@@ -10,7 +10,7 @@ Issue Bot 使用的 action 为 [issue-checker](https://github.com/zzyyyl/issue-c
- 给 议题 和 拉取请求 增加标签,包括 `module` 系列,`Client` 系列,`ambiguous``translation required` 等。
Issue Bot 会根据关键词自动增加分类标签。
具体关键词可以参考[配置文件](.github/issue-checker.yml)。
具体关键词可以参考[配置文件](../.github/issue-checker.yml)。
- 给作者是可见性设置为 public 的 MAA 成员的 议题 和 拉取请求 增加 `MAA Team` 标签。
#### 议题Issue及其评论

View File

@@ -8,6 +8,7 @@
#include <fcntl.h>
#include <signal.h>
#include <sys/errno.h>
#include <sys/socket.h>
#ifndef __APPLE__
#include <sys/prctl.h>
#endif
@@ -1361,7 +1362,7 @@ std::optional<int> asst::Controller::call_command_win32(const std::string& cmd,
asst::platform::single_page_buffer<char> pipe_buffer;
asst::platform::single_page_buffer<char> sock_buffer;
HANDLE pipe_parent_read = INVALID_HANDLE_VALUE, pipe_child_write = INVALID_HANDLE_VALUE;
SECURITY_ATTRIBUTES sa_inherit { .nLength = sizeof(SECURITY_ATTRIBUTES), .bInheritHandle = TRUE };
if (!asst::win32::CreateOverlappablePipe(&pipe_parent_read, &pipe_child_write, nullptr, &sa_inherit,
@@ -1590,36 +1591,37 @@ std::optional<int> asst::Controller::call_command_posix(const std::string& cmd,
}
else if (m_child > 0) {
// parent process
do {
if (recv_by_socket) {
sockaddr addr {};
socklen_t len = sizeof(addr);
sock_buffer = asst::platform::single_page_buffer<char>();
if (recv_by_socket) {
sockaddr addr {};
socklen_t len = sizeof(addr);
sock_buffer = asst::platform::single_page_buffer<char>();
int client_socket = ::accept(m_server_sock, &addr, &len);
if (client_socket < 0) {
Log.error("accept failed:", strerror(errno));
return std::nullopt;
}
ssize_t read_num = ::read(client_socket, sock_buffer.get(), sock_buffer.size());
while (read_num > 0) {
sock_data.insert(sock_data.end(), sock_buffer.get(), sock_buffer.get() + read_num);
read_num = ::read(client_socket, sock_buffer.get(), sock_buffer.size());
}
::close(client_socket);
break;
int client_socket = ::accept(m_server_sock, &addr, &len);
if (client_socket < 0) {
Log.error("accept failed:", strerror(errno));
::kill(m_child, SIGKILL);
::waitpid(m_child, &exit_ret, 0);
return std::nullopt;
}
ssize_t read_num = ::read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size());
ssize_t read_num = ::read(client_socket, sock_buffer.get(), sock_buffer.size());
while (read_num > 0) {
pipe_data.insert(pipe_data.end(), pipe_buffer.get(), pipe_buffer.get() + read_num);
read_num = ::read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size());
sock_data.insert(sock_data.end(), sock_buffer.get(), sock_buffer.get() + read_num);
read_num = ::read(client_socket, sock_buffer.get(), sock_buffer.size());
}
} while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout());
::shutdown(client_socket, SHUT_RDWR);
::close(client_socket);
}
else {
do {
ssize_t read_num = ::read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size());
while (read_num > 0) {
pipe_data.insert(pipe_data.end(), pipe_buffer.get(), pipe_buffer.get() + read_num);
read_num = ::read(m_pipe_out[PIPE_READ], pipe_buffer.get(), pipe_buffer.size());
}
} while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout());
}
::waitpid(m_child, &exit_ret, 0); // if ::waitpid(m_child, &exit_ret, WNOHANG) == 0, repeat it will cause ECHILD, so not check the return value
}
else {
// failed to create child process

View File

@@ -19,6 +19,7 @@ using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using MaaWpfGui.Helper;
using Newtonsoft.Json.Linq;
using Semver;
@@ -85,18 +86,30 @@ namespace MaaWpfGui
"yyyy/MM/dd HH:mm:ss",
CultureInfo.InvariantCulture).AddHours(-Convert.ToInt32(keyValuePairs?["TimeZone"].ToString() ?? "0"));
if (activity != null)
var settingsModel = _container.Get<SettingsViewModel>();
var clientType = settingsModel.ClientType;
// 官服和B服使用同样的资源
if (clientType == "Bilibili" || clientType == string.Empty)
{
clientType = "Official";
}
if (activity?[clientType] != null)
{
try
{
// 资源全开放活动
var resource = activity["Official"]["resourceCollection"];
resourceCollection.Tip = resource?["Tip"]?.ToString();
resourceCollection.UtcStartTime = GetDateTime(resource, "UtcStartTime");
resourceCollection.UtcExpireTime = GetDateTime(resource, "UtcExpireTime");
var resource = activity[clientType]["resourceCollection"];
if (resource != null)
{
resourceCollection.Tip = resource["Tip"]?.ToString();
resourceCollection.UtcStartTime = GetDateTime(resource, "UtcStartTime");
resourceCollection.UtcExpireTime = GetDateTime(resource, "UtcExpireTime");
}
// 活动关卡
foreach (var stageObj in activity["Official"]["sideStoryStage"])
foreach (var stageObj in activity[clientType]["sideStoryStage"] ?? Enumerable.Empty<JToken>())
{
bool isDebugVersion = Marshal.PtrToStringAnsi(AsstGetVersion()) == "DEBUG VERSION";
bool curParsed = !isDebugVersion ?

View File

@@ -58,13 +58,31 @@ namespace MaaWpfGui
}
}
private static string _clientType = ViewStatusStorage.Get("Start.ClientType", string.Empty);
public static string ClientType { get => _clientType; set => _clientType = value; }
// YJ历每一天从4点开始计算日期的时候第二天4点前仍然算作前一天
private static readonly int YJDayStartHour = 4;
private static readonly Dictionary<string, int> _clientTypeTimezone = new Dictionary<string, int>
{
{ string.Empty, 8 },
{ "Official", 8 },
{ "Bilibili", 8 },
{ "txwy", 8 },
{ "YoStarEN", -7 },
{ "YoStarJP", 9 },
{ "YoStarKR", 9 },
};
/// <summary>
/// 获取yj历时间
/// </summary>
/// <returns>yj历时间</returns>
public static DateTime GetYJTimeNow()
{
return DateTime.UtcNow.AddHours(4);
return ToYJTime(DateTime.UtcNow);
}
/// <summary>
@@ -101,7 +119,7 @@ namespace MaaWpfGui
/// <returns>yj历格式的时间</returns>
public static DateTime ToYJTime(DateTime dt)
{
return dt.AddHours(4);
return dt.AddHours(_clientTypeTimezone[ClientType] - YJDayStartHour);
}
private static readonly JObject _itemList = new JObject();

View File

@@ -476,6 +476,11 @@ namespace MaaWpfGui
copilotModel.AddLog(Localization.GetString("CombatError"), UILogColor.Error);
}
if (taskChain == "Fight" && (mainModel.Stage == "Annihilation"))
{
mainModel.AddLog(Localization.GetString("AnnihilationTaskFailed"), UILogColor.Warning);
}
break;
case AsstMsg.TaskChainStart:

View File

@@ -548,8 +548,11 @@ namespace MaaWpfGui
set
{
SetAndNotify(ref _clientType, value);
Utils.ClientType = value;
ViewStatusStorage.Set("Start.ClientType", value);
UpdateWindowTitle(); /* 每次修改客户端时更新WindowTitle */
_container.Get<TaskQueueViewModel>().UpdateStageList(true);
_container.Get<TaskQueueViewModel>().UpdateDatePrompt();
}
}

View File

@@ -782,6 +782,17 @@ namespace MaaWpfGui
var asstProxy = _container.Get<AsstProxy>();
bool mainFightRet = asstProxy.AsstAppendFight(Stage, medicine, stone, times, DropsItemId, drops_quantity);
if (mainFightRet && (Stage == "Annihilation") && _container.Get<SettingsViewModel>().UseAlternateStage)
{
foreach (var stage in new[] { Stage1, Stage2, Stage3 })
{
if (IsStageOpen(stage) && (stage != Stage))
{
mainFightRet = asstProxy.AsstAppendFight(stage, medicine, 0, int.MaxValue, string.Empty, 0);
}
}
}
if (mainFightRet && UseRemainingSanityStage && (RemainingSanityStage != string.Empty))
{
return asstProxy.AsstAppendFight(RemainingSanityStage, 0, 0, int.MaxValue, string.Empty, 0, false);

View File

@@ -74,7 +74,7 @@
<system:String x:Key="StartingRoles">Starting Roles</system:String>
<system:String x:Key="StartingCoreChar">Starting Oper (single, CN name only)</system:String>
<system:String x:Key="StartingCoreCharTip">Only supports the CN name of a single oper, default if not filled.</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">Select "Starting Oper" from support unit list</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">Select &quot;Starting Oper&quot; from support unit list</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">Enable nonfirend support</system:String>
<system:String x:Key="DeploymentWithPause">Deployment with Pause, Works for IS, Copilot and SSS, Beta function, Not recommended yet</system:String>
<system:String x:Key="AdbLiteEnabled">Use Adb Lite (Experimental)</system:String>
@@ -100,6 +100,10 @@
<system:String x:Key="OvercomingYourWeaknesses">Overcoming Your Weaknesses</system:String>
<system:String x:Key="AsYourHeartDesires">As Your Heart Desires</system:String>
<system:String x:Key="AlgorithmFinish">Algorithm Finish</system:String>
<system:String x:Key="AlgorithmBadge">Algorithm Badge</system:String>
<system:String x:Key="AlgorithmConstructionPoint">Algorithm Construction Point</system:String>
<system:String x:Key="NotSelected">Not selected</system:String>
<system:String x:Key="Official">Official (CN)</system:String>
<system:String x:Key="Bilibili">Bilibili</system:String>
@@ -242,6 +246,7 @@
<system:String x:Key="Mall">Credit Store</system:String>
<system:String x:Key="Mission">Collect mission rewards</system:String>
<system:String x:Key="AutoRoguelike">Auto I.S.</system:String>
<system:String x:Key="ReclamationAlgorithm">Reclamation Algorithm</system:String>
<system:String x:Key="SelectAll">Select All</system:String>
<system:String x:Key="Inverse">Inverse</system:String>
@@ -324,6 +329,7 @@
<system:String x:Key="AboutToShutdown">All tasks are completed shutting down. Do you want to cancel?</system:String>
<system:String x:Key="ShutdownPrompt">Tip</system:String>
<system:String x:Key="HibernatePrompt">Task(s) completed, about to hibernate</system:String>
<system:String x:Key="AnnihilationTaskFailed">Annihilation task failed, will try to use alternate stage, some combat settings will not be effective</system:String>
<!-- Logs -->
<!-- Farming -->

View File

@@ -329,6 +329,7 @@
<system:String x:Key="AboutToShutdown">已刷完,即将关机,是否取消?</system:String>
<system:String x:Key="ShutdownPrompt">提示</system:String>
<system:String x:Key="HibernatePrompt">已刷完,即将休眠</system:String>
<system:String x:Key="AnnihilationTaskFailed">剿灭任务失败,将尝试使用剩余备选关卡,部分战斗设置将不生效</system:String>
<!-- 日志 -->
<!-- 一键长草 -->