Exemplo n.º 1
0
        //This returns the percentage of the specified score for the specified song and difficulty compared to the max possible score
        public static float GetScorePercentage(string songID, float score, KataConfig.Difficulty difficulty)
        {
            //Get data
            float maxPossibleScore = Convert.ToSingle(starThresholds.GetMaxRawScore(songID, difficulty));

            //Calculate score percentage
            float percentage = (score / maxPossibleScore) * 100;

            return(percentage);
        }
Exemplo n.º 2
0
 public static int GetFirstTick()
 {
     if (cachedFirstTick == 0)
     {
         SongList.SongData     songData = SongDataHolder.I.songData;
         KataConfig.Difficulty diff     = KataConfig.I.GetDifficulty();
         cachedFirstTick = SongCues.GetCues(songData, diff)[0].tick;
     }
     return(cachedFirstTick);
 }
Exemplo n.º 3
0
 public AudicaScore(string songID, int score, float maxScorePercent, KataConfig.Difficulty difficulty, int combo, int maxCombo)
 {
     this.songID           = songID;
     this.score            = score;
     this.maxScorePercent  = maxScorePercent;
     this.difficultyString = difficulty.ToString("g");
     this.combo            = combo;
     this.maxCombo         = maxCombo;
     date    = DateTime.Now;
     version = 4;
 }
Exemplo n.º 4
0
    public float GetRatingFromKataDifficulty(KataConfig.Difficulty difficulty)
    {
        switch (difficulty)
        {
        case KataConfig.Difficulty.Easy:
            if (beginner != null)
            {
                return(beginner.difficultyRating);
            }
            else
            {
                return(0f);
            }

        case KataConfig.Difficulty.Normal:
            if (standard != null)
            {
                return(standard.difficultyRating);
            }
            else
            {
                return(0f);
            }

        case KataConfig.Difficulty.Hard:
            if (advanced != null)
            {
                return(advanced.difficultyRating);
            }
            else
            {
                return(0f);
            }

        case KataConfig.Difficulty.Expert:
            if (expert != null)
            {
                return(expert.difficultyRating);
            }
            else
            {
                return(0f);
            }

        default:
            return(0f);
        }
    }
Exemplo n.º 5
0
    public static void AddScore(string songID, int score, float maxScorePercent, float difficultyRating, int combo, int maxCombo, KataConfig.Difficulty difficulty)
    {
        var scoreToAdd    = new AudicaScore(songID, score, maxScorePercent, difficulty, combo, maxCombo);
        var previousScore = scores.FirstOrDefault(previous => previous.songID == songID);

        if (!previousScore.Equals(default(AudicaScore)))
        {
            if (scoreToAdd.score < previousScore.score)
            {
                return;
            }
            else
            {
                scores.Add(scoreToAdd);
                scores.Remove(previousScore);
            }
        }
        else
        {
            scores.Add(scoreToAdd);
        }
        lastAudicaScore = audicaScore;
        audicaScore     = CalculateTotalRating();
        SongBrowser.DebugText($"<color=green>+{(audicaScore - lastAudicaScore).ToString("n2")}</color>");
        SaveHistory(PlatformChooser.I.GetLeaderboardID());
    }
Exemplo n.º 6
0
 private static void Postfix(SongPlayHistory __instance, string songID, int score, KataConfig.Difficulty difficulty, float percent, bool fullCombo, bool noFail)
 {
     if (counter % 2 == 0)
     {
         MelonLogger.Msg("Recorded new score!");
         if (noFail)
         {
             return;
         }
         if (percent < 30f)
         {
             return;
         }
         float maxScorePercent = (float)score / (float)StarThresholds.I.GetMaxRawScore(songID, difficulty);
         DifficultyCalculator.CachedCalculation difficultyRating = DifficultyCalculator.GetRating(songID, difficulty.ToString());
         AddScore(songID, score, maxScorePercent, difficultyRating.value, ScoreKeeper.I.mStreak, ScoreKeeper.I.mMaxStreak, difficulty);
     }
     counter++;
 }
Exemplo n.º 7
0
 private static void Postfix(SongSelectItem __instance, int score, KataConfig.Difficulty difficulty, float percent, bool fullCombo)
 {
     AudicaMod.UpdateScoreDisplays(__instance, score);
 }