mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
fix: trim
This commit is contained in:
1 parent
91d98c6aad
commit
b25814e399
3 files changed
+46
-16
No files matched your search
@@ -400,7 +400,7 @@ interface AvailableNationsYaml {
|
|||||||
available_nations: string[];
|
available_nations: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SquadBattleTypeUI {
|
export interface SquadBattleTypeStyles {
|
||||||
Prototypes: {
|
Prototypes: {
|
||||||
components: {
|
components: {
|
||||||
UIDataLocalBindingsComponent: {
|
UIDataLocalBindingsComponent: {
|
||||||
@@ -496,11 +496,11 @@ export async function definitions(production: boolean) {
|
|||||||
`${DATA}/camouflages.yaml.dvpl`,
|
`${DATA}/camouflages.yaml.dvpl`,
|
||||||
);
|
);
|
||||||
const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages);
|
const camouflagesXmlEntries = Object.entries(camouflagesXml.root.camouflages);
|
||||||
const squadBattleTypeUI = await readYAMLDVPL<SquadBattleTypeUI>(
|
const squadBattleTypeStyles = await readYAMLDVPL<SquadBattleTypeStyles>(
|
||||||
`${DATA}/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml.dvpl`,
|
`${DATA}/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml.dvpl`,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const match of squadBattleTypeUI.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||||
/"(\d+)" -> "(battleType\/[a-zA-Z]+)"/g,
|
/"(\d+)" -> "(battleType\/[a-zA-Z]+)"/g,
|
||||||
)) {
|
)) {
|
||||||
const id = Number(match[1]);
|
const id = Number(match[1]);
|
||||||
@@ -1336,6 +1336,7 @@ export async function definitions(production: boolean) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
await commitAssets(
|
await commitAssets(
|
||||||
'definitions',
|
'definitions',
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -1,24 +1,52 @@
|
|||||||
|
import sharp from 'sharp';
|
||||||
|
import { readDVPLFile } from '../../src/core/blitz/readDVPLFile';
|
||||||
import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL';
|
import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL';
|
||||||
|
import { commitAssets } from '../../src/core/blitzkit/commitAssets';
|
||||||
|
import { FileChange } from '../../src/core/blitzkit/commitMultipleFiles';
|
||||||
import { DATA } from './constants';
|
import { DATA } from './constants';
|
||||||
import { SquadBattleTypeUI } from './definitions';
|
import { SquadBattleTypeStyles } from './definitions';
|
||||||
|
|
||||||
// enum EGameMode {
|
|
||||||
// Rating = 7,
|
|
||||||
// Scuffle = 22,
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function gameModeIcons(production: boolean) {
|
export async function gameModeIcons(production: boolean) {
|
||||||
const squadBattleTypeUI = await readYAMLDVPL<SquadBattleTypeUI>(
|
const changes: FileChange[] = [];
|
||||||
|
const gameTypeSelectorStyles = await readYAMLDVPL<SquadBattleTypeStyles>(
|
||||||
|
`${DATA}/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml.dvpl`,
|
||||||
|
);
|
||||||
|
const squadBattleTypeStyles = await readYAMLDVPL<SquadBattleTypeStyles>(
|
||||||
`${DATA}/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml.dvpl`,
|
`${DATA}/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml.dvpl`,
|
||||||
);
|
);
|
||||||
|
const bannerMatches: { name: string; path: string }[] = [];
|
||||||
|
|
||||||
for (const match of squadBattleTypeUI.Prototypes[0].components.UIDataLocalBindingsComponent.data[0][2].matchAll(
|
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||||
/"(\d+)" -> "(battleType\/[a-zA-Z]+)"/g,
|
/eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g,
|
||||||
|
)) {
|
||||||
|
bannerMatches.push({ name: match[1], path: match[2] });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const match of squadBattleTypeStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||||
|
/"(\d+)" -> "battleType\/([a-zA-Z]+)"/g,
|
||||||
)) {
|
)) {
|
||||||
const id = Number(match[1]);
|
const id = Number(match[1]);
|
||||||
|
const name = match[2];
|
||||||
|
let path = bannerMatches.find(
|
||||||
|
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase(),
|
||||||
|
)?.path;
|
||||||
|
|
||||||
// gameDefinitions.gameModes[id] = {
|
if (path === undefined) {
|
||||||
// name,
|
path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`;
|
||||||
// };
|
}
|
||||||
|
|
||||||
|
const content = (
|
||||||
|
await sharp(await readDVPLFile(`${DATA}${path}.packed.webp.dvpl`))
|
||||||
|
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
||||||
|
.toBuffer()
|
||||||
|
).toString('base64');
|
||||||
|
|
||||||
|
changes.push({
|
||||||
|
path: `icons/game_mode_banners/${id}.webp`,
|
||||||
|
content,
|
||||||
|
encoding: 'base64',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await commitAssets('game mode icons', changes, production);
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ import { consumableProvisionIcons } from './consumableProvisionIcons';
|
|||||||
import { currencies } from './currencies';
|
import { currencies } from './currencies';
|
||||||
import { definitions } from './definitions';
|
import { definitions } from './definitions';
|
||||||
import { equipmentIcons } from './equipmentIcons';
|
import { equipmentIcons } from './equipmentIcons';
|
||||||
|
import { gameModeIcons } from './gameModeIcons';
|
||||||
import { moduleIcons } from './moduleIcons';
|
import { moduleIcons } from './moduleIcons';
|
||||||
import { scratchedFlags } from './scratchedFlags';
|
import { scratchedFlags } from './scratchedFlags';
|
||||||
import { shellIcons } from './shellIcons';
|
import { shellIcons } from './shellIcons';
|
||||||
@@ -29,7 +30,7 @@ import { videos } from './videos';
|
|||||||
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
||||||
|
|
||||||
const methods = [
|
const methods = [
|
||||||
// gameModeIcons,
|
gameModeIcons,
|
||||||
definitions,
|
definitions,
|
||||||
tankIcons,
|
tankIcons,
|
||||||
videos,
|
videos,
|
||||||
|
|||||||
Reference in new issue
Block a user