feat: some custom url support.

This commit is contained in:
Rintim 2024-04-21 21:55:11 +08:00
parent 68129fc8c8
commit 3215b0caa9
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
2 changed files with 23 additions and 17 deletions

View File

@ -4751,7 +4751,8 @@ export class Game {
const audiosrc = "die:ext:" + extname + "/" + j + ".mp3"; const audiosrc = "die:ext:" + extname + "/" + j + ".mp3";
if ( if (
!pack[i][j][4].some( !pack[i][j][4].some(
(str) => typeof str == "string" && /^(?:db:extension-|ext:):(?:.+)/.test(str) (str) =>
typeof str == "string" && /^(?:db:extension-.+?|ext|img):(?:.+)/.test(str)
) )
) )
pack[i][j][4].add(imgsrc); pack[i][j][4].add(imgsrc);
@ -4800,17 +4801,19 @@ export class Game {
if (info.audio == true) { if (info.audio == true) {
info.audio = "ext:" + extname; info.audio = "ext:" + extname;
} }
if (info.fullskin) { if (!info.image || typeof info.image !== "string") {
if (_status.evaluatingExtension) { if (info.fullskin) {
info.image = "db:extension-" + extname + ":" + name + ".png"; if (_status.evaluatingExtension) {
} else { info.image = "db:extension-" + extname + ":" + name + ".png";
info.image = "ext:" + extname + "/" + name + ".png"; } else {
} info.image = "ext:" + extname + "/" + name + ".png";
} else if (info.fullimage) { }
if (_status.evaluatingExtension) { } else if (info.fullimage) {
info.image = "db:extension-" + extname + ":" + name + ".jpg"; if (_status.evaluatingExtension) {
} else { info.image = "db:extension-" + extname + ":" + name + ".jpg";
info.image = "ext:" + extname + "/" + name + ".jpg"; } else {
info.image = "ext:" + extname + "/" + name + ".jpg";
}
} }
} }
lib.card[name] = info; lib.card[name] = info;
@ -4930,10 +4933,14 @@ export class Game {
lib.translate[name] = info2.translate; lib.translate[name] = info2.translate;
let imgsrc; let imgsrc;
let extname = _status.extension || info2.extension; let extname = _status.extension || info2.extension;
if (_status.evaluatingExtension) { if (info.splash) {
imgsrc = "extension-" + extname + ":" + name + ".jpg"; imgsrc = info.splash;
} else { } else {
imgsrc = "ext:" + extname + "/" + name + ".jpg"; if (_status.evaluatingExtension) {
imgsrc = "extension-" + extname + ":" + name + ".jpg";
} else {
imgsrc = "ext:" + extname + "/" + name + ".jpg";
}
} }
lib.mode[name] = { lib.mode[name] = {
name: info2.translate, name: info2.translate,

View File

@ -171,8 +171,7 @@ Reflect.defineProperty(HTMLDivElement.prototype, "setBackground", {
if (value.startsWith("img:")) { if (value.startsWith("img:")) {
imgPrefixUrl = value.slice(4); imgPrefixUrl = value.slice(4);
break; break;
} } else if (value.startsWith("ext:")) {
if (value.startsWith("ext:")) {
extimage = value; extimage = value;
break; break;
} else if (value.startsWith("db:")) { } else if (value.startsWith("db:")) {