Skip to content

Commit

Permalink
feat: Added CSR Rework
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Oct 23, 2024
1 parent 90881ef commit 9c43f4e
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 29 deletions.
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.5",
"@kotrikd/rosu-pp": "2.0.0-alpha.6",
"semver": "^7.5.4",
"ws": "^8.16.0"
},
Expand Down
34 changes: 20 additions & 14 deletions packages/server/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,21 +413,27 @@ export default function buildBaseApi(server: Server) {

const params: rosu.PerformanceArgs = {};

if (query.clockRate) params.clockRate = +query.clockRate;
if (query.passedObjects)
if (query.ar !== undefined) params.ar = +query.ar;
if (query.cs !== undefined) params.cs = +query.cs;
if (query.hp !== undefined) params.hp = +query.hp;
if (query.od !== undefined) params.od = +query.od;

if (query.clockRate !== undefined)
params.clockRate = +query.clockRate;
if (query.passedObjects !== undefined)
params.passedObjects = +query.passedObjects;
if (query.combo) params.combo = +query.combo;
if (query.nMisses) params.misses = +query.nMisses;
if (query.n100) params.n100 = +query.n100;
if (query.n300) params.n300 = +query.n300;
if (query.n50) params.n50 = +query.n50;
if (query.nGeki) params.nGeki = +query.nGeki;
if (query.nKatu) params.nKatu = +query.nKatu;
if (query.mods) params.mods = +query.mods;
if (query.acc) params.accuracy = +query.acc;
if (query.sliderEndHits)
if (query.combo !== undefined) params.combo = +query.combo;
if (query.nMisses !== undefined) params.misses = +query.nMisses;
if (query.n100 !== undefined) params.n100 = +query.n100;
if (query.n300 !== undefined) params.n300 = +query.n300;
if (query.n50 !== undefined) params.n50 = +query.n50;
if (query.nGeki !== undefined) params.nGeki = +query.nGeki;
if (query.nKatu !== undefined) params.nKatu = +query.nKatu;
if (query.mods !== undefined) params.mods = +query.mods;
if (query.acc !== undefined) params.accuracy = +query.acc;
if (query.sliderEndHits !== undefined)
params.sliderEndHits = +query.sliderEndHits;
if (query.sliderTickHits)
if (query.sliderTickHits !== undefined)
params.sliderTickHits = +query.sliderTickHits;

if (
Expand All @@ -452,7 +458,7 @@ export default function buildBaseApi(server: Server) {
}
});

server.app.route('/api/ingame', 'GET', (req, res) => {
server.app.route(/\/api\/ingame/, 'GET', (req, res) => {
try {
fs.readFile(
path.join(pkgAssetsPath, 'ingame.html'),
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.5",
"@kotrikd/rosu-pp": "2.0.0-alpha.6",
"semver": "^7.5.4",
"tsprocess": "workspace:*"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/tosu/src/api/types/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ export interface Hits {
geki: number;
katu: number;
sliderBreaks: number;
sliderEndHits: number;
sliderTickHits: number;
}

export interface Combo {
Expand Down Expand Up @@ -490,6 +492,8 @@ export interface Hits3 {
'300': number;
geki: number;
katu: number;
sliderEndHits: number;
sliderTickHits: number;
}

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

return {
Expand Down Expand Up @@ -509,7 +511,9 @@ function buildPlay(
katu: gameplay.hitKatu,
50: gameplay.hit50,
0: gameplay.hitMiss,
sliderBreaks: gameplay.hitSB
sliderBreaks: gameplay.hitSB,
sliderEndHits: gameplay.sliderEndHits,
sliderTickHits: gameplay.sliderTickHits
},

hitErrorArray: gameplay.hitErrors,
Expand Down
4 changes: 2 additions & 2 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
hit100: statistics.ok,
hit50: statistics.meh,
hitMiss: statistics.miss,
sliderEndHits: statistics.largeTickHit,
sliderTickHits: statistics.smallTickHit,
sliderEndHits: statistics.sliderTailHit,
sliderTickHits: statistics.largeTickHit,
combo: this.process.readInt(scoreInfo + 0xcc),
maxCombo: this.process.readInt(scoreInfo + 0xc4),
pp
Expand Down
8 changes: 6 additions & 2 deletions packages/tosu/src/utils/osuMods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export const calculateMods = (
return {
number: mods,
name,
array: [],
array:
name
.match(/.{1,2}/g)
?.map((r) => ({ acronym: r.toUpperCase() })) || [],
rate: speedChange
};
}
Expand Down Expand Up @@ -238,7 +241,8 @@ export const calculateMods = (

const ModsLazer = Array.isArray(mods)
? mods
: ModsArray.map((r) => ({ acronym: r }));
: ModsArray.map((r) => ({ acronym: r.toUpperCase() }));

const settingsSpeedChange = (ModsLazer as any).find(
(r) =>
r.acronym === 'DT' && typeof r.settings?.speed_change === 'number'
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 9c43f4e

Please sign in to comment.