Пример #1
0
        private OsuJsonUserRecent[] ProcessJson(OsuJsonUserRecent[] array, bool retrycount)
        {
            foreach (var item in array)
            {
                if (retrycount)
                {
                    continue;
                }

                //Get Beatmap last update
                var beatmapBuilder = new OsuBeatmapBuilder
                {
                    Mode = Mode,
                    ConvertedIncluded = "1",
                    BeatmapId         = item.beatmap_id
                };

                item.Beatmap = beatmapBuilder.Execute().First();

                OsuUtil.GetCalculatedAccuracy(item, Mode);
                var data        = OsuDlBeatmap.FindMap(item.beatmap_id, item.Beatmap.last_update.DateTime);
                var beatmapData = Beatmap.Read(new StreamReader(new MemoryStream(data, false)));
                var diff        = new DiffCalc().Calc(beatmapData, (Mods)item.enabled_mods);

                var rawPp = new PPv2(new PPv2Parameters(beatmapData, diff, new Accuracy(item.count300, item.count100, item.count50, item.countmiss).Value(), item.countmiss, item.maxcombo, (Mods)item.enabled_mods));
                item.nochokeaccuracy = new Accuracy(item.count300 + item.countmiss, item.count100, item.count50, 0).Value() * 100;
                var nochokePp = new PPv2(new PPv2Parameters(beatmapData, diff, item.nochokeaccuracy / 100, 0, diff.Beatmap.GetMaxCombo(), (Mods)item.enabled_mods));
                item.pp        = rawPp.Total;
                item.nochokepp = nochokePp.Total;

                item.rounded_score = item.score.ToString("C0", _nfi);

                if (item.maxcombo <= (beatmapData.GetMaxCombo() - (item.count100 + item.count50)) || item.rank == "XH" || item.rank == "SH")
                {
                    item.choked = true;
                }
                else if (item.countmiss > 0)
                {
                    item.choked = true;
                }

                item.starrating = diff.Total;

                item.counttotal = beatmapData.CountCircles + beatmapData.CountSliders + beatmapData.CountSpinners;

                item.rounded_score = item.score.ToString("C0", _nfi);

                item.standardhit = item.count300 + item.count100 + item.count50 + item.countmiss;

                item.hitted = item.countkatu + item.countgeki + item.count300 + item.count100 + item.count50 + item.countmiss;

                item.completion = item.standardhit / (double)item.counttotal * 100;
            }

            return(array);
        }
Пример #2
0
        private OsuJsonBeatmap GetBeatmap(int beatmap_id)
        {
            var beatmapBuilder = new OsuBeatmapBuilder
            {
                Mode = Mode,
                ConvertedIncluded = "1",
                BeatmapId         = beatmap_id
            };

            return(beatmapBuilder.Execute().First());
        }
Пример #3
0
        public OsuJsonScore[] ProcessJson(OsuJsonScore[] scoreArray)
        {
            foreach (var item in scoreArray)
            {
                var beatmapBuilder = new OsuBeatmapBuilder
                {
                    Mode = Mode,
                    ConvertedIncluded = "1",
                    BeatmapId         = BeatmapId
                };

                item.Beatmap = beatmapBuilder.Execute().First();

                item.rounded_score = item.score.ToString("C0", Nfi);

                switch (Mode)
                {
                case 0:
                    item.calculated_accuracy = 100.0 * (6 * item.count300 + 2 * item.count100 + item.count50) /
                                               (6 * (item.count50 + item.count100 + item.count300 +
                                                     item.countmiss));
                    break;

                case 1:
                    item.calculated_accuracy = 100.0 * (2 * item.count300 + item.count100) /
                                               (2 * (item.count300 + item.count100 + item.countmiss));
                    break;

                case 2:
                    item.calculated_accuracy = 100.0 * (item.count300 + item.count100 + item.count50) /
                                               (item.count300 + item.count100 + item.count50 + item.countkatu +
                                                item.countmiss);
                    break;

                case 3:
                    item.calculated_accuracy =
                        100.0 * (6 * item.countgeki + 6 * item.count300 + 4 * item.countkatu + 2 * item.count100 +
                                 item.count50) /
                        (6 * (item.count50 + item.count100 + item.count300 + item.countmiss + item.countgeki +
                              item.countkatu));
                    break;

                default:
                    throw new InvalidOperationException("`Hitted unreachable code in switch statement (OsuScoreBuilder)`");
                }
            }

            return(scoreArray);
        }