Compare commits
No commits in common. "4d5503115ea7bb5ecc8e72dbd14f7636368406f1" and "32034b7b6fc8b75028de76065e266d2f596ca824" have entirely different histories.
4d5503115e
...
32034b7b6f
|
@ -22,7 +22,7 @@ module.exports = {
|
||||||
greeting: 'Hi, I am aisha, your game host!',
|
greeting: 'Hi, I am aisha, your game host!',
|
||||||
usernamePrefix: '@',
|
usernamePrefix: '@',
|
||||||
channels: ['GamesNight'],
|
channels: ['GamesNight'],
|
||||||
games: ['mash', 'trivia', 'letters', 'duck', 'dice', 'ping', 'say', 'kill', 'uptime', 'help'],
|
games: ['mash', 'trivia', 'letters', 'duck', 'ping', 'say', 'kill', 'uptime', 'help'],
|
||||||
schatColors: {
|
schatColors: {
|
||||||
red: 'red',
|
red: 'red',
|
||||||
orange: 'orange',
|
orange: 'orange',
|
||||||
|
@ -53,8 +53,4 @@ module.exports = {
|
||||||
length: 9,
|
length: 9,
|
||||||
timeout: 60,
|
timeout: 60,
|
||||||
},
|
},
|
||||||
dice: {
|
|
||||||
maxRolls: 10,
|
|
||||||
maxFaces: 1000,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.15.0",
|
"version": "1.14.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.15.0",
|
"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.15.0",
|
"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": {
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const config = require('config');
|
|
||||||
const crypto = require('crypto');
|
|
||||||
|
|
||||||
const style = require('../utils/style');
|
|
||||||
|
|
||||||
const dieFaces = ['⚀', '⚁', '⚂', '⚃', '⚄', '⚅'];
|
|
||||||
|
|
||||||
function onCommand(args, context) {
|
|
||||||
const rolls = Number(args[0]) || 1;
|
|
||||||
const faces = Number(args[1]) || 6;
|
|
||||||
|
|
||||||
if (rolls > config.dice.maxRolls) {
|
|
||||||
context.sendMessage(`You can only roll ${config.dice.maxRolls} dice at one time`, context.room.id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rolls > config.dice.maxFaces) {
|
|
||||||
context.sendMessage(`Your dice can have at most ${config.dice.maxFace} faces`, context.room.id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = Array.from({ length: rolls }, () => {
|
|
||||||
const result = crypto.randomInt(1, faces);
|
|
||||||
|
|
||||||
// using U+2003 Em Space after dice to create double space that doesn't get filtered in SChat
|
|
||||||
return `${dieFaces[result - 1] ? `${style.grey(dieFaces[result - 1])} ` : ''}${style.bold(result)}`; // eslint-disable-line no-irregular-whitespace
|
|
||||||
});
|
|
||||||
|
|
||||||
context.sendMessage(results.join(' | '), context.room.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
onCommand,
|
|
||||||
commands: ['dice', 'roll'],
|
|
||||||
};
|
|
|
@ -3,7 +3,7 @@
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const style = require('./style');
|
const style = require('./style');
|
||||||
|
|
||||||
function getLeaders(points, user, ping = true) {
|
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] || userKey; // process the points file
|
const username = userKey.split(':')[1] || userKey; // process the points file
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue