コード例 #1
0
        private void PopulateComboBoxes()
        {
            bool oldLoaded = loaded;

            loaded = false;

            AddComparisonComboBoxItems(comboBoxHatchCounterComparison);
            AddComparisonComboBoxItems(comboBoxStatComparison);
            AddComparisonComboBoxItems(comboBoxConditionComparison);
            AddComparisonComboBoxItems(comboBoxIVComparison);
            AddComparisonComboBoxItems(comboBoxEVComparison);
            AddComparisonComboBoxItems(comboBoxLevelComparison);
            AddComparisonComboBoxItems(comboBoxFriendshipComparison);
            AddComparisonComboBoxItems(comboBoxHiddenPowerDamageComparison);

            comboBoxSpecies.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                AddComboBoxItem(comboBoxSpecies, PokemonDatabase.GetPokemonFromDexID(i).Name, (int)i);
            }

            comboBoxType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Normal; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxType, i.ToString(), (int)i);
            }

            comboBoxNature.Items.Clear();
            for (byte i = 0; i <= 24; i++)
            {
                AddComboBoxItem(comboBoxNature, PokemonDatabase.GetNatureFromID(i).Name, (int)i);
            }

            comboBoxAbility.Items.Clear();
            for (byte i = 1; i <= 76; i++)
            {
                AddComboBoxItem(comboBoxAbility, PokemonDatabase.GetAbilityFromID(i).Name, (int)i);
            }

            comboBoxHeldItem.Items.Clear();
            AddComboBoxItem(comboBoxHeldItem, "Any", 0);
            for (int i = 1; ItemDatabase.GetItemAt(i) != null; i++)
            {
                ItemData item = ItemDatabase.GetItemAt(i);
                if (!item.IsImportant && item.ID < 500)
                {
                    AddComboBoxItem(comboBoxHeldItem, item.Name, (int)item.ID);
                }
            }

            comboBoxPokeBall.Items.Clear();
            AddComboBoxItem(comboBoxPokeBall, "Poké Ball", 4);
            AddComboBoxItem(comboBoxPokeBall, "Great Ball", 3);
            AddComboBoxItem(comboBoxPokeBall, "Ultra Ball", 2);
            AddComboBoxItem(comboBoxPokeBall, "Master Ball", 1);
            AddComboBoxItem(comboBoxPokeBall, "Safari Ball", 5);
            AddComboBoxItem(comboBoxPokeBall, "Timer Ball", 10);
            AddComboBoxItem(comboBoxPokeBall, "Repeat Ball", 9);
            AddComboBoxItem(comboBoxPokeBall, "Net Ball", 6);
            AddComboBoxItem(comboBoxPokeBall, "Dive Ball", 7);
            AddComboBoxItem(comboBoxPokeBall, "Nest Ball", 8);
            AddComboBoxItem(comboBoxPokeBall, "Premier Ball", 12);
            AddComboBoxItem(comboBoxPokeBall, "Luxury Ball", 11);


            comboBoxRibbon.Items.Clear();
            for (PokemonRibbons i = PokemonRibbons.Any; i <= PokemonRibbons.World; i++)
            {
                // Add spaces to the names
                string        name    = i.ToString();
                StringBuilder newName = new StringBuilder();
                foreach (char c in name)
                {
                    if (char.IsUpper(c) && newName.Length > 0)
                    {
                        newName.Append(' ');
                    }
                    newName.Append(c);
                }
                AddComboBoxItem(comboBoxRibbon, newName.ToString(), (int)i);
            }


            comboBoxPokerus.Items.Clear();
            AddComboBoxItem(comboBoxPokerus, "None", (int)PokerusStatuses.None);
            AddComboBoxItem(comboBoxPokerus, "Infected", (int)PokerusStatuses.Infected);
            AddComboBoxItem(comboBoxPokerus, "Cured", (int)PokerusStatuses.Cured);

            ComboBox[] statComboBoxes = new ComboBox[] { comboBoxStatType, comboBoxIVType, comboBoxEVType };
            for (int i = 0; i < 3; i++)
            {
                statComboBoxes[i].Items.Clear();
                AddComboBoxItem(statComboBoxes[i], "HP", (int)StatTypes.HP);
                AddComboBoxItem(statComboBoxes[i], "Attack", (int)StatTypes.Attack);
                AddComboBoxItem(statComboBoxes[i], "Defense", (int)StatTypes.Defense);
                AddComboBoxItem(statComboBoxes[i], "Sp Attack", (int)StatTypes.SpAttack);
                AddComboBoxItem(statComboBoxes[i], "Sp Defense", (int)StatTypes.SpDefense);
                AddComboBoxItem(statComboBoxes[i], "Speed", (int)StatTypes.Speed);
                AddComboBoxItem(statComboBoxes[i], "Any", (int)StatTypes.Any);
                AddComboBoxItem(statComboBoxes[i], "All", (int)StatTypes.All);
                AddComboBoxItem(statComboBoxes[i], "Total", (int)StatTypes.Total);
            }

            comboBoxConditionType.Items.Clear();
            AddComboBoxItem(comboBoxConditionType, "Cool", (int)ConditionTypes.Cool);
            AddComboBoxItem(comboBoxConditionType, "Beauty", (int)ConditionTypes.Beauty);
            AddComboBoxItem(comboBoxConditionType, "Cute", (int)ConditionTypes.Cute);
            AddComboBoxItem(comboBoxConditionType, "Smart", (int)ConditionTypes.Smart);
            AddComboBoxItem(comboBoxConditionType, "Tough", (int)ConditionTypes.Tough);
            AddComboBoxItem(comboBoxConditionType, "Feel", (int)ConditionTypes.Feel);
            AddComboBoxItem(comboBoxConditionType, "Any", (int)ConditionTypes.Any);
            AddComboBoxItem(comboBoxConditionType, "All", (int)ConditionTypes.All);
            AddComboBoxItem(comboBoxConditionType, "Total", (int)ConditionTypes.Total);

            comboBoxGender.Items.Clear();
            AddComboBoxItem(comboBoxGender, "Male", (int)Genders.Male);
            AddComboBoxItem(comboBoxGender, "Female", (int)Genders.Female);
            AddComboBoxItem(comboBoxGender, "Genderless", (int)Genders.Genderless);

            comboBoxFamily.Items.Clear();
            for (ushort i = 1; i <= 386; i++)
            {
                PokemonData pokemonData = PokemonDatabase.GetPokemonFromDexID(i);
                if (pokemonData.FamilyDexID == i)
                {
                    AddComboBoxItem(comboBoxFamily, pokemonData.Name, (int)i);
                }
            }


            ComboBox[] moveComboBoxes = new ComboBox[] { comboBoxMove1, comboBoxMove2, comboBoxMove3, comboBoxMove4 };
            for (int i = 0; i < 4; i++)
            {
                moveComboBoxes[i].Items.Clear();
                AddComboBoxItem(moveComboBoxes[i], "None", 0);
                for (ushort j = 1; j <= 354; j++)
                {
                    AddComboBoxItem(moveComboBoxes[i], PokemonDatabase.GetMoveFromID(j).Name, (int)j);
                }
            }

            comboBoxHiddenPowerType.Items.Clear();
            for (PokemonTypes i = PokemonTypes.Fighting; i <= PokemonTypes.Dark; i++)
            {
                AddComboBoxItem(comboBoxHiddenPowerType, i.ToString(), (int)i);
            }


            comboBoxEggGroup.Items.Clear();
            for (EggGroups i = EggGroups.Field; i <= EggGroups.Ditto; i++)
            {
                AddComboBoxItem(comboBoxEggGroup, PokemonDatabase.GetEggGroupName(i), (int)i);
            }

            comboBoxEggMode.Items.Clear();
            AddComboBoxItem(comboBoxEggMode, "Include Eggs", (int)EggModes.IncludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Exclude Eggs", (int)EggModes.ExcludeEggs);
            AddComboBoxItem(comboBoxEggMode, "Only Eggs", (int)EggModes.OnlyEggs);

            comboBoxShinyMode.Items.Clear();
            AddComboBoxItem(comboBoxShinyMode, "Include Shinies", (int)ShinyModes.IncludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Exclude Shinies", (int)ShinyModes.ExcludeShinies);
            AddComboBoxItem(comboBoxShinyMode, "Only Shinies", (int)ShinyModes.OnlyShinies);

            comboBoxShadowMode.Items.Clear();
            AddComboBoxItem(comboBoxShadowMode, "Include Shadow", (int)ShadowModes.IncludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Exclude Shadow", (int)ShadowModes.ExcludeShadow);
            AddComboBoxItem(comboBoxShadowMode, "Only Shadow", (int)ShadowModes.OnlyShadow);

            comboBoxSortMethod.Items.Clear();
            AddComboBoxItem(comboBoxSortMethod, "None", (int)SortMethods.None);
            AddComboBoxItem(comboBoxSortMethod, "Dex Number", (int)SortMethods.DexNumber);
            AddComboBoxItem(comboBoxSortMethod, "Alphabetical", (int)SortMethods.Alphabetical);
            AddComboBoxItem(comboBoxSortMethod, "Level", (int)SortMethods.Level);
            AddComboBoxItem(comboBoxSortMethod, "Friendship", (int)SortMethods.Friendship);
            AddComboBoxItem(comboBoxSortMethod, "Hatch Counter", (int)SortMethods.HatchCounter);
            AddComboBoxItem(comboBoxSortMethod, "Type", (int)SortMethods.Type);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Type", (int)SortMethods.HiddenPowerType);
            AddComboBoxItem(comboBoxSortMethod, "Hidden Power Damage", (int)SortMethods.HiddenPowerDamage);
            AddComboBoxItem(comboBoxSortMethod, "Total Stats", (int)SortMethods.TotalStats);
            AddComboBoxItem(comboBoxSortMethod, "Total IVs", (int)SortMethods.TotalIVs);
            AddComboBoxItem(comboBoxSortMethod, "Total EVs", (int)SortMethods.TotalEVs);
            AddComboBoxItem(comboBoxSortMethod, "Total Conditions", (int)SortMethods.TotalCondition);
            AddComboBoxItem(comboBoxSortMethod, "Ribbon Count", (int)SortMethods.RibbonCount);
            AddComboBoxItem(comboBoxSortMethod, "HP", (int)SortMethods.HP);
            AddComboBoxItem(comboBoxSortMethod, "Attack", (int)SortMethods.Attack);
            AddComboBoxItem(comboBoxSortMethod, "Defense", (int)SortMethods.Defense);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack", (int)SortMethods.SpAttack);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense", (int)SortMethods.SpDefense);
            AddComboBoxItem(comboBoxSortMethod, "Speed", (int)SortMethods.Speed);
            AddComboBoxItem(comboBoxSortMethod, "HP IV", (int)SortMethods.HPIV);
            AddComboBoxItem(comboBoxSortMethod, "Attack IV", (int)SortMethods.AttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Defense IV", (int)SortMethods.DefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack IV", (int)SortMethods.SpAttackIV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense IV", (int)SortMethods.SpDefenseIV);
            AddComboBoxItem(comboBoxSortMethod, "Speed IV", (int)SortMethods.SpeedIV);
            AddComboBoxItem(comboBoxSortMethod, "HP EV", (int)SortMethods.HPEV);
            AddComboBoxItem(comboBoxSortMethod, "Attack EV", (int)SortMethods.AttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Defense EV", (int)SortMethods.DefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Attack EV", (int)SortMethods.SpAttackEV);
            AddComboBoxItem(comboBoxSortMethod, "Sp Defense EV", (int)SortMethods.SpDefenseEV);
            AddComboBoxItem(comboBoxSortMethod, "Speed EV", (int)SortMethods.SpeedEV);
            AddComboBoxItem(comboBoxSortMethod, "Coolness", (int)SortMethods.Coolness);
            AddComboBoxItem(comboBoxSortMethod, "Beauty", (int)SortMethods.Beauty);
            AddComboBoxItem(comboBoxSortMethod, "Cuteness", (int)SortMethods.Cuteness);
            AddComboBoxItem(comboBoxSortMethod, "Smartness", (int)SortMethods.Smartness);
            AddComboBoxItem(comboBoxSortMethod, "Toughness", (int)SortMethods.Toughness);
            AddComboBoxItem(comboBoxSortMethod, "Feel", (int)SortMethods.Feel);

            comboBoxSortOrder.Items.Clear();
            AddComboBoxItem(comboBoxSortOrder, "Highest to Lowest", (int)SortOrders.HighestToLowest);
            AddComboBoxItem(comboBoxSortOrder, "Lowest to Highest", (int)SortOrders.LowestToHighest);

            comboBoxSearchMode.Items.Clear();
            AddComboBoxItem(comboBoxSearchMode, "New Search", (int)SearchModes.NewSearch);
            AddComboBoxItem(comboBoxSearchMode, "Add Results", (int)SearchModes.AddResults);
            AddComboBoxItem(comboBoxSearchMode, "Refine Results", (int)SearchModes.RefineResults);

            loaded = oldLoaded;
        }