feat: add rollp cbs

This commit is contained in:
kwaroran
2024-06-03 17:50:47 +09:00
parent eecfa3cc21
commit a138be7b90

View File

@@ -1013,7 +1013,8 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
return arr[randomIndex]?.replace(/§X/g, ',') ?? ''
}
}
if(p1.startsWith('roll')){
if(p1.startsWith('roll:') || p1.startsWith('rollp:')){
const p = p1.startsWith('rollp:')
const arr = p1.split(/\:|\ /g)
let ina = arr.at(-1)
@@ -1025,6 +1026,11 @@ const matcher = (p1:string,matcherArg:matcherArg) => {
if(isNaN(maxRoll)){
return 'NaN'
}
if(p){
const selchar = db.characters[get(selectedCharID)]
const rand = sfc32(uuidtoNumber(selchar.chaId), chatID, uuidtoNumber(selchar.chaId), chatID)
return (Math.floor(rand() * maxRoll) + 1).toString()
}
return (Math.floor(Math.random() * maxRoll) + 1).toString()
}
if(p1.startsWith('datetimeformat')){