예제 #1
0
        public void LoadMoves(DatabaseConnection dbConnection, int ID, int formNum)
        {
            MySql database = dbConnection.Database;

            string query = "SELECT pokedex_pokemonlevelmove.LevelNum, pokedex_pokemonlevelmove.Move " +
                           "FROM pokedex_pokemonlevelmove " +
                           "WHERE pokedex_pokemonlevelmove.DexNum = \'" + ID + "\' " +
                           "AND pokedex_pokemonlevelmove.FormNum = \'" + formNum + "\' " +
                           "ORDER BY pokedex_pokemonlevelmove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                int         levelNum = column["LevelNum"].ValueString.ToInt();
                int         moveNum  = column["Move"].ValueString.ToInt();
                LevelUpMove move     = new LevelUpMove(moveNum, levelNum);
                LevelUpMoves.Add(move);
            }

            query = "SELECT pokedex_pokemontmmove.Move " +
                    "FROM pokedex_pokemontmmove " +
                    "WHERE pokedex_pokemontmmove.DexNum = \'" + ID + "\' " +
                    "AND pokedex_pokemontmmove.FormNum = \'" + formNum + "\' " +
                    "ORDER BY pokedex_pokemontmmove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                TMMoves.Add(column["Move"].ValueString.ToInt());
            }

            query = "SELECT pokedex_pokemoneggmove.Move " +
                    "FROM pokedex_pokemoneggmove " +
                    "WHERE pokedex_pokemoneggmove.DexNum = \'" + ID + "\' " +
                    "AND pokedex_pokemoneggmove.FormNum = \'" + formNum + "\' " +
                    "ORDER BY pokedex_pokemoneggmove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                EggMoves.Add(column["Move"].ValueString.ToInt());
            }

            query = "SELECT pokedex_pokemontutormove.Move " +
                    "FROM pokedex_pokemontutormove " +
                    "WHERE pokedex_pokemontutormove.DexNum = \'" + ID + "\' " +
                    "AND pokedex_pokemontutormove.FormNum = \'" + formNum + "\' " +
                    "ORDER BY pokedex_pokemontutormove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                TutorMoves.Add(column["Move"].ValueString.ToInt());
            }

            query = "SELECT pokedex_pokemondwmove.Move " +
                    "FROM pokedex_pokemondwmove " +
                    "WHERE pokedex_pokemondwmove.DexNum = \'" + ID + "\' " +
                    "AND pokedex_pokemondwmove.FormNum = \'" + formNum + "\' " +
                    "ORDER BY pokedex_pokemondwmove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                DWMoves.Add(column["Move"].ValueString.ToInt());
            }

            query = "SELECT pokedex_pokemoneventmove.Move " +
                    "FROM pokedex_pokemoneventmove " +
                    "WHERE pokedex_pokemoneventmove.DexNum = \'" + ID + "\' " +
                    "AND pokedex_pokemoneventmove.FormNum = \'" + formNum + "\' " +
                    "ORDER BY pokedex_pokemoneventmove.MoveIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                EventMoves.Add(column["Move"].ValueString.ToInt());
            }
        }
예제 #2
0
        //public Enums.Sex GenerateLegalSex() {
        //    if (MaleRatio + FemaleRatio <= 0) {
        //        return Enums.Sex.Genderless;
        //    } else if (Server.Math.Rand(0, MaleRatio + FemaleRatio) < MaleRatio) {
        //        return Enums.Sex.Male;
        //    } else {
        //        return Enums.Sex.Female;
        //    }
        //}

        public void Load(int ID, int formNum)
        {
            FormIndex = formNum;
            using (XmlReader reader = XmlReader.Create(Paths.DataPath + "Dex\\" + ID.ToString() + "-" + FormIndex + ".xml")) {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            #region Basic Data
                        case "FormName": {
                            FormName = reader.ReadString();
                        }
                        break;

                        case "Height": {
                            Height = reader.ReadString().ToDbl();
                        }
                        break;

                        case "Weight": {
                            Weight = reader.ReadString().ToDbl();
                        }
                        break;

                        case "Male": {
                            MaleRatio = reader.ReadString().ToInt();
                        }
                        break;

                        case "Female": {
                            FemaleRatio = reader.ReadString().ToInt();
                        }
                        break;

                        case "RecruitRate": {
                            RecruitRate = reader.ReadString().ToInt();
                        }
                        break;

                        case "BodyStyle": {
                            string style = reader.ReadString();
                            if (style.IsEnum <Enums.BodyShape>())
                            {
                                BodyStyle = style.ToEnum <Enums.BodyShape>();
                            }
                        }
                        break;

                            #endregion
                            #region Stats
                        case "HP": {
                            BaseHP = reader.ReadString().ToInt();
                        }
                        break;

                        case "Atk": {
                            BaseAtk = reader.ReadString().ToInt();
                        }
                        break;

                        case "Def": {
                            BaseDef = reader.ReadString().ToInt();
                        }
                        break;

                        case "SpAtk": {
                            BaseSpAtk = reader.ReadString().ToInt();
                        }
                        break;

                        case "SpDef": {
                            BaseSpDef = reader.ReadString().ToInt();
                        }
                        break;

                        case "Speed": {
                            BaseSpeed = reader.ReadString().ToInt();
                        }
                        break;

                            #endregion
                            #region Pokemon Info
                        case "Type1": {
                            Type1 = reader.ReadString().ToEnum <Enums.Element>();
                        }
                        break;

                        case "Type2": {
                            Type2 = reader.ReadString().ToEnum <Enums.Element>();
                        }
                        break;

                        case "Ability1": {
                            Ability1 = reader.ReadString();
                        }
                        break;

                        case "Ability2": {
                            Ability2 = reader.ReadString();
                        }
                        break;

                        case "Ability3": {
                            Ability3 = reader.ReadString();
                        }
                        break;

                        case "Exp": {
                            ExpYield = reader.ReadString().ToInt();
                        }
                        break;

                            #endregion
                            #region Moves
                        case "LevelUpMove": {
                            if (reader.Read())
                            {
                                int level = reader.ReadElementString("Level").ToInt(-1);
                                int move  = GameData.GetMove(reader.ReadElementString("Name"));
                                if (level > -1 && move > -1)
                                {
                                    LevelUpMoves.Add(new LevelUpMove(move, level));
                                }
                            }
                        }
                        break;

                        case "TMMove": {
                            if (reader.Read())
                            {
                                int move = GameData.GetMove(reader.ReadElementString("Name"));
                                if (move > -1)
                                {
                                    TMMoves.Add(move);
                                }
                            }
                        }
                        break;

                        case "EggMove": {
                            if (reader.Read())
                            {
                                int move = GameData.GetMove(reader.ReadElementString("Name"));
                                if (move > -1)
                                {
                                    EggMoves.Add(move);
                                }
                            }
                        }
                        break;

                        case "DWMove": {
                            if (reader.Read())
                            {
                                int move = GameData.GetMove(reader.ReadElementString("Name"));
                                if (move > -1)
                                {
                                    DWMoves.Add(move);
                                }
                            }
                        }
                        break;

                        case "TutorMove": {
                            if (reader.Read())
                            {
                                int move = GameData.GetMove(reader.ReadElementString("Name"));
                                if (move > -1)
                                {
                                    TutorMoves.Add(move);
                                }
                            }
                        }
                        break;

                        case "EventMove": {
                            if (reader.Read())
                            {
                                int move = GameData.GetMove(reader.ReadElementString("Name"));
                                if (move > -1)
                                {
                                    EventMoves.Add(move);
                                }
                            }
                        }
                        break;
                            #endregion
                        }
                    }
                }
            }
        }