diff options
-rw-r--r-- | src/cleaners/skyblock/stats.ts | 13 | ||||
-rw-r--r-- | src/database.ts | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/cleaners/skyblock/stats.ts b/src/cleaners/skyblock/stats.ts index 8105f26..a89bdd2 100644 --- a/src/cleaners/skyblock/stats.ts +++ b/src/cleaners/skyblock/stats.ts @@ -85,6 +85,9 @@ export interface StatItem { } export function getStatUnit(name: string): string | null { + if (name === 'fastest_target_practice') + return 'time' + for (const [unitName, statMatchers] of Object.entries(statUnits)) { for (const statMatch of statMatchers) { let trailingEnd = statMatch[0] === '_' @@ -118,5 +121,15 @@ export function cleanProfileStats(data: typedHypixelApi.SkyBlockProfileMember): }) } + if (data.fastest_target_practice !== undefined) + stats.push({ + categorizedName: 'fastest_target_practice', + // the api gives it in seconds, we want milliseconds + value: data.fastest_target_practice * 1000, + rawName: 'fastest_target_practice', + category: 'misc', + unit: 'time' + }) + return stats } diff --git a/src/database.ts b/src/database.ts index 5ede904..0e0a4af 100644 --- a/src/database.ts +++ b/src/database.ts @@ -87,7 +87,7 @@ const leaderboardMax = 100 const reversedLeaderboards = [ 'first_join', 'last_save', '_best_time', '_best_time_2', - 'fastest_coop_join' + 'fastest_coop_join', 'fastest_target_practice' ] let client: MongoClient @@ -324,6 +324,10 @@ function getMemberLeaderboardAttributes(member: CleanMember): StringNumber { data.slowest_coop_join = member.coopInvitation.acceptedTimestamp - member.coopInvitation.invitedTimestamp } + const fastestTargetPractice = member.stats.find(s => s.rawName === 'fastest_target_practice')?.value + if (fastestTargetPractice !== undefined) + data.fastest_target_practice = fastestTargetPractice + return data } @@ -433,6 +437,7 @@ export async function fetchAllMemberLeaderboardAttributes(): Promise<string[]> { 'top_1_leaderboards_count', 'fastest_coop_join', 'slowest_coop_join', + 'fastest_target_practice' ] } |