aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-20 22:54:05 -0500
committermat <github@matdoes.dev>2022-05-20 22:54:05 -0500
commiteb13e07305169c0f19ee87e2516005eb5c0ef3c9 (patch)
tree79ce5d5b0af95d65881ef4bf231de34e5ac456c1
parent3d1506341d77e9271df9ec1091b4871d61544a67 (diff)
downloadskyblock-api-eb13e07305169c0f19ee87e2516005eb5c0ef3c9.tar.gz
skyblock-api-eb13e07305169c0f19ee87e2516005eb5c0ef3c9.tar.bz2
skyblock-api-eb13e07305169c0f19ee87e2516005eb5c0ef3c9.zip
fastest_target_practice stat & leaderboard
-rw-r--r--src/cleaners/skyblock/stats.ts13
-rw-r--r--src/database.ts7
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'
]
}