public Oppai.pp_calc GetIfFcPP(ModsInfo mods, int n300, int n100, int n50, int nmiss)
        {
            double acc = Oppai.acc_calc(n300, n100, n50, nmiss) * 100.0;

            Oppai.acc_round(acc, m_cache.nobjects, nmiss, out n300, out n100, out n50);

            bool need_update = false;

            need_update = need_update || _fc_n100 != n100;
            need_update = need_update || _fc_n50 != n50;


            if (need_update)
            {
                _fc_n100 = n100;
                _fc_n50  = n50;

                Oppai.rtpp_params args;
                args.combo = Oppai.FullCombo;
                args.mods  = (uint)mods.Mod;
                args.n100  = n100;
                args.n50   = n50;
                args.nmiss = 0;

                Oppai.get_ppv2(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, true, m_cache, ref _fc_result);
            }

            return(_fc_result);
        }
        public Oppai.pp_calc GetRealTimePP(int end_time, ModsInfo mods, int n100, int n50, int nmiss, int max_combo)
        {
            int pos = GetPosition(end_time);

            bool need_update = false;

            need_update = need_update || _pos != pos;
            need_update = need_update || _n100 != n100;
            need_update = need_update || _n50 != n50;
            need_update = need_update || _nmiss != nmiss;
            need_update = need_update || _max_combo != max_combo;

            if (need_update)
            {
                _pos       = pos;
                _n100      = n100;
                _n50       = n50;
                _nmiss     = nmiss;
                _max_combo = max_combo;

                Oppai.rtpp_params args;
                args.combo = max_combo;
                args.mods  = (uint)mods.Mod;
                args.n100  = n100;
                args.n50   = n50;
                args.nmiss = nmiss;

                if (!Oppai.get_ppv2(m_beatmap_raw, (uint)pos, ref args, false, null, ref _rtpp_result))
                {
                    return(Oppai.pp_calc.Empty);
                }
            }

            return(_rtpp_result);
        }
        public Oppai.pp_calc GetMaxPP(ModsInfo mods)
        {
            bool need_update = false;

            need_update = need_update || mods != _max_mods;

            if (need_update)
            {
                _max_mods = mods;

                Oppai.rtpp_params args;
                args.combo = Oppai.FullCombo;
                args.mods  = (uint)mods.Mod;
                args.n100  = 0;
                args.n50   = 0;
                args.nmiss = 0;

                //Cache Beatmap
                Oppai.get_ppv2(m_beatmap_raw, (uint)m_beatmap_raw.Length, ref args, false, m_cache, ref _max_result);
            }
            return(_max_result);
        }
Esempio n. 4
0
        public override string GetFormattedMapInfo(LegacyMods mods, bool includeName = false)
        {
            string pp = string.Empty;

            if (Mode == Mode.Osu)
            {
                try
                {
                    double info100 = Oppai.GetBeatmapPP(this, mods, 100);
                    if (info100 > 0)
                    {
                        pp = $"100% - {info100:N2}pp";

                        double info98 = Oppai.GetBeatmapPP(this, mods, 98);
                        if (info98 > 0)
                        {
                            pp += $" | 98% - {info98:N2}pp";
                        }

                        double info95 = Oppai.GetBeatmapPP(this, mods, 95);
                        if (info95 > 0)
                        {
                            pp += $" | 95% - {info95:N2}pp";
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error($"Oppai failed: {e.InnerMessageIfAny()}");
                }
            }

            var fullName = string.Empty;

            if (includeName)
            {
                fullName = $"<a href=\"{Link}\">{BeatmapSet?.Artist} - {BeatmapSet?.Title}</a>\n";
            }

            switch (Mode)
            {
            case Mode.Osu:
                return
                    ($"{fullName}" +
                     $"[{Version.FilterToHTML()}] - {StarRating:N2}* - {ModdedDrainLength(mods):mm\':\'ss} - {BeatmapSet?.CreatorName} - <b>{Status}</b>\n" +
                     $"⭕️ | <b>CS:</b> {ModdedCS(mods):N2} | <b>AR:</b> {ModdedAR(mods):N2} | <b>OD:</b> {ModdedOD(mods):N2} | <b>BPM:</b> {ModdedBPM(mods):N2}\n" +
                     $"{pp}");

            case Mode.Taiko:
                return
                    ($"{fullName}" +
                     $"[{Version.FilterToHTML()}] - {StarRating:N2}* - {ModdedDrainLength(mods):mm\':\'ss} - {BeatmapSet?.CreatorName} - <b>{Status}</b>\n" +
                     $"🥁 | <b>OD:</b> {ModdedOD(mods):N2} | <b>BPM:</b> {ModdedBPM(mods):N2}");

            case Mode.Fruits:
                return
                    ($"{fullName}" +
                     $"[{Version.FilterToHTML()}] - {StarRating:N2}* - {ModdedDrainLength(mods):mm\':\'ss} - {BeatmapSet?.CreatorName} - <b>{Status}</b>\n" +
                     $"🍎 | <b>CS:</b> {ModdedCS(mods):N2} | <b>AR:</b> {ModdedAR(mods):N2} | <b>OD:</b> {ModdedOD(mods):N2} | <b>BPM:</b> {ModdedBPM(mods):N2}");

            case Mode.Mania:
                return
                    ($"{fullName}" +
                     $"[{Version.FilterToHTML()}] - {StarRating:N2}* - {ModdedDrainLength(mods):mm\':\'ss} - {BeatmapSet?.CreatorName} - <b>{Status}</b>\n" +
                     $"🎹 | <b>Keys:</b> {CS:N0} | <b>OD:</b> {ModdedOD(mods):N2} | <b>BPM:</b> {ModdedBPM(mods):N2}");

            default:
                return(string.Empty);
            }
        }