added unique sprites support
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
import AdmZip from "adm-zip";
|
||||
import fs from "node:fs";
|
||||
|
||||
const SPECIALS = ["sp", "spm"];
|
||||
const DATA = JSON.parse(fs.readFileSync("./data.json", "utf-8"));
|
||||
const chapters = fs.readdirSync("../_sprites/original");
|
||||
|
||||
const SPECIALS = ["sp", "spm"];
|
||||
const UNIQUES = fs
|
||||
.readFileSync("../_sprites/unique.txt", "utf-8")
|
||||
.split("УНИКАЛЬНЫЕ ДЛЯ РУСИФИКАТОРА:")
|
||||
.at(-1)
|
||||
?.split("\n");
|
||||
|
||||
UNIQUES?.shift();
|
||||
if (UNIQUES?.at(-1) == "") UNIQUES?.pop();
|
||||
|
||||
function add_singles(chapter, sprite_name) {
|
||||
const img_name = `${sprite_name}.png`;
|
||||
@@ -97,4 +105,25 @@ for (const chapter of chapters) {
|
||||
}
|
||||
}
|
||||
|
||||
if (UNIQUES != undefined) {
|
||||
for (const unique of UNIQUES) {
|
||||
const uniqueChapter = unique.split("/")[0];
|
||||
const uniqueName = unique.split("/")[1];
|
||||
console.log(uniqueChapter, uniqueName);
|
||||
|
||||
if (fs.existsSync(`../_sprites/translation/${uniqueName}.png`))
|
||||
fs.copyFileSync(
|
||||
`../_sprites/translation/${uniqueName}.png`,
|
||||
`../_sprites/sorted/${uniqueChapter}/${uniqueName}.png`
|
||||
);
|
||||
|
||||
if (fs.existsSync(`../_sprites/translation/${uniqueName}`))
|
||||
fs.cpSync(
|
||||
`../_sprites/translation/${uniqueName}`,
|
||||
`../_sprites/sorted/${uniqueChapter}/${uniqueName}`,
|
||||
{ recursive: true, force: true }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// :D
|
||||
|
||||
Reference in New Issue
Block a user