diff --git a/scripts/pack-act-assets.ts b/scripts/pack-act-assets.ts index 6b10bf1..161d52d 100644 --- a/scripts/pack-act-assets.ts +++ b/scripts/pack-act-assets.ts @@ -64,6 +64,8 @@ const PAGE_SIZE = 2048 const HOT_RADIUS_CELLS = 8 /** Where object art lives. */ const OBJECT_PREFIX = 'data\\global\\objects\\' +/** Where monster and town-NPC art lives. */ +const MONSTER_PREFIX = 'data\\global\\monsters\\' /** * Mode directories tried in order when picking an object's art. * @@ -347,9 +349,12 @@ const objectMembers = new Map>() const monsterMembers = new Map>() for (const name of allNames) { const isObj = name.toLowerCase().startsWith(OBJECT_PREFIX.toLowerCase()) - const isMon = name.toLowerCase().startsWith('data\\global\\monsters\\') + const isMon = name.toLowerCase().startsWith(MONSTER_PREFIX.toLowerCase()) if (!isObj && !isMon) continue - const prefixLen = isObj ? OBJECT_PREFIX.length : 22 // 'data\\global\\monsters\\'.length + // Derive the length; a hand-counted magic number here was off by one (22 vs + // the real 21), which sliced the first letter off every monster token and + // silently broke all NPC art lookups. + const prefixLen = isObj ? OBJECT_PREFIX.length : MONSTER_PREFIX.length const rest = name.slice(prefixLen).split('\\') if (rest.length < 3) continue const token = (rest[0] ?? '').toUpperCase()