예제 #1
0
        public Language RetrieveSpecificLanguage(IDbConnection connection, int language_id)
        {
            Language Language = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificLanguage;
                command.Prepare();
                command.AddWithValue("@language_id", language_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        Language = new Language {
                            Id            = reader.CheckValue <int>("id"),
                            Iso639        = reader.CheckObject <string>("iso639"),
                            Iso3166       = reader.CheckObject <string>("iso3166"),
                            Identifier    = reader.CheckObject <string>("identifier"),
                            OfficialIndex = reader.CheckValue <bool>("official"),
                            Order         = reader.CheckValue <int>("order")
                        };
                    }
                }
            } // Command
            return(Language);
        }
예제 #2
0
        public Berry RetrieveSpecificBerry(IDbConnection connection, int berry_id)
        {
            Berry berry = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificBerry;
                command.Prepare();
                command.AddWithValue("@berry_id", berry_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        berry = new Berry {
                            Id   = reader.CheckValue <int>("id"),
                            Item = new Item {
                                Id = reader.CheckValue <int>("item_id")
                            },
                            BerryFirmness = new BerryFirmness {
                                Id = reader.CheckValue <int>("firmness_id")
                            },
                            NaturalGiftPower = reader.CheckValue <int>("natural_gift_power"),
                            NaturalGiftType  = new Type {
                                Id = reader.CheckValue <int>("natural_gift_type_id")
                            },
                            Size        = reader.CheckValue <int>("size"),
                            MaxHarvest  = reader.CheckValue <int>("max_harvest"),
                            GrowthTime  = reader.CheckValue <int>("growth_time"),
                            SoilDryness = reader.CheckValue <int>("soil_dryness"),
                            Smoothness  = reader.CheckValue <int>("smoothness")
                        };
                    }
                }
            } // Command
            return(berry);
        }
예제 #3
0
        public List <AbilityProse> RetrieveSpecificAbilityProse(IDbConnection connection, int ability_id)
        {
            List <AbilityProse> abilityProses = new List <AbilityProse>();

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificAbilityProse;
                command.Prepare();
                command.AddWithValue("@ability_id", ability_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        AbilityProse abilityProse = new AbilityProse {
                            LocalLanguage = new Language {
                                Id = reader.CheckValue <int>("local_language_id")
                            },
                            ShortEffect = reader.CheckObject <string>("short_effect"),
                            Effect      = reader.CheckObject <string>("effect")
                        };
                        abilityProses.Add(abilityProse);
                    }
                }
            } // Command
            return(abilityProses);
        }
예제 #4
0
        public VersionGroups RetrieveSpecificVersionGroups(IDbConnection connection, int version_group_id)
        {
            VersionGroups versionGroups = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificVersionGroup;
                command.Prepare();
                command.AddWithValue("@version_group_id", version_group_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        versionGroups = new VersionGroups {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier"),
                            Generation = new Generation {
                                Id = reader.CheckValue <int>("generation_id")
                            },
                            Order = reader.CheckValue <int>("order")
                        };
                    }
                }
            } // Command
            return(versionGroups);
        }
예제 #5
0
        public Item RetrieveSpecificItem(IDbConnection connection, int item_id)
        {
            Item item = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificItem;
                command.Prepare();
                command.AddWithValue("@item_id", item_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        item = new Item {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier"),
                            Category   = new Category {
                                Id = reader.CheckValue <int>("category_id"),
                            },
                            Cost        = reader.CheckValue <int>("cost"),
                            FlingPower  = reader.CheckValue <int>("fling_power"),
                            FlingEffect = new FlingEffects {
                                Id = reader.CheckValue <int>("fling_effect_id")
                            }
                        };
                    }
                }
            } // Command
            return(item);
        }
예제 #6
0
        public Ability RetrieveSpecificAbility(IDbConnection connection, int ability_id)
        {
            Ability ability = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificAbility;
                command.Prepare();
                command.AddWithValue("@ability_id", ability_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        ability = new Ability {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier"),
                            Generation = new Generation {
                                Id = reader.CheckValue <int>("generation_id")
                            },
                            IsMainSeries = reader.CheckValue <bool>("is_main_series")
                        };
                    }
                }
            } // Command
            return(ability);
        }
예제 #7
0
        public Type RetrieveSpecificType(IDbConnection connection, int type_id)
        {
            Type type = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificType;
                command.Prepare();
                command.AddWithValue("@type_id", type_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        type = new Type {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier"),
                            Generation = new Generation {
                                Id = reader.CheckValue <int>("generation_id"),
                            },
                            DamageClass = new DamageClass {
                                Id = reader.CheckValue <int>("damage_class_id"),
                            }
                        };
                    }
                }
            } // Command
            return(type);
        }
예제 #8
0
 /// <summary>
 /// Prepares the parameters.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="parameters">The parameters.</param>
 protected void PrepareParams(IDbCommand command, Dictionary <string, object> parameters = null)
 {
     command.Prepare();
     if (parameters != null)
     {
         foreach (KeyValuePair <string, object> kvp in parameters)
         {
             command.AddWithValue(kvp.Key, kvp.Value);
         }
     }
 }
예제 #9
0
        public Pocket RetrieveSpecificPocket(IDbConnection connection, int pocket_id)
        {
            Pocket pocket = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificPocket;
                command.Prepare();
                command.AddWithValue("@pocket_id", pocket_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        pocket = new Pocket {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier")
                        };
                    }
                }
            } // Command
            return(pocket);
        }
예제 #10
0
        public BerryFirmness RetrieveSpecificBerryFirmness(IDbConnection connection, int firmness_id)
        {
            BerryFirmness berryFirmness = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificBerryFirmness;
                command.Prepare();
                command.AddWithValue("@firmness_id", firmness_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        berryFirmness = new BerryFirmness {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier")
                        };
                    }
                }
            } // Command
            return(berryFirmness);
        }
예제 #11
0
        public ContestType RetrieveSpecificContestType(IDbConnection connection, int contest_type_id)
        {
            ContestType contestType = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificContestType;
                command.Prepare();
                command.AddWithValue("@contest_type_id", contest_type_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        contestType = new ContestType {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier")
                        };
                    }
                }
            } // Command
            return(contestType);
        }
예제 #12
0
        public Region RetrieveSpecificRegion(IDbConnection connection, int regions_id)
        {
            Region region = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificRegion;
                command.Prepare();
                command.AddWithValue("@regions_id", regions_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        region = new Region {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier")
                        };
                    }
                }
            } // Command
            return(region);
        }
예제 #13
0
        public List <BerryFlavor> RetrieveSpecificBerryFlavor(IDbConnection connection, int berry_id)
        {
            List <BerryFlavor> berryFlavors = new List <BerryFlavor>();

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificBerryFlavor;
                command.Prepare();
                command.AddWithValue("@berry_id", berry_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        BerryFlavor berryFlavor = new BerryFlavor {
                            ContestType = new ContestType {
                                Id = reader.CheckValue <int>("contest_type_id"),
                            },
                            Flavor = reader.CheckValue <int>("flavor")
                        };
                        berryFlavors.Add(berryFlavor);
                    }
                }
            } // Command
            return(berryFlavors);
        }
예제 #14
0
        public List <AbilityChangelog> RetrieveSpecificAbilityChangelog(IDbConnection connection, int ability_id)
        {
            List <AbilityChangelog> abilityChangelogs = new List <AbilityChangelog>();

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificAbilityChangelog;
                command.Prepare();
                command.AddWithValue("@ability_id", ability_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        AbilityChangelog abilityChangelog = new AbilityChangelog {
                            Id = reader.CheckValue <int>("id"),
                            ChangedInVersionGroup = new VersionGroups {
                                Id = reader.CheckValue <int>("changed_in_version_group_id")
                            }
                        };
                        abilityChangelogs.Add(abilityChangelog);
                    }
                }
            } // Command
            return(abilityChangelogs);
        }
예제 #15
0
        public Category RetrieveSpecificCategory(IDbConnection connection, int category_id)
        {
            Category category = null;

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificCategory;
                command.Prepare();
                command.AddWithValue("@category_id", category_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    if (reader.Read())
                    {
                        category = new Category {
                            Id         = reader.CheckValue <int>("id"),
                            Identifier = reader.CheckObject <string>("identifier"),
                            Pocket     = new Pocket {
                                Id = reader.CheckValue <int>("pocket_id"),
                            }
                        };
                    }
                }
            } // Command
            return(category);
        }
예제 #16
0
        public List <BerryFirmnessName> RetrieveSpecificBerryFirmnessName(IDbConnection connection, int firmness_id)
        {
            List <BerryFirmnessName> berryFirmnessNames = new List <BerryFirmnessName>();

            using (IDbCommand command = database.CreateCommand()) {
                command.Connection  = connection;
                command.CommandText = Query.GetSpecificBerryFirmnessName;
                command.Prepare();
                command.AddWithValue("@firmness_id", firmness_id);
                using (IDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        BerryFirmnessName berryFirmnessName = new BerryFirmnessName {
                            LocalLanguage = new Language {
                                Id = reader.CheckValue <int>("local_language_id"),
                            },
                            Name = reader.CheckObject <string>("name")
                        };
                        berryFirmnessNames.Add(berryFirmnessName);
                    }
                }
            } // Command
            return(berryFirmnessNames);
        }
예제 #17
0
        public List <Pokemon> RetrieveAllPokemon()
        {
            List <Pokemon> pokemons = new List <Pokemon>();

            using (IDbConnection connection = database.CreateOpenConnection()) {
                using (IDbCommand command = database.CreateCommand()) {
                    command.Connection  = connection;
                    command.CommandText = Query.GetAllPokemon;
                    command.Prepare();
                    using (IDataReader reader = command.ExecuteReader()) {
                        while (reader.Read())
                        {
                            Pokemon pokemon = new Pokemon {
                                IndexNumber = reader.CheckValue <int>("index_number"),
                                Name        = reader.CheckObject <string>("name"),
                                Genus       = reader.CheckObject <string>("genus"),
                                Type1       = reader.CheckObject <string>("type1") ?? string.Empty,
                                Type2       = reader.CheckObject <string>("type2") ?? string.Empty,
                                Type1_Image = reader.CheckObject <byte[]>("type1_image"),
                                Type2_Image = reader.CheckObject <byte[]>("type2_image"),
                                Stats       = new Stats {
                                    HP           = reader.CheckValue <int>("hp"),
                                    Atk          = reader.CheckValue <int>("atk"),
                                    Def          = reader.CheckValue <int>("def"),
                                    SpAtk        = reader.CheckValue <int>("sp_atk"),
                                    SpDef        = reader.CheckValue <int>("sp_def"),
                                    Spe          = reader.CheckValue <int>("spe"),
                                    EVYieldHP    = reader.CheckValue <int>("ev_yield_hp"),
                                    EVYieldAtk   = reader.CheckValue <int>("ev_yield_atk"),
                                    EVYieldDef   = reader.CheckValue <int>("ev_yield_def"),
                                    EVYieldSpAtk = reader.CheckValue <int>("ev_yield_sp_atk"),
                                    EVYieldSpDef = reader.CheckValue <int>("ev_yield_sp_def"),
                                    EVYieldSpe   = reader.CheckValue <int>("ev_yield_spe")
                                },
                                EggGroups            = reader.CheckObject <string>("egg_groups"),
                                Color                = reader.CheckObject <string>("color"),
                                Shape                = reader.CheckObject <string>("shape"),
                                Shape_Image          = reader.CheckObject <byte[]>("shape_image"),
                                Habitat              = reader.CheckObject <string>("habitat"),
                                Habitat_Image        = reader.CheckObject <byte[]>("habitat_image"),
                                Footprint            = reader.CheckObject <byte[]>("footprint"),
                                EvolutionChainId     = reader.CheckValue <int>("evolution_chain_id"),
                                EvolvesFromSpeciesId = reader.CheckValue <int>("evolves_from_species_id"),
                                GenderRate           = reader.CheckValue <int>("gender_rate"),
                                CaptureRate          = reader.CheckValue <int>("capture_rate"),
                                BaseHappiness        = reader.CheckValue <int>("base_happiness"),
                                IsBaby               = reader.CheckValue <bool>("is_baby"),
                                HatchCounter         = reader.CheckValue <int>("hatch_counter"),
                                HatchSteps           = reader.CheckValue <long>("hatch_steps"),
                                GrowthRate           = reader.CheckObject <string>("growth_rate"),
                                Height               = reader.CheckValue <int>("height"),
                                Weight               = reader.CheckValue <int>("weight"),
                                BaseExperience       = reader.CheckValue <int>("base_experience"),
                                Ability1             = reader.CheckObject <string>("ability1") ?? string.Empty,
                                Ability2             = reader.CheckObject <string>("ability2") ?? string.Empty,
                                HiddenAbility        = reader.CheckObject <string>("hidden_ability") ?? string.Empty,
                                SpeciesSummary       = reader.CheckObject <string>("species_summary")?.Replace("\r\n", " "),
                                Icon   = reader.CheckObject <byte[]>("icon"),
                                Sprite = reader.CheckObject <byte[]>("sprite")
                            };
                            pokemons.Add(pokemon);
                        }
                    }
                } // Command

                foreach (Pokemon pokemon in pokemons)
                {
                    pokemon.Forms = new List <Form>();
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificForm;
                        command.Prepare();
                        command.AddWithValue("@species_id", pokemon.IndexNumber);
                        using (IDataReader reader = command.ExecuteReader()) {
                            while (reader.Read())
                            {
                                Form form = new Form {
                                    FormName     = reader.CheckObject <string>("form_name") ?? string.Empty,
                                    PokemonName  = reader.CheckObject <string>("pokemon_name") ?? string.Empty,
                                    IsDefault    = reader.CheckValue <bool>("is_default"),
                                    IsBattleOnly = reader.CheckValue <bool>("is_battle_only"),
                                    IsMega       = reader.CheckValue <bool>("is_mega"),
                                    Icon         = reader.CheckObject <byte[]>("icon"),
                                    Sprite       = reader.CheckObject <byte[]>("sprite")
                                };
                                pokemon.Forms.Add(form);
                            }
                        }
                    } // Command

                    pokemon.Evolutions = new List <Evolution>();
                    int stage = 0;
                    int i     = 0;
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificEvolutionChain;
                        command.Prepare();
                        command.AddWithValue("@evolution_chain_id", pokemon.EvolutionChainId);
                        using (IDataReader reader = command.ExecuteReader()) {
                            while (reader.Read())
                            {
                                Evolution evolution = new Evolution {
                                    Name = reader.CheckObject <string>("name"),
                                    Icon = reader.CheckObject <byte[]>("icon"),
                                    EvolvesFromSpeciesId = reader.CheckValue <int>("evolves_from_species_id"),
                                    EvolutionTrigger     = reader.CheckObject <string>("evolution_trigger"),
                                    TriggerItem          = reader.CheckObject <string>("trigger_item"),
                                    MinimumLevel         = reader.CheckValue <int>("minimum_level"),
                                    Gender                = reader.CheckObject <string>("gender"),
                                    Location              = reader.CheckObject <string>("location"),
                                    KnownMove             = reader.CheckObject <string>("known_move"),
                                    KnownMoveType         = reader.CheckObject <string>("known_move_type"),
                                    HeldItem              = reader.CheckObject <string>("held_item"),
                                    IsBaby                = reader.CheckValue <bool>("is_baby"),
                                    TimeOfDay             = reader.CheckObject <string>("time_of_day"),
                                    MinimumHappiness      = reader.CheckValue <int>("minimum_happiness"),
                                    MinimumAffection      = reader.CheckValue <int>("minimum_affection"),
                                    MinimumBeauty         = reader.CheckValue <int>("minimum_beauty"),
                                    RelativePhysicalStats = !DBNull.Value.Equals(reader["relative_physical_stats"]) ? (int)reader["relative_physical_stats"] : (int?)null,
                                    PartySpecies          = reader.CheckObject <string>("party_species"),
                                    PartyType             = reader.CheckObject <string>("party_type"),
                                    TradeSpecies          = reader.CheckObject <string>("trade_species"),
                                    NeedsOverworldRain    = reader.CheckValue <bool>("needs_overworld_rain"),
                                    TurnUpsideDown        = reader.CheckValue <bool>("turn_upside_down"),
                                };
                                if (pokemon.Evolutions.Count > 0)
                                {
                                    if (evolution.EvolvesFromSpeciesId != pokemon.Evolutions[i - 1].EvolvesFromSpeciesId)
                                    {
                                        stage++;
                                        i++;
                                    }
                                }
                                else
                                {
                                    stage++;
                                    i++;
                                }

                                if (evolution.IsBaby)
                                {
                                    evolution.Stage = 0;
                                    stage           = 0;
                                }
                                else
                                {
                                    evolution.Stage = stage;
                                }

                                pokemon.Evolutions.Add(evolution);
                            }
                        }
                    } // Command
                }     // foreach
            }
            return(pokemons);
        }
예제 #18
0
        public Pokemon GetPokemon(int pokemon_id)
        {
            Pokemon pokemon = null;

            using (IDbConnection connection = database.CreateOpenConnection()) {
                using (IDbCommand command = database.CreateCommand()) {
                    command.Connection  = connection;
                    command.CommandText = Query.GetSpecificPokemon;
                    command.Prepare();
                    command.AddWithValue("@pokemon_id", pokemon_id);
                    using (IDataReader reader = command.ExecuteReader()) {
                        if (reader.Read())
                        {
                            pokemon = new Pokemon {
                                Id         = reader.CheckValue <int>("id"),
                                Identifier = reader.CheckObject <string>("identifier"),
                                Species    = new Species {
                                    Id = reader.CheckValue <int>("species_id"),
                                },
                                Height         = reader.CheckValue <int>("height"),
                                Weight         = reader.CheckValue <int>("weight"),
                                BaseExperience = reader.CheckValue <int>("base_experience"),
                                Order          = reader.CheckValue <int>("order"),
                                IsDefault      = reader.CheckValue <bool>("is_default"),
                            };
                        }
                    }
                } // Command

                if (pokemon == null)
                {
                    return(pokemon);
                }

                if (pokemon.Species != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificSpecies;
                        command.Prepare();
                        command.AddWithValue("@species_id", pokemon.Species.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species = new Species {
                                    Id         = reader.CheckValue <int>("id"),
                                    Identifier = reader.CheckObject <string>("identifier"),
                                    Generation = new Generation {
                                        Id = reader.CheckValue <int>("generation_id")
                                    },
                                    EvolvesFromSpecies = reader.CheckValue <int>("evolves_from_species_id"),
                                    EvolutionChain     = new EvolutionChain {
                                        Id = reader.CheckValue <int>("evolution_chain_id")
                                    },
                                    Color = new Color {
                                        Id = reader.CheckValue <int>("color_id")
                                    },
                                    Shape = new Shape {
                                        Id = reader.CheckValue <int>("shape_id")
                                    },
                                    Habitat = new Habitat {
                                        Id = reader.CheckValue <int>("habitat_id")
                                    },
                                    GenderRate           = reader.CheckValue <int>("gender_rate"),
                                    CaptureRate          = reader.CheckValue <int>("capture_rate"),
                                    BaseHappiness        = reader.CheckValue <int>("base_happiness"),
                                    IsBaby               = reader.CheckValue <bool>("is_baby"),
                                    HatchCounter         = reader.CheckValue <int>("hatch_counter"),
                                    HasGenderDifferences = reader.CheckValue <bool>("has_gender_differences"),
                                    GrowthRate           = new GrowthRate {
                                        Id = reader.CheckValue <int>("growth_rate_id")
                                    },
                                    FormsSwitchable = reader.CheckValue <bool>("forms_switchable"),
                                    Order           = reader.CheckValue <int>("order"),
                                    ConquestOrder   = reader.CheckValue <int>("conquest_order")
                                };
                            }
                        }
                    } // Command
                }

                if (pokemon.Species.Generation != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificGeneration;
                        command.Prepare();
                        command.AddWithValue("@generations_id", pokemon.Species.Generation.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.Generation = new Generation {
                                    Id         = reader.CheckValue <int>("id"),
                                    MainRegion = new Region {
                                        Id = reader.CheckValue <int>("main_region_id")
                                    },
                                    Identifier = reader.CheckObject <string>("identifier")
                                };
                            }
                        }
                    } // Command

                    if (pokemon.Species.Generation.MainRegion != null)
                    {
                        using (IDbCommand command = database.CreateCommand()) {
                            command.Connection  = connection;
                            command.CommandText = Query.GetSpecificRegion;
                            command.Prepare();
                            command.AddWithValue("@regions_id", pokemon.Species.Generation.MainRegion.Id);
                            using (IDataReader reader = command.ExecuteReader()) {
                                if (reader.Read())
                                {
                                    pokemon.Species.Generation.MainRegion = new Region {
                                        Id         = reader.CheckValue <int>("id"),
                                        Identifier = reader.CheckObject <string>("identifier")
                                    };
                                }
                            }
                        } // Command
                    }
                }

                if (pokemon.Species.Color != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificColor;
                        command.Prepare();
                        command.AddWithValue("@color_id", pokemon.Species.Color.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.Color = new Color {
                                    Id         = reader.CheckValue <int>("id"),
                                    Identifier = reader.CheckObject <string>("identifier")
                                };
                            }
                        }
                    } // Command
                }

                if (pokemon.Species.Shape != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificShape;
                        command.Prepare();
                        command.AddWithValue("@shape_id", pokemon.Species.Shape.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.Shape = new Shape {
                                    Id         = reader.CheckValue <int>("id"),
                                    Identifier = reader.CheckObject <string>("identifier")
                                };
                            }
                        }
                    } // Command
                }

                if (pokemon.Species.Habitat != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificHabitat;
                        command.Prepare();
                        command.AddWithValue("@habitat_id", pokemon.Species.Habitat.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.Habitat = new Habitat {
                                    Id         = reader.CheckValue <int>("id"),
                                    Identifier = reader.CheckObject <string>("identifier")
                                };
                            }
                        }
                    } // Command
                }

                if (pokemon.Species.GrowthRate != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificGrowthRate;
                        command.Prepare();
                        command.AddWithValue("@growth_rate_id", pokemon.Species.GrowthRate.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.GrowthRate = new GrowthRate {
                                    Id         = reader.CheckValue <int>("id"),
                                    Identifier = reader.CheckObject <string>("identifier"),
                                    Formula    = reader.CheckObject <string>("formula")
                                };
                            }
                        }
                    } // Command
                }

                if (pokemon.Species.EvolutionChain != null)
                {
                    using (IDbCommand command = database.CreateCommand()) {
                        command.Connection  = connection;
                        command.CommandText = Query.GetSpecificEvolutionChain;
                        command.Prepare();
                        command.AddWithValue("@evolution_chains_id", pokemon.Species.EvolutionChain.Id);
                        using (IDataReader reader = command.ExecuteReader()) {
                            if (reader.Read())
                            {
                                pokemon.Species.EvolutionChain = new EvolutionChain {
                                    Id = reader.CheckValue <int>("id"),
                                    BabyTriggerItem = new Item {
                                        Id = reader.CheckValue <int>("baby_trigger_item_id")
                                    }
                                };
                            }
                        }
                    } // Command

                    if (pokemon.Species.EvolutionChain.BabyTriggerItem != null)
                    {
                        using (IDbCommand command = database.CreateCommand()) {
                            command.Connection  = connection;
                            command.CommandText = Query.GetSpecificBabyTriggerItem;
                            command.Prepare();
                            command.AddWithValue("@baby_trigger_item_id", pokemon.Species.EvolutionChain.BabyTriggerItem.Id);
                            using (IDataReader reader = command.ExecuteReader()) {
                                if (reader.Read())
                                {
                                    pokemon.Species.EvolutionChain.BabyTriggerItem = new Item {
                                        Id         = reader.CheckValue <int>("id"),
                                        Identifier = reader.CheckObject <string>("identifier"),
                                        Category   = new Category {
                                            Id = reader.CheckValue <int>("category_id")
                                        },
                                        Cost        = reader.CheckValue <int>("cost"),
                                        FlingPower  = reader.CheckValue <int>("fling_power"),
                                        FlingEffect = new FlingEffects {
                                            Id = reader.CheckValue <int>("fling_effect_id")
                                        }
                                    };
                                }
                            }
                        } // Command

                        if (pokemon.Species.EvolutionChain.BabyTriggerItem.Category != null)
                        {
                            using (IDbCommand command = database.CreateCommand()) {
                                command.Connection  = connection;
                                command.CommandText = Query.GetSpecificCategory;
                                command.Prepare();
                                command.AddWithValue("@category_id", pokemon.Species.EvolutionChain.BabyTriggerItem.Category.Id);                                    using (IDataReader reader = command.ExecuteReader()) {
                                    if (reader.Read())
                                    {
                                        pokemon.Species.EvolutionChain.BabyTriggerItem.Category = new Category {
                                            Id     = reader.CheckValue <int>("id"),
                                            Pocket = new Pocket {
                                                Id = reader.CheckValue <int>("id")
                                            },
                                            Identifier = reader.CheckObject <string>("identifier")
                                        };
                                    }
                                }
                            } // Command

                            if (pokemon.Species.EvolutionChain.BabyTriggerItem.Category.Pocket != null)
                            {
                                using (IDbCommand command = database.CreateCommand()) {
                                    command.Connection  = connection;
                                    command.CommandText = Query.GetSpecificPocket;
                                    command.Prepare();
                                    command.AddWithValue("@pocket_id", pokemon.Species.EvolutionChain.BabyTriggerItem.Category.Pocket.Id);
                                    using (IDataReader reader = command.ExecuteReader()) {
                                        if (reader.Read())
                                        {
                                            pokemon.Species.EvolutionChain.BabyTriggerItem.Category.Pocket = new Pocket {
                                                Id         = reader.CheckValue <int>("id"),
                                                Identifier = reader.CheckObject <string>("identifier")
                                            };
                                        }
                                    }
                                } // Command
                            }
                        }

                        if (pokemon.Species.EvolutionChain.BabyTriggerItem.FlingEffect != null)
                        {
                            using (IDbCommand command = database.CreateCommand()) {
                                command.Connection  = connection;
                                command.CommandText = Query.GetSpecificFlingEffect;
                                command.Prepare();
                                command.AddWithValue("@fling_effect_id", pokemon.Species.EvolutionChain.BabyTriggerItem.FlingEffect.Id);
                                using (IDataReader reader = command.ExecuteReader()) {
                                    if (reader.Read())
                                    {
                                        pokemon.Species.EvolutionChain.BabyTriggerItem.FlingEffect = new FlingEffects {
                                            Id = reader.CheckValue <int>("id")
                                        };
                                    }
                                }
                            } // Command
                        }
                    }
                }
                connection.Close();
            } // Connection
            return(pokemon);
        }