/// <summary> /// Gets the Form ID from the input <see cref="name"/>. /// </summary> /// <param name="name"></param> /// <param name="strings"></param> /// <param name="species">Species ID the form belongs to</param> /// <param name="format">Format the form name should appear in</param> /// <returns>Zero (base form) if no form matches the input string.</returns> public static int GetFormFromString(string name, GameStrings strings, int species, int format) { if (name.Length == 0) { return(0); } string[] formStrings = FormConverter.GetFormList(species, strings.Types, strings.forms, genderForms, format); return(Math.Max(0, Array.FindIndex(formStrings, z => z.Contains(name)))); }
/// <summary> /// Converts a Form ID to string. /// </summary> /// <param name="form"></param> /// <param name="strings"></param> /// <param name="species"></param> /// <param name="format"></param> /// <returns></returns> public static string GetStringFromForm(int form, GameStrings strings, int species, int format) { if (form <= 0) { return(string.Empty); } var forms = FormConverter.GetFormList(species, strings.Types, strings.forms, genderForms, format); return(form >= forms.Length ? string.Empty : forms[form]); }
public void SetFormString(int index) { FormIndex = index; if (index <= 0) { Form = string.Empty; return; } var Forms = FormConverter.GetFormList(Species, Strings.Types, Strings.forms, genderForms, Format); Form = FormIndex >= Forms.Length ? string.Empty : Forms[index]; }
private void LoadLines(IEnumerable <string> lines) { lines = lines.Select(z => z.Replace('\'', '’').Replace('–', '-').Trim()); // Sanitize apostrophes & dashes lines = lines.Where(z => z.Length > 2); ParseLines(lines); Form = ConvertFormFromShowdown(Form, Species, Ability); // Set Form if (Form.Length == 0) { FormIndex = 0; return; } string[] formStrings = FormConverter.GetFormList(Species, Strings.Types, Strings.forms, genderForms, Format); FormIndex = Math.Max(0, Array.FindIndex(formStrings, z => z.Contains(Form))); }
/// <summary> /// Gets a list of formes that the species can have. /// </summary> /// <param name="species">National Dex number of the Pokémon.</param> /// <param name="types">List of type names</param> /// <param name="forms">List of form names</param> /// <param name="genders">List of genders names</param> /// <param name="generation">Generation number for exclusive formes</param> /// <returns>A list of strings corresponding to the formes that a Pokémon can have.</returns> public static string[] GetFormList(int species, string[] types, string[] forms, string[] genders, int generation = Generation) { return(FormConverter.GetFormList(species, types, forms, genders, generation)); }
/// <summary> /// Gets a list of formes that the species can have. /// </summary> /// <param name="species">National Dex number of the Pokémon.</param> /// <param name="types">List of type names</param> /// <param name="forms">List of form names</param> /// <param name="genders">List of genders names</param> /// <param name="generation">Generation number for exclusive formes</param> /// <returns>A list of strings corresponding to the formes that a Pokémon can have.</returns> public static string[] GetFormList(int species, IReadOnlyList <string> types, IReadOnlyList <string> forms, IReadOnlyList <string> genders, int generation = Generation) { return(FormConverter.GetFormList(species, types, forms, genders, generation)); }