Skip to content

Commit

Permalink
fix: Update rosu-pp to version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Dec 6, 2024
1 parent 6473bd4 commit b03e853
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 38 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ api
- `n100` - Amount of 100
- `n50` - Amount of 50
- `sliderEndHits` - Amount of slider ends hits (lazer only)
- `sliderTickHits` - Amount of slider ticks hits (lazer only)
- `smallTickHits` - Amount of slider small ticks hits (lazer only)
- `largeTickHits` - Amount of slider large ticks hits (lazer only)
- `nMisses` - Amount of Misses
- `combo` - combo
- `passedObjects` - Sum of nGeki, nKatu, n300, n100, n50, nMisses
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@tosu/common": "workspace:*",
"@tosu/updater": "workspace:*",
"@kotrikd/rosu-pp": "2.0.0-alpha.10",
"@kotrikd/rosu-pp": "2.0.0",
"semver": "^7.5.4",
"ws": "^8.16.0"
},
Expand Down
12 changes: 4 additions & 8 deletions packages/server/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,10 @@ export default function buildBaseApi(server: Server) {
if (query.acc !== undefined) params.accuracy = +query.acc;
if (query.sliderEndHits !== undefined)
params.sliderEndHits = +query.sliderEndHits;
if (query.sliderTickHits !== undefined)
params.sliderTickHits = +query.sliderTickHits;

if (
params.sliderEndHits === undefined &&
params.sliderTickHits === undefined
)
params.lazer = false;
if (query.smallTickHits !== undefined)
params.smallTickHits = +query.smallTickHits;
if (query.largeTickHits !== undefined)
params.largeTickHits = +query.largeTickHits;

const calculate = new rosu.Performance(params).calculate(beatmap);
sendJson(res, calculate);
Expand Down
2 changes: 1 addition & 1 deletion packages/tosu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"osu-standard-stable": "^5.0.0",
"osu-taiko-stable": "^5.0.0",
"resedit": "^2.0.0",
"@kotrikd/rosu-pp": "2.0.0-alpha.10",
"@kotrikd/rosu-pp": "2.0.0",
"semver": "^7.5.4",
"tsprocess": "workspace:*"
},
Expand Down
6 changes: 4 additions & 2 deletions packages/tosu/src/api/types/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ export interface Hits {
katu: number;
sliderBreaks: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
}

export interface Combo {
Expand Down Expand Up @@ -364,7 +365,8 @@ export interface Hits3 {
geki: number;
katu: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
}

export interface Folders {
Expand Down
6 changes: 4 additions & 2 deletions packages/tosu/src/api/utils/buildResultV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export const buildResult = (instanceManager: InstanceManager): ApiAnswer => {
50: resultScreen.hit50,
0: resultScreen.hitMiss,
sliderEndHits: resultScreen.sliderEndHits,
sliderTickHits: resultScreen.sliderTickHits
smallTickHits: resultScreen.smallTickHits,
largeTickHits: resultScreen.largeTickHits
};

return {
Expand Down Expand Up @@ -570,7 +571,8 @@ function buildPlay(
0: gameplay.hitMiss,
sliderBreaks: gameplay.hitSB,
sliderEndHits: gameplay.sliderEndHits,
sliderTickHits: gameplay.sliderTickHits
smallTickHits: gameplay.smallTickHits,
largeTickHits: gameplay.largeTickHits
},

hitErrorArray: gameplay.hitErrors,
Expand Down
8 changes: 5 additions & 3 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,9 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
hit100: statistics.ok,
hit50: statistics.meh,
hitMiss: statistics.miss,
sliderEndHits: statistics.sliderTailHit || statistics.smallTickHit,
sliderTickHits: statistics.largeTickHit,
sliderEndHits: statistics.sliderTailHit,
smallTickHits: statistics.largeTickHit,
largeTickHits: statistics.smallTickHit,
combo,
maxCombo: this.process.readInt(scoreInfo + 0xc4),
pp
Expand Down Expand Up @@ -925,7 +926,8 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
hitKatu: score.hitKatu,
hitMiss: score.hitMiss,
sliderEndHits: score.sliderEndHits,
sliderTickHits: score.sliderTickHits,
smallTickHits: score.smallTickHits,
largeTickHits: score.largeTickHits,
date
};
}
Expand Down
6 changes: 4 additions & 2 deletions packages/tosu/src/memory/stable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
hitKatu,
hitMiss,
sliderEndHits: 0,
sliderTickHits: 0,
smallTickHits: 0,
largeTickHits: 0,
date
};
} catch (error) {
Expand Down Expand Up @@ -549,7 +550,8 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
hitKatu,
hitMiss,
sliderEndHits: 0,
sliderTickHits: 0,
smallTickHits: 0,
largeTickHits: 0,
combo,
maxCombo
};
Expand Down
6 changes: 4 additions & 2 deletions packages/tosu/src/memory/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export type IResultScreen =
hitKatu: number;
hitMiss: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
date: string;
}
| string
Expand All @@ -85,7 +86,8 @@ export type IScore = {
hitKatu: number;
hitMiss: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
combo: number;
maxCombo: number;
pp?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/tosu/src/states/beatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export class BeatmapPP extends AbstractState {
rhythm: fcPerformance.difficulty.rhythm,
color: fcPerformance.difficulty.color,
peak: fcPerformance.difficulty.peak,
hitWindow: fcPerformance.difficulty.hitWindow
hitWindow: fcPerformance.difficulty.greatHitWindow
};

attributes.free();
Expand Down
12 changes: 8 additions & 4 deletions packages/tosu/src/states/gameplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export class Gameplay extends AbstractState {
hitKatu: number;
hitMiss: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
hitMissPrev: number;
hitUR: number;
hitSB: number;
Expand Down Expand Up @@ -87,7 +88,8 @@ export class Gameplay extends AbstractState {
this.hitKatu = 0;
this.hitMiss = 0;
this.sliderEndHits = 0;
this.sliderTickHits = 0;
this.smallTickHits = 0;
this.largeTickHits = 0;
this.hitMissPrev = 0;
this.hitUR = 0.0;
this.hitSB = 0;
Expand Down Expand Up @@ -203,7 +205,8 @@ export class Gameplay extends AbstractState {
this.hitKatu = result.hitKatu;
this.hitMiss = result.hitMiss;
this.sliderEndHits = result.sliderEndHits;
this.sliderTickHits = result.sliderTickHits;
this.smallTickHits = result.smallTickHits;
this.largeTickHits = result.largeTickHits;

this.combo = result.combo;
this.maxCombo = result.maxCombo;
Expand Down Expand Up @@ -487,7 +490,8 @@ export class Gameplay extends AbstractState {
nKatu: this.hitKatu,
nGeki: this.hitGeki,
sliderEndHits: this.sliderEndHits,
sliderTickHits: this.sliderTickHits
osuSmallTickHits: this.smallTickHits,
osuLargeTickHits: this.largeTickHits
};

const currPerformance = this.gradualPerformance.nth(
Expand Down
12 changes: 8 additions & 4 deletions packages/tosu/src/states/resultScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class ResultScreen extends AbstractState {
hitKatu: number;
hitMiss: number;
sliderEndHits: number;
sliderTickHits: number;
smallTickHits: number;
largeTickHits: number;
grade: string;
date: string;
accuracy: number;
Expand Down Expand Up @@ -52,7 +53,8 @@ export class ResultScreen extends AbstractState {
this.hitKatu = 0;
this.hitMiss = 0;
this.sliderEndHits = 0;
this.sliderTickHits = 0;
this.smallTickHits = 0;
this.largeTickHits = 0;
this.grade = '';
this.date = '';
this.accuracy = 0;
Expand Down Expand Up @@ -84,7 +86,8 @@ export class ResultScreen extends AbstractState {
this.hitKatu = result.hitKatu;
this.hitMiss = result.hitMiss;
this.sliderEndHits = result.sliderEndHits;
this.sliderTickHits = result.sliderTickHits;
this.smallTickHits = result.smallTickHits;
this.largeTickHits = result.largeTickHits;
this.date = result.date;

const hits = {
Expand Down Expand Up @@ -146,7 +149,8 @@ export class ResultScreen extends AbstractState {
nKatu: this.hitKatu,
nGeki: this.hitGeki,
sliderEndHits: this.sliderEndHits,
sliderTickHits: this.sliderTickHits,
smallTickHits: this.smallTickHits,
largeTickHits: this.largeTickHits,
lazer: this.game.client === ClientType.lazer
};

Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b03e853

Please sign in to comment.