From 2902ddeb3703609d95472bb21ff643151a6cb3ac Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Tue, 21 Dec 2021 11:27:00 -0500 Subject: [PATCH] Fix lib for new items JSON --- data/lib/index.ts | 2 +- ps-items.sheet.mjs | 10 ++++++---- smogon.deploy.js | 6 ++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/data/lib/index.ts b/data/lib/index.ts index 624b9741..6f6e3987 100644 --- a/data/lib/index.ts +++ b/data/lib/index.ts @@ -19,7 +19,7 @@ export type SpecieEntry = { export type ItemEntry = { type : 'item', sid : string, - name : string + names : string[] }; export type Entry = SpecieEntry | ItemEntry; diff --git a/ps-items.sheet.mjs b/ps-items.sheet.mjs index a6f2e643..dd6e6756 100644 --- a/ps-items.sheet.mjs +++ b/ps-items.sheet.mjs @@ -529,11 +529,13 @@ const ITEMS = { const found = new Map; -for (const {type, sid, name} of spritedata.entries()) { +for (const {type, sid, names} of spritedata.entries()) { if (type !== 'item') continue; - const id = toPSID(name); - const filename = spritedata.formatFilename({id: sid}); - found.set(id, path.join(root, "newsrc/minisprites/items", filename + ".png")); + for (let name of names) { + const id = toPSID(name); + const filename = spritedata.formatFilename({id: sid}); + found.set(id, path.join(root, "newsrc/minisprites/items", filename + ".png")); + } } const entries = []; diff --git a/smogon.deploy.js b/smogon.deploy.js index ee4a1097..44ea2003 100644 --- a/smogon.deploy.js +++ b/smogon.deploy.js @@ -38,8 +38,10 @@ function spritecopy(f, {dir, ext}) { function itemspritecopy(f, {dir, ext}) { const sn = spritedata.parseFilename(f.name); const sd = spritedata.get(sn.id); - const name = toSmogonAlias(sd.name); - copy(f, {dir, ext, name}); + for (const n of sd.names) { + const name = toSmogonAlias(n); + copy(f, {dir, ext, name}); + } } for (const f of list("newsrc/models")) {