Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply adjustments for struct attributes #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions osu.Server.DifficultyCalculator/ServerDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ private void run(WorkingBeatmap beatmap, Action<ProcessableItem, MySqlConnection

private void processDifficulty(ProcessableItem item, MySqlConnection conn)
{
foreach (var attribute in item.Ruleset.CreateDifficultyCalculator(item.WorkingBeatmap).CalculateAllLegacyCombinations())
foreach (var (mods, attributes) in item.Ruleset.CreateDifficultyCalculator(item.WorkingBeatmap).CalculateAllLegacyCombinations())
{
if (dryRun)
continue;

LegacyMods legacyMods = item.Ruleset.ConvertToLegacyMods(attribute.Mods);
LegacyMods legacyMods = item.Ruleset.ConvertToLegacyMods(mods);

conn.Execute(
"INSERT INTO `osu_beatmap_difficulty` (`beatmap_id`, `mode`, `mods`, `diff_unified`) "
Expand All @@ -120,14 +120,14 @@ private void processDifficulty(ProcessableItem item, MySqlConnection conn)
BeatmapId = item.BeatmapID,
Mode = item.RulesetID,
Mods = (int)legacyMods,
Diff = attribute.StarRating
Diff = attributes.StarRating
});

if (item.Ranked && !AppSettings.SKIP_INSERT_ATTRIBUTES)
{
var parameters = new List<object>();

foreach (var mapping in attribute.ToDatabaseAttributes())
foreach (var mapping in attributes.ToDatabaseAttributes())
{
parameters.Add(new
{
Expand Down Expand Up @@ -168,13 +168,13 @@ private void processDifficulty(ProcessableItem item, MySqlConnection conn)
object param = new
{
BeatmapId = item.BeatmapID,
Diff = attribute.StarRating,
Diff = attributes.StarRating,
AR = item.WorkingBeatmap.BeatmapInfo.Difficulty.ApproachRate,
OD = item.WorkingBeatmap.BeatmapInfo.Difficulty.OverallDifficulty,
HP = item.WorkingBeatmap.BeatmapInfo.Difficulty.DrainRate,
CS = item.WorkingBeatmap.BeatmapInfo.Difficulty.CircleSize,
BPM = Math.Round(bpm, 2),
MaxCombo = attribute.MaxCombo,
MaxCombo = attributes.MaxCombo,
CountCircle = countCircle,
CountSlider = countSlider,
CountSpinner = countSpinner,
Expand Down
Loading