Readded icons to accurate leaderboard

This commit is contained in:
GDColon 2020-11-14 16:14:29 -05:00
parent b77a6c73d4
commit bc5d0b8d81
3 changed files with 5 additions and 3 deletions

View file

@ -1,6 +1,7 @@
const {GoogleSpreadsheet} = require('google-spreadsheet');
const sheet = new GoogleSpreadsheet('1ADIJvAkL0XHGBDhO7PP9aQOuK3mPIKB2cVPbshuBBHc'); // accurate leaderboard spreadsheet
let forms = ['cube', 'ship', 'ball', 'ufo', 'wave', 'robot', 'spider']
let lastIndex = {"stars": 0, "coins": 0, "demons": 0}
let caches = [{"stars": null, "coins": null, "demons": null}, {"stars": null, "coins": null, "demons": null}] // 0 for JSON, 1 for GD
@ -22,7 +23,7 @@ module.exports = async (app, req, res, post) => {
let leaderboard = JSON.parse(tab.getCell(1, type == "demons" ? 2 : type == "coins" ? 1 : 0).value)
let gdFormatting = ""
leaderboard.forEach(x => gdFormatting += `1:${x.username}:2:${x.playerID}:13:${x.coins}:17:${x.usercoins}:6:${x.rank}:9:1:10:10:11:14:14:0:15:0:16:${x.accountID}:3:${x.stars}:8:${x.cp}:46:${x.diamonds}:4:${x.demons}|`)
leaderboard.forEach(x => gdFormatting += `1:${x.username}:2:${x.playerID}:13:${x.coins}:17:${x.usercoins}:6:${x.rank}:9:${x.icon.icon}:10:${x.icon.col1}:11:${x.icon.col2}:14:${forms.indexOf(x.icon.form)}:15:${x.icon.glow ? 2 : 0}:16:${x.accountID}:3:${x.stars}:8:${x.cp}:46:${x.diamonds}:4:${x.demons}|`)
caches[0][type] = JSON.stringify(leaderboard)
caches[1][type] = gdFormatting
lastIndex[type] = Date.now()

View file

@ -349,7 +349,7 @@
<p>coins: Number of secret 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 (Not supported by accurate leaderboard)</p>
<p>icon: The icon preview showed next to the player's name</p>
</div>
<br>

View file

@ -75,6 +75,7 @@
<script>
let sort = "stars"
let useTrophies = false
let trophies = [1, 3, 10, 25, 50, 75, 100]
let top250Text =
@ -126,7 +127,7 @@ function leaderboard(val) {
<div class="center ranking" style="position:absolute; transform:scale(0.82) translate(-20.7vh, -20vh); height: 10%; width: 12.5%;">
${type == "accurate" ? `<img class="spaced" src="./trophies/${trophies.findIndex(z => x.rank <= z) + 1}.png" height="150%" style="margin-bottom: 0%; transform:scale(1.1)">` :
${useTrophies && type == "accurate" ? `<img class="spaced" src="./trophies/${trophies.findIndex(z => x.rank <= 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%">${x.rank}</h2>