mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add SECRET RANK
This commit is contained in:
parent
819c5ba2b8
commit
b1babb507c
2 changed files with 22 additions and 2 deletions
|
|
@ -9,12 +9,14 @@ class RankCondition {
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class Trophy {
|
export class Trophy {
|
||||||
rankCondition: RankCondition | null = null;
|
rankCondition: RankCondition | null = null;
|
||||||
rank: RANK = RANK.UNKNOWN;
|
rank: RANK = RANK.UNKNOWN;
|
||||||
topMessage = "Unknown";
|
topMessage = "Unknown";
|
||||||
bottomMessage = "0";
|
bottomMessage = "0";
|
||||||
title = "";
|
title = "";
|
||||||
|
hidden = false;
|
||||||
constructor(
|
constructor(
|
||||||
private score: number,
|
private score: number,
|
||||||
private rankConditions: Array<RankCondition>,
|
private rankConditions: Array<RankCondition>,
|
||||||
|
|
@ -38,7 +40,8 @@ export class Trophy {
|
||||||
}
|
}
|
||||||
private calculateNextRankPercentage() {
|
private calculateNextRankPercentage() {
|
||||||
const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1;
|
const nextRankIndex = RANK_ORDER.indexOf(this.rank) - 1;
|
||||||
if (nextRankIndex < 0) {
|
// When got the max rank
|
||||||
|
if (nextRankIndex < 0 || this.rank === RANK.SSS) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
const nextRank = RANK_ORDER[nextRankIndex];
|
const nextRank = RANK_ORDER[nextRankIndex];
|
||||||
|
|
@ -87,6 +90,22 @@ export class Trophy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MultipleLangTrophy extends Trophy{
|
||||||
|
constructor(score: number){
|
||||||
|
const rankConditions = [
|
||||||
|
new RankCondition(
|
||||||
|
RANK.SECRET,
|
||||||
|
"Rainbow Lang User",
|
||||||
|
7,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
super(score, rankConditions);
|
||||||
|
this.title = "MultipleLang";
|
||||||
|
this.hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export class TotalStarTrophy extends Trophy {
|
export class TotalStarTrophy extends Trophy {
|
||||||
constructor(score: number) {
|
constructor(score: number) {
|
||||||
const rankConditions = [
|
const rankConditions = [
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export const CONSTANTS = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export enum RANK {
|
export enum RANK {
|
||||||
|
SECRET = "SECRET",
|
||||||
SSS = "SSS",
|
SSS = "SSS",
|
||||||
SS = "SS",
|
SS = "SS",
|
||||||
S = "S",
|
S = "S",
|
||||||
|
|
@ -40,4 +41,4 @@ export enum RANK {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RANK_ORDER= Object.values(RANK);
|
export const RANK_ORDER= Object.values(RANK);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue