Skip to content

Commit

Permalink
fix: exclude unwanted data from reseting on retry
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Jun 6, 2023
1 parent 80f2f8a commit d4239de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/Instances/Osu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export class OsuInstance {
case 2:
// Reset gameplay data on retry
if (prevTime > allTimesData.PlayTime) {
gamePlayData.init();
gamePlayData.init(true);
}

prevTime = allTimesData.PlayTime;
Expand Down Expand Up @@ -290,7 +290,6 @@ export class OsuInstance {
settings.gameFolder &&
previousState !== currentTimeMD5
) {
console.log(currentTimeMD5);
previousState = currentTimeMD5;

await beatmapPpData.updateMapMetadata(currentMods);
Expand Down
20 changes: 13 additions & 7 deletions src/Services/Entities/GamePlayData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ export class GamePlayData extends AbstractEntity {
this.init();
}

init() {
this.isDefaultState = true;
this.Retries = 0;
this.PlayerName = '';
this.Mods = 0;
init(isRetry?: boolean) {
this.HitErrors = [];
this.Mode = 0;
this.MaxCombo = 0;
this.Score = 0;
this.Hit100 = 0;
Expand All @@ -87,9 +82,20 @@ export class GamePlayData extends AbstractEntity {
this.UnstableRate = 0;
this.GradeCurrent = '';
this.GradeExpected = '';
this.Leaderboard = undefined;
this.KeyOverlay = {} as KeyOverlay;
this.isReplayUiHidden = false;

// below is gata that shouldn't be reseted on retry
if (isRetry == true) {
return;
};

this.isDefaultState = true;
this.Retries = 0;
this.PlayerName = '';
this.Mode = 0;
this.Mods = 0;
this.Leaderboard = undefined;
}

async updateState() {
Expand Down

0 comments on commit d4239de

Please sign in to comment.