diff --git a/package-lock.json b/package-lock.json index f000a01ba..a4fdef721 100644 --- a/package-lock.json +++ b/package-lock.json @@ -480,9 +480,9 @@ } }, "node_modules/@rian8337/osu-difficulty-calculator": { - "version": "4.0.0-beta.31", - "resolved": "https://registry.npmjs.org/@rian8337/osu-difficulty-calculator/-/osu-difficulty-calculator-4.0.0-beta.31.tgz", - "integrity": "sha512-nm+pGfJKixisg4Fzh8CqtOih1tZgIN1dNtllrIOeaXTCnmhkzfqoAUhZIZ/i5MkH0uRfmaFUo+acViy4Ybsv9A==", + "version": "4.0.0-beta.32", + "resolved": "https://registry.npmjs.org/@rian8337/osu-difficulty-calculator/-/osu-difficulty-calculator-4.0.0-beta.32.tgz", + "integrity": "sha512-kKsbZHKbslizi4GrQ0iopBRoRfyRDlzCQ31kRg1VVKuleEMmvdJTo5TsSMJWlI0S1zDsp0AZtssI+ZG4lV2kig==", "license": "MIT", "dependencies": { "@rian8337/osu-base": "^4.0.0-beta.31" @@ -492,14 +492,14 @@ } }, "node_modules/@rian8337/osu-droid-replay-analyzer": { - "version": "4.0.0-beta.31", - "resolved": "https://registry.npmjs.org/@rian8337/osu-droid-replay-analyzer/-/osu-droid-replay-analyzer-4.0.0-beta.31.tgz", - "integrity": "sha512-AU56JzBQ9rIygbDHAuQFP5sWW05JED3jOFZNMEsrDIKZI7L1agVbtdSFpcqNUIKn8MtGn5zQgDhewx3wtPfNqQ==", + "version": "4.0.0-beta.32", + "resolved": "https://registry.npmjs.org/@rian8337/osu-droid-replay-analyzer/-/osu-droid-replay-analyzer-4.0.0-beta.32.tgz", + "integrity": "sha512-M47Juz9gMt+6uFc6nZdwvEibxw99N6xI5KhCbVmwxqhdwkM6/Bd+2zorZE8LiJfCszBJah9II3SbDMWfOdHKKA==", "license": "MIT", "dependencies": { "@rian8337/osu-base": "^4.0.0-beta.31", - "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.31", - "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.31", + "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.32", + "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.32", "java-deserialization": "^0.1.0", "unzipper": "^0.10.11" }, @@ -508,9 +508,9 @@ } }, "node_modules/@rian8337/osu-droid-utilities": { - "version": "4.0.0-beta.31", - "resolved": "https://registry.npmjs.org/@rian8337/osu-droid-utilities/-/osu-droid-utilities-4.0.0-beta.31.tgz", - "integrity": "sha512-++lgpT3s1PIjz+I5lSjOuoc6Wo7FTmyzTRjpNWWJYkrQZAo8doSFnMn+/6w+vjZNmx3jDD1iUxrvwYMXtIrhKQ==", + "version": "4.0.0-beta.32", + "resolved": "https://registry.npmjs.org/@rian8337/osu-droid-utilities/-/osu-droid-utilities-4.0.0-beta.32.tgz", + "integrity": "sha512-fGNsLgVyDQWI9f513Ipab6jZ7WlbnEiuXzUUrdjnTOkQk2nxD3XUOfC8DwGALzDbUGYKPwuBWeYyYXd7jV/7Sw==", "license": "MIT", "dependencies": { "@rian8337/osu-base": "^4.0.0-beta.31" @@ -520,9 +520,9 @@ } }, "node_modules/@rian8337/osu-rebalance-difficulty-calculator": { - "version": "4.0.0-beta.31", - "resolved": "https://registry.npmjs.org/@rian8337/osu-rebalance-difficulty-calculator/-/osu-rebalance-difficulty-calculator-4.0.0-beta.31.tgz", - "integrity": "sha512-KhWpfdvK/15ZjRVs9h1NwpT+IC0L7zNPl9haUxrgHMBNX7mfJT9O+YefiCsc+vY/7TJujevaNUp4ItvrL5xQzQ==", + "version": "4.0.0-beta.32", + "resolved": "https://registry.npmjs.org/@rian8337/osu-rebalance-difficulty-calculator/-/osu-rebalance-difficulty-calculator-4.0.0-beta.32.tgz", + "integrity": "sha512-oirhEwVw8LBCF9Zg9LsVjB4XHGwVhBD/hl3DwJGRzLkuFOyaxDSUtXx9i61KTgl1TWLxZRcVg6OC67mbWfEkFw==", "license": "MIT", "dependencies": { "@rian8337/osu-base": "^4.0.0-beta.31" @@ -532,14 +532,14 @@ } }, "node_modules/@rian8337/osu-strain-graph-generator": { - "version": "4.0.0-beta.31", - "resolved": "https://registry.npmjs.org/@rian8337/osu-strain-graph-generator/-/osu-strain-graph-generator-4.0.0-beta.31.tgz", - "integrity": "sha512-vPTjNz67wdLmY/n7LGAI36Fu4pfZYk4y23/2nsZdClQVGOdxGIaBkKaSU3Ny0uRwskyD4q7YGDoZ6x4ax0T4iQ==", + "version": "4.0.0-beta.32", + "resolved": "https://registry.npmjs.org/@rian8337/osu-strain-graph-generator/-/osu-strain-graph-generator-4.0.0-beta.32.tgz", + "integrity": "sha512-aiq2TWX0Mo4ZV20I+JArD9bldp2rz+6vmfZ8TU4vAnegNIgna3NxKyfmFwYOSVUt2LmJhp+558BO8ruSsf4ifQ==", "license": "MIT", "dependencies": { "@rian8337/osu-base": "^4.0.0-beta.31", - "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.31", - "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.31", + "@rian8337/osu-difficulty-calculator": "^4.0.0-beta.32", + "@rian8337/osu-rebalance-difficulty-calculator": "^4.0.0-beta.32", "canvas": "^3.0.0-rc2" }, "engines": { @@ -547,9 +547,9 @@ } }, "node_modules/@sapphire/async-queue": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.3.tgz", - "integrity": "sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==", + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.4.tgz", + "integrity": "sha512-id65RxAx34DCk8KAVTPWwcephJSkStiS9M15F87+zvK2gK47wf7yeRIo8WiuKeXQS6bsyo/uQ/t0QW1cLmSb+A==", "license": "MIT", "engines": { "node": ">=v14.0.0", @@ -888,9 +888,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.17.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.2.tgz", - "integrity": "sha512-OOHK4sjXqkL7yQ7VEEHcf6+0jSvKjWqwnaCtY7AKD/VLEvRHMsxxu7eI8ErnjxHS8VwmekD4PeVCpu4qZEZSxg==", + "version": "20.17.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.6.tgz", + "integrity": "sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" @@ -932,9 +932,9 @@ } }, "node_modules/@types/ws": { - "version": "8.5.12", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", - "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", "license": "MIT", "dependencies": { "@types/node": "*" @@ -5466,9 +5466,9 @@ } }, "node_modules/ts-api-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", - "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.0.tgz", + "integrity": "sha512-032cPxaEKwM+GT3vA5JXNzIaizx388rhsSW79vGRNGXfRRAdEAn2mvk36PvK5HnOchyWZ7afLEXqYCvPCrzuzQ==", "dev": true, "license": "MIT", "engines": { @@ -5485,9 +5485,9 @@ "license": "MIT" }, "node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, "node_modules/ttys": { @@ -5635,9 +5635,9 @@ } }, "node_modules/utf-8-validate": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", - "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.5.tgz", + "integrity": "sha512-EYZR+OpIXp9Y1eG1iueg8KRsY8TuT8VNgnanZ0uA3STqhHQTLwbl+WX76/9X5OY12yQubymBpaBSmMPkSTQcKA==", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/src/database/official/schema/OfficialDatabaseUser.ts b/src/database/official/schema/OfficialDatabaseUser.ts index aaad4b4bc..ddab1f9a8 100644 --- a/src/database/official/schema/OfficialDatabaseUser.ts +++ b/src/database/official/schema/OfficialDatabaseUser.ts @@ -8,6 +8,7 @@ export interface OfficialDatabaseUser { readonly email: string; readonly deviceid: string; readonly score: number; + readonly pp: number; readonly playcount: number; readonly accuracy: number; readonly regist_time: Date; diff --git a/src/interactions/buttons/Onboarding/onboardingPlayerProfileAction.ts b/src/interactions/buttons/Onboarding/onboardingPlayerProfileAction.ts index d62df69d1..14b7c92d3 100644 --- a/src/interactions/buttons/Onboarding/onboardingPlayerProfileAction.ts +++ b/src/interactions/buttons/Onboarding/onboardingPlayerProfileAction.ts @@ -43,6 +43,7 @@ export const run: ButtonCommand["run"] = async (_, interaction) => { "playcount", "accuracy", "region", + "pp", ]); if (!player) { diff --git a/src/interactions/commands/osu! and osu!droid/profile/subcommands/profile-view.ts b/src/interactions/commands/osu! and osu!droid/profile/subcommands/profile-view.ts index e8a61d1df..207405336 100644 --- a/src/interactions/commands/osu! and osu!droid/profile/subcommands/profile-view.ts +++ b/src/interactions/commands/osu! and osu!droid/profile/subcommands/profile-view.ts @@ -50,6 +50,7 @@ export const run: SlashSubcommand["run"] = async (_, interaction) => { | "accuracy" | "region" | "email" + | "pp" > | Player | null = null; @@ -64,6 +65,7 @@ export const run: SlashSubcommand["run"] = async (_, interaction) => { "accuracy", "region", "email", + "pp", ]); uid ??= @@ -95,6 +97,7 @@ export const run: SlashSubcommand["run"] = async (_, interaction) => { "accuracy", "region", "email", + "pp", ]); uid ??= @@ -148,6 +151,7 @@ export const run: SlashSubcommand["run"] = async (_, interaction) => { "accuracy", "region", "email", + "pp", ]); if (!player) { diff --git a/src/interactions/contextmenus/user/viewDroidProfile.ts b/src/interactions/contextmenus/user/viewDroidProfile.ts index e4ba6b6de..e14bae2bc 100644 --- a/src/interactions/contextmenus/user/viewDroidProfile.ts +++ b/src/interactions/contextmenus/user/viewDroidProfile.ts @@ -51,6 +51,7 @@ export const run: UserContextMenuCommand["run"] = async (_, interaction) => { "playcount", "accuracy", "region", + "pp", ]); if (!player) { diff --git a/src/localization/utils/creators/ProfileCardCreator/ProfileCardCreatorLocalization.ts b/src/localization/utils/creators/ProfileCardCreator/ProfileCardCreatorLocalization.ts index 73f7dab82..5a851ec53 100644 --- a/src/localization/utils/creators/ProfileCardCreator/ProfileCardCreatorLocalization.ts +++ b/src/localization/utils/creators/ProfileCardCreator/ProfileCardCreatorLocalization.ts @@ -9,7 +9,7 @@ export interface ProfileCardCreatorStrings { readonly totalScore: string; readonly accuracy: string; readonly playCount: string; - readonly droidPP: string; + readonly performancePoints: string; readonly clan: string; readonly challengePoints: string; } diff --git a/src/localization/utils/creators/ProfileCardCreator/translations/ProfileCardCreatorENTranslation.ts b/src/localization/utils/creators/ProfileCardCreator/translations/ProfileCardCreatorENTranslation.ts index 47546b879..6eb79c6e1 100644 --- a/src/localization/utils/creators/ProfileCardCreator/translations/ProfileCardCreatorENTranslation.ts +++ b/src/localization/utils/creators/ProfileCardCreator/translations/ProfileCardCreatorENTranslation.ts @@ -9,7 +9,7 @@ export class ProfileCardCreatorENTranslation extends Translation | Player; @@ -82,6 +88,7 @@ export class ProfileCardCreator { | "accuracy" | "playcount" | "region" + | "pp" > | Player, detailed: boolean, @@ -396,27 +403,17 @@ export class ProfileCardCreator { x, y + yOffset, ); + increaseYOffset(); - if (this.bindInfo) { - this.context.fillText( - `${this.localization.getTranslation("accuracy")}: ${( - this.player.accuracy * - (this.player instanceof Player ? 1 : 100) - ).toFixed(2)}% | ${this.bindInfo.weightedAccuracy.toFixed(2)}%`, - x, - y + yOffset, - ); - } else { - this.context.fillText( - `${this.localization.getTranslation("accuracy")}: ${( - this.player.accuracy * - (this.player instanceof Player ? 1 : 100) - ).toFixed(2)}%`, - x, - y + yOffset, - ); - } + this.context.fillText( + `${this.localization.getTranslation("accuracy")}: ${( + this.player.accuracy * (this.player instanceof Player ? 1 : 100) + ).toFixed(2)}%`, + x, + y + yOffset, + ); + increaseYOffset(); this.context.fillText( @@ -426,31 +423,29 @@ export class ProfileCardCreator { x, y + yOffset, ); + increaseYOffset(); - if (this.bindInfo) { - const ppRank = await this.getPlayerPPRank(this.bindInfo); + this.context.fillText( + `${this.localization.getTranslation( + "performancePoints", + )}: ${this.player.pp.toFixed(2)}pp`, + x, + y + yOffset, + ); + + increaseYOffset(); + + if (this.bindInfo?.clan) { this.context.fillText( - `${this.localization.getTranslation( - "droidPP", - )}: ${this.bindInfo.pptotal.toFixed( - 2, - )}pp (#${ppRank.toLocaleString(this.BCP47)})`, + `${this.localization.getTranslation("clan")}: ${ + this.bindInfo.clan + }`, x, y + yOffset, ); - increaseYOffset(); - if (this.bindInfo.clan) { - this.context.fillText( - `${this.localization.getTranslation("clan")}: ${ - this.bindInfo.clan - }`, - x, - y + yOffset, - ); - increaseYOffset(); - } + increaseYOffset(); } this.context.restore(); diff --git a/src/utils/managers/ProfileManager.ts b/src/utils/managers/ProfileManager.ts index 05a2cf663..6ce1be4be 100644 --- a/src/utils/managers/ProfileManager.ts +++ b/src/utils/managers/ProfileManager.ts @@ -48,6 +48,7 @@ export abstract class ProfileManager extends Manager { | "accuracy" | "playcount" | "region" + | "pp" > | Player, bindInfo?: UserBind | null, @@ -71,7 +72,15 @@ export abstract class ProfileManager extends Manager { } if (!player) { - const newPlayer = await DroidHelper.getPlayer(uid); + const newPlayer = await DroidHelper.getPlayer(uid, [ + "id", + "username", + "score", + "accuracy", + "playcount", + "region", + "pp", + ]); if (!newPlayer) { return null; @@ -136,6 +145,7 @@ export abstract class ProfileManager extends Manager { | "accuracy" | "playcount" | "region" + | "pp" > | Player, language: Language = "en", @@ -148,6 +158,7 @@ export abstract class ProfileManager extends Manager { "accuracy", "playcount", "region", + "pp", ]); if (!newPlayer) {