diff --git a/PKHeX.Core/Legality/Checks.cs b/PKHeX.Core/Legality/Checks.cs index 0fc90e94f..f2f1a2859 100644 --- a/PKHeX.Core/Legality/Checks.cs +++ b/PKHeX.Core/Legality/Checks.cs @@ -181,14 +181,10 @@ private void VerifyNickname() if (!Encounter.Valid) return; - if (pkm.Format <= 6 && pkm.Language > 8) + int maxLanguageID = Legal.GetMaxLanguageID(Info.Generation); + if (pkm.Language == 6 || pkm.Language > maxLanguageID) { - AddLine(Severity.Indeterminate, V4, CheckIdentifier.Language); - return; - } - if (pkm.Format <= 7 && pkm.Language > 10) - { - AddLine(Severity.Indeterminate, V5, CheckIdentifier.Language); + AddLine(Severity.Indeterminate, string.Format(V5, "<=" + maxLanguageID, pkm.Language), CheckIdentifier.Language); return; } @@ -321,7 +317,11 @@ private void VerifyNicknameTrade() return; } else if (3 <= Info.Generation && Info.Generation <= 5) - { + { + // Trades for JPN games have language ID of 0, not 1. + if (pkm.BW && pkm.Format == 5 && pkm.Language == 1) + AddLine(Severity.Invalid, string.Format(V5, 0, 1), CheckIdentifier.Language); + // Suppressing temporarily return; } diff --git a/PKHeX.Core/Legality/Core.cs b/PKHeX.Core/Legality/Core.cs index 417989733..b684efe56 100644 --- a/PKHeX.Core/Legality/Core.cs +++ b/PKHeX.Core/Legality/Core.cs @@ -1101,6 +1101,23 @@ internal static IEnumerable GetFutureGenEvolutions(int generation) } } + internal static int GetMaxLanguageID(int generation) + { + switch (generation) + { + case 1: + case 2: + case 7: + return 10; // VC -> Gen7 + case 3: + return 7; // 1-7 except 6 + case 4: + case 5: + case 6: + return 8; + } + return -1; + } private static bool[] GetReleasedHeldItems(int generation) { switch (generation) diff --git a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs index 6073364fc..b270edd7a 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterGenerator.cs @@ -883,7 +883,9 @@ private static IEnumerable GetValidEncounterTrades(PKM pkm, Game } int lang = pkm.Language; - if (lang == 0 || lang == 6) + if (lang == 6) // invalid language + yield break; + if (lang == 0 && (pkm.Format != 5 || !pkm.BW)) // Japanese trades in BW have no language ID yield break; int lvl = GetMinLevelEncounter(pkm); diff --git a/PKHeX.Core/Legality/LegalityCheckStrings.cs b/PKHeX.Core/Legality/LegalityCheckStrings.cs index bbf495227..ac9519f2c 100644 --- a/PKHeX.Core/Legality/LegalityCheckStrings.cs +++ b/PKHeX.Core/Legality/LegalityCheckStrings.cs @@ -108,9 +108,8 @@ public static class LegalityCheckStrings public static string V11 {get; set;} = "Ingame Trade OT and Nickname have not been altered."; // Valid public static string V1 {get; set;} = "Nickname too long."; // Invalid public static string V2 {get; set;} = "Nickname is empty."; // Invalid - public static string V4 {get; set;} = "Language ID > 8."; // Invalid - public static string V5 {get; set;} = "Language ID > 10."; // Invalid - public static string V222 { get; set; } = "Cannot be given this Nickname."; // Invalid + public static string V5 {get; set;} = "Language ID should be {0}, not {1}."; // Invalid + public static string V222 {get; set;} = "Cannot be given this Nickname."; // Invalid public static string V3 {get; set;} = "Species index invalid for Nickname comparison."; // Invalid public static string V20 {get; set;} = "Nickname does not match species name."; // Invalid public static string V13 {get; set;} = "Egg name does not match language Egg name."; // Invalid diff --git a/PKHeX.Core/PKM/PK5.cs b/PKHeX.Core/PKM/PK5.cs index 5f10d4e15..face551bb 100644 --- a/PKHeX.Core/PKM/PK5.cs +++ b/PKHeX.Core/PKM/PK5.cs @@ -310,7 +310,7 @@ public PK6 ConvertToPK6() else pk6.AbilityNumber = Gen5 ? 1 << (int)(PID >> 16 & 1) : 1 << (int)(PID & 1); } pk6.Markings = Markings; - pk6.Language = Language; + pk6.Language = Math.Max(1, Language); // Hacked or Bad IngameTrade (Japanese B/W) pk6.CNT_Cool = CNT_Cool; pk6.CNT_Beauty = CNT_Beauty; diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index 6281a7005..d19930e23 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -292,6 +292,7 @@ private byte[] Write() public bool FRLG => Version == (int)GameVersion.FR || Version == (int)GameVersion.LG; public bool Pt => (int)GameVersion.Pt == Version; public bool HGSS => Version == (int)GameVersion.HG || Version == (int)GameVersion.SS; + public bool BW => Version == (int)GameVersion.B || Version == (int)GameVersion.W; public bool B2W2 => Version == (int)GameVersion.B2 || Version == (int)GameVersion.W2; public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y; public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR; diff --git a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt index 32c2fff06..7df60feb4 100644 --- a/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt +++ b/PKHeX.Core/Resources/text/en/LegalityCheckStrings_en.txt @@ -69,8 +69,7 @@ V19 = Nickname matches demo language name. V11 = Ingame Trade OT and Nickname have not been altered. V1 = Nickname too long. V2 = Nickname is empty. -V4 = Language ID > 8. -V5 = Language ID > 10. +V5 = Language ID should be {0}, not {1}. V222 = Cannot be given this Nickname. V3 = Species index invalid for Nickname comparison. V20 = Nickname does not match species name. diff --git a/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt b/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt index 7be28db52..5aa47669b 100644 --- a/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt +++ b/PKHeX.Core/Resources/text/ko/LegalityCheckStrings_ko.txt @@ -69,8 +69,7 @@ V19 = 이름이 언어별 데모 이름과 일치합니다. V11 = 게임 내 교환의 어버이와 이름이 달라졌습니다. V1 = 이름이 너무 깁니다. V2 = 이름이 비어 있습니다. -V4 = 언어 ID가 8을 초과합니다. -V5 = 언어 ID가 10을 초과합니다. +V5 = 언어 ID should be {0}, not {1}. V222 = 이 이름은 사용할 수 없습니다. V3 = 이름 비교에 사용할 포켓몬 종류 인덱스가 잘못되었습니다. V20 = 이름이 포켓몬 종류와 일치하지 않습니다. diff --git a/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt b/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt index 3975de2e9..54fcd380e 100644 --- a/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt +++ b/PKHeX.Core/Resources/text/zh/LegalityCheckStrings_zh.txt @@ -69,8 +69,7 @@ V19 = 昵称与体验版语言一致。 V11 = 游戏内连接交换的初训家和昵称未被修改。 V1 = 昵称太长。 V2 = 昵称为空。 -V4 = 语言ID > 8。 -V5 = 语言ID > 10。 +V5 = 语言ID should be {0}, not {1}。 V222 = 无法给宝可梦取中文昵称。 V3 = 宝可梦种类无法用于昵称对比 V20 = 昵称与种类名不一致。