Skip to content

Commit

Permalink
fix: 干员识别中出现卫戍中的 4★ 预备干员 及 特有 6★
Browse files Browse the repository at this point in the history
  • Loading branch information
ABA2396 committed Nov 28, 2024
1 parent 901e61a commit c36a4ca
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
15 changes: 15 additions & 0 deletions MAA.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=WSA/@EntryIndexedValue">WSA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/Abbreviations/=XYAZ/@EntryIndexedValue">XYAZ</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acast/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acfend/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acguad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acpion/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acspec/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=acsupo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=advapi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Aero/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Affero/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -46,7 +51,15 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bilibili/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bluestacks/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bsconsole/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ccast/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cdfend/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cguard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmedic/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Collapsal/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cpione/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=csnipe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cspec/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=csuppo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ctrler/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=desp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dnplayer/@EntryIndexedValue">True</s:Boolean>
Expand Down Expand Up @@ -106,6 +119,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Prts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=pwfi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=qmsg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Raidian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rcast/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rdfend/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rguard/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -123,6 +137,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=specialaccess/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SSS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=STGM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stormeye/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=strlen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stylet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subtask/@EntryIndexedValue">True</s:Boolean>
Expand Down
58 changes: 38 additions & 20 deletions src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,18 +455,34 @@ public async void StartDepot()
/// </summary>
private static readonly HashSet<string?> _virtuallyOpers =
[
"char_504_rguard",
"char_505_rcast",
"char_506_rmedic",
"char_507_rsnipe",
"char_514_rdfend",
"char_513_apionr",
"char_511_asnipe",
"char_510_amedic",
"char_509_acast",
"char_508_aguard",
"char_1001_amiya2",
"char_1037_amiya3"
"char_504_rguard", // 预备干员-近战
"char_505_rcast", // 预备干员-术师
"char_506_rmedic", // 预备干员-后勤
"char_507_rsnipe", // 预备干员-狙击
"char_508_aguard", // Sharp
"char_509_acast", // Pith
"char_510_amedic", // Touch
"char_511_asnipe", // Stormeye
"char_513_apionr", // 郁金香
"char_514_rdfend", // 预备干员-重装

// 因为 core 是通过名字来判断的,所以下面干员中如果有和上面重名的不会用到,不过也加上了
"char_600_cpione", // 预备干员-先锋 4★
"char_601_cguard", // 预备干员-近卫 4★
"char_602_cdfend", // 预备干员-重装 4★
"char_603_csnipe", // 预备干员-狙击 4★
"char_604_ccast", // 预备干员-术师 4★
"char_605_cmedic", // 预备干员-医疗 4★
"char_606_csuppo", // 预备干员-辅助 4★
"char_607_cspec", // 预备干员-特种 4★
"char_608_acpion", // 郁金香 6★
"char_609_acguad", // Sharp 6★
"char_610_acfend", // Mechanist
"char_614_acsupo", // Raidian
"char_615_acspec", // Misery

"char_1001_amiya2", // 阿米娅-WARRIOR
"char_1037_amiya3", // 阿米娅-MEDIC
];

private string _operBoxInfo = LocalizationHelper.GetString("OperBoxRecognitionTip");
Expand Down Expand Up @@ -549,12 +565,13 @@ public bool OperBoxParse(JObject? details)
return false;
}

List<Tuple<string, int>> operHave = [];
List<Tuple<string, int>> operNotHave = [];

List<(string Name, int Rarity)> operHave = [];
List<(string Name, int Rarity)> operNotHave = [];
(string Name, int Rarity) tuple = ("???", -1);
foreach (JObject operBox in operBoxes.Cast<JObject>())
{
var tuple = new Tuple<string, int>(DataHelper.GetLocalizedCharacterName((string?)operBox["name"]) ?? "???", (int)(operBox["rarity"] ?? -1));
tuple.Name = DataHelper.GetLocalizedCharacterName((string?)operBox["name"]) ?? "???";
tuple.Rarity = (int)(operBox["rarity"] ?? -1);

if (_virtuallyOpers.Contains((string?)operBox["id"]))
{
Expand All @@ -573,11 +590,11 @@ public bool OperBoxParse(JObject? details)
}
}

operHave.Sort((x, y) => y.Item2.CompareTo(x.Item2));
operNotHave.Sort((x, y) => y.Item2.CompareTo(x.Item2));
operHave.Sort((x, y) => y.Rarity.CompareTo(x.Rarity));
operNotHave.Sort((x, y) => y.Rarity.CompareTo(x.Rarity));

OperBoxHaveList = new ObservableCollection<string>(operHave.Select(tuple => tuple.Item1));
OperBoxNotHaveList = new ObservableCollection<string>(operNotHave.Select(tuple => tuple.Item1));
OperBoxHaveList = new(operHave.Select(valueTuple => valueTuple.Name));
OperBoxNotHaveList = new(operNotHave.Select(valueTuple => valueTuple.Name));

bool done = (bool)(details?["done"] ?? false);
if (!done)
Expand All @@ -588,6 +605,7 @@ public bool OperBoxParse(JObject? details)
OperBoxInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("OperBoxRecognitionTip");
OperBoxExportData = details?["own_opers"]?.ToString() ?? string.Empty;
OperBoxDataArray = (JArray)(details?["own_opers"] ?? new JArray());

_runningState.SetIdle(true);

return true;
Expand Down

0 comments on commit c36a4ca

Please sign in to comment.