From 3ba2e8e376b1a167721bbaa7c09fd2389484fe60 Mon Sep 17 00:00:00 2001 From: abcboy101 <16735361+abcboy101@users.noreply.github.com> Date: Tue, 9 Jan 2024 04:34:44 +0800 Subject: [PATCH] Gen 1/2 VC filtered OT name legality (#4155) --- .../Legality/Verifiers/TrainerNameVerifier.cs | 5 ++ .../Strings/StringConverter12Transporter.cs | 74 +++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs index ad869a129..40bdff7b0 100644 --- a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs @@ -120,6 +120,11 @@ public void VerifyOTGB(LegalityAnalysis data) private void VerifyGBOTWithinBounds(LegalityAnalysis data, ReadOnlySpan str) { var pk = data.Entity; + + // Filtered OT names use unavailable characters and can be too long + if (str.SequenceEqual(StringConverter12Transporter.GetFilteredOT(pk.Language, pk.Version))) + return; + if (pk.Japanese) { if (str.Length > 5) diff --git a/PKHeX.Core/PKM/Strings/StringConverter12Transporter.cs b/PKHeX.Core/PKM/Strings/StringConverter12Transporter.cs index 237e19091..92244d45d 100644 --- a/PKHeX.Core/PKM/Strings/StringConverter12Transporter.cs +++ b/PKHeX.Core/PKM/Strings/StringConverter12Transporter.cs @@ -147,6 +147,80 @@ private static bool IsAnyKataOnly(ReadOnlySpan chars) 5 => "Trainer", 7 => "Entrenador", //8 => "트레이너", + //9 => "训练家", + //10 => "訓練家", + _ => string.Empty, + }; + + public static string GetFilteredOT(int language, int version) => version switch + { + (int)GameVersion.RD => language switch + { + 1 => "レッド.", + 2 => "Red*", + 3 => "Rouge*", + 4 => "Rosso*", + 5 => "Rot*", + 7 => "Rojo*", + _ => string.Empty, + }, + (int)GameVersion.GN => language switch + { + 1 => "グリーン.", + 2 => "Blue*", + 3 => "Bleu*", + 4 => "Blu*", + 5 => "Blau*", + 7 => "Azul*", + _ => string.Empty, + }, + (int)GameVersion.BU => language switch + { + 1 => "ブルー.", + _ => string.Empty, + }, + (int)GameVersion.YW => language switch + { + 1 => "イエロー.", + 2 => "Yellow*", + 3 => "Jaune*", + 4 => "Giallo*", + 5 => "Gelb*", + 7 => "Amarillo*", + _ => string.Empty, + }, + (int)GameVersion.GD => language switch + { + 1 => "ゴールド.", + 2 => "Gold*", + 3 => "Or*", + 4 => "Oro*", + 5 => "Gold*", + 7 => "Oro*", + 8 => "금.", + _ => string.Empty, + }, + (int)GameVersion.SI => language switch + { + 1 => "シルバー.", + 2 => "Silver*", + 3 => "Argent*", + 4 => "Argento*", + 5 => "Silber*", + 7 => "Plata*", + 8 => "은.", + _ => string.Empty, + }, + (int)GameVersion.C => language switch + { + 1 => "クリスタル.", + 2 => "Crystal*", + 3 => "Cristal*", + 4 => "Cristallo*", + 5 => "Kristall*", + 7 => "Cristal*", + _ => string.Empty, + }, _ => string.Empty, }; }