Skip to content

Commit

Permalink
Remove bot-scope droid pp from profile card
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Nov 4, 2024
1 parent cb011c7 commit d26acdc
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 81 deletions.
74 changes: 37 additions & 37 deletions package-lock.json

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

1 change: 1 addition & 0 deletions src/database/official/schema/OfficialDatabaseUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const run: ButtonCommand["run"] = async (_, interaction) => {
"playcount",
"accuracy",
"region",
"pp",
]);

if (!player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const run: SlashSubcommand<true>["run"] = async (_, interaction) => {
| "accuracy"
| "region"
| "email"
| "pp"
>
| Player
| null = null;
Expand All @@ -64,6 +65,7 @@ export const run: SlashSubcommand<true>["run"] = async (_, interaction) => {
"accuracy",
"region",
"email",
"pp",
]);

uid ??=
Expand Down Expand Up @@ -95,6 +97,7 @@ export const run: SlashSubcommand<true>["run"] = async (_, interaction) => {
"accuracy",
"region",
"email",
"pp",
]);

uid ??=
Expand Down Expand Up @@ -148,6 +151,7 @@ export const run: SlashSubcommand<true>["run"] = async (_, interaction) => {
"accuracy",
"region",
"email",
"pp",
]);

if (!player) {
Expand Down
1 change: 1 addition & 0 deletions src/interactions/contextmenus/user/viewDroidProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const run: UserContextMenuCommand["run"] = async (_, interaction) => {
"playcount",
"accuracy",
"region",
"pp",
]);

if (!player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ProfileCardCreatorENTranslation extends Translation<ProfileCardCrea
totalScore: "Total Score",
accuracy: "Accuracy",
playCount: "Play Count",
droidPP: "Droid pp",
performancePoints: "Performance Points",
clan: "Clan",
challengePoints: "Challenge Points",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ProfileCardCreatorESTranslation extends Translation<ProfileCardCrea
totalScore: "Puntaje Total",
accuracy: "Precisión",
playCount: "Jugadas",
droidPP: "Droid pp",
performancePoints: "",
clan: "Clan",
challengePoints: "Puntos de desafio",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ProfileCardCreatorIDTranslation extends Translation<ProfileCardCrea
totalScore: "",
accuracy: "",
playCount: "",
droidPP: "",
performancePoints: "",
clan: "",
challengePoints: "",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ProfileCardCreatorKRTranslation extends Translation<ProfileCardCrea
totalScore: "총 점수",
accuracy: "정확도",
playCount: "플레이 횟수",
droidPP: "Droid pp",
performancePoints: "",
clan: "클랜",
challengePoints: "챌린지 포인트",
};
Expand Down
71 changes: 33 additions & 38 deletions src/utils/creators/ProfileCardCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ export class ProfileCardCreator {
private readonly player:
| Pick<
OfficialDatabaseUser,
"id" | "username" | "score" | "accuracy" | "playcount" | "region"
| "id"
| "username"
| "score"
| "accuracy"
| "playcount"
| "region"
| "pp"
>
| Player;

Expand Down Expand Up @@ -82,6 +88,7 @@ export class ProfileCardCreator {
| "accuracy"
| "playcount"
| "region"
| "pp"
>
| Player,
detailed: boolean,
Expand Down Expand Up @@ -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(
Expand All @@ -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();
Expand Down
Loading

0 comments on commit d26acdc

Please sign in to comment.