modify [function] processPrompt

This commit is contained in:
Ho-spair 2024-05-15 17:05:30 +08:00
parent d11bf58cb4
commit d5832b824b
2 changed files with 18 additions and 10 deletions

View File

@ -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;
}

View File

@ -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;
}