Compare commits
2 Commits
77a94d17ec
...
32034b7b6f
Author | SHA1 | Date |
---|---|---|
|
32034b7b6f | |
|
5d58d434b8 |
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.14.2",
|
"version": "1.14.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.14.2",
|
"version": "1.14.3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.14.2",
|
"version": "1.14.3",
|
||||||
"description": "Game host for SChat 2-powered chat sites",
|
"description": "Game host for SChat 2-powered chat sites",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -73,7 +73,7 @@ function getLeaderboard(game, { user, room, command }) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.sendMessage(`The top ${Math.min(Object.keys(leaderboard).length, 10)} ${style.italic(game.name)} players are: ${getLeaders(leaderboard, user)}`, room.id);
|
game.sendMessage(`The top ${Math.min(Object.keys(leaderboard).length, 10)} ${style.italic(game.name)} players are: ${getLeaders(leaderboard, user, false)}`, room.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable no-irregular-whitespace */
|
/* eslint-disable no-irregular-whitespace */
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const style = require('./style');
|
const style = require('./style');
|
||||||
|
|
||||||
function getLeaders(points, _user) {
|
function getLeaders(points, user, ping = false) {
|
||||||
return Object.entries(points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([userKey, score], index) => {
|
return Object.entries(points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([userKey, score], index) => {
|
||||||
const username = userKey.split(':')[1]; // process the points file
|
const username = userKey.split(':')[1] || userKey; // process the points file
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return `${style.bold(style.yellow(`${config.usernamePrefix}${username}`))} with ${style.bold(`${score}`)} points`;
|
return `${style.bold(style.yellow(`${ping ? config.usernamePrefix : ''}${username}`))} with ${style.bold(`${score}`)} points`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${style.bold(style.cyan(`${config.usernamePrefix}${username}`))} with ${style.bold(`${score}`)} points`;
|
return `${style.bold(style.cyan(`${ping ? config.usernamePrefix : ''}${username}`))} with ${style.bold(`${score}`)} points`;
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue