From d5832b824bc41bbca12d29ff1a1fcd83ba675370 Mon Sep 17 00:00:00 2001 From: Ho-spair Date: Wed, 15 May 2024 17:05:30 +0800 Subject: [PATCH] modify [function] processPrompt --- Fk/Pages/RoomLogic.js | 14 +++++++++----- Fk/util.js | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Fk/Pages/RoomLogic.js b/Fk/Pages/RoomLogic.js index 00b6f30f..4fce22f9 100644 --- a/Fk/Pages/RoomLogic.js +++ b/Fk/Pages/RoomLogic.js @@ -542,11 +542,15 @@ function processPrompt(prompt) { if (raw.match("%src")) raw = raw.replace(/%src/g, getPlayerStr(src)); if (raw.match("%dest")) - raw = raw.replace(/%dest/g, getPlayerStr(dest)); - if (raw.match("%arg2")) - raw = raw.replace(/%arg2/g, luatr(data[4])); - if (raw.match("%arg")) - raw = raw.replace(/%arg/g, luatr(data[3])); + raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general)); + + if (data.length > 3) { + for (let i = 4; i < data.length; i++) { + raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]); + } + + raw = raw.replace(new RegExp("%arg", "g"), data[3]); + } return raw; } diff --git a/Fk/util.js b/Fk/util.js index 40273a7d..ea46cc12 100644 --- a/Fk/util.js +++ b/Fk/util.js @@ -34,11 +34,15 @@ function processPrompt(prompt) { if (raw.match("%src")) raw = raw.replace(/%src/g, getPlayerStr(src)); if (raw.match("%dest")) - raw = raw.replace(/%dest/g, getPlayerStr(dest)); - if (raw.match("%arg2")) - raw = raw.replace(/%arg2/g, luatr(data[4])); - if (raw.match("%arg")) - raw = raw.replace(/%arg/g, luatr(data[3])); + raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general)); + + if (data.length > 3) { + for (let i = 4; i < data.length; i++) { + raw = raw.replace(new RegExp("%arg" + (i - 2), "g"), data[i]); + } + + raw = raw.replace(new RegExp("%arg", "g"), data[3]); + } return raw; }