feat: expand ISAC content modeling
This commit is contained in:
@@ -14,6 +14,19 @@ if (!bundleArgument || !process.argv.includes('--confirm-merge')) {
|
||||
process.exit(2);
|
||||
}
|
||||
const updateExisting = process.argv.includes('--update-existing');
|
||||
const gameDataRenderSourceTypes = new Set([
|
||||
'weapon_render',
|
||||
'gear_render',
|
||||
'weapon_mod_render',
|
||||
'gear_mod_render',
|
||||
'talent_render',
|
||||
'brand_set_render',
|
||||
'os_protocol_render',
|
||||
'skill_chip_render',
|
||||
'specialization_render',
|
||||
'specialization_ability_render',
|
||||
'specialization_node_render',
|
||||
]);
|
||||
const bundlePath = resolve(bundleArgument);
|
||||
const bundle = JSON.parse(await readFile(bundlePath, 'utf8'));
|
||||
if (
|
||||
@@ -30,21 +43,21 @@ for (const image of bundle.images) {
|
||||
typeof image?.row?.id !== 'string' ||
|
||||
!/^[0-9a-f-]{36}$/i.test(image.row.id) ||
|
||||
typeof image.row.storage_key !== 'string' ||
|
||||
!/^(?:library|talent|brand_set|os_protocol|skill_chip|specialization|specialization_ability|specialization_node)-[0-9a-f-]{36}\.webp$/i.test(
|
||||
!/^(?:library|talent|brand_set|os_protocol|skill_chip|specialization|specialization_ability|specialization_node|weapon_mod_slot)-[0-9a-f-]{36}\.webp$/i.test(
|
||||
image.row.storage_key,
|
||||
) ||
|
||||
typeof image.contentBase64 !== 'string'
|
||||
) {
|
||||
throw new Error('The bundle contains an invalid managed image.');
|
||||
}
|
||||
const isItemRender = ['weapon_render', 'gear_render'].includes(
|
||||
const isGameDataRender = gameDataRenderSourceTypes.has(
|
||||
image.row.source_entity_type,
|
||||
);
|
||||
if (
|
||||
image.row.source_entity_type &&
|
||||
(typeof image.row.source_entity_id !== 'string' ||
|
||||
!/^[0-9a-f-]{36}$/i.test(image.row.source_entity_id) ||
|
||||
(isItemRender
|
||||
(isGameDataRender
|
||||
? !image.row.storage_key.startsWith('library-')
|
||||
: !image.row.storage_key.startsWith(
|
||||
`${image.row.source_entity_type}-`,
|
||||
|
||||
Reference in New Issue
Block a user