Ejemplo n.º 1
0
 public BasePokemon BasePokemon([FromForm][Required] string pokemon, [FromForm] string form, [FromForm] int generation)
 {
     if (!Enum.GetNames(typeof(Species)).Any(s => s.ToLower() == pokemon.ToLower()))
     {
         Response.StatusCode = 400;
         return(null);
     }
     try
     {
         Species s       = (Species)Enum.Parse(typeof(Species), pokemon, true);
         var     formNum = 0;
         if (form != null)
         {
             var forms = FormConverter.GetFormList((int)s, GameInfo.Strings.Types, GameInfo.Strings.forms, GameInfo.GenderSymbolASCII, generation);
             formNum = StringUtil.FindIndexIgnoreCase(forms, form);
             if (formNum < 0 || formNum >= forms.Length)
             {
                 Console.WriteLine("No form data found for the following query " + pokemon + " " + form + " " + generation + " forms available: " + String.Join(", ", forms.ToArray()));
                 formNum = 0;
             }
         }
         return(Utils.GetBasePokemon((int)s, formNum, generation));
     }
     catch
     {
         Response.StatusCode = 400;
         return(null);
     }
 }
Ejemplo n.º 2
0
        private static Image GetBaseImageTotem(int species, int form, int gender, bool shiny, int generation)
        {
            var baseform  = FormConverter.GetTotemBaseForm(species, form);
            var baseImage = GetBaseImageDefault(species, baseform, gender, shiny, generation);

            return(ImageUtil.ToGrayscale(baseImage));
        }
Ejemplo n.º 3
0
        private void GetComboBoxes()
        {
            CB_3DSReg.InitializeBinding();
            CB_3DSReg.DataSource = GameInfo.Regions;
            CB_Language.InitializeBinding();
            CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation);

            CB_Country.InitializeBinding();
            CB_Region.InitializeBinding();
            Main.SetCountrySubRegion(CB_Country, "countries");

            var names  = Enum.GetNames(typeof(TrainerSprite6));
            var values = (int[])Enum.GetValues(typeof(TrainerSprite6));
            var data   = names.Zip(values, (a, b) => new ComboItem(a, b))
                         .ToList();

            if (SAV is not SAV6AO)
            {
                data.RemoveAll(z => z.Value > 36);
            }

            CB_MultiplayerSprite.InitializeBinding();
            CB_MultiplayerSprite.DataSource = data;

            L_Vivillon.Text = GameInfo.Strings.specieslist[(int)Species.Vivillon] + ":";
            CB_Vivillon.InitializeBinding();
            CB_Vivillon.DataSource = FormConverter.GetFormList((int)Species.Vivillon, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 6);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Checks a <see cref="PKM"/> file for compatibility to the <see cref="SaveFile"/>.
        /// </summary>
        /// <param name="SAV"><see cref="SaveFile"/> that is being checked.</param>
        /// <param name="pkm"><see cref="PKM"/> that is being tested for compatibility.</param>
        /// <returns></returns>
        public static string[] IsPKMCompatible(this SaveFile SAV, PKM pkm)
        {
            // Check if PKM properties are outside of the valid range
            List <string> errata = new List <string>();

            if (SAV.Generation > 1)
            {
                ushort held = (ushort)pkm.HeldItem;

                if (held > GameInfo.Strings.itemlist.Length)
                {
                    errata.Add($"Item Index beyond range: {held}");
                }
                else if (held > SAV.MaxItemID)
                {
                    errata.Add($"Game can't obtain item: {GameInfo.Strings.itemlist[held]}");
                }
                else if (!pkm.CanHoldItem(SAV.HeldItems))
                {
                    errata.Add($"Game can't hold item: {GameInfo.Strings.itemlist[held]}");
                }
            }

            int count = SAV.Personal[pkm.Species].FormeCount;

            if (pkm.AltForm >= SAV.Personal[pkm.Species].FormeCount && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
            {
                errata.Add(string.Format(LegalityCheckStrings.V304, count - 1, pkm.AltForm));
            }

            if (pkm.Species > GameInfo.Strings.specieslist.Length)
            {
                errata.Add($"Species Index beyond range: {pkm.Species}");
            }
            else if (SAV.MaxSpeciesID < pkm.Species)
            {
                errata.Add($"Game can't obtain species: {GameInfo.Strings.specieslist[pkm.Species]}");
            }

            if (pkm.Moves.Any(m => m > GameInfo.Strings.movelist.Length))
            {
                errata.Add($"Item Index beyond range: {string.Join(", ", pkm.Moves.Where(m => m > GameInfo.Strings.movelist.Length).Select(m => m.ToString()))}");
            }
            else if (pkm.Moves.Any(m => m > SAV.MaxMoveID))
            {
                errata.Add($"Game can't have move: {string.Join(", ", pkm.Moves.Where(m => m > SAV.MaxMoveID).Select(m => GameInfo.Strings.movelist[m]))}");
            }

            if (pkm.Ability > GameInfo.Strings.abilitylist.Length)
            {
                errata.Add($"Ability Index beyond range: {pkm.Ability}");
            }
            else if (pkm.Ability > SAV.MaxAbilityID)
            {
                errata.Add($"Game can't have ability: {GameInfo.Strings.abilitylist[pkm.Ability]}");
            }

            return(errata.ToArray());
        }
Ejemplo n.º 5
0
        public void LoadArgument(IFormArgument f, int species, int form, int generation)
        {
            FieldsLoaded = false;
            var max = FormConverter.GetFormArgumentMax(species, form, generation);

            if (max == 0)
            {
                CurrentSpecies      = species;
                CurrentForm         = form;
                CurrentGeneration   = generation;
                NUD_FormArg.Value   = CB_FormArg.SelectedIndex = 0;
                CB_FormArg.Visible  = false;
                NUD_FormArg.Visible = false;
                FieldsLoaded        = true;
                return;
            }

            bool named = FormConverter.GetFormArgumentIsNamedIndex(species);

            if (named)
            {
                if (CurrentSpecies == species && CurrentForm == form && CurrentGeneration == generation)
                {
                    CurrentValue = f.FormArgument;
                    FieldsLoaded = true;
                    return;
                }
                IsRawMode = false;

                NUD_FormArg.Visible = false;
                CB_FormArg.Items.Clear();
                var args = FormConverter.GetFormArgumentStrings(species);
                CB_FormArg.Items.AddRange(args);
                CB_FormArg.SelectedIndex = 0;
                CB_FormArg.Visible       = true;
            }
            else
            {
                IsRawMode = true;

                CB_FormArg.Visible  = false;
                NUD_FormArg.Maximum = max;
                NUD_FormArg.Visible = true;
            }
            CurrentSpecies    = species;
            CurrentForm       = form;
            CurrentGeneration = generation;

            if (FormConverter.IsFormArgumentTypeDatePair(species, form))
            {
                CurrentValue = f.FormArgument & 0xFF;
            }
            else
            {
                CurrentValue = f.FormArgument;
            }

            FieldsLoaded = true;
        }
Ejemplo n.º 6
0
        private static Image GetBaseImage(int species, int form, int gender, bool shiny, int generation)
        {
            var img = FormConverter.IsTotemForm(species, form)
                ? GetBaseImageTotem(species, form, gender, shiny, generation)
                : GetBaseImageDefault(species, form, gender, shiny, generation);

            return(img ?? GetBaseImageFallback(species, form, gender, shiny, generation));
        }
Ejemplo n.º 7
0
        private static Image GetBaseImageTotem(int species, int form, int gender, bool shiny, int generation)
        {
            var baseform  = FormConverter.GetTotemBaseForm(species, form);
            var file      = PKX.GetResourceStringSprite(species, baseform, gender, generation, shiny);
            var baseImage = (Image)Resources.ResourceManager.GetObject(file);

            return(ImageUtil.ToGrayscale(baseImage));
        }
Ejemplo n.º 8
0
        public static Image GetSprite(int species, int form, int gender, int item, bool isegg, bool shiny, int generation = -1, bool isBoxBGRed = false)
        {
            if (species == 0)
            {
                return(Resources._0);
            }

            if (generation == 3 && species == 386) // Deoxys, special consideration for Gen3 save files
            {
                form = GetDeoxysForm();
            }

            string file = PKX.GetResourceStringSprite(species, form, gender, generation);

            // Redrawing logic
            Image baseImage = (Image)Resources.ResourceManager.GetObject(file);

            if (FormConverter.IsTotemForm(species, form))
            {
                form      = FormConverter.GetTotemBaseForm(species, form);
                file      = PKX.GetResourceStringSprite(species, form, gender, generation);
                baseImage = (Image)Resources.ResourceManager.GetObject(file);
                baseImage = ImageUtil.ToGrayscale(baseImage);
            }
            if (baseImage == null)
            {
                baseImage = (Image)Resources.ResourceManager.GetObject($"_{species}");
                baseImage = baseImage != null?ImageUtil.LayerImage(baseImage, Resources.unknown, 0, 0, .5) : Resources.unknown;
            }
            if (isegg)
            {
                // Partially transparent species.
                baseImage = ImageUtil.ChangeOpacity(baseImage, 0.33);
                // Add the egg layer over-top with full opacity.
                var egg = species == 490 ? (Image)Resources.ResourceManager.GetObject("_490_e") : Resources.egg;
                baseImage = ImageUtil.LayerImage(baseImage, egg, 0, 0, 1);
            }
            if (shiny)
            {
                // Add shiny star to top left of image.
                var rare = isBoxBGRed ? Resources.rare_icon_alt : Resources.rare_icon;
                baseImage = ImageUtil.LayerImage(baseImage, rare, 0, 0, 0.7);
            }
            if (item > 0)
            {
                Image itemimg = (Image)Resources.ResourceManager.GetObject($"item_{item}") ?? Resources.helditem;
                if (generation >= 2 && generation <= 4 && 328 <= item && item <= 419) // gen2/3/4 TM
                {
                    itemimg = Resources.item_tm;
                }

                // Redraw
                int x = 22 + (15 - itemimg.Width) / 2;
                int y = 15 + (15 - itemimg.Height);
                baseImage = ImageUtil.LayerImage(baseImage, itemimg, x, y, 1);
            }
            return(baseImage);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Checks a <see cref="PKM"/> file for compatibility to the <see cref="SaveFile"/>.
        /// </summary>
        /// <param name="SAV"><see cref="SaveFile"/> that is being checked.</param>
        /// <param name="pkm"><see cref="PKM"/> that is being tested for compatibility.</param>
        /// <returns></returns>
        public static string[] IsPKMCompatible(this SaveFile SAV, PKM pkm)
        {
            // Check if PKM properties are outside of the valid range
            List <string> errata = new List <string>();

            if (SAV.Generation > 1)
            {
                ushort held = (ushort)pkm.HeldItem;

                if (held > GameInfo.Strings.itemlist.Length)
                {
                    errata.Add($"{MsgIndexItemRange} {held}");
                }
                else if (held > SAV.MaxItemID)
                {
                    errata.Add($"{MsgIndexItemGame} {GameInfo.Strings.itemlist[held]}");
                }
                else if (!pkm.CanHoldItem(SAV.HeldItems))
                {
                    errata.Add($"{MsgIndexItemHeld} {GameInfo.Strings.itemlist[held]}");
                }
            }

            if (pkm.Species > GameInfo.Strings.specieslist.Length)
            {
                errata.Add($"{MsgIndexSpeciesRange} {pkm.Species}");
            }
            else if (SAV.MaxSpeciesID < pkm.Species)
            {
                errata.Add($"{MsgIndexSpeciesGame} {GameInfo.Strings.specieslist[pkm.Species]}");
            }

            if (!SAV.Personal[pkm.Species].IsFormeWithinRange(pkm.AltForm) && !FormConverter.IsValidOutOfBoundsForme(pkm.Species, pkm.AltForm, pkm.GenNumber))
            {
                errata.Add(string.Format(LegalityCheckStrings.V304, Math.Max(0, SAV.Personal[pkm.Species].FormeCount - 1), pkm.AltForm));
            }

            if (pkm.Moves.Any(m => m > GameInfo.Strings.movelist.Length))
            {
                errata.Add($"{MsgIndexMoveRange} {string.Join(", ", pkm.Moves.Where(m => m > GameInfo.Strings.movelist.Length).Select(m => m.ToString()))}");
            }
            else if (pkm.Moves.Any(m => m > SAV.MaxMoveID))
            {
                errata.Add($"{MsgIndexMoveGame} {string.Join(", ", pkm.Moves.Where(m => m > SAV.MaxMoveID).Select(m => GameInfo.Strings.movelist[m]))}");
            }

            if (pkm.Ability > GameInfo.Strings.abilitylist.Length)
            {
                errata.Add($"{MsgIndexAbilityRange} {pkm.Ability}");
            }
            else if (pkm.Ability > SAV.MaxAbilityID)
            {
                errata.Add($"{MsgIndexAbilityGame} {GameInfo.Strings.abilitylist[pkm.Ability]}");
            }

            return(errata.ToArray());
        }
Ejemplo n.º 10
0
 private static string[] GetFormNames4Dex(int species)
 {
     string[] formNames = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 4);
     if (species == (int)Species.Pichu)
     {
         formNames = new[] { MALE, FEMALE, formNames[1] }
     }
     ;                                                     // Spiky
     return(formNames);
 }
Ejemplo n.º 11
0
        private void SetForms()
        {
            int  species = WinFormsUtil.GetIndex(CB_Species);
            bool hasForms = PersonalTable.AO[species].HasFormes || new[] { 664, 665, 414 }.Contains(species);

            CB_Form.Enabled = CB_Form.Visible = hasForms;

            CB_Form.InitializeBinding();
            CB_Form.DataSource = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
        }
Ejemplo n.º 12
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))));
    }
Ejemplo n.º 13
0
        private void SetForms()
        {
            int  species  = WinFormsUtil.GetIndex(CB_Species);
            bool hasForms = FormConverter.HasFormSelection(PersonalTable.AO[species], species, 6);

            CB_Form.Enabled = CB_Form.Visible = hasForms;

            CB_Form.InitializeBinding();
            CB_Form.DataSource = PKX.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();
        }
Ejemplo n.º 14
0
        private void SetForms(EntreeSlot slot)
        {
            bool hasForms = PersonalTable.B2W2[slot.Species].HasFormes || slot.Species == 414;

            L_Form.Visible = CB_Form.Enabled = CB_Form.Visible = hasForms;

            CB_Form.InitializeBinding();
            var list = FormConverter.GetFormList(slot.Species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);

            CB_Form.DataSource = new BindingSource(list, null);
        }
Ejemplo n.º 15
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>
    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]);
    }
Ejemplo n.º 16
0
        private static IEnumerable <string> getAllForms(int species)
        {
            string[] pkx_forms_1 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 1);
            string[] pkx_forms_2 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 2);
            string[] pkx_forms_3 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 3);
            string[] pkx_forms_4 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 4);
            string[] pkx_forms_5 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 5);
            string[] pkx_forms_6 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 6);
            string[] pkx_forms_7 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 7);
            string[] pkx_forms_8 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, 8);

            return(pkx_forms_1.Union(pkx_forms_2).Union(pkx_forms_3).Union(pkx_forms_4).Union(pkx_forms_5).Union(pkx_forms_6).Union(pkx_forms_7).Union(pkx_forms_8));
        }
Ejemplo n.º 17
0
        private bool FillLBForms(int index)
        {
            LB_Forms.DataSource = null;
            LB_Forms.Items.Clear();

            DisplayedForms.Clear();
            DisplayedForms.Add(new ComboItem(GameInfo.Strings.types[0], 0));
            CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);

            lastForm = 0;

            int  species  = DexToSpecies[index + 1];
            bool hasForms = FormInfo.HasFormSelection(SAV.Personal[species], species, 8);

            LB_Forms.Enabled = CB_DisplayForm.Enabled = hasForms;
            if (!hasForms)
            {
                return(false);
            }

            var ds = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();

            if (ds.Count == 1 && string.IsNullOrEmpty(ds[0]))
            {
                // empty
                LB_Forms.Enabled = CB_DisplayForm.Enabled = false;
                return(false);
            }

            // Sanitize forms to only show entries with form storage
            var formCount = SAV.Personal[species].FormCount;
            var sanitized = new List <string>();

            DisplayedForms.Clear();
            for (var form = 0; form < formCount; form++)
            {
                if (!Dex.HasFormStorage(species, form) || Dex.IsBlacklisted(species, form))
                {
                    continue;
                }

                sanitized.Add(ds[form]);
                DisplayedForms.Add(new ComboItem(ds[form], form));
            }

            CB_DisplayForm.DataSource = new BindingSource(DisplayedForms, null);
            LB_Forms.DataSource       = sanitized;
            LB_Forms.SelectedIndex    = 0;

            return(true);
        }
Ejemplo n.º 18
0
        private void GetComboBoxes()
        {
            CB_3DSReg.InitializeBinding();
            CB_3DSReg.DataSource = GameInfo.Regions;
            CB_Language.InitializeBinding();
            CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation);

            CB_Country.InitializeBinding();
            CB_Region.InitializeBinding();
            Main.SetCountrySubRegion(CB_Country, "countries");

            L_Vivillon.Text = GameInfo.Strings.Species[(int)Species.Vivillon] + ":"; // todo : did they replace this with the new multiform species?
            CB_Vivillon.InitializeBinding();
            CB_Vivillon.DataSource = FormConverter.GetFormList((int)Species.Vivillon, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
        }
Ejemplo n.º 19
0
        public static Image GetSprite(int species, int form, bool shiny)
        {
            int gender = 0;

            if (species == 0)
            {
                return(Resources._0);
            }

            string file = PKX.GetResourceStringSprite(species, form, gender, generation, shiny);

            // Redrawing logic
            Image baseImage = (Image)Resources.ResourceManager.GetObject(file);

            if (FormConverter.IsTotemForm(species, form))
            {
                form      = FormConverter.GetTotemBaseForm(species, form);
                file      = PKX.GetResourceStringSprite(species, form, gender, generation, shiny);
                baseImage = (Image)Resources.ResourceManager.GetObject(file);
                baseImage = ImageUtil.ToGrayscale(baseImage);
            }
            if (baseImage == null)
            {
                if (shiny) // try again without shiny
                {
                    file      = PKX.GetResourceStringSprite(species, form, gender, generation);
                    baseImage = (Image)Resources.ResourceManager.GetObject(file);
                }
                if (baseImage == null)
                {
                    baseImage = (Image)Resources.ResourceManager.GetObject($"_{species}");
                }
                baseImage = baseImage != null?ImageUtil.LayerImage(baseImage, Resources.unknown, 0, 0, .5) : Resources.unknown;
            }
            if (shiny)
            {
                // Add shiny star to top left of image.
                var rare = Resources.rare_icon;
                baseImage = ImageUtil.LayerImage(baseImage, rare, 0, 0, 0.7);
            }
            return(baseImage);
        }
Ejemplo n.º 20
0
    private void GetEntry()
    {
        // Load Bools for the data
        CB_State.SelectedIndex = (int)Zukan.GetState(species);
        Zukan.GetGenderFlags(species, out var m, out var f, out var ms, out var fs);
        CHK_M.Checked  = m;
        CHK_F.Checked  = f;
        CHK_MS.Checked = ms;
        CHK_FS.Checked = fs;

        CHK_LangJPN.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.Japanese);
        CHK_LangENG.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.English);
        CHK_LangFRE.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.French);
        CHK_LangITA.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.Italian);
        CHK_LangGER.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.German);
        CHK_LangSPA.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.Spanish);
        CHK_LangKOR.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.Korean);
        CHK_LangCHS.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.ChineseS);
        CHK_LangCHT.Checked = Zukan.GetLanguageFlag(species, (int)LanguageID.ChineseT);

        var f1 = CLB_FormRegular;
        var f2 = CLB_FormShiny;

        f1.Items.Clear();
        f2.Items.Clear();
        var fc = Zukan8b.GetFormCount(species);

        if (fc <= 0)
        {
            return;
        }

        var forms = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).Take(fc).ToArray();

        f1.Items.AddRange(forms);
        f2.Items.AddRange(forms);
        for (int i = 0; i < f1.Items.Count; i++)
        {
            f1.SetItemChecked(i, Zukan.GetHasFormFlag(species, i, false));
            f2.SetItemChecked(i, Zukan.GetHasFormFlag(species, i, true));
        }
    }
Ejemplo n.º 21
0
        private static void GetSpeciesForm(IReadOnlyList <string> split, out int spec, out int form)
        {
            var strings = GameInfo.Strings;

            spec = StringUtil.FindIndexIgnoreCase(strings.specieslist, split[0]);

            form = 0;
            if (split.Count <= 1)
            {
                return;
            }
            var formstr = split[1];

            if (int.TryParse(formstr, out form))
            {
                return;
            }
            var forms = FormConverter.GetFormList(spec, strings.Types, strings.forms, GameInfo.GenderSymbolASCII, 8);

            form = StringUtil.FindIndexIgnoreCase(forms, formstr);
        }
Ejemplo n.º 22
0
        private async Task PrintPersonalInfoAsync(int spec, int form)
        {
            var strings = GameInfo.Strings;

            if (spec <= 0 || spec >= strings.specieslist.Length)
            {
                await ReplyAsync("Bad species argument!").ConfigureAwait(false);

                return;
            }
            var forms = FormConverter.GetFormList(spec, strings.Types, strings.forms, GameInfo.GenderSymbolASCII, 8);

            if (form < 0 || form >= forms.Length)
            {
                await ReplyAsync("Bad form argument!").ConfigureAwait(false);

                return;
            }
            var pi = PersonalTable.SWSH.GetFormeEntry(spec, form);

            if (pi.HP == 0)
            {
                pi = PersonalTable.USUM.GetFormeEntry(spec, form);
            }

            var specName = strings.specieslist[spec];
            var formName = forms[form];
            var lines    = GetPersonalInfoSummary(pi, strings);

            var builder = new EmbedBuilder
            {
                Color = Color.Gold,
            };

            builder.AddField(x =>
            {
                x.Name     = $"Personal Info for {specName}{(string.IsNullOrEmpty(formName) ? "" : $"-{formName}")}:";
                x.Value    = string.Join('\n', lines.Select(GetPrettyLine));
                x.IsInline = false;
            });
Ejemplo n.º 23
0
        private int SkipFlag => SAV is SAV7USUM ? 4160 : 3200; // FlagMax - 768

        private void GetComboBoxes()
        {
            CB_3DSReg.InitializeBinding();
            CB_3DSReg.DataSource = GameInfo.Regions;
            CB_Language.InitializeBinding();
            CB_Language.DataSource = GameInfo.LanguageDataSource(SAV.Generation);
            CB_AlolaTime.InitializeBinding();
            CB_AlolaTime.DataSource = GetAlolaTimeList();

            CB_Country.InitializeBinding();
            CB_Region.InitializeBinding();
            Main.SetCountrySubRegion(CB_Country, "countries");

            CB_SkinColor.Items.Clear();
            CB_SkinColor.Items.AddRange(Enum.GetNames(typeof(SkinColor7)));

            L_Vivillon.Text = GameInfo.Strings.Species[(int)Species.Vivillon] + ":";
            CB_Vivillon.InitializeBinding();
            CB_Vivillon.DataSource = FormConverter.GetFormList((int)Species.Vivillon, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);

            if (!(SAV is SAV7USUM))
            {
                BattleStyles.RemoveAt(BattleStyles.Count - 1); // remove Nihilist
            }
            foreach (string t in BattleStyles)
            {
                CB_BallThrowType.Items.Add(t);
                LB_BallThrowTypeUnlocked.Items.Add(t);
                LB_BallThrowTypeLearned.Items.Add(t);
            }

            var stamps = Enum.GetNames(typeof(Stamp7)).Select(z => z.Replace("_", " "));

            foreach (string t in stamps)
            {
                LB_Stamps.Items.Add(t);
            }
        }
Ejemplo n.º 24
0
        public Pokemon CreatePKMN()
        {
            try
            {
                var country  = "N/A";
                var region   = "N/A";
                var dsregion = "N/A";
                if (CountryID != "N/A" && CountryID != "0")
                {
                    System.Tuple <string, string> cr = GeoLocation.GetCountryRegionText(int.Parse(CountryID), int.Parse(RegionID), "en");
                    country = cr.Item1;
                    region  = cr.Item2;
                }
                switch (DSRegionID)
                {
                case "N/A":
                    dsregion = "None";
                    break;

                case "0":
                    dsregion = "Japan";
                    break;

                case "1":
                    dsregion = "North America";
                    break;

                case "2":
                    dsregion = "Europe";
                    break;

                case "3":
                    dsregion = "China";
                    break;

                case "4":
                    dsregion = "Korea";
                    break;

                case "5":
                    dsregion = "Taiwan";
                    break;
                }
                var lc   = new LegalityAnalysis(pkm);
                var pkmn = new Pokemon
                {
                    ATK            = ATK,
                    ATK_EV         = ATK_EV,
                    ATK_IV         = ATK_IV,
                    Ability        = Ability,
                    AbilityNum     = AbilityNum,
                    AltForms       = AltForms,
                    Ball           = Ball,
                    Beauty         = Beauty,
                    Cool           = Cool,
                    Country        = country,
                    CountryID      = CountryID,
                    Cute           = Cute,
                    DEF            = DEF,
                    DEF_EV         = DEF_EV,
                    DEF_IV         = DEF_IV,
                    DSRegion       = dsregion,
                    DSRegionID     = DSRegionID,
                    EC             = EC,
                    ESV            = ESV,
                    EXP            = EXP,
                    EggLoc         = EggLoc,
                    Egg_Day        = Egg_Day,
                    Egg_Month      = Egg_Month,
                    Egg_Year       = Egg_Year,
                    Encounter      = Encounter,
                    FatefulFlag    = FatefulFlag,
                    Friendship     = Friendship,
                    Gender         = Gender,
                    GenderFlag     = GenderFlag,
                    Size           = pkm.SIZE_STORED,
                    HP             = HP,
                    HP_EV          = HP_EV,
                    HP_IV          = HP_IV,
                    HP_Type        = HP_Type,
                    HT             = pkm.HT_Name,
                    HeldItem       = HeldItem,
                    IsEgg          = IsEgg,
                    IsNicknamed    = IsNicknamed,
                    IsShiny        = IsShiny,
                    Legal          = Legal,
                    Level          = Level,
                    Markings       = Markings,
                    MetLevel       = MetLevel,
                    MetLoc         = MetLoc,
                    Met_Day        = Met_Day,
                    Met_Month      = Met_Month,
                    Met_Year       = Met_Year,
                    Move1          = Move1,
                    Move1_PP       = Move1_PP,
                    Move1_PPUp     = Move1_PPUp,
                    Move2          = Move2,
                    Move2_PP       = Move2_PP,
                    Move2_PPUp     = Move2_PPUp,
                    Move3          = Move3,
                    Move3_PP       = Move3_PP,
                    Move3_PPUp     = Move3_PPUp,
                    Move4          = Move4,
                    Move4_PP       = Move4_PP,
                    Move4_PPUp     = Move4_PPUp,
                    Nature         = Nature,
                    Nickname       = Nickname,
                    NotOT          = NotOT,
                    OT             = OT,
                    OTLang         = OTLang,
                    OT_Affection   = OT_Affection,
                    OT_Gender      = OT_Gender,
                    PID            = PID,
                    PKRS_Days      = PKRS_Days,
                    PKRS_Strain    = PKRS_Strain,
                    Position       = Position ?? "",
                    Region         = region,
                    RegionID       = RegionID,
                    Relearn1       = Relearn1,
                    Relearn2       = Relearn2,
                    Relearn3       = Relearn3,
                    Relearn4       = Relearn4,
                    SID            = SID,
                    SPA            = SPA,
                    SPA_EV         = SPA_EV,
                    SPA_IV         = SPA_IV,
                    SPD            = SPD,
                    SPD_EV         = SPD_EV,
                    SPD_IV         = SPD_IV,
                    SPE            = SPE,
                    SPE_EV         = SPE_EV,
                    SPE_IV         = SPE_IV,
                    Sheen          = Sheen,
                    Smart          = Smart,
                    Species        = Species,
                    SpecForm       = pkm.SpecForm,
                    TID            = TID,
                    TSV            = TSV,
                    Tough          = Tough,
                    Version        = Version,
                    IllegalReasons = lc.Report(),
                    Checksum       = Checksum,
                    ItemNum        = pkm.HeldItem
                };
                if (pkm.HT_Name == "")
                {
                    pkmn.HT = OT;
                }
                var ds = FormConverter.GetFormList(pkm.Species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolUnicode, pkm.Format);
                if (ds.Count() > 1)
                {
                    pkmn.Form = ds[pkmn.AltForms];
                }
                else
                {
                    pkmn.Form = ds[0];
                }
                pkmn.HeldItemSpriteURL = "";
                pkmn.Move1_Type        = ConsoleIndex.mt[pkm.Move1].Type;
                pkmn.Move2_Type        = ConsoleIndex.mt[pkm.Move2].Type;
                pkmn.Move3_Type        = ConsoleIndex.mt[pkm.Move3].Type;
                pkmn.Move4_Type        = ConsoleIndex.mt[pkm.Move4].Type;
                if (pkm.GetType() == typeof(PK4))
                {
                    pkmn.Generation = "4";
                }
                else if (pkm.GetType() == typeof(PK5))
                {
                    pkmn.Generation = "5";
                }
                else if (pkm.GetType() == typeof(PK6))
                {
                    pkmn.Generation = "6";
                }
                else if (pkm.GetType() == typeof(PK7))
                {
                    pkmn.Generation = "7";
                }
                else if (pkm.GetType() == typeof(PB7))
                {
                    pkmn.Generation = "LGPE";
                }
                else if (pkm.GetType() == typeof(PK8))
                {
                    pkmn.Generation = "8";
                }
                else if (pkm.GetType() == typeof(PK3))
                {
                    pkmn.Generation = "3";
                }
                else if (pkm.GetType() == typeof(PK2))
                {
                    pkmn.Generation = "2";
                }
                else if (pkm.GetType() == typeof(PK1))
                {
                    pkmn.Generation = "1";
                }
                pkmn.SpeciesSpriteURL = GetPokeSprite(pkm.Species, pkmn.Species, pkmn.Gender, pkmn.Version, pkmn.Form, pkmn.Generation, pkmn.IsShiny);
                return(pkmn);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(null);
            }
        }
Ejemplo n.º 25
0
        private void GetEntry()
        {
            // Load Bools for the data
            int pk = species;

            L_Spinda.Visible = TB_Spinda.Visible = pk == (int)Species.Spinda;

            // Load Partitions
            CP[0].Checked = Zukan.GetCaught(species);
            for (int i = 0; i < 4; i++)
            {
                CP[i + 1].Checked = Zukan.GetSeen(species, i);
            }

            for (int i = 0; i < 4; i++)
            {
                CP[i + 5].Checked = Zukan.GetDisplayed(species - 1, i);
            }

            for (int i = 0; i < CL.Length; i++)
            {
                CL[i].Checked = Zukan.GetLanguageFlag(species - 1, i);
            }

            int gt = SAV.Personal[pk].Gender;

            CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = gt != 254;            // Not Female-Only
            CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt != 0 && gt != 255; // Not Male-Only and Not Genderless

            MT_Count.Text = Zukan.GetEncounterCount(species - 1).ToString();

            CLB_FormsSeen.Items.Clear();
            CLB_FormDisplayed.Items.Clear();

            int fc = SAV.Personal[species].FormeCount;
            int f  = DexFormUtil.GetDexFormIndexORAS(species, fc);

            if (f < 0)
            {
                return;
            }
            string[] forms = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
            if (forms.Length < 1)
            {
                return;
            }

            for (int i = 0; i < forms.Length; i++) // Seen
            {
                CLB_FormsSeen.Items.Add(forms[i], Zukan.GetFormFlag(f + i, 0));
            }
            for (int i = 0; i < forms.Length; i++) // Seen Shiny
            {
                CLB_FormsSeen.Items.Add($"* {forms[i]}", Zukan.GetFormFlag(f + i, 1));
            }

            for (int i = 0; i < forms.Length; i++) // Displayed
            {
                CLB_FormDisplayed.Items.Add(forms[i], Zukan.GetFormFlag(f + i, 2));
            }
            for (int i = 0; i < forms.Length; i++) // Displayed Shiny
            {
                CLB_FormDisplayed.Items.Add($"* {forms[i]}", Zukan.GetFormFlag(f + i, 3));
            }
        }
        /// <summary>
        /// Creates a test argument.
        /// </summary>
        private Test CreateWebUnitTest()
        {
            IHtmlFormUnitTestArgs args = null;
            Test test = new Test();
            test.UnitTestDataType  = GetUnitTestDataType();

            #region Buffer Overflow Settings
            if ( this.rbBufferOverflow.Checked )
            {
                args = new BufferOverflowTesterArgs();
                ((BufferOverflowTesterArgs)args).BufferLength = (int)this.numBufferLen.Value;

                test.TestType = UnitTestType.BufferOverflow;
                test.TestTypeName = "Buffer Overflow Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region Data Type Settings
            if ( this.rbDataType.Checked )
            {
                args = new DataTypesTesterArgs();
                ((DataTypesTesterArgs)args).SelectedDataType = (DataType)dataTypesList.GetKey(dataTypesList.IndexOfValue(this.cmbDataType.Text));

                test.TestType= UnitTestType.DataTypes;
                test.TestTypeName = "Data Type Test";
                test.Name  = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region SQL Injection Settings
            if ( this.rbSqlTest.Checked )
            {
                args = new SqlInjectionTesterArgs();
                ((SqlInjectionTesterArgs)args).SqlValue = this.cmbSqlTestValues.Text;

                test.TestType = UnitTestType.SqlInjection;
                test.TestTypeName = "SQL Injection Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region XSS Settings
            if ( this.rbXSSTest.Checked )
            {
                args = new XssInjectionTesterArgs();
                ((XssInjectionTesterArgs)args).XssValue = this.cmbXssTestValues.Text;

                test.TestType = UnitTestType.XSS;
                test.TestTypeName = "XSS Injection Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region Predefined Post Data Test
            if ( this.rbPredefined.Checked )
            {
                args = new PredefinedTesterArgs();
                PredefinedTesterArgs predefinedArgs = (PredefinedTesterArgs)args;

                if ( this.rbForm.Checked )
                {
                    predefinedArgs.FormData = this.WebSessionRequest.Form;
                }
                else
                {
                    // TODO: Change to PostDataCollection method.
                    FormConverter formConverter = new FormConverter();
                    predefinedArgs.UserPostData = formConverter.GetPostDataCollection(((PostSessionRequest)this.WebSessionRequest).PostData);
                }

                test.TestType = UnitTestType.Predefined;
                test.TestTypeName = "Predefined Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            return test;
        }
        /// <summary>
        /// Apply the test requests for a session request.
        /// </summary>
        /// <param name="sessionRequest"> The session request.</param>
        /// <param name="result"> The response buffer result from the safe session.</param>
        private void ApplyRequestTests(SessionRequest sessionRequest, ResponseBuffer result)
        {
            UnitTestItem unitTestItem = sessionRequest.WebUnitTest;
            unitTestItem.Form = sessionRequest.Form;

            CookieCollection cookies = null;

            //int availableTests = this.AvailableTests();
            //bool lastItem = false;
            string requestUrl = sessionRequest.Url.ToString();

            #region Run each test in SessionRequest WebUnitTestItem

            // run each test in Form
            foreach (DictionaryEntry de in unitTestItem.Tests)
            {
                Test test = (Test)de.Value;
                ArrayList values = new ArrayList();

                // get cookies
                cookies = cookieManager.GetCookies(sessionRequest.Url);

                // set current test index
                unitTestItem.SelectedTestIndex = unitTestItem.Tests.IndexOfValue(test);

                // create SessionCommandProcessEventArgs
                SessionCommandProcessEventArgs args = new SessionCommandProcessEventArgs("Applying test '" + test.Name + "' to " + sessionRequest.Url.ToString());
                args.ProcessType = SessionProcessType.TestRequest;

                #region Apply Test
                // --------------------------------------------------------------------------------
                // Process data
                // Html Form Tag
                if ( test.UnitTestDataType == UnitTestDataContainer.HtmlFormTag )
                {
                    // is a form tag
                    // apply test to form
                    HtmlFormTag filledForm = ApplyTestToForm(test, sessionRequest.Form.CloneTag());
                    values = parser.ConvertToArrayList(filledForm, result.HttpBody, updateElementNames);
                }
                // Post Data Hashtable
                if ( test.UnitTestDataType == UnitTestDataContainer.PostDataHashtable )
                {
                    string postdata = ((PostSessionRequest)sessionRequest).PostData;

                    // convert post data to hashtable
                    FormConverter converter = new FormConverter();
                    Hashtable postDataHash = converter.ConvertPostDataString(postdata);

                    // Applies test to post data hashtable
                    Hashtable filledPostData = ApplyTestToPostData(test, (Hashtable)postDataHash.Clone());
                    values = converter.ConvertPostDataArrayList(filledPostData);
                }
                // Cookies
                if ( test.UnitTestDataType == UnitTestDataContainer.Cookies )
                {
                    cookies = ApplyTestToCookies(test, cookies);
                }
                // Url
                if( test.UnitTestDataType == UnitTestDataContainer.NoPostData )
                {
                    // a url test
                    requestUrl = ApplyTestToUrl(test, WebServerUriType.Normal,sessionRequest.Url).ToString();
                }
                // -----------------------------------------------------------------------------------
                #endregion

                if ( (test.UnitTestDataType == UnitTestDataContainer.HtmlFormTag ) || ( test.UnitTestDataType == UnitTestDataContainer.PostDataHashtable ) )
                {
                    // Set post data for report
                    test.Arguments.PostData = ConvertToPostDataString(values);
                    args.Detail = "Posted Data:" + test.Arguments.PostData;
                }
                if ( test.UnitTestDataType == UnitTestDataContainer.NoPostData )
                {
                    args.Detail = "Url query:" + requestUrl;
                }
                if ( test.UnitTestDataType == UnitTestDataContainer.Cookies )
                {
                    StringBuilder cookieQuery = new StringBuilder();

                    foreach ( Cookie cky in cookies )
                    {
                        cookieQuery.Append("Name:" + cky.Name);
                        cookieQuery.Append(", ");
                        cookieQuery.Append("Value:" + cky.Value);
                        cookieQuery.Append(";");
                    }

                    args.Detail = "Cookie:" + cookieQuery.ToString();
                }

                //				// set last item flag
                //				if ( availableTests == 1)
                //				{
                //					lastItem = true;
                //				}

                // display the current processing
                this.DisplaySessionProcessEvent(this,args);

                // clone test item and set last item value
                HttpState httpRequestState = new HttpState();
                httpRequestState.TestItem = unitTestItem.Clone();
                //httpRequestState.IsLastItem = lastItem;

                // http settings
                HttpProperties httpSettings = null;
                if ( sessionRequest.RequestHttpSettings == null )
                {
                    httpSettings = unitTestGetRequest.ClientSettings;
                }
                else
                {
                    httpSettings = sessionRequest.RequestHttpSettings;
                }

                if ( sessionRequest.RequestType == HttpRequestType.GET )
                {
                    // get request
                    this.StartGetRequest(unitTestGetRequest,
                        requestUrl,
                        null,
                        cookies,
                        httpSettings,
                        httpRequestState);
                }
                else
                {
                    // post request
                    this.StartPostRequest(unitTestPostRequest,
                        requestUrl,
                        values,
                        cookies,
                        httpSettings,
                        httpRequestState);
                }

                //availableTests--;
            }
            #endregion
        }
Ejemplo n.º 28
0
        private void RefreshForms()
        {
            var list = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolASCII, Data.Format);

            Forms = new ObservableCollection <string>(list);
        }
Ejemplo n.º 29
0
        private void GetEntry()
        {
            // Load Bools for the data
            int pk = species;

            L_Spinda.Visible = TB_Spinda.Visible = pk == (int)Species.Spinda;

            // Load Partitions
            CP[0].Checked = Zukan.GetCaught(species);
            for (int i = 0; i < 4; i++)
            {
                CP[i + 1].Checked = Zukan.GetSeen(species, i);
            }

            for (int i = 0; i < 4; i++)
            {
                CP[i + 5].Checked = Zukan.GetDisplayed(species - 1, i);
            }

            for (int i = 0; i < CL.Length; i++)
            {
                CL[i].Checked = Zukan.GetLanguageFlag(species - 1, i);
            }

            if (pk <= (int)Species.Genesect)
            {
                CHK_F1.Enabled = true;
                CHK_F1.Checked = Zukan.GetForeignFlag(species - 1);
            }
            else
            {
                CHK_F1.Enabled = CHK_F1.Checked = false;
            }

            var pi = SAV.Personal[pk];

            CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = !pi.OnlyFemale;
            CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = !(pi.OnlyMale || pi.Genderless);

            CLB_FormsSeen.Items.Clear();
            CLB_FormDisplayed.Items.Clear();

            int fc = pi.FormCount;
            int f  = DexFormUtil.GetDexFormIndexXY(species, fc);

            if (f < 0)
            {
                return;
            }
            string[] forms = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
            if (forms.Length < 1)
            {
                return;
            }

            // 0x26 packs of bools
            for (int i = 0; i < forms.Length; i++) // Seen
            {
                CLB_FormsSeen.Items.Add(forms[i], Zukan.GetFormFlag(f + i, 0));
            }
            for (int i = 0; i < forms.Length; i++) // Seen Shiny
            {
                CLB_FormsSeen.Items.Add($"* {forms[i]}", Zukan.GetFormFlag(f + i, 1));
            }

            for (int i = 0; i < forms.Length; i++) // Displayed
            {
                CLB_FormDisplayed.Items.Add(forms[i], Zukan.GetFormFlag(f + i, 2));
            }
            for (int i = 0; i < forms.Length; i++) // Displayed Shiny
            {
                CLB_FormDisplayed.Items.Add($"* {forms[i]}", Zukan.GetFormFlag(f + i, 3));
            }
        }
Ejemplo n.º 30
0
        private bool FillLBForms()
        {
            if (allModifying)
            {
                return(false);
            }
            LB_Forms.DataSource = null;
            LB_Forms.Items.Clear();

            int  fspecies = LB_Species.SelectedIndex + 1;
            var  bspecies = Dex.GetBaseSpecies(fspecies);
            bool hasForms = AltFormInfo.HasFormSelection(SAV.Personal[bspecies], bspecies, 7);

            LB_Forms.Enabled = hasForms;
            if (!hasForms)
            {
                return(false);
            }
            var ds = FormConverter.GetFormList(bspecies, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation).ToList();

            if (ds.Count == 1 && string.IsNullOrEmpty(ds[0]))
            {
                // empty
                LB_Forms.Enabled = false;
                return(false);
            }

            // sanity check formes -- SM does not have totem form dex bits
            int count = SAV.Personal[bspecies].FormeCount;

            if (count < ds.Count)
            {
                ds.RemoveAt(count); // remove last
            }
            LB_Forms.DataSource = ds;
            if (fspecies <= SAV.MaxSpeciesID)
            {
                LB_Forms.SelectedIndex = 0;
            }
            else
            {
                int fc = SAV.Personal[bspecies].FormeCount;
                if (fc <= 1)
                {
                    return(true);
                }

                int f = Dex.DexFormIndexFetcher(bspecies, fc, SAV.MaxSpeciesID - 1);
                if (f < 0)
                {
                    return(true); // bit index valid
                }
                if (f > fspecies - LB_Forms.Items.Count - 1)
                {
                    LB_Forms.SelectedIndex = fspecies - f - 1;
                }
                else
                {
                    LB_Forms.SelectedIndex = -1;
                }
            }
            return(true);
        }
Ejemplo n.º 31
0
    private void GetEntry()
    {
        // Load Bools for the data
        int pk = species;

        // Load Partitions
        var Dex = SAV.Zukan;

        CP[0].Checked = Dex.GetCaught(species);
        for (int i = 0; i < 4; i++)
        {
            CP[i + 1].Checked = Dex.GetSeen(species, i);
        }

        for (int i = 0; i < 4; i++)
        {
            CP[i + 5].Checked = Dex.GetDisplayed(species - 1, i);
        }

        if (species > 493)
        {
            for (int i = 0; i < 7; i++)
            {
                CL[i].Checked = false;
            }
            GB_Language.Enabled = false;
        }
        else
        {
            for (int i = 0; i < 7; i++)
            {
                CL[i].Checked = SAV.Zukan.GetLanguageFlag(species - 1, i);
            }
            GB_Language.Enabled = true;
        }

        var pi = SAV.Personal[pk];

        CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = !pi.OnlyFemale;
        CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = !(pi.OnlyMale || pi.Genderless);

        CLB_FormsSeen.Items.Clear();
        CLB_FormDisplayed.Items.Clear();

        int fc = pi.FormCount;
        int f  = SAV is SAV5B2W2?DexFormUtil.GetDexFormIndexB2W2(species, fc) : DexFormUtil.GetDexFormIndexBW(species, fc);

        if (f < 0)
        {
            return;
        }
        string[] forms = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
        if (forms.Length < 1)
        {
            return;
        }

        for (int i = 0; i < forms.Length; i++) // Seen
        {
            CLB_FormsSeen.Items.Add(forms[i], Dex.GetFormFlag(f + i, 0));
        }
        for (int i = 0; i < forms.Length; i++) // Seen Shiny
        {
            CLB_FormsSeen.Items.Add($"* {forms[i]}", Dex.GetFormFlag(f + i, 1));
        }

        for (int i = 0; i < forms.Length; i++) // Displayed
        {
            CLB_FormDisplayed.Items.Add(forms[i], Dex.GetFormFlag(f + i, 2));
        }
        for (int i = 0; i < forms.Length; i++) // Displayed Shiny
        {
            CLB_FormDisplayed.Items.Add($"* {forms[i]}", Dex.GetFormFlag(f + i, 3));
        }
    }