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);
     }
 }
Beispiel #2
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);
        }
Beispiel #3
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 = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, SAV.Generation);
        }
Beispiel #4
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);
 }
Beispiel #5
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))));
    }
Beispiel #6
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]);
    }
Beispiel #7
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);
        }
Beispiel #8
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));
        }
Beispiel #9
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);
        }
Beispiel #10
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);
        }
Beispiel #11
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));
        }
    }
Beispiel #12
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);
        }
Beispiel #13
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;
            });
Beispiel #14
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);
            }
        }
Beispiel #15
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);
            }
        }
Beispiel #16
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));
            }
        }
Beispiel #17
0
        private void RefreshForms()
        {
            var list = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, GameInfo.GenderSymbolASCII, Data.Format);

            Forms = new ObservableCollection <string>(list);
        }
Beispiel #18
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));
            }
        }
Beispiel #19
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);
        }
Beispiel #20
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));
        }
    }