mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05:00
Update SK2 language coercion
Closes #3194 Exports are fine, imports with an ambiguous language (can be either JPN or INT) while illegal don't result in the above branches passing it. Inputs with <=6 chars for OT&Nick will be ambiguous; PKM editor.
This commit is contained in:
parent
0d45075d4b
commit
7bc733c900
|
|
@ -197,9 +197,9 @@ private static bool IsJapanese(byte[] data)
|
|||
|
||||
for (int i = 6; i < 0xC; i++)
|
||||
{
|
||||
if (data[0x24 + i] != 0 && data[0x24 + i] != StringConverter12.G1TerminatorCode)
|
||||
if (data[0x24 + i] is not (0 or StringConverter12.G1TerminatorCode))
|
||||
return false;
|
||||
if (data[0x30 + i] != 0 && data[0x30 + i] != StringConverter12.G1TerminatorCode)
|
||||
if (data[0x30 + i] is not (0 or StringConverter12.G1TerminatorCode))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,13 @@ private static void CoerceStadium2Language(SK2 sk2, SaveFile sav)
|
|||
|
||||
sk2.SwapLanguage();
|
||||
la = new LegalityAnalysis(sk2);
|
||||
if (!la.Valid) // fail
|
||||
if (la.Valid)
|
||||
return;
|
||||
|
||||
var lang = SpeciesName.GetSpeciesNameLanguage(sk2.Species, sk2.Nickname, 2);
|
||||
if (lang >= 1 && (lang == 1 != sk2.Japanese)) // force match language
|
||||
sk2.SwapLanguage();
|
||||
else if (sk2.Japanese != (sav.Language == 1)) // force match save file
|
||||
sk2.SwapLanguage();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user