private void VerifyG1OTWithinBounds(LegalityAnalysis data, string str) { if (StringConverter12.GetIsG1English(str)) { if (str.Length > 7 && !(data.EncounterOriginal is EncounterTrade)) // OT already verified; GER shuckle has 8 chars { data.AddLine(GetInvalid(LOTLong)); } } else if (StringConverter12.GetIsG1Japanese(str)) { if (str.Length > 5) { data.AddLine(GetInvalid(LOTLong)); } } else if (data.pkm.Korean && StringConverter2KOR.GetIsG2Korean(str)) { if (str.Length > 5) { data.AddLine(GetInvalid(LOTLong)); } } else { data.AddLine(GetInvalid(LG1CharOT)); } }
private void VerifyG1NicknameWithinBounds(LegalityAnalysis data, string str) { var pkm = data.pkm; if (StringConverter12.GetIsG1English(str)) { if (str.Length > 10) { data.AddLine(GetInvalid(LNickLengthLong)); } } else if (StringConverter12.GetIsG1Japanese(str)) { if (str.Length > 5) { data.AddLine(GetInvalid(LNickLengthLong)); } } else if (pkm.Korean && StringConverter2KOR.GetIsG2Korean(str)) { if (str.Length > 5) { data.AddLine(GetInvalid(LNickLengthLong)); } } else { data.AddLine(GetInvalid(LG1CharNick)); } }
/// <summary> /// Gets a Pokémon's default name for the desired language ID and generation. /// </summary> /// <param name="species">National Dex number of the Pokémon. Should be 0 if an egg.</param> /// <param name="lang">Language ID of the Pokémon</param> /// <param name="generation">Generation specific formatting option</param> /// <returns>Generation specific default species name</returns> public static string GetSpeciesNameGeneration(int species, int lang, int generation) { if (generation == 3 && species == 0) { return("タマゴ"); } string nick = GetSpeciesName(species, lang); if (generation == 2 && lang == (int)LanguageID.Korean) { return(StringConverter2KOR.LocalizeKOR2(nick)); } if (generation < 5 && (generation != 4 || species != 0)) // All caps GenIV and previous, except GenIV eggs. { nick = nick.ToUpper(); if (lang == (int)LanguageID.French) { nick = StringConverter4.StripDiacriticsFR4(nick); // strips accents on E and I } } if (generation < 3) { nick = nick.Replace(" ", string.Empty); } return(nick); }
private int SetString(ReadOnlySpan <char> value, Span <byte> destBuffer, int maxLength, StringConverterOption option = StringConverterOption.None) { if (Korean) { return(StringConverter2KOR.SetString(destBuffer, value, maxLength, option)); } return(StringConverter12.SetString(destBuffer, value, maxLength, Japanese, option)); }
private string GetString(Span <byte> asSpan) { if (Korean) { return(StringConverter2KOR.GetString(asSpan)); } return(StringConverter12.GetString(asSpan, Japanese)); }
private void SetString(Span <byte> asSpan, ReadOnlySpan <char> value, int maxLength) { if (Korean) { StringConverter2KOR.SetString(asSpan, value, maxLength); } else { StringConverter12.SetString(asSpan, value, maxLength, Japanese); } }
/// <summary> /// Gets a Pokémon's default name for the desired language ID and generation. /// </summary> /// <param name="species">National Dex number of the Pokémon. Should be 0 if an egg.</param> /// <param name="language">Language ID of the Pokémon</param> /// <param name="generation">Generation specific formatting option</param> /// <returns>Generation specific default species name</returns> public static string GetSpeciesNameGeneration(int species, int language, int generation) { if (generation >= 5) { return(GetSpeciesName(species, language)); } if (species == 0) { if (generation == 3) { return("タマゴ"); // All Gen3 eggs are treated as JPN eggs. } if (language == (int)LanguageID.French) { return("Oeuf"); // Gen2 & Gen4 don't use Œuf like in future games } } string nick = GetSpeciesName(species, language); if (generation == 2 && language == (int)LanguageID.Korean) { return(StringConverter2KOR.LocalizeKOR2(nick)); } if (generation != 4 || species != 0) // All caps GenIV and previous, except GenIV eggs. { nick = nick.ToUpper(); if (language == (int)LanguageID.French) { nick = StringConverter4.StripDiacriticsFR4(nick); // strips accents on E and I } } if (generation < 3) { nick = nick.Replace(" ", string.Empty); } return(nick); }
private static string GetSpeciesName1234(int species, int language, int generation) { if (species == 0) { return(GetEggName1234(species, language, generation)); } string nick = GetSpeciesName(species, language); switch (language) { case (int)LanguageID.Korean when generation == 2: return(StringConverter2KOR.LocalizeKOR2(nick)); case (int)LanguageID.Korean: case (int)LanguageID.Japanese: return(nick); // No further processing } // All names are uppercase. var sb = new System.Text.StringBuilder(nick); for (int i = 0; i < sb.Length; i++) { sb[i] = char.ToUpper(sb[i]); } if (language == (int)LanguageID.French) { StringConverter4.StripDiacriticsFR4(sb); // strips accents on E and I } // Gen1/2 species names do not have spaces. if (generation < 3) { sb.Replace(" ", string.Empty); } return(sb.ToString()); }
/// <summary> /// Gets a Pokémon's default name for the desired language ID and generation. /// </summary> /// <param name="species">National Dex number of the Pokémon. Should be 0 if an egg.</param> /// <param name="language">Language ID of the Pokémon</param> /// <param name="generation">Generation specific formatting option</param> /// <returns>Generation specific default species name</returns> public static string GetSpeciesNameGeneration(int species, int language, int generation) { if (generation >= 5) { // Species Names for Chinese (Simplified) were revised during Generation 8 Crown Tundra DLC (#2). // For a Gen7 species name request, return the old species name (hardcoded... yay). // In an updated Gen8 game, the species nickname will automatically reset to the correct localization (on save/load ?), fixing existing entries. // We don't differentiate patch revisions, just generation; Gen8 will return the latest localization. // Gen8 did revise CHT species names, but only for Barraskewda, Urshifu, and Zarude. These species are new (Gen8); we can just use the latest. if (generation == 7 && language == (int)LanguageID.ChineseS) { switch (species) { // Revised in DLC1 - Isle of Armor // https://cn.portal-pokemon.com/topics/event/200323190120_post_19.html case (int)Species.Porygon2: return("多边兽Ⅱ"); // Later changed to 多边兽2型 case (int)Species.PorygonZ: return("多边兽Z"); // Later changed to 多边兽乙型 case (int)Species.Mimikyu: return("谜拟Q"); // Later changed to 谜拟丘 // Revised in DLC2 - Crown Tundra // https://cn.portal-pokemon.com/topics/event/201020170000_post_21.html case (int)Species.Cofagrigus: return("死神棺"); // Later changed to 迭失棺 case (int)Species.Pangoro: return("流氓熊猫"); // Later changed to 霸道熊猫 case (int)Species.Nickit: return("偷儿狐"); // Later changed to 狡小狐 case (int)Species.Thievul: return("狐大盗"); // Later changed to 猾大狐 case (int)Species.Toxel: return("毒电婴"); // Later changed to 电音婴 case (int)Species.Runerigus: return("死神板"); // Later changed to 迭失板 } } return(GetSpeciesName(species, language)); } if (species == 0) { if (generation == 3) { return("タマゴ"); // All Gen3 eggs are treated as JPN eggs. } if (language == (int)LanguageID.French) { return("Oeuf"); // Gen2 & Gen4 don't use Œuf like in future games } } string nick = GetSpeciesName(species, language); if (generation == 2 && language == (int)LanguageID.Korean) { return(StringConverter2KOR.LocalizeKOR2(nick)); } if (generation != 4 || species != 0) // All caps GenIV and previous, except GenIV eggs. { nick = nick.ToUpper(); if (language == (int)LanguageID.French) { nick = StringConverter4.StripDiacriticsFR4(nick); // strips accents on E and I } } if (generation < 3) { nick = nick.Replace(" ", string.Empty); } return(nick); }