This commit is contained in:
TheGiddyLimit
2024-03-10 21:53:34 +00:00
parent b323d4123e
commit f00d1f3833
272 changed files with 24017 additions and 9350 deletions

View File

@@ -195,6 +195,8 @@ Renderer.dice = {
// endregion
// region Event handling
RE_PROMPT: /#\$prompt_number:?([^$]*)\$#/g,
async pRollerClickUseData (evt, ele) {
evt.stopPropagation();
evt.preventDefault();
@@ -233,10 +235,8 @@ Renderer.dice = {
if (!chosenRollData) return;
const rePrompt = /#\$prompt_number:?([^$]*)\$#/g;
const results = [];
let m;
while ((m = rePrompt.exec(chosenRollData.toRoll))) {
for (const m of chosenRollData.toRoll.matchAll(Renderer.dice.RE_PROMPT)) {
const optionsRaw = m[1];
const opts = {};
if (optionsRaw) {
@@ -263,8 +263,7 @@ Renderer.dice = {
}
const rollDataCpy = MiscUtil.copyFast(chosenRollData);
rePrompt.lastIndex = 0;
rollDataCpy.toRoll = rollDataCpy.toRoll.replace(rePrompt, () => results.shift());
rollDataCpy.toRoll = rollDataCpy.toRoll.replace(Renderer.dice.RE_PROMPT, () => results.shift());
// If there's a prompt, prompt the user to select the dice
let rollDataCpyToRoll;