public static string MutateNickname(string nick, LanguageID?lang, GameVersion game) { // Length checks are handled later in SetSpeciesLevel if (game.GetGeneration() >= 8 || lang == null) { return(nick); } var full = lang == LanguageID.Japanese || lang == LanguageID.Korean || lang == LanguageID.ChineseS || lang == LanguageID.ChineseT; if (full && GlyphLegality.ContainsHalfWidth(nick)) { return(GlyphLegality.StringConvert(nick, StringConversionType.FullWidth)); } if (!full && GlyphLegality.ContainsFullWidth(nick)) { return(GlyphLegality.StringConvert(nick, StringConversionType.HalfWidth)); } return(nick); }
private static string MutateOT(string OT, LanguageID?lang, GameVersion game) { if (game.GetGeneration() >= 8 || lang == null) { return(OT); } var full = lang == LanguageID.Japanese || lang == LanguageID.Korean || lang == LanguageID.ChineseS || lang == LanguageID.ChineseT; if (full && GlyphLegality.ContainsHalfWidth(OT)) { var max = Legal.GetMaxLengthOT(game.GetGeneration(), (LanguageID)lang); var modified = GlyphLegality.StringConvert(OT, StringConversionType.FullWidth); return(modified.Substring(0, Math.Min(modified.Length, max))); } if (!full && GlyphLegality.ContainsFullWidth(OT)) { var max = Legal.GetMaxLengthOT(game.GetGeneration(), (LanguageID)lang); var modified = GlyphLegality.StringConvert(OT, StringConversionType.HalfWidth); return(modified.Substring(0, Math.Min(modified.Length, max))); } return(OT); }