Skip to content

Commit e9948d8

Browse files
committed
Fix lower pp than client
1 parent 1b1178f commit e9948d8

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

PerformanceServer/PerformanceController.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
using Microsoft.AspNetCore.Mvc;
55
using Newtonsoft.Json;
66
using osu.Game.Beatmaps;
7+
using osu.Game.Database;
78
using osu.Game.Online.API;
89
using osu.Game.Rulesets;
910
using osu.Game.Rulesets.Difficulty;
1011
using osu.Game.Rulesets.Mods;
1112
using osu.Game.Rulesets.Scoring;
13+
using osu.Game.Rulesets.Scoring.Legacy;
1214
using osu.Game.Scoring;
15+
using osu.Game.Scoring.Legacy;
1316
using PerformanceServer.Rulesets;
1417

1518
namespace 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

Comments
 (0)