2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-04-14 10:22:00 +00:00
|
|
|
function convertNumber(number) {
|
2022-04-30 07:27:56 +00:00
|
|
|
if (number === 1)
|
|
|
|
return "A";
|
|
|
|
if (number >= 2 && number <= 10)
|
|
|
|
return number;
|
|
|
|
if (number >= 11 && number <= 13) {
|
|
|
|
const strs = ["J", "Q", "K"];
|
|
|
|
return strs[number - 11];
|
|
|
|
}
|
|
|
|
return "";
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
|
|
|
|
2024-01-24 19:23:29 +00:00
|
|
|
function processPrompt(prompt) {
|
|
|
|
const data = prompt.split(":");
|
|
|
|
let raw = luatr(data[0]);
|
|
|
|
const src = parseInt(data[1]);
|
|
|
|
const dest = parseInt(data[2]);
|
|
|
|
if (raw.match("%src"))
|
|
|
|
raw = raw.replace(/%src/g, luatr(getPhoto(src).general));
|
|
|
|
if (raw.match("%dest"))
|
|
|
|
raw = raw.replace(/%dest/g, luatr(getPhoto(dest).general));
|
2024-05-15 09:05:30 +00:00
|
|
|
|
|
|
|
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]);
|
|
|
|
}
|
2024-01-24 19:23:29 +00:00
|
|
|
return raw;
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Array.prototype.prepend = function() {
|
2022-04-30 07:27:56 +00:00
|
|
|
this.splice(0, 0, ...arguments);
|
2022-04-14 10:22:00 +00:00
|
|
|
}
|