Ejemplo n.º 1
0
        public pokemonInfo(pokemonObject poke)
        {
            int pokeIDInt = Convert.ToInt32(poke.pokeID);

            setPokemonStats(poke);
            setPokemonType(pokeIDInt, poke);
            setPokemonAbilities(poke);
        }
Ejemplo n.º 2
0
        public void setPokemonAbilities(pokemonObject poke)
        {
            int slot = 0;

            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "MSI\\MSSQLSERVER01"; // update me
                builder.UserID         = "pokeuser";           // update me
                builder.Password       = "******";           // update me
                builder.InitialCatalog = "PokemonDatabase";

                using (connection = new SqlConnection(builder.ConnectionString))
                {
                    int pokeIDInt = Convert.ToInt32(poke.pokeID);
                    connection.Open();
                    SqlDataReader sdr     = null;
                    string        sqlText = "pokemon.pr_vSelectPokemonByID_AbilitiesNameAndSlot";
                    SqlCommand    cmd     = new SqlCommand(sqlText, connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", pokeIDInt);
                    sdr = cmd.ExecuteReader();

                    while (sdr.Read())
                    {
                        slot = sdr.GetInt32(1);

                        if (slot > 3)
                        {
                            slot = 3;
                        }

                        switch (slot)
                        {
                        case 1:
                            poke.abilityOne = sdr.GetString(0);
                            break;

                        case 2:
                            poke.abilityTwo = sdr.GetString(0);
                            break;

                        case 3:
                            poke.abilityThree = sdr.GetString(0);
                            break;

                        default:
                            poke.abilityThree = sdr.GetString(0);
                            break;
                        }
                    }
                }
            }
            catch (SqlException e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 3
0
        public void pokemonSelection(pokemonObject si)
        {
            pokemonObject currentPokemon = si;

            pi = new pokemonInfo(currentPokemon);
            drawReset();//Reset Statbar drawings
            pokemonNameLabel.Text = currentPokemon.pokeIdentifier;


            #region
            //currentPokemon.hpStat = statsArray[0];
            hpLabel.Text = "HP: " + currentPokemon.hpStat.ToString();                       //Set Up Label for HP stat
            sb.setRect(80, (hpLabel.Location.Y), (Convert.ToInt16(currentPokemon.hpStat))); //this set up rectangle to represent the stat bar
            drawRect();                                                                     //draw method for stat bar

            //currentPokemon.attStat = statsArray[1];
            attackLabel.Text = "Attack: " + currentPokemon.attStat.ToString();
            sb.setRect(80, (attackLabel.Location.Y), Convert.ToInt16(currentPokemon.attStat));
            drawRect();

            //currentPokemon.defStat = statsArray[2];
            defLabel.Text = "Def: " + currentPokemon.defStat.ToString();
            sb.setRect(80, (defLabel.Location.Y), Convert.ToInt16(currentPokemon.defStat));
            drawRect();

            //currentPokemon.spatkStat = statsArray[3];
            spattLabel.Text = "SpAtt: " + currentPokemon.spatkStat.ToString();
            sb.setRect(80, (spattLabel.Location.Y), Convert.ToInt16(currentPokemon.spatkStat));
            drawRect();

            //currentPokemon.spdefStat = statsArray[4];
            spdefLabel.Text = "SpDef: " + currentPokemon.spdefStat.ToString();
            sb.setRect(80, (spdefLabel.Location.Y), Convert.ToInt16(currentPokemon.spdefStat));
            drawRect();

            //currentPokemon.spdStat = statsArray[5];
            spdLabel.Text = "Speed: " + currentPokemon.spdStat.ToString();
            sb.setRect(80, (spdLabel.Location.Y), Convert.ToInt16(currentPokemon.spdStat));
            drawRect();
            #endregion Setting up stats and draw rectangles


            pokemonTypeOneLabel.Text      = currentPokemon.typeOne;
            pokemonTypeTwoLabel.Text      = currentPokemon.typeTwo;
            pokemonAbilityOneLabel.Text   = currentPokemon.abilityOne;
            pokemonAbilityTwoLabel.Text   = currentPokemon.abilityTwo;
            pokemonAbilityThreeLabel.Text = currentPokemon.abilityThree;

            toolTip1.SetToolTip(pokemonAbilityOneLabel, pi.getPokemonAbilitiesFlavorText(pokemonAbilityOneLabel.Text));
            toolTip1.SetToolTip(pokemonAbilityTwoLabel, pi.getPokemonAbilitiesFlavorText(pokemonAbilityTwoLabel.Text));
            toolTip1.SetToolTip(pokemonAbilityThreeLabel, pi.getPokemonAbilitiesFlavorText(pokemonAbilityThreeLabel.Text));
        }
Ejemplo n.º 4
0
        public Double[] setPokemonStats(pokemonObject poke)
        {
            Double[] statsArray = new Double[6];
            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "MSI\\MSSQLSERVER01"; // update me
                builder.UserID         = "pokeuser";           // update me
                builder.Password       = "******";           // update me
                builder.InitialCatalog = "PokemonDatabase";

                using (connection = new SqlConnection(builder.ConnectionString))
                {
                    int pokeIDInt = Convert.ToInt32(poke.pokeID);
                    connection.Open();
                    SqlDataReader sdr     = null;
                    string        sqlText = "pokemon.pr_vSelectPokemonByID_StatsOnly";
                    SqlCommand    cmd     = new SqlCommand(sqlText, connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", pokeIDInt);
                    sdr = cmd.ExecuteReader();
                    int counter = 0;
                    while (sdr.Read())
                    {
                        statsArray[counter] = sdr.GetDouble(0);
                        counter++;
                    }

                    poke.hpStat    = statsArray[0];
                    poke.attStat   = statsArray[1];
                    poke.defStat   = statsArray[2];
                    poke.spatkStat = statsArray[3];
                    poke.spdefStat = statsArray[4];
                    poke.spdStat   = statsArray[5];
                }
            }
            catch (SqlException e)
            {
                Console.WriteLine(e.ToString());
            }
            return(statsArray);
        }
Ejemplo n.º 5
0
        public void setPokemonType(int pID, pokemonObject poke)
        {
            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "MSI\\MSSQLSERVER01"; // update me
                builder.UserID         = "pokeuser";           // update me
                builder.Password       = "******";           // update me
                builder.InitialCatalog = "PokemonDatabase";


                using (connection = new SqlConnection(builder.ConnectionString))
                {
                    connection.Open();
                    SqlDataReader sdr     = null;
                    string        sqlText = "pokemon.pr_vSelectPokemonByID_TypesOnly";
                    SqlCommand    cmd     = new SqlCommand(sqlText, connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", pID);
                    sdr = cmd.ExecuteReader();
                    if (sdr.Read())
                    {
                        poke.typeOne = sdr.GetString(0);
                    }

                    if (sdr.Read())
                    {
                        poke.typeTwo = sdr.GetString(0);
                    }
                    else
                    {
                        poke.typeTwo = "-";
                    }
                }
            }

            catch (SqlException e)
            {
                Console.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 6
0
        private void pokemonListComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            pokemonObject selectedItem = (pokemonObject)pokemonListComboBox.SelectedItem;

            pokemonSelection(selectedItem);
        }