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

feat: read user leaderboard id #256

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/tosu/src/api/types/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export interface Leaderboard {
isFailed: boolean;
position: number;
team: number;
userId: number;
name: string;
score: number;
accuracy: number;
Expand Down
1 change: 1 addition & 0 deletions packages/tosu/src/api/utils/buildResultV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const convertMemoryPlayerToResult = (
position: memoryPlayer.position,
team: memoryPlayer.team,

userId: memoryPlayer.userId,
name: memoryPlayer.name,

score: memoryPlayer.score,
Expand Down
2 changes: 2 additions & 0 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,12 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {

const realmUser = this.process.readIntPtr(scoreInfo + 0x48);
const username = this.process.readSharpStringPtr(realmUser + 0x18);
const userId = this.process.readInt(realmUser + 0x28);

const statistics = this.readStatistics(scoreInfo);

return {
userId,
name: username,
mods,
score: this.process.readLong(scoreInfo + 0x98),
Expand Down
9 changes: 9 additions & 0 deletions packages/tosu/src/memory/stable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,16 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

const scoreAddr = this.process.readIntPtr(base + 0x20);
let userId = 0;
if (scoreAddr !== 0) {
userId = this.process.readInt(
this.process.readIntPtr(scoreAddr + 0x48) + 0x70
);
}

return {
userId,
name: this.process.readSharpString(
this.process.readInt(base + 0x8)
),
Expand Down
1 change: 1 addition & 0 deletions packages/tosu/src/states/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface KeyOverlay {
}

export interface LeaderboardPlayer {
userId: number;
name: string;
score: number;
combo: number;
Expand Down
Loading