added spm_ support
This commit is contained in:
@@ -4,6 +4,8 @@ import fs from "node:fs";
|
||||
const DATA = JSON.parse(fs.readFileSync("./data.json", "utf-8"));
|
||||
const chapters = fs.readdirSync("../_sprites/original");
|
||||
|
||||
const SPECIALS = ["sp", "spm"];
|
||||
|
||||
function add_singles(chapter, sprite_name) {
|
||||
const img_name = `${sprite_name}.png`;
|
||||
if (!fs.existsSync(`../_sprites/translation/${img_name}`)) return;
|
||||
@@ -13,11 +15,13 @@ function add_singles(chapter, sprite_name) {
|
||||
`../_sprites/sorted/${chapter}/${img_name}`
|
||||
);
|
||||
|
||||
if (fs.existsSync(`../_sprites/translation/sp_${img_name}`)) {
|
||||
fs.copyFileSync(
|
||||
`../_sprites/translation/sp_${img_name}`,
|
||||
`../_sprites/sorted/${chapter}/sp_${img_name}`
|
||||
);
|
||||
for (const special of SPECIALS) {
|
||||
if (fs.existsSync(`../_sprites/translation/${special}_${img_name}`)) {
|
||||
fs.copyFileSync(
|
||||
`../_sprites/translation/${special}_${img_name}`,
|
||||
`../_sprites/sorted/${chapter}/${special}_${img_name}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,36 +37,41 @@ function add_animations(chapter, sprite_name) {
|
||||
);
|
||||
} else return;
|
||||
|
||||
if (fs.existsSync(`../_sprites/translation/sp_${sprite_name}`)) {
|
||||
fs.cpSync(
|
||||
`../_sprites/original/${chapter}/${sprite_name}`,
|
||||
`../_sprites/sorted/${chapter}/sp_${sprite_name}`,
|
||||
{ recursive: true, force: true }
|
||||
);
|
||||
for (const special of SPECIALS) {
|
||||
if (fs.existsSync(`../_sprites/translation/${special}_${sprite_name}`)) {
|
||||
fs.cpSync(
|
||||
`../_sprites/original/${chapter}/${sprite_name}`,
|
||||
`../_sprites/sorted/${chapter}/${special}_${sprite_name}`,
|
||||
{ recursive: true, force: true }
|
||||
);
|
||||
|
||||
for (const file of fs.readdirSync(
|
||||
`../_sprites/sorted/${chapter}/sp_${sprite_name}`
|
||||
)) {
|
||||
const oldPath = `../_sprites/sorted/${chapter}/sp_${sprite_name}/${file}`;
|
||||
const newPath = `../_sprites/sorted/${chapter}/sp_${sprite_name}/sp_${file}`;
|
||||
for (const file of fs.readdirSync(
|
||||
`../_sprites/sorted/${chapter}/${special}_${sprite_name}`
|
||||
)) {
|
||||
const oldPath = `../_sprites/sorted/${chapter}/${special}_${sprite_name}/${file}`;
|
||||
const newPath = `../_sprites/sorted/${chapter}/${special}_${sprite_name}/${special}_${file}`;
|
||||
|
||||
fs.renameSync(oldPath, newPath);
|
||||
fs.renameSync(oldPath, newPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const sprite_frames = DATA[chapter][sprite_name];
|
||||
for (let frame of sprite_frames) {
|
||||
const img_name = `${sprite_name}_${frame}.png`;
|
||||
if (!fs.existsSync(`../_sprites/translation/${sprite_name}/${img_name}`))
|
||||
continue;
|
||||
|
||||
if (
|
||||
fs.existsSync(`../_sprites/translation/sp_${sprite_name}/sp_${img_name}`)
|
||||
) {
|
||||
fs.copyFileSync(
|
||||
`../_sprites/translation/sp_${sprite_name}/sp_${img_name}`,
|
||||
`../_sprites/sorted/${chapter}/sp_${sprite_name}/sp_${img_name}`
|
||||
);
|
||||
for (const special of SPECIALS) {
|
||||
if (
|
||||
fs.existsSync(
|
||||
`../_sprites/translation/${special}_${sprite_name}/${special}_${img_name}`
|
||||
)
|
||||
) {
|
||||
fs.copyFileSync(
|
||||
`../_sprites/translation/${special}_${sprite_name}/${special}_${img_name}`,
|
||||
`../_sprites/sorted/${chapter}/${special}_${sprite_name}/${special}_${img_name}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fs.copyFileSync(
|
||||
|
||||
Reference in New Issue
Block a user