2023-04-09 05:35:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-04-14 10:22:00 +00:00
|
|
|
//var AppPath = "file:///home/notify/develop/FreeKill";
|
2022-03-23 11:40:28 +00:00
|
|
|
var PHOTO_BACK_DIR = AppPath + "/image/photo/back/";
|
|
|
|
var PHOTO_DIR = AppPath + "/image/photo/";
|
|
|
|
var GENERAL_DIR = AppPath + "/image/generals/";
|
2022-05-01 10:37:13 +00:00
|
|
|
var GENERALCARD_DIR = AppPath + "/image/card/general/";
|
2022-03-23 11:40:28 +00:00
|
|
|
var STATE_DIR = AppPath + "/image/photo/state/";
|
2022-04-14 10:22:00 +00:00
|
|
|
var STATUS_DIR = AppPath + "/image/photo/status/";
|
2022-03-23 11:40:28 +00:00
|
|
|
var ROLE_DIR = AppPath + "/image/photo/role/";
|
|
|
|
var DEATH_DIR = AppPath + "/image/photo/death/";
|
|
|
|
var MAGATAMA_DIR = AppPath + "/image/photo/magatama/";
|
2023-04-04 17:05:06 +00:00
|
|
|
var LIMIT_SKILL_DIR = AppPath + "/image/photo/skill/";
|
2022-03-23 11:40:28 +00:00
|
|
|
var CARD_DIR = AppPath + "/image/card/";
|
|
|
|
var CARD_SUIT_DIR = AppPath + "/image/card/suit/";
|
2022-04-14 10:22:00 +00:00
|
|
|
var DELAYED_TRICK_DIR = AppPath + "/image/card/delayedTrick/";
|
|
|
|
var EQUIP_ICON_DIR = AppPath + "/image/card/equipIcon/";
|
|
|
|
var PIXANIM_DIR = AppPath + "/image/anim/"
|
2023-01-12 14:53:22 +00:00
|
|
|
var TILE_ICON_DIR = AppPath + "/image/button/tileicon/"
|
2023-03-20 06:53:56 +00:00
|
|
|
var LOBBY_IMG_DIR = AppPath + "/image/lobby/";
|
2023-02-15 11:54:35 +00:00
|
|
|
|
|
|
|
function getGeneralPicture(name) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const data = JSON.parse(Backend.callLuaFunction("GetGeneralData", [name]));
|
|
|
|
const extension = data.extension;
|
|
|
|
const path = AppPath + "/packages/" + extension + "/image/generals/" + name + ".jpg";
|
2023-02-15 11:54:35 +00:00
|
|
|
if (Backend.exists(path)) {
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
return GENERAL_DIR + "0.jpg";
|
|
|
|
}
|
|
|
|
|
2023-05-20 08:00:03 +00:00
|
|
|
function getCardPicture(cidOrName) {
|
|
|
|
let extension = "";
|
|
|
|
let name = "unknown";
|
|
|
|
if (typeof cidOrName === 'string') {
|
|
|
|
name = cidOrName;
|
|
|
|
extension = Backend.callLuaFunction("GetCardExtensionByName", [cidOrName]);
|
|
|
|
} else {
|
|
|
|
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
|
|
|
extension = data.extension;
|
|
|
|
name = data.name;
|
|
|
|
}
|
|
|
|
|
2023-02-15 11:54:35 +00:00
|
|
|
let path = AppPath + "/packages/" + extension + "/image/card/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) {
|
|
|
|
return path;
|
2023-03-09 04:19:16 +00:00
|
|
|
} else {
|
|
|
|
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
|
|
|
path = AppPath + "/packages/" + dir + "/image/card/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) return path;
|
|
|
|
}
|
2023-02-15 11:54:35 +00:00
|
|
|
}
|
|
|
|
return CARD_DIR + "unknown.png";
|
|
|
|
}
|
2023-04-04 18:21:59 +00:00
|
|
|
|
2023-06-04 11:31:44 +00:00
|
|
|
function getDelayedTrickPicture(name) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const extension = Backend.callLuaFunction("GetCardExtensionByName", [name]);
|
2023-06-04 11:31:44 +00:00
|
|
|
|
|
|
|
let path = AppPath + "/packages/" + extension + "/image/card/delayedTrick/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) {
|
|
|
|
return path;
|
|
|
|
} else {
|
|
|
|
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
|
|
|
path = AppPath + "/packages/" + dir + "/image/card/delayedTrick/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DELAYED_TRICK_DIR + "unknown.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-04 18:21:59 +00:00
|
|
|
function getEquipIcon(cid, icon) {
|
2023-06-09 09:23:02 +00:00
|
|
|
const data = JSON.parse(Backend.callLuaFunction("GetCardData", [cid]));
|
|
|
|
const extension = data.extension;
|
|
|
|
const name = icon || data.name;
|
2023-04-04 18:21:59 +00:00
|
|
|
let path = AppPath + "/packages/" + extension + "/image/card/equipIcon/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) {
|
|
|
|
return path;
|
|
|
|
} else {
|
|
|
|
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
|
|
|
path = AppPath + "/packages/" + dir + "/image/card/equipIcon/" + name + ".png";
|
|
|
|
if (Backend.exists(path)) return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EQUIP_ICON_DIR + "unknown.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPhotoBack(kingdom) {
|
|
|
|
let path = PHOTO_BACK_DIR + kingdom + ".png";
|
|
|
|
if (!Backend.exists(path)) {
|
|
|
|
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
|
|
|
path = AppPath + "/packages/" + dir + "/image/kingdom/" + kingdom + "-back.png";
|
|
|
|
if (Backend.exists(path)) return path;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return path;
|
|
|
|
}
|
2023-04-23 13:10:07 +00:00
|
|
|
return PHOTO_BACK_DIR + "unknown";
|
2023-04-04 18:21:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function getGeneralCardDir(kingdom) {
|
|
|
|
let path = GENERALCARD_DIR + kingdom + ".png";
|
|
|
|
if (!Backend.exists(path)) {
|
|
|
|
for (let dir of Backend.ls(AppPath + "/packages/")) {
|
|
|
|
path = AppPath + "/packages/" + dir + "/image/kingdom/" + kingdom + "-back.png";
|
|
|
|
if (Backend.exists(path))
|
|
|
|
return AppPath + "/packages/" + dir + "/image/kingdom/";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return GENERALCARD_DIR;
|
|
|
|
}
|
|
|
|
}
|