aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-05-24 13:46:33 -0500
committermat <github@matdoes.dev>2021-05-24 13:46:33 -0500
commit17866766304a9049dda716a21d94bcd4803980a7 (patch)
tree5937bd82233746719b3c1b8a96afe971d303b804 /src
parentd8cffd55943c3ab36d61201851da7ababf72736f (diff)
downloadskyblock-api-17866766304a9049dda716a21d94bcd4803980a7.tar.gz
skyblock-api-17866766304a9049dda716a21d94bcd4803980a7.tar.bz2
skyblock-api-17866766304a9049dda716a21d94bcd4803980a7.zip
disable leaderboards
Diffstat (limited to 'src')
-rw-r--r--src/database.ts35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/database.ts b/src/database.ts
index 35c04e8..c317be7 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -141,6 +141,7 @@ function getProfileLeaderboardAttributes(profile: CleanFullProfile): StringNumbe
export async function fetchAllLeaderboardsCategorized(): Promise<{ [ category: string ]: string[] }> {
+ return {}
const memberLeaderboardAttributes: string[] = await fetchAllMemberLeaderboardAttributes()
const profileLeaderboardAttributes: string[] = await fetchAllProfileLeaderboardAttributes()
@@ -162,6 +163,7 @@ export async function fetchAllLeaderboardsCategorized(): Promise<{ [ category: s
/** Fetch the raw names for the slayer leaderboards */
export async function fetchSlayerLeaderboards(): Promise<string[]> {
+ return []
const rawSlayerNames = await constants.fetchSlayers()
let leaderboardNames: string[] = [
'slayer_total_xp',
@@ -182,6 +184,7 @@ export async function fetchSlayerLeaderboards(): Promise<string[]> {
/** Fetch the names of all the leaderboards that rank members */
export async function fetchAllMemberLeaderboardAttributes(): Promise<string[]> {
+ return []
return [
// we use the raw stat names rather than the clean stats in case hypixel adds a new stat and it takes a while for us to clean it
...await constants.fetchStats(),
@@ -225,6 +228,7 @@ function isLeaderboardReversed(name: string): boolean {
}
async function fetchMemberLeaderboardRaw(name: string): Promise<DatabaseMemberLeaderboardItem[]> {
+ return []
if (!client) throw Error('Client isn\'t initialized yet')
if (cachedRawLeaderboards.has(name))
@@ -247,6 +251,7 @@ async function fetchMemberLeaderboardRaw(name: string): Promise<DatabaseMemberLe
}
async function fetchProfileLeaderboardRaw(name: string): Promise<DatabaseProfileLeaderboardItem[]> {
+ return []
if (cachedRawLeaderboards.has(name))
return cachedRawLeaderboards.get(name) as DatabaseProfileLeaderboardItem[]
// typescript forces us to make a new variable and set it this way because it gives an error otherwise
@@ -281,6 +286,11 @@ interface ProfileLeaderboard {
/** Fetch a leaderboard that ranks members, as opposed to profiles */
export async function fetchMemberLeaderboard(name: string): Promise<MemberLeaderboard> {
+ return {
+ list: [],
+ name: 'Leaderboards are temporarily disabled, they\'ll be back in a few hours',
+ unit: ''
+ }
const leaderboardRaw = await fetchMemberLeaderboardRaw(name)
const fetchLeaderboardPlayer = async(item: DatabaseMemberLeaderboardItem): Promise<MemberLeaderboardItem> => {
@@ -305,6 +315,11 @@ export async function fetchMemberLeaderboard(name: string): Promise<MemberLeader
/** Fetch a leaderboard that ranks profiles, as opposed to members */
export async function fetchProfileLeaderboard(name: string): Promise<ProfileLeaderboard> {
+ return {
+ list: [],
+ name: 'Leaderboards are temporarily disabled, they\'ll be back in a few hours',
+ unit: ''
+ }
const leaderboardRaw = await fetchProfileLeaderboardRaw(name)
const fetchLeaderboardProfile = async(item: DatabaseProfileLeaderboardItem): Promise<ProfileLeaderboardItem> => {
@@ -331,6 +346,11 @@ export async function fetchProfileLeaderboard(name: string): Promise<ProfileLead
/** Fetch a leaderboard */
export async function fetchLeaderboard(name: string): Promise<MemberLeaderboard|ProfileLeaderboard> {
+ return {
+ list: [],
+ name: 'Leaderboards are temporarily disabled, they\'ll be back in a few hours',
+ unit: ''
+ }
const profileLeaderboards = await fetchAllProfileLeaderboardAttributes()
if (profileLeaderboards.includes(name)) {
return await fetchProfileLeaderboard(name)
@@ -341,6 +361,7 @@ export async function fetchLeaderboard(name: string): Promise<MemberLeaderboard|
/** Get the leaderboard positions a member is on. This may take a while depending on whether stuff is cached */
export async function fetchMemberLeaderboardSpots(player: string, profile: string) {
+ return []
const fullProfile = await cached.fetchProfile(player, profile)
const fullMember = fullProfile.members.find(m => m.username.toLowerCase() === player.toLowerCase() || m.uuid === player)
@@ -382,6 +403,7 @@ async function getLeaderboardRequirement(name: string, leaderboardType: 'member'
/** Get the attributes for the member, but only ones that would put them on the top 100 for leaderboards */
async function getApplicableMemberLeaderboardAttributes(member: CleanMember): Promise<StringNumber> {
+ return {}
const leaderboardAttributes = getMemberLeaderboardAttributes(member)
const applicableAttributes = {}
@@ -412,6 +434,7 @@ async function getApplicableMemberLeaderboardAttributes(member: CleanMember): Pr
/** Get the attributes for the profile, but only ones that would put them on the top 100 for leaderboards */
async function getApplicableProfileLeaderboardAttributes(profile: CleanFullProfile): Promise<StringNumber> {
+ return {}
const leaderboardAttributes = getProfileLeaderboardAttributes(profile)
const applicableAttributes = {}
@@ -442,6 +465,7 @@ async function getApplicableProfileLeaderboardAttributes(profile: CleanFullProfi
/** Update the member's leaderboard data on the server if applicable */
export async function updateDatabaseMember(member: CleanMember, profile: CleanFullProfile): Promise<void> {
+ return
if (!client) return // the db client hasn't been initialized
if (debug) console.debug('updateDatabaseMember', member.username)
// the member's been updated too recently, just return
@@ -503,6 +527,7 @@ export async function updateDatabaseMember(member: CleanMember, profile: CleanFu
* This will not also update the members, you have to call updateDatabaseMember separately for that
*/
export async function updateDatabaseProfile(profile: CleanFullProfile): Promise<void> {
+ return
if (!client) return // the db client hasn't been initialized
if (debug) console.debug('updateDatabaseProfile', profile.name)
@@ -564,12 +589,12 @@ const leaderboardUpdateProfileQueue = new Queue({
/** Queue an update for the member's leaderboard data on the server if applicable */
export async function queueUpdateDatabaseMember(member: CleanMember, profile: CleanFullProfile): Promise<void> {
- leaderboardUpdateMemberQueue.enqueue(async() => await updateDatabaseMember(member, profile))
+ // leaderboardUpdateMemberQueue.enqueue(async() => await updateDatabaseMember(member, profile))
}
/** Queue an update for the profile's leaderboard data on the server if applicable */
export async function queueUpdateDatabaseProfile(profile: CleanFullProfile): Promise<void> {
- leaderboardUpdateProfileQueue.enqueue(async() => await updateDatabaseProfile(profile))
+ // leaderboardUpdateProfileQueue.enqueue(async() => await updateDatabaseProfile(profile))
}
@@ -624,10 +649,10 @@ async function fetchAllLeaderboards(fast?: boolean): Promise<void> {
if (!globalThis.isTest) {
connect().then(() => {
// when it connects, cache the leaderboards and remove bad members
- removeBadMemberLeaderboardAttributes()
+ // removeBadMemberLeaderboardAttributes()
// cache leaderboards on startup so its faster later on
- fetchAllLeaderboards(true)
+ // fetchAllLeaderboards(true)
// cache leaderboard players again every 4 hours
- setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000)
+ // setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000)
})
}