コード例 #1
0
        /// <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))));
        }
コード例 #2
0
        /// <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]);
        }
コード例 #3
0
ファイル: ShowdownSet.cs プロジェクト: anon-lambda/PKHeX
        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];
        }
コード例 #4
0
ファイル: ShowdownSet.cs プロジェクト: Koi-3088/PKHeX
        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)));
        }
コード例 #5
0
 /// <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));
 }
コード例 #6
0
 /// <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));
 }