示例#1
0
        public bool MatchingFilters(BeatmapCharacteristicDifficulty difficulty, Beatmap mapData)
        {
            bool npsCondition    = NPS.HasValue ? MapTools.GetNotesPerSecond(mapData.Metadata.BPM, difficulty.Duration, difficulty.Notes) >= NPS.Value : true;
            bool ratingCondition = Rating.HasValue ? mapData.Stats.Rating >= Rating.Value * 100 : true;

            return(UsingFilters ? npsCondition && ratingCondition : true);
        }
        private void btnCopyMapInfo_Click(object sender, EventArgs e)
        {
            if (mapData == null)
            {
                CustomMessageBox.Show(this, "This map doesn't exist!", new Size(customMessageBoxWidthSize, 100));
            }
            else
            {
                string beatsaverURL = "https://beatsaver.com/beatmap/" + txtMapID.Text;
                string bpm          = mapData.Metadata.BPM.ToString();

                // Stats
                string downloads = mapData.Stats.Downloads.ToString();
                string plays     = mapData.Stats.Plays.ToString();
                string downVotes = mapData.Stats.DownVotes.ToString();
                string upVotes   = mapData.Stats.UpVotes.ToString();
                string rating    = mapData.Stats.Rating.ToString();

                string selectedDifficultyName = cmbDifficulty.Items[cmbDifficulty.SelectedIndex];
                selectedDifficultyName = selectedDifficultyName.Substring(0, 1).ToLower() + selectedDifficultyName.Substring(1);


                // Difficulty Info
                string difficultyInfo = "";

                var difficulties = mapData.Metadata.Characteristics.FirstOrDefault().Difficulties;
                BeatmapCharacteristicDifficulty selectedDifficulty = new BeatmapCharacteristicDifficulty();

                if (!difficulties.ContainsKey(selectedDifficultyName))
                {
                    CustomMessageBox.Show(this, "Could not find info for this difficulty because it doesn't exist!", new Size(customMessageBoxWidthSize, 100));
                    return;
                }
                selectedDifficulty = difficulties[selectedDifficultyName].Value;

                difficultyInfo = selectedDifficulty.GetInfoText(mapData.Metadata.BPM);

                if (difficultyInfo == "")
                {
                    CustomMessageBox.Show(this, "The Difficulty doesn't exist!", new Size(customMessageBoxWidthSize, 100));
                    return;
                }

                string mapInfo =
                    beatsaverURL + "\n\n" +
                    "===================== STATS =====================\n" +
                    "Downloads: " + downloads + "\n" +
                    //"Plays: " + plays + "\n" +
                    "Downvotes: " + downVotes + "\n" +
                    "Upvotes: " + upVotes + "\n" +
                    "Rating: " + rating + "\n\n" +
                    "================ Difficulty Info (" + selectedDifficultyName + ") =================\n" +
                    difficultyInfo + "\n" +
                    "key: " + mapData.Key + "\n\n" +
                    "Note that NPS isn't 100% accurate as it only looks for the amount of notes in the map and how long the map is instead of looking at where the first note begins and where the last note ends.";

                Clipboard.SetData(DataFormats.Text, mapInfo);
                CustomMessageBox.Show(this, "\"" + mapInfo + "\"" + "\n\nWas added to clipboard", new Size(Size.Width - 50, 400));
            }
        }
示例#3
0
        public static BeatmapCharacteristicDifficulty GetHighestDifficulty(this ReadOnlyDictionary <string, BeatmapCharacteristicDifficulty?> beatmapCharacteristicDifficulties)
        {
            BeatmapCharacteristicDifficulty highestDifficulty = new BeatmapCharacteristicDifficulty();

            foreach (var difficulty in beatmapCharacteristicDifficulties.Values)
            {
                if (difficulty != null)
                {
                    highestDifficulty = difficulty.Value;
                }
            }
            return(highestDifficulty);
        }
示例#4
0
        public static string GetInfoText(this BeatmapCharacteristicDifficulty beatmapCharacteristicDifficulty, double bpm)
        {
            long   minutes        = beatmapCharacteristicDifficulty.Length / 60;
            long   seconds        = beatmapCharacteristicDifficulty.Length - minutes * 60;
            double notesPerSecond = MapTools.GetNotesPerSecond(bpm, beatmapCharacteristicDifficulty.Duration, beatmapCharacteristicDifficulty.Notes);
            string lengthInfo     = minutes + " minutes " + seconds + " seconds ";

            if (beatmapCharacteristicDifficulty.Length <= 60)
            {
                lengthInfo = beatmapCharacteristicDifficulty.Length + " seconds ";
            }

            return
                ("Length: " + lengthInfo + "\n" +
                 "Note jump speed: " + beatmapCharacteristicDifficulty.NoteJumpSpeed + "\n" +
                 "Note jump speed offset: " + beatmapCharacteristicDifficulty.NoteJumpSpeedOffset + "\n" +
                 "Notes per second: " + notesPerSecond + "\n" +
                 "Bombs: " + beatmapCharacteristicDifficulty.Bombs + "\n" +
                 "Notes: " + beatmapCharacteristicDifficulty.Notes + "\n" +
                 "Obstacles: " + beatmapCharacteristicDifficulty.Obstacles);
        }
示例#5
0
        public static async Task <Beatmap> GetMapData(Form1 form, RandomKeyFilter randomKeyFilter, string randomKey, bool showError = false)
        {
            try
            {
                Beatmap mapData = await Form1.beatsaverClient.Key(randomKey);

                if (mapData == null)
                {
                    throw new Exception();
                }
                bool isBeatSage = mapData.Metadata.Automapper != null;

                if (isBeatSage)
                {
                    CustomMessageBox.Show(form, "WARNING: This is an autogenerated map!", new Size(Form1.customMessageBoxWidthSize, 100));
                }

                #region NPS Filter
                BeatmapCharacteristicDifficulty highestDifficulty = mapData.Metadata.Characteristics[0].Difficulties.GetHighestDifficulty();
                if (randomKeyFilter != null && !randomKeyFilter.MatchingFilters(highestDifficulty, mapData))
                {
                    mapData = null;
                    return(null);
                }
                #endregion

                return(mapData);
            }
            catch (Exception ex)
            {
                if (showError)
                {
                    CustomMessageBox.Show(form, "There is no map with this key!", new Size(Form1.customMessageBoxWidthSize, 100));
                }
                return(null);
            }
        }
示例#6
0
        internal BeatSaver_DifficultyBeatmap(BeatSaver_DifficultyBeatmapSet p_Parent, BeatSaver_CustomBeatmapLevel p_BSBeatmapLevel, BeatmapCharacteristicSO p_CharacteristicSO, BeatmapDifficulty p_Difficulty, BeatmapCharacteristicDifficulty p_CharacteristicDifficulty)
        {
            level = p_BSBeatmapLevel;
            parentDifficultyBeatmapSet = p_Parent;
            difficulty              = p_Difficulty;
            noteJumpMovementSpeed   = p_CharacteristicDifficulty.NoteJumpSpeed;
            noteJumpStartBeatOffset = p_CharacteristicDifficulty.NoteJumpSpeedOffset;
            beatmapData             = new BeatmapData(4);

            /// From DefaultRating
            switch (p_Difficulty)
            {
            case BeatmapDifficulty.Easy:        difficultyRank = 1; break;

            case BeatmapDifficulty.Normal:      difficultyRank = 3; break;

            case BeatmapDifficulty.Hard:        difficultyRank = 5; break;

            case BeatmapDifficulty.Expert:      difficultyRank = 7; break;

            case BeatmapDifficulty.ExpertPlus:  difficultyRank = 9; break;
            }

            for (int l_I = 0; l_I < p_CharacteristicDifficulty.Notes; ++l_I)
            {
                beatmapData.AddBeatmapObjectData(NoteData.CreateBasicNoteData(0f, 0, NoteLineLayer.Base, ColorType.ColorA, NoteCutDirection.Any));
            }
        }