diff options
author | mat <github@matdoes.dev> | 2021-05-24 13:46:33 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-05-24 13:46:33 -0500 |
commit | 17866766304a9049dda716a21d94bcd4803980a7 (patch) | |
tree | 5937bd82233746719b3c1b8a96afe971d303b804 /build | |
parent | d8cffd55943c3ab36d61201851da7ababf72736f (diff) | |
download | skyblock-api-17866766304a9049dda716a21d94bcd4803980a7.tar.gz skyblock-api-17866766304a9049dda716a21d94bcd4803980a7.tar.bz2 skyblock-api-17866766304a9049dda716a21d94bcd4803980a7.zip |
disable leaderboards
Diffstat (limited to 'build')
-rw-r--r-- | build/database.js | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/build/database.js b/build/database.js index aa8765c..18a78f7 100644 --- a/build/database.js +++ b/build/database.js @@ -115,6 +115,7 @@ function getProfileLeaderboardAttributes(profile) { }; } async function fetchAllLeaderboardsCategorized() { + return {}; const memberLeaderboardAttributes = await fetchAllMemberLeaderboardAttributes(); const profileLeaderboardAttributes = await fetchAllProfileLeaderboardAttributes(); const categorizedLeaderboards = {}; @@ -133,6 +134,7 @@ async function fetchAllLeaderboardsCategorized() { exports.fetchAllLeaderboardsCategorized = fetchAllLeaderboardsCategorized; /** Fetch the raw names for the slayer leaderboards */ async function fetchSlayerLeaderboards() { + return []; const rawSlayerNames = await constants.fetchSlayers(); let leaderboardNames = [ 'slayer_total_xp', @@ -151,6 +153,7 @@ async function fetchSlayerLeaderboards() { exports.fetchSlayerLeaderboards = fetchSlayerLeaderboards; /** Fetch the names of all the leaderboards that rank members */ async function fetchAllMemberLeaderboardAttributes() { + 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(), @@ -186,6 +189,7 @@ function isLeaderboardReversed(name) { return false; } async function fetchMemberLeaderboardRaw(name) { + return []; if (!client) throw Error('Client isn\'t initialized yet'); if (cachedRawLeaderboards.has(name)) @@ -204,6 +208,7 @@ async function fetchMemberLeaderboardRaw(name) { return leaderboardRaw; } async function fetchProfileLeaderboardRaw(name) { + return []; if (cachedRawLeaderboards.has(name)) return cachedRawLeaderboards.get(name); // typescript forces us to make a new variable and set it this way because it gives an error otherwise @@ -222,6 +227,11 @@ async function fetchProfileLeaderboardRaw(name) { /** Fetch a leaderboard that ranks members, as opposed to profiles */ async function fetchMemberLeaderboard(name) { var _a; + 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) => { return { @@ -245,6 +255,11 @@ exports.fetchMemberLeaderboard = fetchMemberLeaderboard; /** Fetch a leaderboard that ranks profiles, as opposed to members */ async function fetchProfileLeaderboard(name) { var _a; + 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) => { const players = []; @@ -270,6 +285,11 @@ async function fetchProfileLeaderboard(name) { exports.fetchProfileLeaderboard = fetchProfileLeaderboard; /** Fetch a leaderboard */ async function fetchLeaderboard(name) { + 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); @@ -282,6 +302,7 @@ exports.fetchLeaderboard = fetchLeaderboard; /** Get the leaderboard positions a member is on. This may take a while depending on whether stuff is cached */ async function fetchMemberLeaderboardSpots(player, profile) { var _a; + return []; const fullProfile = await cached.fetchProfile(player, profile); const fullMember = fullProfile.members.find(m => m.username.toLowerCase() === player.toLowerCase() || m.uuid === player); // update the leaderboard positions for the member @@ -315,6 +336,7 @@ async function getLeaderboardRequirement(name, leaderboardType) { } /** Get the attributes for the member, but only ones that would put them on the top 100 for leaderboards */ async function getApplicableMemberLeaderboardAttributes(member) { + return {}; const leaderboardAttributes = getMemberLeaderboardAttributes(member); const applicableAttributes = {}; for (const [leaderboard, attributeValue] of Object.entries(leaderboardAttributes)) { @@ -335,6 +357,7 @@ async function getApplicableMemberLeaderboardAttributes(member) { } /** Get the attributes for the profile, but only ones that would put them on the top 100 for leaderboards */ async function getApplicableProfileLeaderboardAttributes(profile) { + return {}; const leaderboardAttributes = getProfileLeaderboardAttributes(profile); const applicableAttributes = {}; for (const [leaderboard, attributeValue] of Object.entries(leaderboardAttributes)) { @@ -355,6 +378,7 @@ async function getApplicableProfileLeaderboardAttributes(profile) { } /** Update the member's leaderboard data on the server if applicable */ async function updateDatabaseMember(member, profile) { + return; if (!client) return; // the db client hasn't been initialized if (_1.debug) @@ -410,6 +434,7 @@ exports.updateDatabaseMember = updateDatabaseMember; * This will not also update the members, you have to call updateDatabaseMember separately for that */ async function updateDatabaseProfile(profile) { + return; if (!client) return; // the db client hasn't been initialized if (_1.debug) @@ -464,12 +489,12 @@ const leaderboardUpdateProfileQueue = new queue_promise_1.default({ }); /** Queue an update for the member's leaderboard data on the server if applicable */ async function queueUpdateDatabaseMember(member, profile) { - leaderboardUpdateMemberQueue.enqueue(async () => await updateDatabaseMember(member, profile)); + // leaderboardUpdateMemberQueue.enqueue(async() => await updateDatabaseMember(member, profile)) } exports.queueUpdateDatabaseMember = queueUpdateDatabaseMember; /** Queue an update for the profile's leaderboard data on the server if applicable */ async function queueUpdateDatabaseProfile(profile) { - leaderboardUpdateProfileQueue.enqueue(async () => await updateDatabaseProfile(profile)); + // leaderboardUpdateProfileQueue.enqueue(async() => await updateDatabaseProfile(profile)) } exports.queueUpdateDatabaseProfile = queueUpdateDatabaseProfile; /** @@ -516,10 +541,10 @@ async function fetchAllLeaderboards(fast) { 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) }); } |