Compare commits

...

2 Commits

Author SHA1 Message Date
Niels Simenon ee50935339 1.25.5 2023-04-10 16:50:41 +02:00
Niels Simenon 2860630921 Changed default number name from big to large, added nums to short commands. 2023-04-10 16:50:39 +02:00
4 changed files with 16 additions and 16 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "schat2-clive",
"version": "1.25.4",
"version": "1.25.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "schat2-clive",
"version": "1.25.4",
"version": "1.25.5",
"license": "ISC",
"dependencies": {
"better-sqlite3": "^8.3.0",

View File

@ -1,6 +1,6 @@
{
"name": "schat2-clive",
"version": "1.25.4",
"version": "1.25.5",
"description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js",
"scripts": {

View File

@ -174,7 +174,7 @@ function onMessage(message, context) {
}
if (game?.state === 'letters') {
const multi = message.body.match(/\b[vc]{2,}\b/i)?.[0];
const multi = message.body.match(/\b[vc]{2,}$/i)?.[0];
if (multi) {
pickLetters(multi.toLowerCase(), context);

View File

@ -181,7 +181,7 @@ async function play(context) {
}
}
function pickBig() {
function pickLarge() {
return pickRandom([100, 75, 50, 25]);
}
@ -196,17 +196,17 @@ function pickNumbers(type, context) {
return;
}
if (type === 'big') {
game.numbers = game.numbers.concat(pickBig());
if (type === 'large') {
game.numbers = game.numbers.concat(pickLarge());
}
if (type === 'small') {
game.numbers = game.numbers.concat(pickSmall());
}
if (type !== 'small' && type !== 'big') {
if (type !== 'small' && type !== 'large') {
type.toLowerCase().slice(0, config.numbers.length - game.numbers.length).split('').forEach((typeKey) => {
game.numbers = game.numbers.concat(typeKey === 'b' || typeKey === 'l' ? pickBig() : pickSmall());
game.numbers = game.numbers.concat(typeKey === 'b' || typeKey === 'l' ? pickLarge() : pickSmall());
});
}
@ -215,7 +215,7 @@ function pickNumbers(type, context) {
return;
}
context.sendMessage(`${getBoard(context)} Would you like a big number or a small one?`, context.room.id);
context.sendMessage(`${getBoard(context)} Would you like a large number or a small one?`, context.room.id);
}
function playSolution(solution, context) {
@ -307,7 +307,7 @@ function start(context, numbers) {
return;
}
context.sendMessage('Let\'s play the numbers! Would you like a big number or a small one?', context.room.id);
context.sendMessage('Let\'s play the numbers! Would you like a large number or a small one?', context.room.id);
}
function solve(calculation, context) {
@ -347,15 +347,15 @@ function onMessage(message, context) {
const body = message.originalBody || message.body; // * gets resolved to <em>
if (game?.state === 'pick') {
const multi = body.match(/\b[bls]{2,}\b/i)?.[0];
const multi = body.match(/\b[bls]{2,}$/i)?.[0];
if (multi) {
pickNumbers(multi.toLowerCase(), context);
return;
}
if (/big/i.test(body)) {
pickNumbers('big', context);
if (/large|big/i.test(body)) {
pickNumbers('large', context);
return;
}
@ -373,6 +373,6 @@ function onMessage(message, context) {
module.exports = {
onCommand,
onMessage,
commands: ['numsgo', 'numgo', 'calculate', 'calc', 'solve'],
help: `Reach the target number using only the ${config.numbers.length} numbers on the board; you do not have to use all of them. You may use addition, subtraction, multiplication and divisions, but each calculation must result in a whole number. You can score points for solutions up to ${config.numbers.points.length} away from the target, but only the first best solution gets the points. Quick-start with ${config.prefix}numsgo, or use ${config.prefix}numbers to fill the board by manually selecting a random *large* or *big* number (100, 75, 50, 25), a random *small* number (1-10), or multiple at once like LLSSSS.`, // eslint-disable-line max-len
commands: ['nums', 'numsgo', 'numgo', 'calculate', 'calc', 'solve'],
help: `Reach the target number using only the ${config.numbers.length} numbers on the board; you do not have to use all of them. You may use addition, subtraction, multiplication and divisions, but each calculation must result in a whole number. You can score points for solutions up to ${config.numbers.points.length - 1} away from the target, but only the first best solution gets the points. Quick-start with ${config.prefix}numsgo, or use ${config.prefix}numbers to fill the board by manually selecting a random *large* or *big* number (100, 75, 50, 25), a random *small* number (1-10), or multiple at once like LLSSSS.`, // eslint-disable-line max-len
};