From 97b251e3a3287d2b618a98bc4107cb73122f5edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:04:06 -0500 Subject: [PATCH] feat: gamemode consumable and provisions --- scripts/buildAssets/boosterIcons.ts | 8 +- scripts/buildAssets/camouflageIcons.ts | 4 +- scripts/buildAssets/circleFlags.ts | 8 +- scripts/buildAssets/constants.ts | 31 +- .../buildAssets/consumableProvisionIcons.ts | 284 ++++++++++-------- scripts/buildAssets/definitions.ts | 38 ++- scripts/buildAssets/equipmentIcons.ts | 10 +- scripts/buildAssets/moduleIcons.ts | 8 +- scripts/buildAssets/scratchedFlags.ts | 6 +- scripts/buildAssets/shellIcons.ts | 10 +- scripts/buildAssets/tankArmors.ts | 6 +- scripts/buildAssets/tankIcons.ts | 8 +- scripts/buildAssets/tankModels.ts | 8 +- scripts/buildAssets/videos.ts | 12 +- 14 files changed, 225 insertions(+), 216 deletions(-) diff --git a/scripts/buildAssets/boosterIcons.ts b/scripts/buildAssets/boosterIcons.ts index 307b2c8c2..0f987a421 100644 --- a/scripts/buildAssets/boosterIcons.ts +++ b/scripts/buildAssets/boosterIcons.ts @@ -4,14 +4,14 @@ import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { readStringDVPL } from '../../src/core/blitz/readStringDVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function boosterIcons(production: boolean) { - const boosterFiles = (await readdir(`${DATA}/${POI.boosterIcons}`)).filter( + const boosterFiles = (await readdir(`${DATA}/Gfx/Shared/boosters`)).filter( (file) => !file.endsWith('@2x.txt.dvpl') && !file.startsWith('texture0'), ); const image = sharp( - await readDVPLFile(`${DATA}/${POI.boosterIcons}/texture0.packed.webp.dvpl`), + await readDVPLFile(`${DATA}/Gfx/Shared/boosters/texture0.packed.webp.dvpl`), ); const changes: FileChange[] = []; @@ -22,7 +22,7 @@ export async function boosterIcons(production: boolean) { if (name === undefined) return; const sizes = ( - await readStringDVPL(`${DATA}/${POI.boosterIcons}/${file}`) + await readStringDVPL(`${DATA}/Gfx/Shared/boosters/${file}`) ) .split('\n')[4] .split(' ') diff --git a/scripts/buildAssets/camouflageIcons.ts b/scripts/buildAssets/camouflageIcons.ts index 551b130e6..dfa5eba0c 100644 --- a/scripts/buildAssets/camouflageIcons.ts +++ b/scripts/buildAssets/camouflageIcons.ts @@ -1,12 +1,12 @@ import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function camouflageIcons(production: boolean) { console.log('Building camouflage icons...'); const content = await readDVPLFile( - `${DATA}/${POI.defaultCamoIcon.replace('.webp', '.packed.webp.dvpl')}`, + `${DATA}/Gfx/UI/Hangar/IconCamouflage.packed.webp.dvpl`, ).then((content) => content.toString('base64')); const changes: FileChange[] = [ { diff --git a/scripts/buildAssets/circleFlags.ts b/scripts/buildAssets/circleFlags.ts index 8828728e8..2ce95a293 100644 --- a/scripts/buildAssets/circleFlags.ts +++ b/scripts/buildAssets/circleFlags.ts @@ -3,10 +3,10 @@ import sharp from 'sharp'; import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function circleFlags(production: boolean) { - const flags = await readdir(`${DATA}/${POI.flags}`); + const flags = await readdir(`${DATA}/Gfx/Lobby/flags`); const changes = await Promise.all( flags .filter( @@ -15,7 +15,9 @@ export async function circleFlags(production: boolean) { !flag.endsWith('@2x.packed.webp.dvpl'), ) .map(async (flag) => { - const image = sharp(await readDVPLFile(`${DATA}/${POI.flags}/${flag}`)); + const image = sharp( + await readDVPLFile(`${DATA}/Gfx/Lobby/flags/${flag}`), + ); const content = ( await image.trim({ threshold: 100 }).toBuffer() ).toString('base64'); diff --git a/scripts/buildAssets/constants.ts b/scripts/buildAssets/constants.ts index d7649d279..e66c10e87 100644 --- a/scripts/buildAssets/constants.ts +++ b/scripts/buildAssets/constants.ts @@ -2,39 +2,12 @@ import { readdir } from 'fs/promises'; import { argv } from 'process'; const isDepot = argv.includes('--depot'); + export const WOTB_WIN32_DEPOT = 444202; + export const DATA = isDepot ? await (async () => { const [installationVersion] = await readdir(`depots/${WOTB_WIN32_DEPOT}`); return `depots/${WOTB_WIN32_DEPOT}/${installationVersion}/Data`; })() : 'C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz/Data'; - -export const POI = { - vehicleDefinitions: 'XML/item_defs/vehicles', - strings: 'Strings', - cachedStrings: 'https://stufficons.wgcdn.co/localizations/en.yaml', - tankParameters: '3d/Tanks/Parameters', - smallIcons: 'Gfx/UI/BattleScreenHUD/SmallTankIcons', - bigIcons: 'Gfx/UI/BigTankIcons', - flags: 'Gfx/Lobby/flags', - '3d': '3d', - bigShellIcons: 'Gfx/Shared/tank-supply/ammunition/big', - moduleIcons: 'Gfx/UI/ModulesTechTree', - collisionMeshes: '3d/Tanks/CollisionMeshes', - optionalDevices: 'XML/item_defs/vehicles/common/optional_devices.xml', - optionalDeviceSlots: - 'XML/item_defs/vehicles/common/optional_device_slots.xml', - optionalDeviceImageMappings: - 'UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml', - optionalDevicesImage: - 'Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp', - consumablesCommon: 'XML/item_defs/vehicles/common/consumables/common.xml', - consumableIcons: 'Gfx/UI/InventoryIcons/Big/Consumables', - provisionIcons: 'Gfx/UI/InventoryIcons/Big/Provisions', - equipmentItemImageMappings: - 'UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml', - provisionsCommon: 'XML/item_defs/vehicles/common/provisions/common.xml', - defaultCamoIcon: 'Gfx/UI/Hangar/IconCamouflage.webp', - boosterIcons: 'Gfx/Shared/boosters', -} as const; diff --git a/scripts/buildAssets/consumableProvisionIcons.ts b/scripts/buildAssets/consumableProvisionIcons.ts index 0f03d13c6..cb2fcdcf6 100644 --- a/scripts/buildAssets/consumableProvisionIcons.ts +++ b/scripts/buildAssets/consumableProvisionIcons.ts @@ -1,3 +1,4 @@ +import { existsSync } from 'fs'; import sharp from 'sharp'; import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { readStringDVPL } from '../../src/core/blitz/readStringDVPL'; @@ -5,7 +6,7 @@ import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { ConsumablesCommon, ProvisionsCommon } from './definitions'; interface Mappings { @@ -16,149 +17,176 @@ interface Mappings { }[]; } +const listItemsPattern = //g; + export async function consumableProvisionIcons(production: boolean) { console.log('Building consumable and provision icons...'); const changes: FileChange[] = []; - const consumablesTexture = sharp( - await readDVPLFile( - `${DATA}/${POI.consumableIcons}/texture0.packed.webp.dvpl`, + + const styles = [ + 'UI/Styles/Lobby/Inventory/InventoryNormalStyles.yaml', + 'UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml', + 'UI/Styles/Lobby/Inventory/Event/InventoryNormalStyles.yaml', + 'UI/Screens/Battle/Styles/BattleEquipmentStyles.yaml', + 'UI/Styles/Lobby/Inventory/Event/InventoryBigStyles.yaml', + ]; + const styleSheets = await Promise.all( + styles.map(async (path) => + Object.values( + (await readYAMLDVPL(`${DATA}/${path}.dvpl`)).StyleSheets, + ), ), - ); - const provisionsTexture = sharp( - await readDVPLFile( - `${DATA}/${POI.provisionIcons}/texture0.packed.webp.dvpl`, - ), - ); + ).then((array) => array.flat()); - const equipmentItemImageMappings = await readYAMLDVPL( - `${DATA}/${POI.equipmentItemImageMappings}.dvpl`, - ); - const consumablesCommon = await readXMLDVPL<{ - root: ConsumablesCommon; - }>(`${DATA}/${POI.consumablesCommon}.dvpl`); - const provisionsCommon = await readXMLDVPL<{ - root: ProvisionsCommon; - }>(`${DATA}/${POI.provisionsCommon}.dvpl`); - const styleSheets = Object.values(equipmentItemImageMappings.StyleSheets); + for (const match of ( + await readStringDVPL( + `${DATA}/XML/item_defs/vehicles/common/consumables/list.xml.dvpl`, + ) + ).matchAll(listItemsPattern)) { + const consumablesCommon = await readXMLDVPL<{ + root: ConsumablesCommon; + }>( + `${DATA}/XML/item_defs/vehicles/common/consumables/${match[1]}.xml.dvpl`, + ); - await Promise.all( - Object.values(consumablesCommon.root).map(async (consumable) => { - const styleSheet = styleSheets.find((styleSheet) => - styleSheet.selectors.includes( - `.equipment_item.${consumable.icon} * .equipment-img`, - ), - ); - - if (!styleSheet) { - console.warn( - `No style sheet found for consumable ${consumable.icon}; skipping...`, + await Promise.all( + Object.values(consumablesCommon.root).map(async (consumable) => { + const styleSheet = styleSheets.find((styleSheet) => + styleSheet.selectors.some((selector) => + selector.includes(consumable.icon), + ), ); - return; - } - const configPath = styleSheet.properties['bg-sprite'] - .replace('~res:/', '') - .replace('.psd', '') - .replace('.txt', ''); + if (!styleSheet) { + console.warn( + `No style sheet found for consumable ${consumable.icon}; skipping...`, + ); + return; + } - if (configPath.startsWith('Gfx/Shared')) { - const image = sharp( - await readDVPLFile(`${DATA}/${configPath}.packed.webp.dvpl`), + const configPath = styleSheet.properties['bg-sprite'] + .replace('~res:/', '') + .replace('.psd', '') + .replace('.txt', ''); + + if (existsSync(`${DATA}/${configPath}.packed.webp.dvpl`)) { + const image = sharp( + await readDVPLFile(`${DATA}/${configPath}.packed.webp.dvpl`), + ); + const content = ( + await image.trim({ threshold: 100 }).toBuffer() + ).toString('base64'); + + changes.push({ + path: `icons/consumables/${consumable.id}.webp`, + encoding: 'base64', + content, + }); + } else { + const consumablesTexture = sharp( + await readDVPLFile( + `${`${DATA}/${configPath}`.split('/').slice(0, -1).join('/')}/texture0.packed.webp.dvpl`, + ), + ); + const sizes = (await readStringDVPL(`${DATA}/${configPath}.txt.dvpl`)) + .split('\n')[4] + .split(' ') + .map(Number); + const content = ( + await consumablesTexture + .clone() + .extract({ + left: sizes[0], + top: sizes[1], + width: sizes[2], + height: sizes[3], + }) + .toBuffer() + ).toString('base64'); + + changes.push({ + path: `icons/consumables/${consumable.id}.webp`, + encoding: 'base64', + content, + }); + } + }), + ); + } + + for (const match of ( + await readStringDVPL( + `${DATA}/XML/item_defs/vehicles/common/provisions/list.xml.dvpl`, + ) + ).matchAll(listItemsPattern)) { + const provisionsCommon = await readXMLDVPL<{ + root: ProvisionsCommon; + }>(`${DATA}/XML/item_defs/vehicles/common/provisions/${match[1]}.xml.dvpl`); + await Promise.all( + Object.values(provisionsCommon.root).map(async (provision) => { + const styleSheet = styleSheets.find((styleSheet) => + styleSheet.selectors.some((selector) => + selector.includes(provision.icon), + ), ); - const content = ( - await image.trim({ threshold: 100 }).toBuffer() - ).toString('base64'); - changes.push({ - path: `icons/consumables/${consumable.id}.webp`, - encoding: 'base64', - content, - }); - } else { - const sizes = (await readStringDVPL(`${DATA}/${configPath}.txt.dvpl`)) - .split('\n')[4] - .split(' ') - .map(Number); - const content = ( - await consumablesTexture - .clone() - .extract({ - left: sizes[0], - top: sizes[1], - width: sizes[2], - height: sizes[3], - }) - .toBuffer() - ).toString('base64'); + if (!styleSheet) { + console.warn( + `No style sheet found for provision ${provision.icon}; skipping...`, + ); + return; + } - changes.push({ - path: `icons/consumables/${consumable.id}.webp`, - encoding: 'base64', - content, - }); - } - }), - ); + const configPath = styleSheet.properties['bg-sprite'] + .replace('~res:/', '') + .replace('.psd', '') + .replace('.txt', ''); - await Promise.all( - Object.values(provisionsCommon.root).map(async (provision) => { - const styleSheet = styleSheets.find((styleSheet) => - styleSheet.selectors.includes( - `.equipment_item.${provision.icon} * .equipment-img`, - ), - ); + if (existsSync(`${DATA}/${configPath}.packed.webp.dvpl`)) { + const image = sharp( + await readDVPLFile(`${DATA}/${configPath}.packed.webp.dvpl`), + ); + const content = ( + await image.trim({ threshold: 100 }).toBuffer() + ).toString('base64'); - if (!styleSheet) { - console.warn( - `No style sheet found for provision ${provision.icon}; skipping...`, - ); - return; - } + changes.push({ + path: `icons/provisions/${provision.id}.webp`, + encoding: 'base64', + content, + }); + } else { + const provisionsTexture = sharp( + await readDVPLFile( + `${`${DATA}/${configPath}`.split('/').slice(0, -1).join('/')}/texture0.packed.webp.dvpl`, + ), + ); + const sizes = (await readStringDVPL(`${DATA}/${configPath}.txt.dvpl`)) + .split('\n')[4] + .split(' ') + .map(Number); + const content = ( + await provisionsTexture + .clone() + .extract({ + left: sizes[0], + top: sizes[1], + width: sizes[2], + height: sizes[3], + }) + .toBuffer() + ).toString('base64'); - const configPath = styleSheet.properties['bg-sprite'] - .replace('~res:/', '') - .replace('.psd', '') - .replace('.txt', ''); - - if (configPath.startsWith('Gfx/Shared')) { - const image = sharp( - await readDVPLFile(`${DATA}/${configPath}.packed.webp.dvpl`), - ); - const content = ( - await image.trim({ threshold: 100 }).toBuffer() - ).toString('base64'); - - changes.push({ - path: `icons/provisions/${provision.id}.webp`, - encoding: 'base64', - content, - }); - } else { - const sizes = (await readStringDVPL(`${DATA}/${configPath}.txt.dvpl`)) - .split('\n')[4] - .split(' ') - .map(Number); - const content = ( - await provisionsTexture - .clone() - .extract({ - left: sizes[0], - top: sizes[1], - width: sizes[2], - height: sizes[3], - }) - .toBuffer() - ).toString('base64'); - - changes.push({ - path: `icons/provisions/${provision.id}.webp`, - encoding: 'base64', - content, - }); - } - }), - ); + changes.push({ + path: `icons/provisions/${provision.id}.webp`, + encoding: 'base64', + content, + }); + } + }), + ); + } await commitAssets('consumable and provision icons', changes, production); } diff --git a/scripts/buildAssets/definitions.ts b/scripts/buildAssets/definitions.ts index 2f5023037..959bdcc51 100644 --- a/scripts/buildAssets/definitions.ts +++ b/scripts/buildAssets/definitions.ts @@ -38,7 +38,7 @@ import { Tier, Unlock, } from '../../src/core/blitzkit/tankDefinitions'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { Avatar } from './skillIcons'; import { TankParameters } from './tankIcons'; @@ -444,18 +444,20 @@ export async function definitions(production: boolean) { const skillDefinitions: SkillDefinitions = { classes: { lightTank: [], mediumTank: [], heavyTank: [], 'AT-SPG': [] }, }; - const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then( + const nations = await readdir(`${DATA}/XML/item_defs/vehicles`).then( (nations) => nations.filter((nation) => nation !== 'common'), ); const tankStringIdMap: Record = {}; const stringsPreInstalled = await readYAMLDVPL( - `${DATA}/${POI.strings}/en.yaml.dvpl`, + `${DATA}/Strings/en.yaml.dvpl`, ); - const stringsCache = await fetch(POI.cachedStrings) + const stringsCache = await fetch( + 'https://stufficons.wgcdn.co/localizations/en.yaml', + ) .then((response) => response.text()) .then((string) => parseYaml(string) as BlitzStrings); const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>( - `${DATA}/${POI.optionalDevices}.dvpl`, + `${DATA}/XML/item_defs/vehicles/common/optional_devices.xml.dvpl`, ); const strings = { ...stringsPreInstalled, @@ -463,12 +465,12 @@ export async function definitions(production: boolean) { }; const optionalDeviceSlots = await readXMLDVPL<{ root: OptionalDeviceSlots; - }>(`${DATA}/${POI.optionalDeviceSlots}.dvpl`); + }>(`${DATA}/XML/item_defs/vehicles/common/optional_device_slots.xml.dvpl`); const consumables = await readXMLDVPL<{ root: ConsumablesCommon }>( - `${DATA}/${POI.consumablesCommon}.dvpl`, + `${DATA}/XML/item_defs/vehicles/common/consumables/common.xml.dvpl`, ); const provisions = await readXMLDVPL<{ root: ProvisionsCommon }>( - `${DATA}/${POI.provisionsCommon}.dvpl`, + `${DATA}/XML/item_defs/vehicles/common/provisions/common.xml.dvpl`, ); const avatar = await readXMLDVPL<{ root: Avatar }>( `${DATA}/XML/item_defs/tankmen/avatar.xml.dvpl`, @@ -506,32 +508,28 @@ export async function definitions(production: boolean) { await Promise.all( nations.map(async (nation) => { const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml.dvpl`, ); const turretList = await readXMLDVPL<{ root: TurretDefinitionsList; }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/components/turrets.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/components/turrets.xml.dvpl`, ); const gunList = await readXMLDVPL<{ root: GunDefinitionsList; - }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/components/guns.xml.dvpl`, - ); + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/guns.xml.dvpl`); const shellList = await readXMLDVPL<{ root: ShellDefinitionsList; - }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/components/shells.xml.dvpl`, - ); + }>(`${DATA}/XML/item_defs/vehicles/${nation}/components/shells.xml.dvpl`); const enginesList = await readXMLDVPL<{ root: EngineDefinitionsList; }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/components/engines.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/components/engines.xml.dvpl`, ); const chassisList = await readXMLDVPL<{ root: ChassisDefinitionsList; }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/components/chassis.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/components/chassis.xml.dvpl`, ); function resolveUnlocks(unlocks?: Unlocks) { @@ -587,10 +585,10 @@ export async function definitions(production: boolean) { ? { type: 'credits', value: tank.price } : { type: 'gold', value: tank.price['#text'] }; const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/${tankKey}.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/${tankKey}.xml.dvpl`, ); const tankParameters = await readYAMLDVPL( - `${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`, + `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml.dvpl`, ); const turretOrigin = tankDefinition.root.hull.turretPositions.turret .split(' ') diff --git a/scripts/buildAssets/equipmentIcons.ts b/scripts/buildAssets/equipmentIcons.ts index 171edc14e..795a142e9 100644 --- a/scripts/buildAssets/equipmentIcons.ts +++ b/scripts/buildAssets/equipmentIcons.ts @@ -5,7 +5,7 @@ import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { OptionalDevices } from './definitions'; interface Mappings { @@ -22,13 +22,15 @@ export async function equipmentIcons(production: boolean) { const changes: FileChange[] = []; const optionalDevices = await readXMLDVPL<{ root: OptionalDevices }>( - `${DATA}/${POI.optionalDevices}.dvpl`, + `${DATA}/XML/item_defs/vehicles/common/optional_devices.xml.dvpl`, ); const mappings = await readYAMLDVPL( - `${DATA}/${POI.optionalDeviceImageMappings}.dvpl`, + `${DATA}/UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml.dvpl`, ); const image = sharp( - await readDVPLFile(`${DATA}/${POI.optionalDevicesImage}.dvpl`), + await readDVPLFile( + `${DATA}/Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp.dvpl`, + ), ); await Promise.all( diff --git a/scripts/buildAssets/moduleIcons.ts b/scripts/buildAssets/moduleIcons.ts index fedd6e7c8..763404d39 100644 --- a/scripts/buildAssets/moduleIcons.ts +++ b/scripts/buildAssets/moduleIcons.ts @@ -3,13 +3,13 @@ import sharp from 'sharp'; import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function moduleIcons(production: boolean) { console.log('Building module icons...'); const changes = await Promise.all( - (await readdir(`${DATA}/${POI.moduleIcons}`)) + (await readdir(`${DATA}/Gfx/UI/ModulesTechTree`)) .filter( (file) => !file.endsWith('@2x.packed.webp.dvpl') && file.startsWith('vehicle'), @@ -18,7 +18,9 @@ export async function moduleIcons(production: boolean) { const nameRaw = file.match(/vehicle(.+)\.packed\.webp\.dvpl/)![1]; const name = nameRaw[0].toLowerCase() + nameRaw.slice(1); const content = ( - await sharp(await readDVPLFile(`${DATA}/${POI.moduleIcons}/${file}`)) + await sharp( + await readDVPLFile(`${DATA}/Gfx/UI/ModulesTechTree/${file}`), + ) .trim() .toBuffer() ).toString('base64'); diff --git a/scripts/buildAssets/scratchedFlags.ts b/scripts/buildAssets/scratchedFlags.ts index 31fc0e562..c3cc6880d 100644 --- a/scripts/buildAssets/scratchedFlags.ts +++ b/scripts/buildAssets/scratchedFlags.ts @@ -2,12 +2,12 @@ import { readdir } from 'fs/promises'; import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function scratchedFlags(production: boolean) { console.log('Building scratched flags...'); - const flags = await readdir(`${DATA}/${POI.flags}`); + const flags = await readdir(`${DATA}/Gfx/Lobby/flags`); const changes = await Promise.all( flags .filter( @@ -16,7 +16,7 @@ export async function scratchedFlags(production: boolean) { !flag.endsWith('@2x.packed.webp.dvpl'), ) .map(async (flag) => { - const content = await readBase64DVPL(`${DATA}/${POI.flags}/${flag}`); + const content = await readBase64DVPL(`${DATA}/Gfx/Lobby/flags/${flag}`); const name = flag.match(/flag_tutor-tank_(.+)\.packed\.webp/)![1]; return { diff --git a/scripts/buildAssets/shellIcons.ts b/scripts/buildAssets/shellIcons.ts index d08b271ae..60adc62a0 100644 --- a/scripts/buildAssets/shellIcons.ts +++ b/scripts/buildAssets/shellIcons.ts @@ -4,24 +4,26 @@ import { readDVPLFile } from '../../src/core/blitz/readDVPLFile'; import { readStringDVPL } from '../../src/core/blitz/readStringDVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; export async function shellIcons(production: boolean) { console.log('Building shell icons...'); const image = sharp( await readDVPLFile( - `${DATA}/${POI.bigShellIcons}/texture0.packed.webp.dvpl`, + `${DATA}/Gfx/Shared/tank-supply/ammunition/big/texture0.packed.webp.dvpl`, ), ); const changes = await Promise.all( - (await readdir(`${DATA}/${POI.bigShellIcons}`)) + (await readdir(`${DATA}/Gfx/Shared/tank-supply/ammunition/big`)) .filter((file) => file.endsWith('_l.txt.dvpl')) .map(async (file) => { const name = file.match(/(.+)_l\.txt\.dvpl/)![1]; const sizes = ( - await readStringDVPL(`${DATA}/${POI.bigShellIcons}/${file}`) + await readStringDVPL( + `${DATA}/Gfx/Shared/tank-supply/ammunition/big/${file}`, + ) ) .split('\n')[4] .split(' ') diff --git a/scripts/buildAssets/tankArmors.ts b/scripts/buildAssets/tankArmors.ts index 8c0e104d1..da233edd0 100644 --- a/scripts/buildAssets/tankArmors.ts +++ b/scripts/buildAssets/tankArmors.ts @@ -5,7 +5,7 @@ import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { toUniqueId } from '../../src/core/blitz/toUniqueId'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { VehicleDefinitionList } from './definitions'; export async function tankArmors(production: boolean) { @@ -13,14 +13,14 @@ export async function tankArmors(production: boolean) { const changes: FileChange[] = []; const nodeIO = new NodeIO(); - const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then( + const nations = await readdir(`${DATA}/XML/item_defs/vehicles`).then( (nations) => nations.filter((nation) => nation !== 'common'), ); await Promise.all( nations.map(async (nation) => { const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml.dvpl`, ); await Promise.all( diff --git a/scripts/buildAssets/tankIcons.ts b/scripts/buildAssets/tankIcons.ts index ddd1ff803..ef5a00e5c 100644 --- a/scripts/buildAssets/tankIcons.ts +++ b/scripts/buildAssets/tankIcons.ts @@ -7,7 +7,7 @@ import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { VehicleDefinitionList } from './definitions'; export interface TankParameters { @@ -46,14 +46,14 @@ export async function tankIcons(production: boolean) { console.log('Building tank icons...'); const changes: FileChange[] = []; - const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then( + const nations = await readdir(`${DATA}/XML/item_defs/vehicles`).then( (nations) => nations.filter((nation) => nation !== 'common'), ); await Promise.all( nations.map(async (nation) => { const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml.dvpl`, ); await Promise.all( @@ -63,7 +63,7 @@ export async function tankIcons(production: boolean) { const nationVehicleId = tank.id; const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1; const parameters = await readYAMLDVPL( - `${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`, + `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml.dvpl`, ); const smallPath = `${DATA}/${parameters.resourcesPath.smallIconPath .replace(/~res:\//, '') diff --git a/scripts/buildAssets/tankModels.ts b/scripts/buildAssets/tankModels.ts index 8c03b31e7..42721811c 100644 --- a/scripts/buildAssets/tankModels.ts +++ b/scripts/buildAssets/tankModels.ts @@ -6,7 +6,7 @@ import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { toUniqueId } from '../../src/core/blitz/toUniqueId'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { VehicleDefinitionList } from './definitions'; import { TankParameters } from './tankIcons'; @@ -14,7 +14,7 @@ export async function tankModels(production: boolean) { console.log('Building tank models...'); const nodeIO = new NodeIO(); - const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then( + const nations = await readdir(`${DATA}/XML/item_defs/vehicles`).then( (nations) => nations.filter((nation) => nation !== 'common'), ); @@ -22,7 +22,7 @@ export async function tankModels(production: boolean) { const nation = nations[nationIndex]; const changes: FileChange[] = []; const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml.dvpl`, ); console.log(`Building models for ${nation}`); @@ -33,7 +33,7 @@ export async function tankModels(production: boolean) { const id = toUniqueId(nation, tank.id); const parameters = await readYAMLDVPL( - `${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`, + `${DATA}/3d/Tanks/Parameters/${nation}/${tankKey}.yaml.dvpl`, ); const model = await extractModel( DATA, diff --git a/scripts/buildAssets/videos.ts b/scripts/buildAssets/videos.ts index 8868ab8ff..2bf5734c5 100644 --- a/scripts/buildAssets/videos.ts +++ b/scripts/buildAssets/videos.ts @@ -7,7 +7,7 @@ import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { toUniqueId } from '../../src/core/blitz/toUniqueId'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; import { VideoDefinitions } from '../../src/core/blitzkit/videos'; -import { DATA, POI } from './constants'; +import { DATA } from './constants'; import { BlitzStrings, botPattern, VehicleDefinitionList } from './definitions'; const youtubers = [ @@ -45,13 +45,15 @@ export async function videos(production: boolean) { }); const youtube = google.youtube({ version: 'v3', auth }); - const nations = await readdir(`${DATA}/${POI.vehicleDefinitions}`).then( + const nations = await readdir(`${DATA}/XML/item_defs/vehicles`).then( (nations) => nations.filter((nation) => nation !== 'common'), ); const stringsPreInstalled = await readYAMLDVPL( - `${DATA}/${POI.strings}/en.yaml.dvpl`, + `${DATA}/Strings/en.yaml.dvpl`, ); - const stringsCache = await fetch(POI.cachedStrings) + const stringsCache = await fetch( + 'https://stufficons.wgcdn.co/localizations/en.yaml', + ) .then((response) => response.text()) .then((string) => parseYaml(string) as BlitzStrings); const strings = { @@ -62,7 +64,7 @@ export async function videos(production: boolean) { await Promise.all( nations.map(async (nation) => { const tankList = await readXMLDVPL<{ root: VehicleDefinitionList }>( - `${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`, + `${DATA}/XML/item_defs/vehicles/${nation}/list.xml.dvpl`, ); await Promise.all(