mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: update to new api
This commit is contained in:
1 parent
34ee954502
commit
3a9af7505f
17 files changed
+103
-98
No files matched your search
@@ -6,13 +6,15 @@ export async function boosterIcons() {
|
|||||||
console.log("Building booster icons...");
|
console.log("Building booster icons...");
|
||||||
|
|
||||||
const uploader = new AssetUploader("booster icons");
|
const uploader = new AssetUploader("booster icons");
|
||||||
const boosterFiles = vfs
|
const boosterFiles = await vfs
|
||||||
.dir("Data/Gfx/Shared/boosters")
|
.dir("Data/Gfx/Shared/boosters")
|
||||||
.filter(
|
.then((files) =>
|
||||||
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0")
|
files.filter(
|
||||||
|
(file) => !file.includes("@2x.txt") && !file.startsWith("texture0"),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const image = sharp(
|
const image = sharp(
|
||||||
await vfs.file(`Data/Gfx/Shared/boosters/texture0.packed.webp`)
|
await vfs.file(`Data/Gfx/Shared/boosters/texture0.packed.webp`),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const file of boosterFiles) {
|
for (const file of boosterFiles) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export async function camouflageIcons() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("camo icons");
|
using uploader = new AssetUploader("camo icons");
|
||||||
const content = await vfs.file(
|
const content = await vfs.file(
|
||||||
`Data/Gfx/UI/Hangar/IconCamouflage.packed.webp`
|
`Data/Gfx/UI/Hangar/IconCamouflage.packed.webp`,
|
||||||
);
|
);
|
||||||
|
|
||||||
await uploader.add({ content, path: "icons/camo.webp" });
|
await uploader.add({ content, path: "icons/camo.webp" });
|
||||||
|
|||||||
@@ -26,18 +26,12 @@ export async function consumableProvisionIcons() {
|
|||||||
];
|
];
|
||||||
const styleSheets = await Promise.all(
|
const styleSheets = await Promise.all(
|
||||||
styles.map(async (path) =>
|
styles.map(async (path) =>
|
||||||
Object.values(
|
Object.values((await vfs.yaml<Mappings>(`Data/${path}`)).StyleSheets),
|
||||||
(
|
),
|
||||||
await vfs.yaml<Mappings>(`Data/${path}`)
|
|
||||||
).StyleSheets
|
|
||||||
)
|
|
||||||
)
|
|
||||||
).then((array) => array.flat());
|
).then((array) => array.flat());
|
||||||
|
|
||||||
for (const match of (
|
for (const match of (
|
||||||
await vfs.text(
|
await vfs.text(`Data/XML/item_defs/vehicles/common/consumables/list.xml`)
|
||||||
`Data/XML/item_defs/vehicles/common/consumables/list.xml`
|
|
||||||
)
|
|
||||||
).matchAll(listItemsPattern)) {
|
).matchAll(listItemsPattern)) {
|
||||||
const consumablesCommon = await vfs.xml<{
|
const consumablesCommon = await vfs.xml<{
|
||||||
root: ConsumablesCommon;
|
root: ConsumablesCommon;
|
||||||
@@ -46,13 +40,13 @@ export async function consumableProvisionIcons() {
|
|||||||
for (const consumable of Object.values(consumablesCommon.root)) {
|
for (const consumable of Object.values(consumablesCommon.root)) {
|
||||||
const styleSheet = styleSheets.find((styleSheet) =>
|
const styleSheet = styleSheets.find((styleSheet) =>
|
||||||
styleSheet.selectors.some((selector) =>
|
styleSheet.selectors.some((selector) =>
|
||||||
selector.includes(`${consumable.icon} `)
|
selector.includes(`${consumable.icon} `),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!styleSheet) {
|
if (!styleSheet) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`No style sheet found for consumable ${consumable.icon}; skipping...`
|
`No style sheet found for consumable ${consumable.icon}; skipping...`,
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -62,10 +56,8 @@ export async function consumableProvisionIcons() {
|
|||||||
.replace(".psd", "")
|
.replace(".psd", "")
|
||||||
.replace(".txt", "");
|
.replace(".txt", "");
|
||||||
|
|
||||||
if (vfs.resolve(`Data/${configPath}.packed.webp`)) {
|
if (await vfs.resolve(`Data/${configPath}.packed.webp`)) {
|
||||||
const image = sharp(
|
const image = sharp(await vfs.file(`Data/${configPath}.packed.webp`));
|
||||||
await vfs.file(`Data/${configPath}.packed.webp`)
|
|
||||||
);
|
|
||||||
const content = await image.trim({ threshold: 100 }).toBuffer();
|
const content = await image.trim({ threshold: 100 }).toBuffer();
|
||||||
|
|
||||||
await uploader.add({
|
await uploader.add({
|
||||||
@@ -78,8 +70,8 @@ export async function consumableProvisionIcons() {
|
|||||||
`${`Data/${configPath}`
|
`${`Data/${configPath}`
|
||||||
.split("/")
|
.split("/")
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
.join("/")}/texture0.packed.webp`
|
.join("/")}/texture0.packed.webp`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
const sizes = (await vfs.text(`Data/${configPath}.txt`))
|
const sizes = (await vfs.text(`Data/${configPath}.txt`))
|
||||||
.split("\n")[4]
|
.split("\n")[4]
|
||||||
@@ -104,9 +96,7 @@ export async function consumableProvisionIcons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const match of (
|
for (const match of (
|
||||||
await vfs.text(
|
await vfs.text(`Data/XML/item_defs/vehicles/common/provisions/list.xml`)
|
||||||
`Data/XML/item_defs/vehicles/common/provisions/list.xml`
|
|
||||||
)
|
|
||||||
).matchAll(listItemsPattern)) {
|
).matchAll(listItemsPattern)) {
|
||||||
const provisionsCommon = await vfs.xml<{
|
const provisionsCommon = await vfs.xml<{
|
||||||
root: ProvisionsCommon;
|
root: ProvisionsCommon;
|
||||||
@@ -115,13 +105,13 @@ export async function consumableProvisionIcons() {
|
|||||||
for (const provision of Object.values(provisionsCommon.root)) {
|
for (const provision of Object.values(provisionsCommon.root)) {
|
||||||
const styleSheet = styleSheets.find((styleSheet) =>
|
const styleSheet = styleSheets.find((styleSheet) =>
|
||||||
styleSheet.selectors.some((selector) =>
|
styleSheet.selectors.some((selector) =>
|
||||||
selector.includes(`${provision.icon} `)
|
selector.includes(`${provision.icon} `),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!styleSheet) {
|
if (!styleSheet) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`No style sheet found for provision ${provision.icon}; skipping...`
|
`No style sheet found for provision ${provision.icon}; skipping...`,
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -131,10 +121,8 @@ export async function consumableProvisionIcons() {
|
|||||||
.replace(".psd", "")
|
.replace(".psd", "")
|
||||||
.replace(".txt", "");
|
.replace(".txt", "");
|
||||||
|
|
||||||
if (vfs.resolve(`Data/${configPath}.packed.webp`)) {
|
if (await vfs.resolve(`Data/${configPath}.packed.webp`)) {
|
||||||
const image = sharp(
|
const image = sharp(await vfs.file(`Data/${configPath}.packed.webp`));
|
||||||
await vfs.file(`Data/${configPath}.packed.webp`)
|
|
||||||
);
|
|
||||||
const content = await image.trim({ threshold: 100 }).toBuffer();
|
const content = await image.trim({ threshold: 100 }).toBuffer();
|
||||||
|
|
||||||
await uploader.add({
|
await uploader.add({
|
||||||
@@ -147,8 +135,8 @@ export async function consumableProvisionIcons() {
|
|||||||
`${`Data/${configPath}`
|
`${`Data/${configPath}`
|
||||||
.split("/")
|
.split("/")
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
.join("/")}/texture0.packed.webp`
|
.join("/")}/texture0.packed.webp`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
const sizes = (await vfs.text(`Data/${configPath}.txt`))
|
const sizes = (await vfs.text(`Data/${configPath}.txt`))
|
||||||
.split("\n")[4]
|
.split("\n")[4]
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export async function currencies() {
|
|||||||
|
|
||||||
for (const [file, name] of ICONS) {
|
for (const [file, name] of ICONS) {
|
||||||
const content = await sharp(
|
const content = await sharp(
|
||||||
await vfs.file(`Data/Gfx/Lobby/currency/${file}`)
|
await vfs.file(`Data/Gfx/Lobby/currency/${file}`),
|
||||||
)
|
)
|
||||||
.trim()
|
.trim()
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
@@ -36,14 +36,14 @@ export async function currencies() {
|
|||||||
.then((glossary) =>
|
.then((glossary) =>
|
||||||
Object.values(glossary)
|
Object.values(glossary)
|
||||||
.entries()
|
.entries()
|
||||||
.filter(([key]) => /^prx_season_\d+$/.test(`${key}`))
|
.filter(([key]) => /^prx_season_\d+$/.test(`${key}`)),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const [key, item] of glossary) {
|
for (const [key, item] of glossary) {
|
||||||
if (item.image_url === null) throw new Error(`No image_url for ${key}`);
|
if (item.image_url === null) throw new Error(`No image_url for ${key}`);
|
||||||
|
|
||||||
const imageRaw = await fetch(item.image_url).then((response) =>
|
const imageRaw = await fetch(item.image_url).then((response) =>
|
||||||
response.arrayBuffer()
|
response.arrayBuffer(),
|
||||||
);
|
);
|
||||||
const content = await sharp(imageRaw)
|
const content = await sharp(imageRaw)
|
||||||
.trim({
|
.trim({
|
||||||
|
|||||||
@@ -561,9 +561,9 @@ export async function definitions() {
|
|||||||
[TankClass.TANK_CLASS_TANK_DESTROYER]: { skills: [] },
|
[TankClass.TANK_CLASS_TANK_DESTROYER]: { skills: [] },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const nations = vfs
|
const nations = await vfs
|
||||||
.dir("Data/XML/item_defs/vehicles")
|
.dir("Data/XML/item_defs/vehicles")
|
||||||
.filter((nation) => nation !== "common");
|
.then((files) => files.filter((nation) => nation !== "common"));
|
||||||
const tankStringIdMap: Record<string, number> = {};
|
const tankStringIdMap: Record<string, number> = {};
|
||||||
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>(
|
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>(
|
||||||
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
"Data/XML/item_defs/vehicles/common/optional_devices.xml",
|
||||||
|
|||||||
@@ -17,15 +17,15 @@ export async function equipmentIcons() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("equipment icons");
|
using uploader = new AssetUploader("equipment icons");
|
||||||
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>(
|
const optionalDevices = await vfs.xml<{ root: OptionalDevices }>(
|
||||||
`Data/XML/item_defs/vehicles/common/optional_devices.xml`
|
`Data/XML/item_defs/vehicles/common/optional_devices.xml`,
|
||||||
);
|
);
|
||||||
const mappings = await vfs.yaml<Mappings>(
|
const mappings = await vfs.yaml<Mappings>(
|
||||||
`Data/UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml`
|
`Data/UI/Screens3/Lobby/Inventory/OptionalDevices/OptionalDevicesItemImage.style.yaml`,
|
||||||
);
|
);
|
||||||
const image = sharp(
|
const image = sharp(
|
||||||
await vfs.file(
|
await vfs.file(
|
||||||
`Data/Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp`
|
`Data/Gfx/UI/InventoryIcons/Big/OptionalDevices/texture0.packed.webp`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const optionalDeviceKey in optionalDevices.root) {
|
for (const optionalDeviceKey in optionalDevices.root) {
|
||||||
@@ -35,8 +35,8 @@ export async function equipmentIcons() {
|
|||||||
|
|
||||||
const mapping = mappings.StyleSheets.find((mapping) =>
|
const mapping = mappings.StyleSheets.find((mapping) =>
|
||||||
mapping.selectors.includes(
|
mapping.selectors.includes(
|
||||||
`.optional_device_item.${optionalDevice.icon} #Img`
|
`.optional_device_item.${optionalDevice.icon} #Img`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!mapping) {
|
if (!mapping) {
|
||||||
@@ -49,9 +49,7 @@ export async function equipmentIcons() {
|
|||||||
|
|
||||||
if (configPath.startsWith("Gfx/Lobby")) {
|
if (configPath.startsWith("Gfx/Lobby")) {
|
||||||
const configPathWebp = configPath.replace(".txt", "");
|
const configPathWebp = configPath.replace(".txt", "");
|
||||||
const image = sharp(
|
const image = sharp(await vfs.file(`Data/${configPathWebp}.packed.webp`));
|
||||||
await vfs.file(`Data/${configPathWebp}.packed.webp`)
|
|
||||||
);
|
|
||||||
const content = await image.trim().toBuffer();
|
const content = await image.trim().toBuffer();
|
||||||
|
|
||||||
await uploader.add({
|
await uploader.add({
|
||||||
|
|||||||
@@ -6,20 +6,32 @@ export async function flags() {
|
|||||||
console.log("Building flags...");
|
console.log("Building flags...");
|
||||||
|
|
||||||
using uploader = new AssetUploader("flags");
|
using uploader = new AssetUploader("flags");
|
||||||
const circleFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter(
|
const circleFiles = await vfs
|
||||||
(flag) =>
|
.dir(`Data/Gfx/Lobby/flags`)
|
||||||
flag.startsWith("flag_profile-stat_") &&
|
.then((files) =>
|
||||||
!flag.endsWith("@2x.packed.webp")
|
files.filter(
|
||||||
|
(flag) =>
|
||||||
|
flag.startsWith("flag_profile-stat_") &&
|
||||||
|
!flag.endsWith("@2x.packed.webp"),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
const scratchedFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter(
|
const scratchedFiles = await vfs
|
||||||
|
.dir(`Data/Gfx/Lobby/flags`)
|
||||||
|
.then((files) =>
|
||||||
|
files.filter(
|
||||||
(flag) =>
|
(flag) =>
|
||||||
flag.startsWith("flag_tutor-tank_") &&
|
flag.startsWith("flag_tutor-tank_") &&
|
||||||
!flag.endsWith("@2x.packed.webp")
|
!flag.endsWith("@2x.packed.webp"),
|
||||||
)
|
),
|
||||||
const fadedFiles = vfs.dir(`Data/Gfx/Lobby/flags`).filter(
|
);
|
||||||
(flag) =>
|
const fadedFiles = await vfs
|
||||||
flag.startsWith("flag_filter_") && flag.endsWith("@2x.packed.webp")
|
.dir(`Data/Gfx/Lobby/flags`)
|
||||||
)
|
.then((files) =>
|
||||||
|
files.filter(
|
||||||
|
(flag) =>
|
||||||
|
flag.startsWith("flag_filter_") && flag.endsWith("@2x.packed.webp"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
for (const flag of circleFiles) {
|
for (const flag of circleFiles) {
|
||||||
const image = sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`));
|
const image = sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`));
|
||||||
@@ -43,9 +55,7 @@ export async function flags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const flag of fadedFiles) {
|
for (const flag of fadedFiles) {
|
||||||
const content = await sharp(
|
const content = await sharp(await vfs.file(`Data/Gfx/Lobby/flags/${flag}`))
|
||||||
await vfs.file(`Data/Gfx/Lobby/flags/${flag}`)
|
|
||||||
)
|
|
||||||
.trim({
|
.trim({
|
||||||
threshold: 100,
|
threshold: 100,
|
||||||
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
||||||
|
|||||||
@@ -8,35 +8,33 @@ export async function gameModeBanners() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("game mode banners");
|
using uploader = new AssetUploader("game mode banners");
|
||||||
const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>(
|
const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStyles>(
|
||||||
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`
|
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
|
||||||
);
|
);
|
||||||
const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>(
|
const squadBattleTypeStyles = await vfs.yaml<SquadBattleTypeStyles>(
|
||||||
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`
|
`Data/UI/Screens3/Lobby/Hangar/Squad/SquadBattleType.yaml`,
|
||||||
);
|
);
|
||||||
const bannerMatches: { name: string; path: string }[] = [];
|
const bannerMatches: { name: string; path: string }[] = [];
|
||||||
|
|
||||||
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
for (const match of gameTypeSelectorStyles.Prototypes[0].components.UIDataLocalBindingsComponent.data[1][2].matchAll(
|
||||||
/eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g
|
/eGameMode\.([a-zA-Z]+) -> "~res:([^"]+)"/g,
|
||||||
)) {
|
)) {
|
||||||
bannerMatches.push({ name: match[1], path: match[2] });
|
bannerMatches.push({ name: match[1], path: match[2] });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const match of squadBattleTypeStyles.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]);
|
||||||
const name = match[2];
|
const name = match[2];
|
||||||
let path = bannerMatches.find(
|
let path = bannerMatches.find(
|
||||||
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase()
|
(bannerMatch) => bannerMatch.name.toLowerCase() === name.toLowerCase(),
|
||||||
)?.path;
|
)?.path;
|
||||||
|
|
||||||
if (path === undefined) {
|
if (path === undefined) {
|
||||||
path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`;
|
path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = await sharp(
|
const content = await sharp(await vfs.file(`Data${path}.packed.webp`))
|
||||||
await vfs.file(`Data${path}.packed.webp`)
|
|
||||||
)
|
|
||||||
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ export async function migration() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("migration map");
|
using uploader = new AssetUploader("migration map");
|
||||||
const map: Record<string, number> = {};
|
const map: Record<string, number> = {};
|
||||||
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common");
|
const nations = await vfs
|
||||||
|
.dir(`Data/XML/item_defs/vehicles`)
|
||||||
|
.then((files) => files.filter((nation) => nation !== "common"));
|
||||||
|
|
||||||
for (const nation of nations) {
|
for (const nation of nations) {
|
||||||
const tankList = await vfs.xml<{ root: VehicleDefinitionList }>(
|
const tankList = await vfs.xml<{ root: VehicleDefinitionList }>(
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`
|
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const tankKey in tankList.root) {
|
for (const tankKey in tankList.root) {
|
||||||
|
|||||||
@@ -6,15 +6,20 @@ export async function moduleIcons() {
|
|||||||
console.log("Building module icons...");
|
console.log("Building module icons...");
|
||||||
|
|
||||||
using uploader = new AssetUploader("module icons");
|
using uploader = new AssetUploader("module icons");
|
||||||
const files = vfs.dir(`Data/Gfx/UI/ModulesTechTree`).filter(
|
const files = await vfs
|
||||||
(file) => !file.endsWith("@2x.packed.webp") && file.startsWith("vehicle")
|
.dir(`Data/Gfx/UI/ModulesTechTree`)
|
||||||
)
|
.then((files) =>
|
||||||
|
files.filter(
|
||||||
|
(file) =>
|
||||||
|
!file.endsWith("@2x.packed.webp") && file.startsWith("vehicle"),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const nameRaw = file.match(/vehicle(.+)\.packed\.webp/)![1];
|
const nameRaw = file.match(/vehicle(.+)\.packed\.webp/)![1];
|
||||||
const name = nameRaw[0].toLowerCase() + nameRaw.slice(1);
|
const name = nameRaw[0].toLowerCase() + nameRaw.slice(1);
|
||||||
const content = await sharp(
|
const content = await sharp(
|
||||||
await vfs.file(`Data/Gfx/UI/ModulesTechTree/${file}`)
|
await vfs.file(`Data/Gfx/UI/ModulesTechTree/${file}`),
|
||||||
)
|
)
|
||||||
.trim()
|
.trim()
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export async function popularTanks() {
|
|||||||
const analytics = google.analyticsdata({ version: "v1beta", auth });
|
const analytics = google.analyticsdata({ version: "v1beta", auth });
|
||||||
const report = await analytics.properties.runReport({
|
const report = await analytics.properties.runReport({
|
||||||
property: `properties/${assertSecret(
|
property: `properties/${assertSecret(
|
||||||
import.meta.env.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID
|
import.meta.env.PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID,
|
||||||
)}`,
|
)}`,
|
||||||
requestBody: {
|
requestBody: {
|
||||||
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
dateRanges: [{ startDate: "7daysAgo", endDate: "today" }],
|
||||||
@@ -47,13 +47,13 @@ export async function popularTanks() {
|
|||||||
row.dimensionValues[0].value &&
|
row.dimensionValues[0].value &&
|
||||||
row.dimensionValues[0].value !== "/tanks/" &&
|
row.dimensionValues[0].value !== "/tanks/" &&
|
||||||
row.metricValues &&
|
row.metricValues &&
|
||||||
row.metricValues[0].value
|
row.metricValues[0].value,
|
||||||
)
|
)
|
||||||
.map((row) => ({
|
.map((row) => ({
|
||||||
id: Number(
|
id: Number(
|
||||||
row.dimensionValues![0].value!.match(
|
row.dimensionValues![0].value!.match(
|
||||||
/\/tools\/tankopedia\/(\d+)\/?/
|
/\/tools\/tankopedia\/(\d+)\/?/,
|
||||||
)?.[1]
|
)?.[1],
|
||||||
),
|
),
|
||||||
views: Number(row.metricValues![0].value!),
|
views: Number(row.metricValues![0].value!),
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -8,19 +8,17 @@ export async function shellIcons() {
|
|||||||
using uploader = new AssetUploader("shell icons");
|
using uploader = new AssetUploader("shell icons");
|
||||||
const image = sharp(
|
const image = sharp(
|
||||||
await vfs.file(
|
await vfs.file(
|
||||||
`Data/Gfx/Shared/tank-supply/ammunition/big/texture0.packed.webp`
|
`Data/Gfx/Shared/tank-supply/ammunition/big/texture0.packed.webp`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
const files = vfs.dir(
|
const files = await vfs
|
||||||
`Data/Gfx/Shared/tank-supply/ammunition/big`
|
.dir(`Data/Gfx/Shared/tank-supply/ammunition/big`)
|
||||||
).filter((file) => file.endsWith("_l.txt"))
|
.then((files) => files.filter((file) => file.endsWith("_l.txt")));
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const name = file.match(/(.+)_l\.txt/)![1];
|
const name = file.match(/(.+)_l\.txt/)![1];
|
||||||
const sizes = (
|
const sizes = (
|
||||||
await vfs.text(
|
await vfs.text(`Data/Gfx/Shared/tank-supply/ammunition/big/${file}`)
|
||||||
`Data/Gfx/Shared/tank-supply/ammunition/big/${file}`
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.split("\n")[4]
|
.split("\n")[4]
|
||||||
.split(" ")
|
.split(" ")
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export async function skillIcons() {
|
|||||||
console.log("Building skill icons...");
|
console.log("Building skill icons...");
|
||||||
|
|
||||||
const avatar = await vfs.xml<{ root: Avatar }>(
|
const avatar = await vfs.xml<{ root: Avatar }>(
|
||||||
`Data/XML/item_defs/tankmen/avatar.xml`
|
`Data/XML/item_defs/tankmen/avatar.xml`,
|
||||||
);
|
);
|
||||||
const uploader = new AssetUploader("skill icons");
|
const uploader = new AssetUploader("skill icons");
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ export async function tankArmors() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("tank armors");
|
using uploader = new AssetUploader("tank armors");
|
||||||
const nodeIO = new NodeIO();
|
const nodeIO = new NodeIO();
|
||||||
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common");
|
const nations = await vfs
|
||||||
|
.dir(`Data/XML/item_defs/vehicles`)
|
||||||
|
.then((files) => files.filter((nation) => nation !== "common"));
|
||||||
|
|
||||||
for (const nation of nations) {
|
for (const nation of nations) {
|
||||||
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
|
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`
|
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const tankKey in tanks.root) {
|
for (const tankKey in tanks.root) {
|
||||||
|
|||||||
@@ -41,11 +41,13 @@ export async function tankIcons() {
|
|||||||
console.log("Building tank icons...");
|
console.log("Building tank icons...");
|
||||||
|
|
||||||
using uploader = new AssetUploader("tank icons");
|
using uploader = new AssetUploader("tank icons");
|
||||||
const nations = vfs.dir(`Data/XML/item_defs/vehicles`).filter((nation) => nation !== "common")
|
const nations = await vfs
|
||||||
|
.dir(`Data/XML/item_defs/vehicles`)
|
||||||
|
.then((files) => files.filter((nation) => nation !== "common"));
|
||||||
|
|
||||||
for (const nation of nations) {
|
for (const nation of nations) {
|
||||||
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
|
const tanks = await vfs.xml<{ root: VehicleDefinitionList }>(
|
||||||
`Data/XML/item_defs/vehicles/${nation}/list.xml`
|
`Data/XML/item_defs/vehicles/${nation}/list.xml`,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (const tankKey in tanks.root) {
|
for (const tankKey in tanks.root) {
|
||||||
@@ -57,7 +59,7 @@ export async function tankIcons() {
|
|||||||
const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1;
|
const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1;
|
||||||
|
|
||||||
const parameters = await vfs.yaml<TankParameters>(
|
const parameters = await vfs.yaml<TankParameters>(
|
||||||
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`
|
`Data/3d/Tanks/Parameters/${nation}/${tankKey}.yaml`,
|
||||||
);
|
);
|
||||||
const smallPath = `Data/${parameters.resourcesPath.smallIconPath
|
const smallPath = `Data/${parameters.resourcesPath.smallIconPath
|
||||||
.replace(/~res:\//, "")
|
.replace(/~res:\//, "")
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ export async function tankModels() {
|
|||||||
|
|
||||||
using uploader = new AssetUploader("tank models");
|
using uploader = new AssetUploader("tank models");
|
||||||
const nodeIO = new NodeIO().registerExtensions(ALL_EXTENSIONS);
|
const nodeIO = new NodeIO().registerExtensions(ALL_EXTENSIONS);
|
||||||
const nations = vfs
|
const nations = await vfs
|
||||||
.dir(`Data/XML/item_defs/vehicles`)
|
.dir(`Data/XML/item_defs/vehicles`)
|
||||||
.filter((nation) => nation !== "common");
|
.then((files) => files.filter((nation) => nation !== "common"));
|
||||||
|
|
||||||
for (const nationIndex in nations) {
|
for (const nationIndex in nations) {
|
||||||
const nation = nations[nationIndex];
|
const nation = nations[nationIndex];
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { vfs } from "../../../buildAssets/constants";
|
|||||||
|
|
||||||
export async function readTexture(path: string) {
|
export async function readTexture(path: string) {
|
||||||
const ddsTexturePath = path.replace(".tex", ".dx11.dds");
|
const ddsTexturePath = path.replace(".tex", ".dx11.dds");
|
||||||
const isDds = vfs.resolve(ddsTexturePath);
|
const isDds = await vfs.resolve(ddsTexturePath);
|
||||||
const resolvedTexturePath = isDds
|
const resolvedTexturePath = isDds
|
||||||
? ddsTexturePath
|
? ddsTexturePath
|
||||||
: ddsTexturePath.replace(".dds", ".pvr");
|
: ddsTexturePath.replace(".dds", ".pvr");
|
||||||
|
|||||||
Reference in new issue
Block a user