コード例 #1
0
        public static void LoadMissionPool(DatabaseConnection dbConnection, int difficulty)
        {
            MissionPool missionPool = new MissionPool();
            var         database    = dbConnection.Database;

            string query = "SELECT mission_client.DexNum, mission_client.FormNum " +
                           "FROM mission_client " +
                           "WHERE mission_client.Rank = \'" + difficulty + "\'  " +
                           "ORDER BY mission_client.ClientIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionClientData data = new MissionClientData();
                data.Species = column["DexNum"].ValueString.ToInt();
                data.Form    = column["FormNum"].ValueString.ToInt();
                missionPool.MissionClients.Add(data);
            }

            query = "SELECT mission_enemy.NpcNum " +
                    "FROM mission_enemy " +
                    "WHERE mission_enemy.Rank = \'" + difficulty + "\'  " +
                    "ORDER BY mission_enemy.EnemyIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionEnemyData data = new MissionEnemyData();
                data.NpcNum = column["NpcNum"].ValueString.ToInt();
                missionPool.Enemies.Add(data);
            }

            query = "SELECT mission_reward.ItemNum, mission_reward.ItemAmount, mission_reward.ItemTag " +
                    "FROM mission_reward " +
                    "WHERE mission_reward.Rank = \'" + difficulty + "\'  " +
                    "ORDER BY mission_reward.RewardIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionRewardData data = new MissionRewardData();
                data.ItemNum = column["ItemNum"].ValueString.ToInt();
                data.Amount  = column["ItemAmount"].ValueString.ToInt();
                data.Tag     = column["ItemTag"].ValueString;
                missionPool.Rewards.Add(data);
            }


            missionPools.MissionPools.Add(missionPool);
        }
コード例 #2
0
        public static void SaveMissionPool(DatabaseConnection dbConnection, int difficulty)
        {
            var database = dbConnection.Database;

            database.ExecuteNonQuery("DELETE FROM mission_client WHERE Rank = \'" + difficulty + "\'");

            for (int i = 0; i < missionPools.MissionPools[difficulty].MissionClients.Count; i++)
            {
                MissionClientData data = missionPools.MissionPools[difficulty].MissionClients[i];

                database.AddRow("mission_client", new IDataColumn[]
                {
                    database.CreateColumn(true, "Rank", difficulty.ToString()),
                    database.CreateColumn(true, "ClientIndex", i.ToString()),
                    database.CreateColumn(false, "DexNum", data.Species.ToString()),
                    database.CreateColumn(false, "FormNum", data.Form.ToString())
                });
            }

            database.ExecuteNonQuery("DELETE FROM mission_enemy WHERE Rank = \'" + difficulty + "\'");
            for (int i = 0; i < missionPools.MissionPools[difficulty].Enemies.Count; i++)
            {
                MissionEnemyData data = missionPools.MissionPools[difficulty].Enemies[i];

                database.AddRow("mission_enemy", new IDataColumn[] {
                    database.CreateColumn(false, "Rank", difficulty.ToString()),
                    database.CreateColumn(false, "EnemyIndex", i.ToString()),
                    database.CreateColumn(false, "NpcNum", data.NpcNum.ToString())
                });
            }

            database.ExecuteNonQuery("DELETE FROM mission_reward WHERE Rank = \'" + difficulty + "\'");
            for (int i = 0; i < missionPools.MissionPools[difficulty].Rewards.Count; i++)
            {
                MissionRewardData data = missionPools.MissionPools[difficulty].Rewards[i];


                database.AddRow("mission_reward", new IDataColumn[] {
                    database.CreateColumn(false, "Rank", difficulty.ToString()),
                    database.CreateColumn(false, "RewardIndex", i.ToString()),
                    database.CreateColumn(false, "ItemNum", data.ItemNum.ToString()),
                    database.CreateColumn(false, "ItemAmount", data.Amount.ToString()),
                    database.CreateColumn(false, "ItemTag", data.Tag)
                });
            }
        }
コード例 #3
0
ファイル: WonderMailManager.cs プロジェクト: pzaps/Server
        public static void LoadMissionPool(DatabaseConnection dbConnection, int difficulty)
        {
            MissionPool missionPool = new MissionPool();
            MySql database = dbConnection.Database;

            string query = "SELECT mission_client.DexNum, mission_client.FormNum " +
                "FROM mission_client " +
                "WHERE mission_client.Rank = \'" + difficulty + "\'  " +
                "ORDER BY mission_client.ClientIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionClientData data = new MissionClientData();
                data.Species = column["DexNum"].ValueString.ToInt();
                data.Form = column["FormNum"].ValueString.ToInt();
                missionPool.MissionClients.Add(data);
            }

            query = "SELECT mission_enemy.NpcNum " +
                "FROM mission_enemy " +
                "WHERE mission_enemy.Rank = \'" + difficulty + "\'  " +
                "ORDER BY mission_enemy.EnemyIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionEnemyData data = new MissionEnemyData();
                data.NpcNum = column["NpcNum"].ValueString.ToInt();
                missionPool.Enemies.Add(data);
            }

            query = "SELECT mission_reward.ItemNum, mission_reward.ItemAmount, mission_reward.ItemTag " +
                "FROM mission_reward " +
                "WHERE mission_reward.Rank = \'" + difficulty + "\'  " +
                "ORDER BY mission_reward.RewardIndex";

            foreach (DataColumnCollection column in database.RetrieveRowsEnumerable(query))
            {
                MissionRewardData data = new MissionRewardData();
                data.ItemNum = column["ItemNum"].ValueString.ToInt();
                data.Amount = column["ItemAmount"].ValueString.ToInt();
                data.Tag = column["ItemTag"].ValueString;
                missionPool.Rewards.Add(data);
            }

            missionPools.MissionPools.Add(missionPool);
        }