Skip to content

Commit

Permalink
Skip saving user settings when in dan mode
Browse files Browse the repository at this point in the history
  • Loading branch information
asesidaa committed Sep 17, 2022
1 parent 78989cb commit d474416
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions TaikoLocalServer/Controllers/Game/PlayResultController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ private async Task UpdateUserData(PlayResultRequest request, PlayResultDataReque

userdata.ThrowIfNull($"User data is null! Baid: {request.BaidConf}");

var playMode = (PlayMode)playResultData.PlayMode;

userdata.Title = playResultData.Title;
userdata.TitlePlateId = playResultData.TitleplateId;
var costumeData = new List<uint>
Expand All @@ -194,12 +196,16 @@ private async Task UpdateUserData(PlayResultRequest request, PlayResultDataReque
};
userdata.CostumeData = JsonSerializer.Serialize(costumeData);

var lastStage = playResultData.AryStageInfoes.Last();
var option = BinaryPrimitives.ReadInt16LittleEndian(lastStage.OptionFlg);
userdata.OptionSetting = option;
userdata.IsSkipOn = lastStage.IsSkipOn;
userdata.IsVoiceOn = lastStage.IsVoiceOn;
userdata.NotesPosition = lastStage.NotesPosition;
// Skip user setting saving when in dan mode as dan mode uses its own default setting
if (playMode != PlayMode.DanMode)
{
var lastStage = playResultData.AryStageInfoes.Last();
var option = BinaryPrimitives.ReadInt16LittleEndian(lastStage.OptionFlg);
userdata.OptionSetting = option;
userdata.IsSkipOn = lastStage.IsSkipOn;
userdata.IsVoiceOn = lastStage.IsVoiceOn;
userdata.NotesPosition = lastStage.NotesPosition;
}

userdata.LastPlayDatetime = lastPlayDatetime;
userdata.LastPlayMode = playResultData.PlayMode;
Expand Down

0 comments on commit d474416

Please sign in to comment.