feat: 适配编组、干员识别、公招

This commit is contained in:
ManicSteiner
2024-08-05 22:27:09 +08:00
parent faa68bf51e
commit 3898c2fc42
2 changed files with 17 additions and 6 deletions

View File

@@ -971,7 +971,8 @@ namespace MaaWpfGui.Main
var missingOpers = details["details"]?["opers"]?.ToObject<List<List<string>>>();
if (missingOpers is not null)
{
var missingOpersStr = "[" + string.Join("]; [", missingOpers.Select(opers => string.Join(", ", opers))) + "]";
var missingOpersStr = "[" + string.Join("]; [", missingOpers.Select(opers =>
string.Join(", ", opers.Select(oper => DataHelper.GetLocalizedCharacterName(oper))))) + "]";
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("MissingOperators") + missingOpersStr, UiLogColor.Error);
}
else
@@ -1393,11 +1394,12 @@ namespace MaaWpfGui.Main
}
case "BattleFormation":
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormation") + "\n" + JsonConvert.SerializeObject(subTaskDetails!["formation"]));
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormation") + "\n[" +
string.Join(", ", subTaskDetails!["formation"]?.ToObject<List<string>>().Select(oper => DataHelper.GetLocalizedCharacterName(oper))) + "]");
break;
case "BattleFormationSelected":
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormationSelected") + subTaskDetails!["selected"]);
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormationSelected") + DataHelper.GetLocalizedCharacterName(subTaskDetails!["selected"]?.ToString()));
break;
case "CopilotAction":

View File

@@ -316,8 +316,8 @@ namespace MaaWpfGui.ViewModels.UI
foreach (var oper in (JArray?)combs["opers"] ?? [])
{
int operLevel = (int)oper["level"];
string operId = oper["id"]?.ToString();
string operName = oper["name"]?.ToString();
var operId = oper["id"]?.ToString();
var operName = DataHelper.GetLocalizedCharacterName(oper["name"]?.ToString());
string potential = string.Empty;
@@ -617,7 +617,16 @@ namespace MaaWpfGui.ViewModels.UI
List<Tuple<string, int>> operHave = [];
List<Tuple<string, int>> operNotHave = [];
string localizedName = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, string.Empty) switch
string localizedName = ConfigurationHelper.GetValue(ConfigurationKeys.OperNameLanguage, string.Empty) == "OperNameLanguageClient" ?
ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty) switch
{
"Official" => "name",
"Bilibili" => "name",
"YoStarJP" => "name_jp",
"YoStarKR" => "name_kr",
"txwy" => "name_tw",
_ => "name_en",
} : ConfigurationHelper.GetValue(ConfigurationKeys.Localization, string.Empty) switch
{
"zh-cn" => "name",
"ja-jp" => "name_jp",