Global leaderboard searching + Player class
This commit is contained in:
parent
f53b4790a2
commit
8e078817d8
15 changed files with 193 additions and 5722 deletions
|
@ -1,4 +1,4 @@
|
|||
const colors = require('../misc/icons/colors.json');
|
||||
const Player = require('../classes/Player.js')
|
||||
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
|
@ -54,22 +54,15 @@ module.exports = async (app, req, res) => {
|
|||
}
|
||||
|
||||
if (req.query.type != "profile") {
|
||||
comment.username = y[1] || "-"
|
||||
let commentUser = new Player(y)
|
||||
Object.keys(commentUser).forEach(k => {
|
||||
comment[k] = commentUser[k]
|
||||
})
|
||||
comment.levelID = x[1] || req.params.id
|
||||
comment.playerID = x[3] || 0
|
||||
comment.accountID = y[16] || 0
|
||||
comment.color = (comment.playerID == "16" ? "50,255,255" : x[12] || "255,255,255")
|
||||
if (x[10] > 0) comment.percent = +x[10]
|
||||
comment.moderator = +x[11] || 0
|
||||
comment.icon = {
|
||||
form: ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][+y[14]],
|
||||
icon: +y[9] || 1,
|
||||
col1: +y[10],
|
||||
col2: +y[11],
|
||||
glow: +y[15] > 1,
|
||||
col1RGB: colors[y[10]] || colors["0"],
|
||||
col2RGB: colors[y[11]] || colors["3"]
|
||||
}
|
||||
app.userCache(req.id, comment.accountID, comment.playerID, comment.username)
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ async function buildIcon(account=[], userCode) {
|
|||
|
||||
let partName = getPartName(part, leg)
|
||||
let offsetData = icons[partName.slice(mainPath.length)]
|
||||
if (!offsetData) return
|
||||
let { spriteSize, spriteOffset } = offsetData
|
||||
|
||||
let builtPart = sharp(partName.slice(1)) // slice 1 from filename since sharp also reads paths differently
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
const Jimp = require('jimp');
|
||||
const fs = require('fs');
|
||||
const icons = require('../icons/gameSheet.json');
|
||||
const colors = require('../icons/colors.json');
|
||||
const forms = require('../icons/forms.json')
|
||||
const offsets = require('../icons/offsets.json');
|
||||
const icons = require('../misc/icons/gameSheet.json');
|
||||
const colors = require('../misc/icons/colors.json');
|
||||
const forms = require('../misc/icons/forms.json')
|
||||
const offsets = require('../misc/icons/offsets.json');
|
||||
|
||||
let hexRegex = /^[A-Fa-f0-9]{6}$/
|
||||
function hexConvert(hex) { hex = hex.replace('#', ''); return {r: '0x' + hex[0] + hex[1] | 0, g: '0x' + hex[2] + hex[3] | 0, b: '0x' + hex[4] + hex[5] | 0}; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const colors = require('../../misc/icons/colors.json');
|
||||
const Player = require('../../classes/Player.js')
|
||||
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
|
@ -15,6 +15,10 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
if (["creators", "creator", "cp"].some(x => req.query.hasOwnProperty(x) || req.query.type == x)) params.type = "creators"
|
||||
else if (["week", "weekly"].some(x => req.query.hasOwnProperty(x) || req.query.type == x)) params.type = "week"
|
||||
else if (["global", "relative"].some(x => req.query.hasOwnProperty(x) || req.query.type == x)) {
|
||||
params.type = "relative"
|
||||
params.accountID = req.query.accountID
|
||||
}
|
||||
|
||||
req.gdRequest('getGJScores20', params, function(err, resp, body) {
|
||||
|
||||
|
@ -22,30 +26,8 @@ module.exports = async (app, req, res) => {
|
|||
scores = body.split('|').map(x => app.parseResponse(x)).filter(x => x[1])
|
||||
if (!scores.length) return res.sendError()
|
||||
|
||||
scores.forEach(x => {
|
||||
let keys = Object.keys(x)
|
||||
x.rank = +x[6]
|
||||
x.username = x[1]
|
||||
x.playerID = x[2]
|
||||
x.accountID = x[16]
|
||||
x.stars = +x[3]
|
||||
x.demons = +x[4]
|
||||
x.cp = +x[8]
|
||||
x.coins = +x[13]
|
||||
x.usercoins = +x[17]
|
||||
x.diamonds = +x[46]
|
||||
x.icon = {
|
||||
form: ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][+x[14]],
|
||||
icon: +x[9] || 1,
|
||||
col1: +x[10],
|
||||
col2: +x[11],
|
||||
glow: +x[15] > 1,
|
||||
col1RGB: colors[x[10]] || colors["0"],
|
||||
col2RGB: colors[x[11]] || colors["3"]
|
||||
}
|
||||
keys.forEach(k => delete x[k])
|
||||
app.userCache(req.id, x.accountID, x.playerID, x.username)
|
||||
})
|
||||
return res.status(200).send(scores)
|
||||
})
|
||||
scores = scores.map(x => new Player(x))
|
||||
scores.forEach(x => app.userCache(req.id, x.accountID, x.playerID, x.username))
|
||||
return res.status(200).send(scores.slice(0, amount))
|
||||
})
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
const fs = require('fs')
|
||||
const colors = require('../misc/icons/colors.json');
|
||||
const Player = require('../classes/Player.js')
|
||||
|
||||
module.exports = async (app, req, res, api, getLevels) => {
|
||||
|
||||
|
@ -48,38 +48,7 @@ module.exports = async (app, req, res, api, getLevels) => {
|
|||
|
||||
if (!foundID) app.userCache(req.id, account[16], account[2], account[1])
|
||||
|
||||
let userData = {
|
||||
username: account[1] || "[MISSINGNO.]",
|
||||
playerID: account[2],
|
||||
accountID: account[16],
|
||||
rank: +account[30],
|
||||
stars: +account[3],
|
||||
diamonds: +account[46],
|
||||
coins: +account[13],
|
||||
userCoins: +account[17],
|
||||
demons: +account[4],
|
||||
cp: +account[8],
|
||||
friendRequests: account[19] == "0",
|
||||
messages: account[18] == "0" ? "all" : account[18] == "1" ? "friends" : "off",
|
||||
commentHistory: account[50] == "0" ? "all" : account[50] == "1" ? "friends" : "off",
|
||||
moderator: +account[49],
|
||||
youtube: account[20] || null,
|
||||
twitter: account[44] || null,
|
||||
twitch: account[45] || null,
|
||||
icon: +account[21],
|
||||
ship: +account[22],
|
||||
ball: +account[23],
|
||||
ufo: +account[24],
|
||||
wave: +account[25],
|
||||
robot: +account[26],
|
||||
spider: +account[43],
|
||||
col1: +account[10],
|
||||
col2: +account[11],
|
||||
deathEffect: +account[48] || 1,
|
||||
glow: account[28] == "1",
|
||||
col1RGB: colors[account[10]] || colors["0"],
|
||||
col2RGB: colors[account[11]] || colors["3"]
|
||||
}
|
||||
let userData = new Player(account)
|
||||
|
||||
if (api) return res.status(200).send(userData)
|
||||
|
||||
|
|
BIN
assets/unmagnify.png
Normal file
BIN
assets/unmagnify.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
53
classes/Player.js
Normal file
53
classes/Player.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
const colors = require('../misc/icons/colors.json');
|
||||
|
||||
class Level {
|
||||
constructor(account) {
|
||||
this.username = account[1] || "-",
|
||||
this.playerID = account[2],
|
||||
this.accountID = account[16],
|
||||
this.rank = +account[6] || +account[30],
|
||||
this.stars = +account[3],
|
||||
this.diamonds = +account[46],
|
||||
this.coins = +account[13],
|
||||
this.userCoins = +account[17],
|
||||
this.demons = +account[4],
|
||||
this.cp = +account[8],
|
||||
this.icon = +account[21]
|
||||
|
||||
if (!+account[22]) { // partial profile, used for leaderboards and stuff
|
||||
this.icon = {
|
||||
form: ['icon', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider'][+account[14]],
|
||||
icon: +account[9] || 1,
|
||||
col1: +account[10],
|
||||
col2: +account[11],
|
||||
glow: +account[15] > 1 || account[28] == "1"
|
||||
}
|
||||
delete this.col1; delete this.col2; delete this.glow; delete this.col1RGB; delete this.col2RGB
|
||||
}
|
||||
|
||||
else {
|
||||
this.friendRequests = account[19] == "0",
|
||||
this.messages = account[18] == "0" ? "all" : account[18] == "1" ? "friends" : "off",
|
||||
this.commentHistory = account[50] == "0" ? "all" : account[50] == "1" ? "friends" : "off",
|
||||
this.moderator = +account[49],
|
||||
this.youtube = account[20] || null,
|
||||
this.twitter = account[44] || null,
|
||||
this.twitch = account[45] || null,
|
||||
this.ship = +account[22],
|
||||
this.ball = +account[23],
|
||||
this.ufo = +account[24],
|
||||
this.wave = +account[25],
|
||||
this.robot = +account[26],
|
||||
this.spider = +account[43],
|
||||
this.col1 = +account[10],
|
||||
this.col2 = +account[11],
|
||||
this.deathEffect = +account[48] || 1,
|
||||
this.glow = account[15] > 1 || account[28] == "1"
|
||||
}
|
||||
|
||||
this.col1RGB = colors[account[10]] || colors["0"],
|
||||
this.col2RGB = colors[account[11]] || colors["3"]
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Level;
|
|
@ -357,7 +357,7 @@
|
|||
<p>demons: Number of completed demons</p>
|
||||
<p>cp: Number of creator points</p>
|
||||
<p>coins: Number of secret coins</p>
|
||||
<p>usercoins: Number of user coins</p>
|
||||
<p>userCoins: Number of user coins</p>
|
||||
<p>diamonds: Number of diamonds</p>
|
||||
<p>icon: The icon preview showed next to the player's name</p>
|
||||
</div>
|
||||
|
|
|
@ -51,11 +51,15 @@
|
|||
</div>
|
||||
|
||||
<div class="leaderboardBox supercenter gs" style="width: 120vh; height: 80%; pointer-events: none">
|
||||
<div class="sortDiv" style="position: relative; left: 100%; transform: translateX(4.5vh); top: 12%; width: 0.1%">
|
||||
<div id="relativeUser" class="sortDiv" style="position: relative; left: 100%; transform: translateX(4.5vh); top: 12%; width: 0.1%">
|
||||
<img class="gdButton" id="findRelative" style="margin-bottom: 1vh" title="Global Search" src="../assets/magnify.png" height="11%">
|
||||
<img class="gdButton" id="clearRelative" style="margin-bottom: 1vh; display: none" title="Clear Global Search" src="../assets/unmagnify.png" height="11%">
|
||||
</div>
|
||||
<div class="sortDiv" style="display: none; position: relative; left: 100%; transform: translateX(4.5vh); top: 12%; width: 0.1%">
|
||||
<img class="gdButton" id="modSort" style="margin-bottom: 1vh" title="Moderators" src="../assets/sort-mod.png" height="11%">
|
||||
<img class="gdButton" id="weeklyStats" style="margin-bottom: 1vh" title="Weekly Stats" src="../assets/sort-week.png" height="11%">
|
||||
</div>
|
||||
<div class="sortDiv" style="position: relative; right: 10.5%; top: 0%; width: 0.1%; transform: translateY(-33.3%)" id="statSort">
|
||||
<div class="sortDiv" style="display: none; position: relative; right: 10.5%; top: 0%; width: 0.1%; transform: translateY(-33.3%)" id="statSort">
|
||||
<img class="gdButton sortButton" style="margin-bottom: 1vh" sort="stars" title="Most stars" src="../assets/sort-stars-on.png" height="11%" id="starSort">
|
||||
<img class="gdButton sortButton" style="margin-bottom: 1vh" sort="diamonds" title="Most diamonds" src="../assets/sort-diamonds.png" height="11%">
|
||||
<img class="gdButton sortButton" style="margin-bottom: 1vh" sort="coins" title="Most coins" src="../assets/sort-coins.png" height="11%">
|
||||
|
@ -80,12 +84,24 @@
|
|||
<div class="supercenter" id="loading" style="height: 10%; top: 47%; display: none;">
|
||||
<img class="spin noSelect" src="../assets/loading.png" height="105%">
|
||||
</div>
|
||||
|
||||
<div class="popup" id="userSearch">
|
||||
<div class="brownbox bounce center supercenter" style="width: 75vh">
|
||||
<h2 class="smaller center" style="font-size: 5.5vh; margin-top: 1%">User Search</h2>
|
||||
<p>Enter the <cy>username</cy> of a player to find their position in the <ca>global leaderboard</ca>.</p>
|
||||
<input type="text" id="relativeName" placeholder="Username" style="height: 8vh; width: 90%; text-align: center; margin-top: 0.5%; margin-bottom: 5%"><br>
|
||||
<img src="../assets/btn-cancel.png" class="postButton gdButton center" style="width: 32%; margin-right: 1%" onclick="$('#userSearch').hide()">
|
||||
<img src="../assets/btn-submit.png" class="postButton gdButton center" style="width: 32%; margin-left: 1%" id="relativeSearch">
|
||||
<p id="relativeStatus" style="display: none"></p>
|
||||
<img class="closeWindow gdButton" src="../assets/close.png" width="13%" style="position: absolute; top: -13.5%; left: -6vh" onclick="$('#userSearch').hide()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js"></script>
|
||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js"></script>
|
||||
<script type="text/javascript" src="../sizecheck.js?"></script>
|
||||
<script type="text/javascript" src="../dragscroll.js"></script>
|
||||
<script>
|
||||
|
@ -123,14 +139,18 @@ function infoText(text, altDiscord) {
|
|||
|
||||
infoText(top250Text)
|
||||
|
||||
function leaderboard(val) {
|
||||
let didGDPSStuff = false
|
||||
|
||||
function leaderboard(val, leaderboardParams, scrollTo) {
|
||||
|
||||
$('#searchBox').html(`<div style="height: 4.5%"></div>`)
|
||||
$('#clearRelative').hide()
|
||||
$('#loading').show()
|
||||
|
||||
Fetch(`../api/leaderboard?count=250&${val}&type=${sort}${modMode ? "&mod=1" : ""}`).then(res => {
|
||||
Fetch("../api/leaderboard?" + (leaderboardParams || `count=250&${val}&type=${sort}${modMode ? "&mod=1" : ""}`)).then(res => {
|
||||
|
||||
if (gdps) {
|
||||
if (gdps && !didGDPSStuff) {
|
||||
didGDPSStuff = true
|
||||
top250Text = topGDPSText
|
||||
$('#accurateTabOn').remove()
|
||||
$('#accurateTabOff').remove()
|
||||
|
@ -157,45 +177,50 @@ function leaderboard(val) {
|
|||
if (modMode && sort == "cp") res = res.sort(function(a, b){return b.cp - a.cp});
|
||||
let wk = type == "weekly"
|
||||
|
||||
if (val == type && res != -1 && res.length) res.forEach((x, y) => {
|
||||
if ((leaderboardParams ? true : val == type) && res != -1 && res.length) res.forEach((x, y) => {
|
||||
|
||||
let wp = x.weeklyProgress || {}
|
||||
let cosmetics = x.cosmetics || {}
|
||||
|
||||
let bgCol = cosmetics.bgColor
|
||||
let bgString = bgCol ? ` style="background-color: rgb(${bgCol.join()})"` : ""
|
||||
let wp = x.weeklyProgress || {}
|
||||
let cosmetics = x.cosmetics || {}
|
||||
|
||||
let bgCol = cosmetics.bgColor
|
||||
let bgString = bgCol ? ` style="background-color: rgb(${bgCol.join()})"` : ""
|
||||
|
||||
let nameCol = cosmetics.nameColor
|
||||
let nameString = nameCol ? `; color: rgb(${nameCol.join()}) ;` : null
|
||||
let nameCol = cosmetics.nameColor
|
||||
let nameString = nameCol ? `; color: rgb(${nameCol.join()}) ;` : null
|
||||
|
||||
$('#searchBox').append(`<div class="searchresult leaderboardSlot"${bgString}>
|
||||
${x.moderator ? `<img title="${x.moderator == 2 ? "Elder " : ""}Moderator" src="../assets/mod${x.moderator == 2 ? "-elder" : ""}.png" style="height: 25%; cursor: help; padding-right: 1.6%; transform: translateY(0.7vh)">` : ""}
|
||||
<h2 class="small inline gdButton" style="margin-top: 1.5%${nameString || (x.moderator == 2 ? "; color: #FF9977;" : "")}"><a href="${onePointNine ? `../search/${x.playerID}?user` : `../u/${x.accountID}.`}">${x.username}</a></h2>
|
||||
<h3 class="inline sideSpace${x.stars >= 100000 ? " yellow" : ""}" style="font-size: 4.5vh${type == "weekly" ? "; display: none" : ""};">${x.stars} <img class="help valign" src="../assets/star.png"
|
||||
style="width: 4vh; transform: translate(-25%, -10%);" title="Stars"></h3>
|
||||
if (x.usercoins) x.userCoins = x.userCoins
|
||||
if (wp.usercoins) wp.userCoins = wp.userCoins
|
||||
|
||||
<h3 class="lessSpaced leaderboardStats">
|
||||
${type != "weekly" ? "" : `<span${x.stars >= 1000 ? " class='yellow'" : ""}>+${x.stars}</span> <img class="help valign" src="../assets/star.png" title="Star Gain">`}
|
||||
${wk || onePointNine ? "" : `<span${x.diamonds >= 65535 ? ` class='blue'>` : ">"}${x.diamonds}</span> <img class="help valign" src="../assets/diamond.png" title="Diamonds">`}
|
||||
${wk ? " " : `<span${x.coins >= 149 ? " class='yellow'" : ""}>${x.coins}</span> <img class="help valign" src="../assets/coin.png" title="Secret Coins">`}
|
||||
${wk || onePointNine ? "" : `<span${x.usercoins >= 10000 ? " class='brightblue'" : ""}>${x.usercoins}</span> <img class="help valign" src="../assets/silvercoin.png" title="User Coins">`}
|
||||
${wk ? "" : `<span${x.demons >= 1000 ? " class='brightred'" : ""}>${x.demons}</span> <img class="help valign" src="../assets/demon.png" title="Demons">`}
|
||||
${x.cp <= 0 ? "" : `<span${x.cp >= 100 ? " class='yellow'" : ""}>${x.cp}</span> <img class="help valign" src="../assets/cp.png" title="Creator Points">`}
|
||||
</h3>
|
||||
$('#searchBox').append(`<div class="searchresult leaderboardSlot"${bgString}>
|
||||
${x.moderator ? `<img title="${x.moderator == 2 ? "Elder " : ""}Moderator" src="../assets/mod${x.moderator == 2 ? "-elder" : ""}.png" style="height: 25%; cursor: help; padding-right: 1.6%; transform: translateY(0.7vh)">` : ""}
|
||||
<h2 class="leaderboardName small inline gdButton" style="margin-top: 1.5%${nameString || (x.moderator == 2 ? "; color: #FF9977;" : "")}"><a href="${onePointNine ? `../search/${x.playerID}?user` : `../u/${x.accountID}.`}" accountID="${x.accountID}">${x.username}</a></h2>
|
||||
<h3 class="inline sideSpace${x.stars >= 100000 ? " yellow" : ""}" style="font-size: 4.5vh${type == "weekly" ? "; display: none" : ""};">${x.stars} <img class="help valign" src="../assets/star.png"
|
||||
style="width: 4vh; transform: translate(-25%, -10%);" title="Stars"></h3>
|
||||
|
||||
<h3 class="lessSpaced leaderboardStats weeklyStuff"}>
|
||||
<span${wp.diamonds >= 250 ? " class='blue'" : ""}>${wp.diamonds >= 0 ? "+" : ""}${wp.diamonds}</span> <img class="help valign" src="../assets/diamond.png" title="Diamond Gain">
|
||||
<span${wp.stars >= 1000 ? " class='yellow'" : ""}>${wp.stars >= 0 ? "+" : ""}${wp.stars}</span> <img class="help valign" src="../assets/star.png" title="Star Gain">
|
||||
<span${wp.usercoins >= 250 ? " class='brightblue'" : ""}>${wp.usercoins >= 0 ? "+" : ""}${wp.usercoins}</span> <img class="help valign" src="../assets/silvercoin.png" title="User Coin Gain">
|
||||
<span${wp.demons >= 25 ? " class='brightred'" : ""}>${wp.demons >= 0 ? "+" : ""}${wp.demons}</span> <img class="help valign" src="../assets/demon.png" title="Demon Gain">
|
||||
</h3>
|
||||
|
||||
<div class="center ranking">
|
||||
${x.icon.icon == -1 && type == "accurate" ? `<img class="spaced" src="./assets/trophies/${trophies.findIndex(z => y+1 <= z) + 1}.png" height="150%" style="margin-bottom: 0%; transform:scale(1.1)">` :
|
||||
`<img class="spaced lazyLoad" data-src="./icon/icon?form=${x.icon.form}&icon=${x.icon.icon}&col1=${x.icon.col1}&col2=${x.icon.col2}&glow=${x.icon.glow}&size=auto" height="150%" style="margin-bottom: 0%; transform:scale(1.1);">`}
|
||||
<h2 class="small" style="margin-top: 0%">${y+1}</h2>
|
||||
</div>
|
||||
</div>`)
|
||||
<h3 class="lessSpaced leaderboardStats">
|
||||
${type != "weekly" ? "" : `<span${x.stars >= 1000 ? " class='yellow'" : ""}>+${x.stars}</span> <img class="help valign" src="../assets/star.png" title="Star Gain">`}
|
||||
${wk || onePointNine ? "" : `<span${x.diamonds >= 65535 ? ` class='blue'>` : ">"}${x.diamonds}</span> <img class="help valign" src="../assets/diamond.png" title="Diamonds">`}
|
||||
${wk ? " " : `<span${x.coins >= 149 ? " class='yellow'" : ""}>${x.coins}</span> <img class="help valign" src="../assets/coin.png" title="Secret Coins">`}
|
||||
${wk || onePointNine ? "" : `<span${x.userCoins >= 10000 ? " class='brightblue'" : ""}>${x.userCoins}</span> <img class="help valign" src="../assets/silvercoin.png" title="User Coins">`}
|
||||
${wk ? "" : `<span${x.demons >= 1000 ? " class='brightred'" : ""}>${x.demons}</span> <img class="help valign" src="../assets/demon.png" title="Demons">`}
|
||||
${x.cp <= 0 ? "" : `<span${x.cp >= 100 ? " class='yellow'" : ""}>${x.cp}</span> <img class="help valign" src="../assets/cp.png" title="Creator Points">`}
|
||||
</h3>
|
||||
|
||||
<h3 class="lessSpaced leaderboardStats weeklyStuff"}>
|
||||
<span${wp.diamonds >= 250 ? " class='blue'" : ""}>${wp.diamonds >= 0 ? "+" : ""}${wp.diamonds}</span> <img class="help valign" src="../assets/diamond.png" title="Diamond Gain">
|
||||
<span${wp.stars >= 1000 ? " class='yellow'" : ""}>${wp.stars >= 0 ? "+" : ""}${wp.stars}</span> <img class="help valign" src="../assets/star.png" title="Star Gain">
|
||||
<span${wp.userCoins >= 250 ? " class='brightblue'" : ""}>${wp.userCoins >= 0 ? "+" : ""}${wp.userCoins}</span> <img class="help valign" src="../assets/silvercoin.png" title="User Coin Gain">
|
||||
<span${wp.demons >= 25 ? " class='brightred'" : ""}>${wp.demons >= 0 ? "+" : ""}${wp.demons}</span> <img class="help valign" src="../assets/demon.png" title="Demon Gain">
|
||||
</h3>
|
||||
|
||||
<div class="center ranking">
|
||||
${x.icon.icon == -1 && type == "accurate" ? `<img class="spaced" src="./assets/trophies/${trophies.findIndex(z => y+1 <= z) + 1}.png" height="150%" style="margin-bottom: 0%; transform:scale(1.1)">` :
|
||||
`<img class="spaced lazyLoad" data-src="./icon/icon?form=${x.icon.form}&icon=${x.icon.icon}&col1=${x.icon.col1}&col2=${x.icon.col2}&glow=${x.icon.glow}&size=auto" height="150%" style="margin-bottom: 0%; transform:scale(1.1);">`}
|
||||
<div style="display: flex; justify-content: center">
|
||||
<h2 class="small" style="margin-top: 1%; transform: scale(${1 - (Math.max(0, String(x.rank).length - 3) * 0.16)})">${x.rank}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>`)
|
||||
})
|
||||
|
||||
/* else if (type == "accurate") {
|
||||
|
@ -207,6 +232,15 @@ function leaderboard(val) {
|
|||
|
||||
weeklyAdjust()
|
||||
$('#searchBox').append('<div style="height: 4.5%"></div>')
|
||||
|
||||
if (scrollTo) {
|
||||
let foundElement = $(`#searchBox .leaderboardName a[accountID=${scrollTo}]`)
|
||||
if (foundElement.length) {
|
||||
let foundParent = foundElement.parent().parent()
|
||||
$('#searchBox').scrollTop(foundParent.offset().top - foundParent.height())
|
||||
}
|
||||
}
|
||||
|
||||
$('#loading').hide();
|
||||
$('.lazyLoad').Lazy({ appendScroll: '#searchBox' });
|
||||
}).catch(e => {console.log(e); $('#loading').hide();})
|
||||
|
@ -233,6 +267,7 @@ $('#topTabOff').click(function() {
|
|||
$('#creatorTabOff').show()
|
||||
infoText(top250Text)
|
||||
$('.sortDiv').hide()
|
||||
$('#relativeUser').show()
|
||||
})
|
||||
|
||||
$('#accurateTabOff').click(function() {
|
||||
|
@ -245,6 +280,7 @@ $('#accurateTabOff').click(function() {
|
|||
$('#creatorTabOff').show()
|
||||
infoText(accurateText, true)
|
||||
$('.sortDiv').show()
|
||||
$('#relativeUser').hide()
|
||||
})
|
||||
|
||||
$('#weeklyTabOff').click(function() {
|
||||
|
@ -300,6 +336,44 @@ $('#weeklyStats').click(function() {
|
|||
weeklyAdjust()
|
||||
})
|
||||
|
||||
$('#findRelative').click(function() {
|
||||
$('#userSearch').show()
|
||||
$('#relativeName').focus().select()
|
||||
})
|
||||
|
||||
let relativeLoading = false
|
||||
$('#relativeSearch').click(function() {
|
||||
let relativeUsername = $('#relativeName').val()
|
||||
if (relativeLoading || !relativeUsername) return
|
||||
relativeLoading = true
|
||||
Fetch("../api/profile/" + relativeUsername).then(foundUser => {
|
||||
if (foundUser && foundUser.accountID && foundUser.rank) {
|
||||
leaderboard(null, "type=relative&accountID=" + foundUser.accountID, foundUser.accountID)
|
||||
$('#userSearch').hide()
|
||||
$('#relativeStatus').hide()
|
||||
$('#clearRelative').show()
|
||||
type = "relative"
|
||||
relativeLoading = false
|
||||
}
|
||||
else {
|
||||
$('#relativeStatus').html(`${foundUser.username ? `<cy>${foundUser.username}</cy>` : "That user"} doesn't have a global rank!`).show()
|
||||
relativeLoading = false
|
||||
}
|
||||
|
||||
}).catch(e => {
|
||||
$('#relativeStatus').text("That account doesn't seem to exist!").show()
|
||||
relativeLoading = false
|
||||
})
|
||||
})
|
||||
|
||||
$('#clearRelative').click(function() {
|
||||
$('#topTabOff').trigger('click')
|
||||
})
|
||||
|
||||
$(document).keydown(function(k) {
|
||||
if ($('#userSearch').is(':visible') && k.which == 13 && !relativeLoading) $('#relativeSearch').trigger('click') //enter
|
||||
})
|
||||
|
||||
$("#topTabOff").trigger('click')
|
||||
|
||||
</script>
|
|
@ -161,7 +161,8 @@ if (type == "followed") {
|
|||
searchFilters += ("&creators=" + followed.join())
|
||||
}
|
||||
|
||||
if (window.location.host.match(/\./g).length > 1) { // gdps check
|
||||
let hostMatch = window.location.host.match(/\./g)
|
||||
if (hostMatch && hostMatch.length > 1) { // gdps check
|
||||
$('#gdWorld').remove()
|
||||
$('#normalGD').remove()
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
{
|
||||
"0" : {"r": 125, "g": 255, "b": 0},
|
||||
"1" : {"r": 0, "g": 255, "b": 0},
|
||||
"2" : {"r": 0, "g": 255, "b": 125},
|
||||
"3" : {"r": 0, "g": 255, "b": 255},
|
||||
"4" : {"r": 0, "g": 125, "b": 255},
|
||||
"5" : {"r": 0, "g": 0, "b": 255},
|
||||
"6" : {"r": 125, "g": 0, "b": 255},
|
||||
"7" : {"r": 255, "g": 0, "b": 255},
|
||||
"8" : {"r": 255, "g": 0, "b": 125},
|
||||
"9" : {"r": 255, "g": 0, "b": 0},
|
||||
"10" : {"r": 255, "g": 125, "b": 0},
|
||||
"11" : {"r": 255, "g": 255, "b": 0},
|
||||
"12" : {"r": 255, "g": 255, "b": 255},
|
||||
"13" : {"r": 185, "g": 0, "b": 255},
|
||||
"14" : {"r": 255, "g": 185, "b": 0},
|
||||
"15" : {"r": 0, "g": 0, "b": 0},
|
||||
"16" : {"r": 0, "g": 200, "b": 255},
|
||||
"17" : {"r": 175, "g": 175, "b": 175},
|
||||
"18" : {"r": 90, "g": 90, "b": 90},
|
||||
"19" : {"r": 255, "g": 125, "b": 125},
|
||||
"20" : {"r": 0, "g": 175, "b": 75},
|
||||
"21" : {"r": 0, "g": 125, "b": 125},
|
||||
"22" : {"r": 0, "g": 75, "b": 175},
|
||||
"23" : {"r": 75, "g": 0, "b": 175},
|
||||
"24" : {"r": 125, "g": 0, "b": 125},
|
||||
"25" : {"r": 175, "g": 0, "b": 75},
|
||||
"26" : {"r": 175, "g": 75, "b": 0},
|
||||
"27" : {"r": 125, "g": 125, "b": 0},
|
||||
"28" : {"r": 75, "g": 175, "b": 0},
|
||||
"29" : {"r": 255, "g": 75, "b": 0},
|
||||
"30" : {"r": 150, "g": 50, "b": 0},
|
||||
"31" : {"r": 150, "g": 100, "b": 0},
|
||||
"32" : {"r": 100, "g": 150, "b": 0},
|
||||
"33" : {"r": 0, "g": 150, "b": 100},
|
||||
"34" : {"r": 0, "g": 100, "b": 150},
|
||||
"35" : {"r": 100, "g": 0, "b": 150},
|
||||
"36" : {"r": 150, "g": 0, "b": 100},
|
||||
"37" : {"r": 150, "g": 0, "b": 0},
|
||||
"38" : {"r": 0, "g": 150, "b": 0},
|
||||
"39" : {"r": 0, "g": 0, "b": 150},
|
||||
"40" : {"r": 125, "g": 255, "b": 175},
|
||||
"41" : {"r": 125, "g": 125, "b": 255}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"ship": {
|
||||
"form": "ship",
|
||||
"ind": 22
|
||||
},
|
||||
"ball": {
|
||||
"form": "player_ball",
|
||||
"ind": 23
|
||||
},
|
||||
"ufo": {
|
||||
"form": "bird",
|
||||
"ind": 24
|
||||
},
|
||||
"wave": {
|
||||
"form": "dart",
|
||||
"ind": 25
|
||||
},
|
||||
"robot": {
|
||||
"form": "robot",
|
||||
"ind": 26,
|
||||
"legs": true
|
||||
},
|
||||
"spider": {
|
||||
"form": "spider",
|
||||
"ind": 43,
|
||||
"legs": true
|
||||
},
|
||||
"cursed": {
|
||||
"form": "spider",
|
||||
"ind": 43,
|
||||
"legs": true
|
||||
},
|
||||
"swing": {
|
||||
"form": "swing",
|
||||
"ind": -1
|
||||
}
|
||||
}
|
5486
icons/gameSheet.json
5486
icons/gameSheet.json
File diff suppressed because it is too large
Load diff
|
@ -1,35 +0,0 @@
|
|||
{
|
||||
"robot": {
|
||||
"3": [-2, 0, 0, 0, -100],
|
||||
"5": [4, -4, 10, 8, -100],
|
||||
"6": [5, -1, 0, 0, -100],
|
||||
"7": [-23, -2, 14, 5],
|
||||
"8": [5, -2, -3, 0, -100],
|
||||
"9": [5, -3],
|
||||
"10": [-22, -2, 12, 3],
|
||||
"11": [-1, 0, -2],
|
||||
"12": [5, -2, 6, 5],
|
||||
"13": [-3, 2, -7, -4],
|
||||
"15": [0, 0, -7, -2],
|
||||
"16": [1, 0, 0, 0, -100],
|
||||
"17": [1, 0, 0, 0, -100],
|
||||
"18": [-6, 4, -4, 0, -100],
|
||||
"19": [-21, 0, 14, 4],
|
||||
"20": [1, 0, 10, 5],
|
||||
"21": [10, -8, 12, 3, -5, 2],
|
||||
"22": [-10, 6, -12, 3, -100],
|
||||
"23": [-18, 16, -4],
|
||||
"24": [4, -2, -4],
|
||||
"25": [12, -9, -1, 2],
|
||||
"26": [-1, 0, 5]
|
||||
},
|
||||
|
||||
"spider": {
|
||||
"9": [0, 3],
|
||||
"10": [8, 5],
|
||||
"11": [1, 3],
|
||||
"14": [2, 1],
|
||||
"15": [3, 20, 0, 14],
|
||||
"17": [1, 1]
|
||||
}
|
||||
}
|
2
index.js
2
index.js
|
@ -252,7 +252,7 @@ app.get("/", function(req, res) {
|
|||
if (req.server.downloadsDisabled && process.platform == "linux") {
|
||||
downloadDisabled.forEach(x => { html = html.replace(`menu-${x}`, 'menuDisabled') })
|
||||
html = html.replace('id="dl" style="display: none', 'style="display: block')
|
||||
.replace('No active < span id="noLevel">daily</span> level!', '[Blocked by RobTop]')
|
||||
.replace('No active <span id="noLevel">daily</span> level!', '[Blocked by RobTop]')
|
||||
}
|
||||
if (html.includes('menuDisabled" src="../assets/category-weekly')) { // if weekly disabled, replace with featured
|
||||
html = html.replace('block" id="menu_weekly', 'none" id="menu_weekly')
|
||||
|
|
Loading…
Add table
Reference in a new issue