mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
idk bro
This commit is contained in:
1 parent
4e72ea567f
commit
f41eeba25e
9 files changed
+150
-34
No files matched your search
@@ -101,6 +101,7 @@
|
||||
"dependencies": {
|
||||
"@blitzkit/closed": "workspace:*",
|
||||
"@blitzkit/core": "workspace:*",
|
||||
"@blitzkit/game": "workspace:*",
|
||||
"@blitzkit/i18n": "workspace:*",
|
||||
"@gltf-transform/core": "^4.2.1",
|
||||
"@gltf-transform/extensions": "^4.2.1",
|
||||
@@ -687,7 +688,7 @@
|
||||
|
||||
"@fontsource/inter": ["@fontsource/[email protected]", "", {}, "sha512-P6r5WnJoKiNVV+zvW2xM13gNdFhAEpQ9dQJHt3naLvfg+LkF2ldgSLiF4T41lf1SQCM9QmkqPTn4TH568IRagg=="],
|
||||
|
||||
"@gltf-transform/core": ["@gltf-transform/core@4.3.0", "", { "dependencies": { "property-graph": "^4.0.0" } }, "sha512-ZeaQfszGJ9LYwELszu45CuDQCsE26lJNNe36FVmN8xclaT6WDdCj7fwGpQXo0/l/YgAVAHX+uO7YNBW75/SRYw=="],
|
||||
"@gltf-transform/core": ["@gltf-transform/core@4.4.0", "", { "dependencies": { "property-graph": "^4.1.0" } }, "sha512-cOPxOhHFFz5hwmix+li1+Nnq5qMV/QD3fTCsVlApxxFACtFdjkt2R/juseD4gvZ7D2c/yl6OilKH0pvI735YyQ=="],
|
||||
|
||||
"@gltf-transform/extensions": ["@gltf-transform/[email protected]", "", { "dependencies": { "@gltf-transform/core": "^4.3.0", "ktx-parse": "^1.0.1" } }, "sha512-XDAjQPYVMHa/VDpSbfCBwI+/1muwRJCaXhUpLgnUzAjn0D//PgvIAcbNm1EwBl3LIWBSwjDUCn2LiMAjp+aXVw=="],
|
||||
|
||||
@@ -2467,7 +2468,7 @@
|
||||
|
||||
"prompts": ["[email protected]", "", { "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" } }, "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q=="],
|
||||
|
||||
"property-graph": ["property-graph@4.0.0", "", {}, "sha512-I0hojAJfTbSCZy3y6xyK29eayxo14v1bj1VPiDkHjTdz33SV6RdfMz2AHnf4ai62Vng2mN5GkaKahkooBIo9gA=="],
|
||||
"property-graph": ["property-graph@4.1.0", "", {}, "sha512-AvPcP7XECNWy4LGmFQ77k7un4lSKM4eS29PTvW4ck95uYeLxXPWJM7hLuBqK91FaHqCcgJvIUCuNJjjxKE7VKQ=="],
|
||||
|
||||
"property-information": ["[email protected]", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
|
||||
|
||||
@@ -3091,9 +3092,9 @@
|
||||
|
||||
"@blitzkit/scripts/@types/three": ["@types/[email protected]", "", { "dependencies": { "@dimforge/rapier3d-compat": "~0.12.0", "@tweenjs/tween.js": "~23.1.3", "@types/stats.js": "*", "@types/webxr": "*", "@webgpu/types": "*", "fflate": "~0.8.2", "meshoptimizer": "~0.22.0" } }, "sha512-ykFtgCqNnY0IPvDro7h+9ZeLY+qjgUWv+qEvUt84grhenO60Hqd4hScHE7VTB9nOQ/3QM8lkbNE+4vKjEpUxKg=="],
|
||||
|
||||
"@blitzkit/scripts/three": ["[email protected]", "", {}, "sha512-o+qycAMZrh+TsE01GqWUxUIKR1AL0S8pq7zDkYOQw8GqfX8b8VoCKYUoHbhiX5j+7hr8XsuHDVU6+gkQJQKg9w=="],
|
||||
"@blitzkit/scripts/lodash-es": ["[email protected]", "", {}, "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A=="],
|
||||
|
||||
"@blitzkit/scripts/yaml": ["[email protected]", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A=="],
|
||||
"@blitzkit/scripts/three": ["[email protected]", "", {}, "sha512-o+qycAMZrh+TsE01GqWUxUIKR1AL0S8pq7zDkYOQw8GqfX8b8VoCKYUoHbhiX5j+7hr8XsuHDVU6+gkQJQKg9w=="],
|
||||
|
||||
"@blitzkit/website/@types/three": ["@types/[email protected]", "", { "dependencies": { "@dimforge/rapier3d-compat": "~0.12.0", "@tweenjs/tween.js": "~23.1.3", "@types/stats.js": "*", "@types/webxr": "*", "@webgpu/types": "*", "fflate": "~0.8.2", "meshoptimizer": "~0.22.0" } }, "sha512-ykFtgCqNnY0IPvDro7h+9ZeLY+qjgUWv+qEvUt84grhenO60Hqd4hScHE7VTB9nOQ/3QM8lkbNE+4vKjEpUxKg=="],
|
||||
|
||||
@@ -3105,8 +3106,6 @@
|
||||
|
||||
"@blitzkit/website-ue/@astrojs/node": ["@astrojs/[email protected]", "", { "dependencies": { "@astrojs/internal-helpers": "0.7.6", "send": "^1.2.1", "server-destroy": "^1.0.1" }, "peerDependencies": { "astro": "^5.17.3" } }, "sha512-rtU2BGU5u3SfGURpANfMxVzCIoR86MkaN05ncza9rbtuMKJ/XnRJt/BbyVknDbOJ71hoci0SIsJwKcJR8vvi/A=="],
|
||||
|
||||
"@blitzkit/website-ue/@gltf-transform/core": ["@gltf-transform/[email protected]", "", { "dependencies": { "property-graph": "^4.1.0" } }, "sha512-cOPxOhHFFz5hwmix+li1+Nnq5qMV/QD3fTCsVlApxxFACtFdjkt2R/juseD4gvZ7D2c/yl6OilKH0pvI735YyQ=="],
|
||||
|
||||
"@blitzkit/website-ue/astro": ["[email protected]", "", { "dependencies": { "@astrojs/compiler": "^2.13.0", "@astrojs/internal-helpers": "0.7.6", "@astrojs/markdown-remark": "6.3.11", "@astrojs/telemetry": "3.3.0", "@capsizecss/unpack": "^4.0.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.3.0", "acorn": "^8.15.0", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.3.1", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^1.1.1", "cssesc": "^3.0.0", "debug": "^4.4.3", "deterministic-object-hash": "^2.0.2", "devalue": "^5.6.2", "diff": "^8.0.3", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.7.0", "esbuild": "^0.27.3", "estree-walker": "^3.0.3", "flattie": "^1.1.1", "fontace": "~0.4.0", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.2.0", "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", "magic-string": "^0.30.21", "magicast": "^0.5.1", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", "p-queue": "^8.1.1", "package-manager-detector": "^1.6.0", "piccolore": "^0.1.3", "picomatch": "^4.0.3", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.7.3", "shiki": "^3.21.0", "smol-toml": "^1.6.0", "svgo": "^4.0.0", "tinyexec": "^1.0.2", "tinyglobby": "^0.2.15", "tsconfck": "^3.1.6", "ultrahtml": "^1.6.0", "unifont": "~0.7.3", "unist-util-visit": "^5.0.0", "unstorage": "^1.17.4", "vfile": "^6.0.3", "vite": "^6.4.1", "vitefu": "^1.1.1", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "yocto-spinner": "^0.2.3", "zod": "^3.25.76", "zod-to-json-schema": "^3.25.1", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.34.0" }, "bin": { "astro": "astro.js" } }, "sha512-TnFwLnAXty5MXKPDGuKXqK4AMBXG+FH6RUdK7Oyc3gyfNoFIthT+4eRbzOK43bdRlLaZuxgciDSjgtggZ3OtGQ=="],
|
||||
|
||||
"@blitzkit/website-ue/astro-favicons": ["[email protected]", "", { "dependencies": { "favilib": "^1.0.5", "ultrahtml": "^1.5.3" }, "peerDependencies": { "astro": ">= 4.0.0" } }, "sha512-9YfNWaBEFz1nCHy4P1l4wfPRvuLe4qHuHovIcqD5HYfZeW82wyVG1+CZUVGhcjwbRCVkGRJ3G+CKTyX9BcoI5w=="],
|
||||
@@ -3121,6 +3120,10 @@
|
||||
|
||||
"@discordjs/ws/@discordjs/collection": ["@discordjs/[email protected]", "", {}, "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg=="],
|
||||
|
||||
"@gltf-transform/extensions/@gltf-transform/core": ["@gltf-transform/[email protected]", "", { "dependencies": { "property-graph": "^4.0.0" } }, "sha512-ZeaQfszGJ9LYwELszu45CuDQCsE26lJNNe36FVmN8xclaT6WDdCj7fwGpQXo0/l/YgAVAHX+uO7YNBW75/SRYw=="],
|
||||
|
||||
"@gltf-transform/functions/@gltf-transform/core": ["@gltf-transform/[email protected]", "", { "dependencies": { "property-graph": "^4.0.0" } }, "sha512-ZeaQfszGJ9LYwELszu45CuDQCsE26lJNNe36FVmN8xclaT6WDdCj7fwGpQXo0/l/YgAVAHX+uO7YNBW75/SRYw=="],
|
||||
|
||||
"@jimp/core/file-type": ["[email protected]", "", { "dependencies": { "readable-web-to-node-stream": "^3.0.0", "strtok3": "^6.2.4", "token-types": "^4.1.1" } }, "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw=="],
|
||||
|
||||
"@rollup/plugin-babel/@rollup/pluginutils": ["@rollup/[email protected]", "", { "dependencies": { "@types/estree": "0.0.39", "estree-walker": "^1.0.1", "picomatch": "^2.2.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0" } }, "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg=="],
|
||||
@@ -3315,8 +3318,6 @@
|
||||
|
||||
"@blitzkit/website-ue/@astrojs/node/@astrojs/internal-helpers": ["@astrojs/[email protected]", "", {}, "sha512-GOle7smBWKfMSP8osUIGOlB5kaHdQLV3foCsf+5Q9Wsuu+C6Fs3Ez/ttXmhjZ1HkSgsogcM1RXSjjOVieHq16Q=="],
|
||||
|
||||
"@blitzkit/website-ue/@gltf-transform/core/property-graph": ["[email protected]", "", {}, "sha512-AvPcP7XECNWy4LGmFQ77k7un4lSKM4eS29PTvW4ck95uYeLxXPWJM7hLuBqK91FaHqCcgJvIUCuNJjjxKE7VKQ=="],
|
||||
|
||||
"@blitzkit/website-ue/astro/@astrojs/internal-helpers": ["@astrojs/[email protected]", "", {}, "sha512-GOle7smBWKfMSP8osUIGOlB5kaHdQLV3foCsf+5Q9Wsuu+C6Fs3Ez/ttXmhjZ1HkSgsogcM1RXSjjOVieHq16Q=="],
|
||||
|
||||
"@blitzkit/website-ue/astro/@astrojs/markdown-remark": ["@astrojs/[email protected]", "", { "dependencies": { "@astrojs/internal-helpers": "0.7.6", "@astrojs/prism": "3.3.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", "import-meta-resolve": "^4.2.0", "js-yaml": "^4.1.1", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", "shiki": "^3.21.0", "smol-toml": "^1.6.0", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.2", "vfile": "^6.0.3" } }, "sha512-hcaxX/5aC6lQgHeGh1i+aauvSwIT6cfyFjKWvExYSxUhZZBBdvCliOtu06gbQyhbe0pGJNoNmqNlQZ5zYUuIyQ=="],
|
||||
@@ -3337,6 +3338,10 @@
|
||||
|
||||
"@blitzkit/website/vite/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="],
|
||||
|
||||
"@gltf-transform/extensions/@gltf-transform/core/property-graph": ["[email protected]", "", {}, "sha512-I0hojAJfTbSCZy3y6xyK29eayxo14v1bj1VPiDkHjTdz33SV6RdfMz2AHnf4ai62Vng2mN5GkaKahkooBIo9gA=="],
|
||||
|
||||
"@gltf-transform/functions/@gltf-transform/core/property-graph": ["[email protected]", "", {}, "sha512-I0hojAJfTbSCZy3y6xyK29eayxo14v1bj1VPiDkHjTdz33SV6RdfMz2AHnf4ai62Vng2mN5GkaKahkooBIo9gA=="],
|
||||
|
||||
"@rollup/plugin-babel/@rollup/pluginutils/@types/estree": ["@types/[email protected]", "", {}, "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw=="],
|
||||
|
||||
"@rollup/plugin-babel/@rollup/pluginutils/estree-walker": ["[email protected]", "", {}, "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg=="],
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
"setup": "chmod a+x scripts/*.sh && ./scripts/setup.sh",
|
||||
"dev": "./scripts/dev.sh",
|
||||
"build-game": "./scripts/build_game.sh",
|
||||
"build-website": "./scripts/build_website.sh"
|
||||
"build-website": "./scripts/build_website.sh",
|
||||
"discover-servers": "./scripts/discover_servers.sh"
|
||||
},
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
|
||||
@@ -28,16 +28,18 @@ namespace BlitzKit.Game.JSExport;
|
||||
public partial class GameInterface
|
||||
{
|
||||
private readonly BlitzFileProvider provider;
|
||||
|
||||
public HashSet<string> files;
|
||||
public int textureChunks;
|
||||
|
||||
public GameInterface(string directory, string map, string temp)
|
||||
public GameInterface(string directory, string map, string temp, int textureChunks)
|
||||
{
|
||||
provider = new(directory, map, temp);
|
||||
files = [.. provider.Files.Keys];
|
||||
|
||||
this.textureChunks = textureChunks;
|
||||
}
|
||||
|
||||
readonly Dictionary<string, string> texturePaths = new();
|
||||
readonly Dictionary<string, (int, string)> texturePaths = [];
|
||||
readonly string textureCache = "../../temp/textures.json";
|
||||
|
||||
public void DiscoverTextures(string[] tankTags)
|
||||
@@ -47,7 +49,7 @@ public partial class GameInterface
|
||||
Console.WriteLine("Found textures cache");
|
||||
|
||||
var content = File.ReadAllText(textureCache);
|
||||
var cached = JsonSerializer.Deserialize<Dictionary<string, string>>(content);
|
||||
var cached = JsonSerializer.Deserialize<Dictionary<string, (int, string)>>(content);
|
||||
|
||||
foreach (var (key, value) in cached)
|
||||
{
|
||||
@@ -110,9 +112,10 @@ public partial class GameInterface
|
||||
if (MonoGltf.knownChannels.TryGetValue(parameterTexture.Key, out var channel))
|
||||
{
|
||||
var path = parameterTexture.Value.GetPathName();
|
||||
var modulus = MonoGltf.TextureModulus(path, textureChunks);
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
|
||||
texturePaths[name] = path;
|
||||
texturePaths[name] = (modulus, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,11 +135,12 @@ public partial class GameInterface
|
||||
Console.WriteLine("Saved textures cache");
|
||||
}
|
||||
|
||||
public List<string> Textures => [.. texturePaths.Keys];
|
||||
public List<(int, string)> Textures =>
|
||||
[.. texturePaths.Select(texture => (texture.Value.Item1, texture.Key))];
|
||||
|
||||
public byte[] Texture(string name)
|
||||
{
|
||||
var path = texturePaths[name];
|
||||
var (_, path) = texturePaths[name];
|
||||
var texture = provider.LoadPackageObject<UTexture2D>(path);
|
||||
var isRMAO = name.EndsWith("_RMAO");
|
||||
var postProcess = isRMAO ? ImagePostProcess.RMAO : ImagePostProcess.None;
|
||||
@@ -257,7 +261,7 @@ public partial class GameInterface
|
||||
// var meshes = CollectMeshes(meshSettings);
|
||||
// var gltf = new MonoGltf(meshes);
|
||||
|
||||
var gltf = new MonoGltf(meshSettings);
|
||||
var gltf = new MonoGltf(meshSettings, textureChunks);
|
||||
|
||||
return gltf.Write($"{tag}/{part}");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using CUE4Parse.Compression;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Numerics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using CUE4Parse_Conversion;
|
||||
using CUE4Parse_Conversion.Materials;
|
||||
using CUE4Parse_Conversion.Meshes;
|
||||
@@ -44,9 +46,12 @@ public class MonoGltf
|
||||
static readonly byte[] stubBytes = File.ReadAllBytes("../game/stub/small.png");
|
||||
static readonly float scaleCorrection = 0.01f;
|
||||
|
||||
public MonoGltf(FStructFallback settings)
|
||||
readonly int textureChunks;
|
||||
|
||||
public MonoGltf(FStructFallback settings, int textureChunks)
|
||||
{
|
||||
var root = new NodeBuilder("root");
|
||||
this.textureChunks = textureChunks;
|
||||
|
||||
Traverse(settings, root);
|
||||
scene.AddNode(root);
|
||||
@@ -173,9 +178,7 @@ public class MonoGltf
|
||||
{
|
||||
if (knownChannels.TryGetValue(parameterTexture.Key, out var channels))
|
||||
{
|
||||
var texture = parameterTexture.Value;
|
||||
var name = Path.GetFileNameWithoutExtension(texture.GetPathName());
|
||||
var path = $"../../../textures/{name}.webp";
|
||||
var path = TexturePath(parameterTexture.Value.GetPathName(), textureChunks);
|
||||
|
||||
var lastIndex = stubBytes.Length - 1;
|
||||
stubBytes[lastIndex] = (byte)(++stubBytes[lastIndex] % 255);
|
||||
@@ -214,6 +217,25 @@ public class MonoGltf
|
||||
return meshBuilder;
|
||||
}
|
||||
|
||||
public static int TextureModulus(string path, int textureChunks)
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
var bytes = Encoding.UTF8.GetBytes(name);
|
||||
var hash = SHA256.HashData(bytes);
|
||||
var value = BitConverter.ToUInt32(hash, 0);
|
||||
var modulus = value % textureChunks;
|
||||
|
||||
return (int)modulus;
|
||||
}
|
||||
|
||||
public static string TexturePath(string path, int textureChunks)
|
||||
{
|
||||
var modulus = TextureModulus(path, textureChunks);
|
||||
var name = Path.GetFileNameWithoutExtension(path);
|
||||
|
||||
return $"../../../textures-{modulus}/{name}.webp";
|
||||
}
|
||||
|
||||
public byte[] Write(string name)
|
||||
{
|
||||
var model = scene.ToGltf2();
|
||||
|
||||
@@ -3,22 +3,12 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build:assets": "bun src/buildAssets/index.ts",
|
||||
"build:averages": "bun src/averages.ts",
|
||||
"setup:depotdownloader": "bun src/setupDepotDownloader.ts",
|
||||
"setup:patches": "bun src/applyPatches.ts",
|
||||
"build:reviews": "bun src/reviews.ts",
|
||||
"build:ids": "bun src/discoverIds.ts",
|
||||
"build:bot": "bun src/buildBot.ts",
|
||||
"build:ratingleaderboard": "bun src/buildRatingLeaderboard.ts",
|
||||
"build:proxyclient": "bun src/buildProxyClient.ts",
|
||||
"build:catalogitemaccessor": "bun src/buildCatalogItemAccessor.ts",
|
||||
"build:protos": "bun src/protos.ts",
|
||||
"patchnotes": "bun src/patchNotes.ts"
|
||||
"discover-servers": "bun src/discoverServers.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzkit/closed": "workspace:*",
|
||||
"@blitzkit/core": "workspace:*",
|
||||
"@blitzkit/game": "workspace:*",
|
||||
"@blitzkit/i18n": "workspace:*",
|
||||
"@gltf-transform/core": "^4.2.1",
|
||||
"@gltf-transform/extensions": "^4.2.1",
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import { GameInterface } from "@blitzkit/game";
|
||||
|
||||
const urls = [
|
||||
//
|
||||
];
|
||||
|
||||
interface Bindings {
|
||||
bindings: Binding[];
|
||||
forbidden: string[];
|
||||
}
|
||||
|
||||
interface Binding {
|
||||
name: string;
|
||||
versions: string[];
|
||||
discovery: string;
|
||||
env: string;
|
||||
show_server_selection: boolean;
|
||||
}
|
||||
|
||||
interface Discovery {
|
||||
version: "1";
|
||||
clusters: string[];
|
||||
default_server: string;
|
||||
servers: Record<string, Server>;
|
||||
icmp_servers: Record<string, ICMPServer>;
|
||||
clusters_versions: Record<string, ClusterVersion[]>;
|
||||
countries_by_clusters: Record<string, Countries>;
|
||||
extensions: Record<string, Extension>;
|
||||
}
|
||||
|
||||
interface ClusterVersion {
|
||||
version: string;
|
||||
server: string;
|
||||
}
|
||||
|
||||
interface Countries {
|
||||
countries: string[];
|
||||
}
|
||||
|
||||
interface Extension {
|
||||
playability_config_url: string;
|
||||
fullscreen_notifications_url: string;
|
||||
mgg_frontier_url: string;
|
||||
mgg_pay_url: string;
|
||||
}
|
||||
|
||||
type ICMPServer = Record<string, string[]>;
|
||||
|
||||
interface Server {
|
||||
name: string;
|
||||
addr: string;
|
||||
addr_dsapp?: string;
|
||||
}
|
||||
|
||||
const game = new GameInterface();
|
||||
|
||||
urls.forEach(async (url) => {
|
||||
const bindings = await fetch(url).then(
|
||||
(response) => response.json() as Promise<Bindings>,
|
||||
);
|
||||
|
||||
bindings.bindings.forEach(async (binding) => {
|
||||
const discovery = await fetch(binding.discovery).then(
|
||||
(response) => response.json() as Promise<Discovery>,
|
||||
);
|
||||
|
||||
if (discovery.version !== "1") {
|
||||
throw new Error(`Unsupported discovery version: ${discovery.version}`);
|
||||
}
|
||||
|
||||
Object.values(discovery.servers).forEach(async (server) => {
|
||||
const url = server.addr
|
||||
.replace("wss://", "https://")
|
||||
.replace(/:\d+$/, "");
|
||||
const response = await fetch(url).catch(() => null);
|
||||
|
||||
if (response === null || response.status !== 426) return;
|
||||
|
||||
let message = "";
|
||||
|
||||
message += `${server.name}:\n`;
|
||||
message += ` address: ${server.addr}\n`;
|
||||
message += ` versions:\n`;
|
||||
|
||||
for (const version of binding.versions) {
|
||||
message += ` - ${version}\n`;
|
||||
}
|
||||
|
||||
console.log(message);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,7 @@ if (!clientUnmounted && import.meta.env.SSR) {
|
||||
assertSecret(import.meta.env.PUBLIC_WOTB_CLIENT),
|
||||
assertSecret(import.meta.env.WOTB_USMAP),
|
||||
"../../temp",
|
||||
Number(assertSecret(import.meta.env.TEXTURE_CHUNKS)),
|
||||
);
|
||||
|
||||
const tankTags: string[] = [];
|
||||
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
cd packages/scripts
|
||||
bun run discover-servers
|
||||
Reference in new issue
Block a user