|
|
|
@ -388,7 +388,7 @@ OS.karada = function (body) {
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var dice_re = /(#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 = /(#dame|#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 = [
|
|
|
|
@ -444,7 +444,10 @@ var IMFEY = [
|
|
|
|
|
'elwind!',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
function parse_dice(frag) {
|
|
|
|
|
function parse_dice(frag)
|
|
|
|
|
{
|
|
|
|
|
if(/^#(dame|muri)$/i.test(frag))
|
|
|
|
|
return {n:1, faces:2};
|
|
|
|
|
if(frag == '#loli') {
|
|
|
|
|
return {n:1, faces:3};
|
|
|
|
|
}
|
|
|
|
@ -492,6 +495,15 @@ function parse_dice(frag) {
|
|
|
|
|
}
|
|
|
|
|
exports.parse_dice = parse_dice;
|
|
|
|
|
|
|
|
|
|
const audio_root = "/s/audio";
|
|
|
|
|
|
|
|
|
|
function readable_audio(bit, d) {
|
|
|
|
|
if (bit=='#dame')
|
|
|
|
|
return "dame.wav";
|
|
|
|
|
else if (bit=='#muri')
|
|
|
|
|
return "muri.wav";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function readable_dice(bit, d) {
|
|
|
|
|
if(bit == '#loli') {
|
|
|
|
|
return "you should not see this";
|
|
|
|
@ -591,7 +603,13 @@ OS.geimu = function (text) {
|
|
|
|
|
var d = this.dice.shift();
|
|
|
|
|
this.callback(safe('<strong>'));
|
|
|
|
|
this.strong = true; // for client DOM insertion
|
|
|
|
|
if(bit == "#loli") {
|
|
|
|
|
var audio = readable_audio(bit,d);
|
|
|
|
|
if(audio)
|
|
|
|
|
{
|
|
|
|
|
this.callback(safe("<a style='text-decoration:none;' href='javascript:void(0);' onclick='this.nextSibling.play();'>"+bit+"</a>"));
|
|
|
|
|
this.callback(safe("<audio src='"+audio_root+"/"+audio+"'></audio>"));
|
|
|
|
|
}
|
|
|
|
|
else if(bit == "#loli") {
|
|
|
|
|
this.callback(safe("<a href='"+d[0]+"' target='_blank' rel='noopener noreferrer'><img src='"+d[1]+"'></img></a>"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|