mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Add all s rank trophy
This commit is contained in:
parent
d89b242989
commit
3ceb08fce5
2 changed files with 25 additions and 1 deletions
10
src/card.ts
10
src/card.ts
|
|
@ -10,6 +10,7 @@ import {
|
||||||
LongTimeAccountTrophy,
|
LongTimeAccountTrophy,
|
||||||
AncientAccountTrophy,
|
AncientAccountTrophy,
|
||||||
Joined2020Trophy,
|
Joined2020Trophy,
|
||||||
|
AllSuperRankTrophy,
|
||||||
} from "./trophies.ts";
|
} from "./trophies.ts";
|
||||||
import { UserInfo } from "./github_api_client.ts";
|
import { UserInfo } from "./github_api_client.ts";
|
||||||
import { RANK_ORDER, RANK } from "./utils.ts";
|
import { RANK_ORDER, RANK } from "./utils.ts";
|
||||||
|
|
@ -33,6 +34,7 @@ export class Card {
|
||||||
userInfo: UserInfo,
|
userInfo: UserInfo,
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
): string {
|
): string {
|
||||||
|
// Base trophies
|
||||||
let trophyList = new Array<Trophy>(
|
let trophyList = new Array<Trophy>(
|
||||||
new TotalStarTrophy(userInfo.totalStargazers),
|
new TotalStarTrophy(userInfo.totalStargazers),
|
||||||
new TotalCommitTrophy(userInfo.totalCommits),
|
new TotalCommitTrophy(userInfo.totalCommits),
|
||||||
|
|
@ -40,10 +42,16 @@ export class Card {
|
||||||
new TotalIssueTrophy(userInfo.totalIssues),
|
new TotalIssueTrophy(userInfo.totalIssues),
|
||||||
new TotalPullRequestTrophy(userInfo.totalPullRequests),
|
new TotalPullRequestTrophy(userInfo.totalPullRequests),
|
||||||
new TotalRepositoryTrophy(userInfo.totalRepositories),
|
new TotalRepositoryTrophy(userInfo.totalRepositories),
|
||||||
|
);
|
||||||
|
const isAllSRank =
|
||||||
|
trophyList.every((trophy) => trophy.rank.slice(0, 1) == RANK.S) ? 1 : 0;
|
||||||
|
// Secret trophies
|
||||||
|
trophyList.push(
|
||||||
new MultipleLangTrophy(userInfo.languageCount),
|
new MultipleLangTrophy(userInfo.languageCount),
|
||||||
new LongTimeAccountTrophy(userInfo.durationYear),
|
new LongTimeAccountTrophy(userInfo.durationYear),
|
||||||
new AncientAccountTrophy(userInfo.acientAccount),
|
new AncientAccountTrophy(userInfo.acientAccount),
|
||||||
new Joined2020Trophy(userInfo.joined2020),
|
new Joined2020Trophy(userInfo.joined2020),
|
||||||
|
new AllSuperRankTrophy(isAllSRank),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter by hidden
|
// Filter by hidden
|
||||||
|
|
@ -54,7 +62,7 @@ export class Card {
|
||||||
// Filter by titles
|
// Filter by titles
|
||||||
if (this.titles.length != 0) {
|
if (this.titles.length != 0) {
|
||||||
trophyList = trophyList.filter((trophy) => {
|
trophyList = trophyList.filter((trophy) => {
|
||||||
return trophy.filterTitles.some((title) => this.titles.includes(title))
|
return trophy.filterTitles.some((title) => this.titles.includes(title));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,22 @@ export class MultipleLangTrophy extends Trophy{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class AllSuperRankTrophy extends Trophy{
|
||||||
|
constructor(score: number){
|
||||||
|
const rankConditions = [
|
||||||
|
new RankCondition(
|
||||||
|
RANK.SECRET,
|
||||||
|
"S Rank Hacker",
|
||||||
|
1,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
super(score, rankConditions);
|
||||||
|
this.title = "AllSuperRank";
|
||||||
|
this.filterTitles = ["AllSuperRank"];
|
||||||
|
this.bottomMessage = "All S Rank"
|
||||||
|
this.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
export class Joined2020Trophy extends Trophy{
|
export class Joined2020Trophy extends Trophy{
|
||||||
constructor(score: number){
|
constructor(score: number){
|
||||||
const rankConditions = [
|
const rankConditions = [
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue