Weekly Stats + Other small fixes

This commit is contained in:
GDColon 2021-02-28 11:27:27 -05:00
parent 0d2046e745
commit 2fe2f5f926
13 changed files with 68 additions and 23 deletions

View file

@ -43,6 +43,7 @@ module.exports = async (app, req, res) => {
let outline = req.query.glow || account[28] || "0";
let topless = form == "bird" && req.query.topless
let drawLegs = !(req.query.noLegs > 0)
let autoSize = req.query.size == "auto"
let sizeParam = autoSize || (req.query.size && !isNaN(req.query.size))
if (outline == "0" || outline == "false") outline = false;
@ -57,7 +58,7 @@ module.exports = async (app, req, res) => {
glow = genImageName(isSpecial && '01', '2');
extra = genImageName(isSpecial && '01', 'extra');
}
const isSpecial = ['robot', 'spider'].includes(form);
let isSpecial = ['robot', 'spider'].includes(form);
setBaseIcons();
if (!fs.existsSync(fromIcons(icon)) || (isSpecial && !fs.existsSync(fromIcons(genImageName('02'))))) {
@ -85,10 +86,9 @@ module.exports = async (app, req, res) => {
let iconCode = `${req.query.form == "cursed" ? "cursed" : form}${topless ? "top" : ""}-${iconID}-${col1}-${col2}-${colG || "x"}-${colW || "x"}-${outline ? 1 : 0}`
if (!sizeParam && cache[iconCode]) return res.end(cache[iconCode].value)
if (!sizeParam && (!isSpecial || drawLegs) && cache[iconCode]) return res.end(cache[iconCode].value)
let useExtra = false
let originalOffset = icons[icon].spriteOffset;
let minusOrigOffset = function(x, y) { return x - originalOffset[y] }
let offset = icons[glow].spriteOffset.map(minusOrigOffset);
@ -148,7 +148,7 @@ module.exports = async (app, req, res) => {
if (!outline) ic.composite(await Jimp.read(ufoSprite), ufoCoords[0], ufoCoords[1], {mode: Jimp.BLEND_DESTINATION_OVER})
}
if (form == "robot" || req.query.form == "cursed") {
if (drawLegs && (form == "robot" || req.query.form == "cursed")) {
ic.contain(iconSize[0], 300, Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_TOP)
ic.contain(iconSize[0] + 200, 300, Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_TOP)
@ -203,7 +203,7 @@ module.exports = async (app, req, res) => {
}
else if (form == "spider") {
else if (drawLegs && form == "spider") {
let spiderBody;
ic.contain(iconSize[0], 300, Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_TOP)
@ -297,7 +297,7 @@ module.exports = async (app, req, res) => {
img.resize(imgSize, Jimp.AUTO)
}
img.getBuffer(Jimp.AUTO, (err, buffer) => {
if (!sizeParam) {
if (!sizeParam && drawLegs) {
cache[iconCode] = { value: buffer, timeoutID: setTimeout(function() {delete cache[iconCode]}, 10000000) } // 3 hour cache
if (usercode) cache[usercode] = { value: buffer, timeoutID: setTimeout(function() {delete cache[usercode]}, 300000) } // 5 min cache for player icons
}

View file

@ -28,7 +28,7 @@ module.exports = async (app, req, res, post) => {
let cell = tab.getCell(1, cellIndex).value
if (cell.startsWith("GoogleSpreadsheetFormulaError")) return res.send("-1")
let leaderboard = JSON.parse(cell)
let leaderboard = JSON.parse(cell.replace(/~( |$)/g, ""))
let gdFormatting = ""
leaderboard.forEach(x => {

View file

@ -720,6 +720,17 @@ input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
height: 25%;
}
.weeklyStuff {
display: none;
}
.ranking {
transform:scale(0.82) translate(-20.7vh, -20vh);
position: absolute;
height: 10%;
width: 12.5%;
}
#collectibles, .leaderboardStats {
font-size: 4.3vh;
white-space: nowrap;
@ -736,7 +747,7 @@ input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
.leaderboardStats img {
transform: translate(-20%, -7%);
height: 22%;
width: 4.3%;
}
#boomling {

BIN
assets/gdps/ausk_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
assets/gdps/ausk_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
assets/sort-week-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/sort-week.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,7 +1,7 @@
<head>
<title>Leaderboard</title>
<meta charset="utf-8">
<link href="../assets/css/browser.css?v=2"text/css" rel="stylesheet">
<link href="../assets/css/browser.css?v=3"text/css" rel="stylesheet">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-135255146-3"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', 'UA-135255146-3');</script>
<link rel="icon" href="../assets/trophy.png">
<meta id="meta-title" property="og:title" content="Leaderboards">
@ -53,8 +53,9 @@
<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%">
<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%">
<div class="sortDiv" style="position: relative; right: 10.5%; top: 0%; width: 0.1%; transform: translateY(-33.3%)">
<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="coins" title="Most coins" src="../assets/sort-coins.png" height="11%">
<img class="gdButton sortButton" style="margin-bottom: 1vh" sort="demons" title="Most demons" src="../assets/sort-demons.png" height="11%">
@ -84,9 +85,9 @@
<script>
let sort = "stars"
let useTrophies = false
let modMode = false
let weekly = false
let showWeek = localStorage.weeklyStats == "1"
let trophies = [1, 3, 10, 25, 50, 75, 100]
let boomColors = ["red", "orange", "yellow", "green", "teal", "blue", "pink"]
@ -105,6 +106,8 @@ let accurateText =
let creatorText =
`The <cg>Creators Leaderboard</cg> is sorted by <cg>creator points</cg>, rather than stars. A player's <cg>creator points</cg> (CP) is calculated by counting their number of <cy>star rated</cy> levels, plus an extra point for every level that has been <cb>featured</cb>, plus an additional point for <co>epic rated</co> levels.`
if (showWeek) $('#weeklyStats').attr('src', '../assets/sort-week-on.png')
function infoText(text) { $('#infoText').html(text) }
infoText(accurateText)
@ -136,11 +139,12 @@ function leaderboard(val) {
if (val == type && res != -1 && res.length) res.forEach((x, y) => {
let wp = x.weeklyProgress || {}
$('#searchBox').append(`<div class="searchresult leaderboardSlot">
${x.moderator ? `<img title="${x.moderator == 2 ? "Elder " : ""}Moderator" src="../assets/mod${x.moderator == 2 ? "-elder" : ""}.png" style="height: 30%; cursor: help; padding-right: 1.6%; transform: translateY(0.7vh)">` : ""}
<h2 class="small inline gdButton" style="margin-top: 1.5%${x.moderator == 2 ? "; color: #FF9977;" : ""}"><a href="${onePointNine ? `../search/${x.playerID}?user` : `../u/${x.username}`}">${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="height: 19%; transform: translate(-25%, -10%);" title="Stars"></h3>
style="width: 4vh; transform: translate(-25%, -10%);" title="Stars"></h3>
<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">`}
@ -150,12 +154,17 @@ function leaderboard(val) {
${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>
<div class="center ranking" style="position:absolute; transform:scale(0.82) translate(-20.7vh, -20vh); height: 10%; width: 12.5%;">
${useTrophies && 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)">` :
<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: 2%">${y+1}</h2>
</div>
</div>`)
@ -168,6 +177,7 @@ function leaderboard(val) {
</div>`)
} */
weeklyAdjust()
$('#searchBox').append('<div style="height: 4.5%"></div>')
$('#loading').hide();
$('.lazyLoad').Lazy({ appendScroll: '#searchBox' });
@ -244,5 +254,19 @@ $('#modSort').click(function() {
leaderboard(type)
})
function weeklyAdjust() {
let weekEnabled = showWeek && type == "accurate"
$('.leaderboardSlot').css('height', weekEnabled ? '33%' : '25%')
$('.weeklyStuff').css('display', weekEnabled ? 'block' : 'none')
$('.ranking').css('transform', `scale(0.82) translate(-20.7vh, -${weekEnabled ? 24 : 20}vh)`)
}
$('#weeklyStats').click(function() {
showWeek = !showWeek
localStorage.weeklyStats = showWeek + 0
$(this).attr('src', `../assets/sort-week${showWeek ? "-on" : ""}.png`)
weeklyAdjust()
})
</script>

View file

@ -94,7 +94,7 @@ function leaderboard() {
<h3 class="inline lessSpaced leaderboardStats" style="transform:translateY(-10%)">
${x.percent}%
${'<div class="inline" style="width: 12%"><img class="valign" src="../assets/silvercoin.png" style="height: 33%"></div>'.repeat(x.coins)}
${'<div class="inline" style="width: 12%"><img class="valign" src="../assets/silvercoin.png" style="height: 33%; width: auto"></div>'.repeat(x.coins)}
</h3>
<div class="center" style="position:absolute; transform:scale(0.82) translate(-28vh, -10vh); height: 10%; width: 12.5%;">

View file

@ -58,7 +58,7 @@
let line = 0
let dialogue = [
"Hi there!", "We got IP banned again :)", "As usual we don't know why...", "Lately the GD servers have been slow",
"Hi there!", "We got IP banned again :)", "As usual we don't know why...", "Bit of a shame honestly", "We had a good streak going", "Lately the GD servers have been slow",
"So maybe Rob tried to fix it...", "...by killing GDBrowser??", "Look I really don't know", "Anyways uhhh",
"Hopefully we're back soon", "You're stuck with me for now", "Some features still work though!",
"Accurate leaderboard works fine", "Icon kit too, mostly", "Also, keep in mind we're on GitHub", "So you can use GDBrowser locally",

View file

@ -37,7 +37,7 @@
<p class="bigger center" style="line-height: 5vh; margin-top: 1.5vh;">
Delete all saved online levels?<br><cy>Levels will be cleared from your browser.</cy>
</p>
<img src="../assets/btn-cancel.png" height=25%; class="gdButton center closeWindow">
<img src="../assets/btn-cancel-green.png" height=25%; class="gdButton center closeWindow">
<img src="../assets/btn-delete.png" height=25%; id="purgeSaved" class="gdButton center sideSpaceB">
</div>
</div>

View file

@ -35,6 +35,7 @@
[ "mulpan", 90, 2, 12, 1 ],
[ "npesta", 30, 2, 12, 0 ],
[ "Norcda Childa", 53, 37, 12, 1 ],
[ "OmegaFalcon", 11, 22, 4, 1 ],
[ "Partition", 3, 4, 3, 0 ],
[ "RedHuseey", 98, 9, 12, 0 ],
[ "Riot", 35, 7, 3, 1 ],

View file

@ -99,12 +99,12 @@
},
{
"name": "Geometry Dash Gravity",
"name": "GD Gravity",
"link": "https://discord.gg/qpUJgBC",
"author": "Sai",
"authorLink": "https://youtube.com/channel/UCvYEPVUVVLDhwfHCzgVdIIg",
"id": "gravity",
"endpoint": "http://gravity4.000webhostapp.com/"
"endpoint": "http://gravity5.000webhostapp.com/"
},
{
@ -119,8 +119,8 @@
{
"name": "Supreme GDPS",
"link": "https://discord.gg/pAU42pbREb",
"author": "Mr.Scatman7",
"authorLink": "https://youtube.com/c/MrScatman7",
"author": "Optimal",
"authorLink": "https://youtube.com/c/Optimal7",
"id": "supreme",
"endpoint": "http://gdps.mathieuar.fr/supreme1/"
},
@ -150,5 +150,14 @@
"authorLink": "https://www.youtube.com/channel/UCg9HipnGYtfwIax4bLTTzUQ",
"id": "resurrection",
"endpoint": "http://gdpsresu.000webhostapp.com/"
},
{
"name": "Ausks GDPS",
"link": "https://discord.gg/AEBhCaa",
"author": "Ausk",
"authorLink": "https://www.youtube.com/channel/UCRbHwfh_BlMUfTZOvquDuRA",
"id": "ausk",
"endpoint": "http://gdps.mathieuar.fr/ausk____/"
}
]