hash-command-arbitrary
Avril 4 years ago
parent e3ec533df0
commit 446510d021
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -392,7 +392,7 @@ OS.karada = function (body) {
return output;
}
var dice_re = /(#dame|#tutturu|#muri|#flip|#when|#du|#pyu|#pcount|#test|#sleep|#janken|#8ball|#imfey|#\?(?:\[(?:\w,*)+\])?|#\d{0,2}d\d{1,4}(?:[+-]\d{1,4})?)/i;
var dice_re = /(#tea|#dame|#tutturu|#muri|#flip|#when|#du|#pyu|#pcount|#test|#sleep|#janken|#8ball|#imfey|#\?(?:\[(?:\w,*)+\])?|#\d{0,2}d\d{1,4}(?:[+-]\d{1,4})?)/i;
exports.dice_re = dice_re;
var WHEN = [
@ -472,6 +472,8 @@ function parse_dice(frag)
}
if (frag == '#pyu' || frag == '#pcount' || frag == '#du')
return {n: 1, faces: 2};
if (frag == '#tea')
return {n: 1, faces: 2};
if (frag == '#flip')
return {n: 1, faces: 2};
if (frag == '#imfey')
@ -546,6 +548,8 @@ function readable_dice(bit, d) {
return '#pyu (' + d[0]+ ')';
if (bit == '#pcount')
return '#pcount (' + d[0] + ')';
if (bit == '#tea')
return '#tea (' + ((d[0] === true)?"now!":d[0]+" hours") + ')';
if (bit == '#flip')
return '#flip (' + (d[1] == 2) + ')';
if (bit == '#imfey')
@ -554,7 +558,7 @@ function readable_dice(bit, d) {
return '#8ball (' + EIGHT_BALL[d[1] - 1] + ')';
if (bit == '#when')
{
var f = function(n) {
const f = (n) => {
if(WHEN[n] === null)
return f(n-1);
else return WHEN[n];

@ -52,7 +52,7 @@ function getLoli() {
});
// console.log("AAAA "+JSON.stringify(lolis));
// console.log("AAAA "+JSON.stringify(lolis));
});
return ret;
}
@ -99,6 +99,18 @@ exports.roll_dice = function (frag, post, extra) {
dice.push([ds]);
}
else if (ms[i] == '#tea')
{
const hours = new Date().getUTCHours();
if ( (hours >= 14 && hours< 16) || (hours >= 2 && hours <4))
dice.push([true]);
else {
const fxdate = (h) => h<0?fxdate(24+h):h;
const morning_session = fxdate(14 - hours);
const evening_session = fxdate(2 - hours);
dice.push([Math.min(morning_session, evening_session)]);
}
}
else if(ms[i] == '#pyu') {
if( dice.length + (post.dice ? post.dice.length : 0) < rollLimit)
pyu += 1;

Loading…
Cancel
Save