Exemplo n.º 1
0
        public Achievement(DataRow Row)
        {
            using (RowAdapter Adapter = new RowAdapter(Row))
            {
                Id = Adapter.PopInt32("id");
                CategoryId = Adapter.PopInt32("category_id");
                BadgeId = Adapter.PopInt32("badge_id");
                PixelReward = Adapter.PopInt32("pixel_reward");
                ScoreReward = Adapter.PopInt32("score_reward");
                PixelMultiply = Adapter.PopDouble("pixel_multiply");
                ScoreMultiply = Adapter.PopDouble("score_multiply");
                EnableBadgeBuilding = Adapter.PopBoolean("enable_bagde_building");
            }

            Limits = new Dictionary<int, int>();

            foreach (DataRow LimitRow in System.MySQLManager.GetObject(new AchievementLimitsQuery(Id)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(LimitRow))
                {
                    int Level = Adapter.PopInt32("level");
                    int Limit = Adapter.PopInt32("required");

                    if (Limit < 0)
                    {
                        Limit = 1;
                    }

                    if (!Limits.ContainsKey(Level))
                    {
                        Limits.Add(Level, Limit);
                    }
                }
            }
        }