mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +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[];
|
||||
}
|
||||
|
||||
export interface SquadBattleTypeUI {
|
||||
export interface SquadBattleTypeStyles {
|
||||
Prototypes: {
|
||||
components: {
|
||||
UIDataLocalBindingsComponent: {
|
||||
@@ -496,11 +496,11 @@ export async function definitions(production: boolean) {
|
||||
`${DATA}/camouflages.yaml.dvpl`,
|
||||
);
|
||||
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`,
|
||||
);
|
||||
|
||||
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,
|
||||
)) {
|
||||
const id = Number(match[1]);
|
||||
@@ -1336,6 +1336,7 @@ export async function definitions(production: boolean) {
|
||||
};
|
||||
});
|
||||
|
||||
return;
|
||||
await commitAssets(
|
||||
'definitions',
|
||||
[
|
||||
|
||||
@@ -1,24 +1,52 @@
|
||||
import sharp from 'sharp';
|
||||
import { readDVPLFile } from '../../src/core/blitz/readDVPLFile';
|
||||
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 { SquadBattleTypeUI } from './definitions';
|
||||
|
||||
// enum EGameMode {
|
||||
// Rating = 7,
|
||||
// Scuffle = 22,
|
||||
// }
|
||||
import { SquadBattleTypeStyles } from './definitions';
|
||||
|
||||
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`,
|
||||
);
|
||||
const bannerMatches: { name: string; path: string }[] = [];
|
||||
|
||||
for (const match of squadBattleTypeUI.Prototypes[0].components.UIDataLocalBindingsComponent.data[0][2].matchAll(
|
||||
/"(\d+)" -> "(battleType\/[a-zA-Z]+)"/g,
|
||||
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||
/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 name = match[2];
|
||||
let path = bannerMatches.find(
|
||||
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase(),
|
||||
)?.path;
|
||||
|
||||
// gameDefinitions.gameModes[id] = {
|
||||
// name,
|
||||
// };
|
||||
if (path === undefined) {
|
||||
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 { definitions } from './definitions';
|
||||
import { equipmentIcons } from './equipmentIcons';
|
||||
import { gameModeIcons } from './gameModeIcons';
|
||||
import { moduleIcons } from './moduleIcons';
|
||||
import { scratchedFlags } from './scratchedFlags';
|
||||
import { shellIcons } from './shellIcons';
|
||||
@@ -29,7 +30,7 @@ import { videos } from './videos';
|
||||
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
||||
|
||||
const methods = [
|
||||
// gameModeIcons,
|
||||
gameModeIcons,
|
||||
definitions,
|
||||
tankIcons,
|
||||
videos,
|
||||
|
||||
Reference in new issue
Block a user