예제 #1
0
        static async Task Main(string[] args)
        {
            Configuration c            = new($"{Directory.GetCurrentDirectory()}/client.json");
            PlayerConfig  playerConfig = new($"{Directory.GetCurrentDirectory()}/player.json");

            using osuClient client = new osuClient(c.Config);
            MapCache cache = new();

            await client.ConnectAsync();

            var player = await client.GetUserRequest(playerConfig.Player.Id);

            Console.WriteLine($"Getting data for {player.Username}");
            Console.WriteLine($"Current Status : Rank #{player.RankHistory.Data.Last()} (#{player.Statistics.Rank.Country} {player.Country.Code}) | Avg ACC : {player.Statistics.HitAccuracy:F2}%");
            var threshold = Math.Floor(player.Statistics.HitAccuracy);

            Console.WriteLine($"Using floor(avg acc) as cutoff point for accuracy. X = {threshold}%");
            Console.WriteLine($"Getting top 100 scores...");
            var top50 = await client.GetUserScoresRequest(playerConfig.Player.Id, ScoreType.BEST, limit : 50);

            var _51to100 = await client.GetUserScoresRequest(playerConfig.Player.Id, ScoreType.BEST, limit : 50, offset : 50);

            var top100 = top50.Concat(_51to100).ToList();

            Console.WriteLine($"Got top 100. Filtering data...");
            var lowerThenTheshold = top100.Where(x => x.Accuracy < threshold / 100).ToList();

            Console.WriteLine("Populating the cache...");
            await cache.PopulateCacheAsync(lowerThenTheshold.Select(x => x.Beatmap.Id).ToList(), client);

            Console.WriteLine("Done.");
            Console.WriteLine($"From 100 scores : {lowerThenTheshold.Count} were below {threshold}% of accuracy");
            var aRank    = lowerThenTheshold.Where(x => x.Grade == ScoreGrade.A).ToList();
            var bOrLower = lowerThenTheshold.Where(x => x.Grade <= ScoreGrade.B).ToList();
            var sRank    = lowerThenTheshold.Where(x => x.Grade == ScoreGrade.S || x.Grade == ScoreGrade.SH).ToList();

            Console.WriteLine($"From those, based on rank gathered.");
            Console.WriteLine($"{sRank.Count} were S/S+ Rank.");
            Console.WriteLine($"{aRank.Count} were A Rank.");
            Console.WriteLine($"{bOrLower.Count} were B or Lower.");
            var orderedS      = sRank.OrderRanks(threshold, cache.CACHE);
            var orderedA      = aRank.OrderRanks(threshold, cache.CACHE);
            var orderedBMinus = bOrLower.OrderRanks(threshold, cache.CACHE);

            SaveScores(orderedS, orderedA, orderedBMinus);
            Console.WriteLine($"Scores exported to scores/rank.json ordered on Rebase v1");
            Console.WriteLine($"LOWER IS BETTER. The smaller the number the easier it should be to replicate said score.");
        }
예제 #2
0
        public async Task PopulateCacheAsync(IEnumerable <uint> mapIds, osuClient client)
        {
            foreach (var mapId in mapIds.Where(mapId => !CACHE.Exists(x => x.Id == mapId)))
            {
                var map = await client.GetBeatmapRequest(mapId);

                if (map.MaxCombo.HasValue)
                {
                    CachedMap mapx = new();
                    mapx.Combo = map.MaxCombo.Value;
                    mapx.Id    = map.Id;
                    CACHE.Insert(mapx);
                }
                else
                {
                    Console.WriteLine($"ERROR ON MAPID  #{mapId}, Request didn't return max combo.");
                }
            }
        }