mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: augment
This commit is contained in:
1 parent
f70864a0db
commit
1cc15f64b0
9 files changed
+63
-75
No files matched your search
@@ -1,32 +1,11 @@
|
||||
import { readdir } from "fs/promises";
|
||||
import { argv } from "process";
|
||||
import { assertSecret, SteamVFS } from "@blitzkit/core";
|
||||
|
||||
const WINDOWS_APPS = "C:/Program Files/WindowsApps";
|
||||
const wotbPackageRegex = /7458BE2C\..+_\d+(\.\d+)+_x64__.+/;
|
||||
const APP = 444200;
|
||||
const DEPOT = 444202;
|
||||
|
||||
const isManual = argv.includes("--manual");
|
||||
|
||||
let data: string;
|
||||
let compressed: boolean;
|
||||
|
||||
if (isManual) {
|
||||
data = "../../temp/game/Data";
|
||||
compressed = true;
|
||||
} else {
|
||||
const directories = await readdir(WINDOWS_APPS).then((files) =>
|
||||
files.filter((file) => wotbPackageRegex.test(file))
|
||||
);
|
||||
|
||||
if (directories.length !== 1) {
|
||||
throw new Error(
|
||||
`Expected 1 directory for WoTB Windows App, got ${directories.length}.`
|
||||
);
|
||||
}
|
||||
|
||||
const [windowsApp] = directories;
|
||||
data = `${WINDOWS_APPS}/${windowsApp}/Data`;
|
||||
compressed = false;
|
||||
}
|
||||
|
||||
export const DATA = data;
|
||||
export const DATA_COMPRESSED = compressed;
|
||||
export const vfs = new SteamVFS(
|
||||
assertSecret(import.meta.env.STEAM_USERNAME),
|
||||
assertSecret(import.meta.env.STEAM_PASSWORD),
|
||||
APP,
|
||||
DEPOT
|
||||
);
|
||||
@@ -1,16 +1,8 @@
|
||||
import { config } from "dotenv";
|
||||
import { argv } from "process";
|
||||
|
||||
config();
|
||||
|
||||
const allTargets = argv.includes("--all-targets");
|
||||
const targets = argv
|
||||
.find((argument) => argument.startsWith("--target"))
|
||||
?.split("=")[1]
|
||||
.split(",");
|
||||
|
||||
import { boosterIcons } from "./boosterIcons";
|
||||
import { camouflageIcons } from "./camouflageIcons";
|
||||
import { vfs } from "./constants";
|
||||
import { consumableProvisionIcons } from "./consumableProvisionIcons";
|
||||
import { currencies } from "./currencies";
|
||||
import { definitions } from "./definitions";
|
||||
@@ -27,6 +19,14 @@ import { tankArmors } from "./tankArmors";
|
||||
import { tankIcons } from "./tankIcons";
|
||||
import { tankModels } from "./tankModels";
|
||||
|
||||
config();
|
||||
|
||||
const allTargets = argv.includes("--all-targets");
|
||||
const targets = argv
|
||||
.find((argument) => argument.startsWith("--target"))
|
||||
?.split("=")[1]
|
||||
.split(",");
|
||||
|
||||
if (!targets && !allTargets) throw new Error("No target(s) specified");
|
||||
|
||||
const methods = [
|
||||
@@ -59,3 +59,6 @@ for (const method of methods) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vfs.dispose();
|
||||
process.exit(0);
|
||||
@@ -1,6 +0,0 @@
|
||||
import { readDVPLFile } from './readDVPLFile';
|
||||
|
||||
export async function readStringDVPL(file: string) {
|
||||
const buffer = await readDVPLFile(file);
|
||||
return buffer.toString();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { XMLParser } from 'fast-xml-parser';
|
||||
import { readStringDVPL } from './readStringDVPL';
|
||||
|
||||
export async function readXMLDVPL<Type>(file: string) {
|
||||
const parser = new XMLParser();
|
||||
const xml = await readStringDVPL(file);
|
||||
|
||||
return parser.parse(xml) as Type;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { readFile } from 'fs/promises';
|
||||
import { parse } from 'yaml';
|
||||
|
||||
export async function readYAML<Type>(file: string) {
|
||||
const yaml = (await readFile(file)).toString();
|
||||
return parse(yaml) as Type;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { parse } from 'yaml';
|
||||
import { readStringDVPL } from './readStringDVPL';
|
||||
|
||||
export async function readYAMLDVPL<Type>(file: string) {
|
||||
const yaml = await readStringDVPL(file);
|
||||
|
||||
return parse(yaml) as Type;
|
||||
}
|
||||
Reference in new issue
Block a user