44using Microsoft . AspNetCore . Mvc ;
55using Newtonsoft . Json ;
66using osu . Game . Beatmaps ;
7+ using osu . Game . Database ;
78using osu . Game . Online . API ;
89using osu . Game . Rulesets ;
910using osu . Game . Rulesets . Difficulty ;
1011using osu . Game . Rulesets . Mods ;
1112using osu . Game . Rulesets . Scoring ;
13+ using osu . Game . Rulesets . Scoring . Legacy ;
1214using osu . Game . Scoring ;
15+ using osu . Game . Scoring . Legacy ;
1316using PerformanceServer . Rulesets ;
1417
1518namespace PerformanceServer
@@ -54,7 +57,7 @@ public async Task<ActionResult<PerformanceAttributes>> CalculatePerformance(
5457 List < Mod > mods = body . Mods . Select ( m => m . ToMod ( ruleset ) ) . ToList ( ) ;
5558 if ( body . IsLegacy && ! mods . Any ( m => m is ModClassic ) )
5659 {
57- Mod ? classicMod = ruleset . CreateModFromAcronym ( "CL" ) ;
60+ Mod ? classicMod = ruleset . CreateMod < ModClassic > ( ) ;
5861 if ( classicMod != null )
5962 mods . Add ( classicMod ) ;
6063 }
@@ -67,6 +70,7 @@ public async Task<ActionResult<PerformanceAttributes>> CalculatePerformance(
6770 Mods = mods . ToArray ( ) ,
6871 Accuracy = body . Accuracy ,
6972 MaxCombo = body . Combo ,
73+ Ruleset = ruleset . RulesetInfo ,
7074 } ;
7175 ProcessorWorkingBeatmap workingBeatmap ;
7276 if ( body . BeatmapFile != null )
@@ -87,6 +91,18 @@ public async Task<ActionResult<PerformanceAttributes>> CalculatePerformance(
8791 }
8892 }
8993
94+ IBeatmap ? playableBeatmap = workingBeatmap . GetPlayableBeatmap ( ruleset . RulesetInfo , scoreInfo . Mods ) ;
95+ scoreInfo . BeatmapInfo = playableBeatmap . BeatmapInfo ;
96+ LegacyScoreDecoder . PopulateMaximumStatistics ( scoreInfo , workingBeatmap ) ;
97+ if ( scoreInfo . IsLegacyScore )
98+ {
99+ StandardisedScoreMigrationTools . UpdateFromLegacy (
100+ scoreInfo ,
101+ ruleset ,
102+ LegacyBeatmapConversionDifficultyInfo . FromBeatmap ( playableBeatmap ) ,
103+ ( ( ILegacyRuleset ) ruleset ) . CreateLegacyScoreSimulator ( ) . Simulate ( workingBeatmap , playableBeatmap ) ) ;
104+ }
105+
90106 DifficultyAttributes ? difficultyAttributes =
91107 ruleset . CreateDifficultyCalculator ( workingBeatmap ) . Calculate ( scoreInfo . Mods ) ;
92108 PerformanceCalculator ? performanceCalculator = ruleset . CreatePerformanceCalculator ( ) ;
0 commit comments