From ca270e2010ef62ff04d65d8d8970883dbfa09ccb Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 22 May 2026 13:51:30 -0500 Subject: [PATCH] beginnings of equipment icon --- package.json | 3 +- packages/game/JSExport/GameInterface.cs | 43 ++++++++++++++++--- packages/game/Models/BlitzFileProvider.cs | 6 +-- .../components/TankopediaLoadout/index.tsx | 5 ++- scripts/build_game.sh | 2 + scripts/setup.sh | 1 - 6 files changed, 47 insertions(+), 13 deletions(-) create mode 100755 scripts/build_game.sh diff --git a/package.json b/package.json index 07be900b7..eb74271ad 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "private": true, "scripts": { "setup": "chmod a+x scripts/*.sh && ./scripts/setup.sh", - "dev": "./scripts/dev.sh" + "dev": "./scripts/dev.sh", + "build-game": "./scripts/build_game.sh" }, "type": "module", "workspaces": [ diff --git a/packages/game/JSExport/GameInterface.cs b/packages/game/JSExport/GameInterface.cs index 1b62496c8..26cb27b78 100644 --- a/packages/game/JSExport/GameInterface.cs +++ b/packages/game/JSExport/GameInterface.cs @@ -1,10 +1,10 @@ -using System.IO; -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; using BlitzKit.Game.Models; using CUE4Parse_Conversion.Textures; using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Objects.Engine; using CUE4Parse.UE4.Objects.UObject; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.JavaScript.NodeApi; using SkiaSharp; @@ -15,12 +15,12 @@ public partial class GameInterface { private readonly BlitzFileProvider provider; - public string[] files; + public HashSet files; public string[] tanksDirectoryNations; - public GameInterface(string directory) + public GameInterface(string directory, string map) { - provider = new(directory); + provider = new(directory, map); files = [.. provider.Files.Keys]; @@ -36,7 +36,7 @@ public partial class GameInterface ]; } - public string[] Files => files; + public HashSet Files => files; public string[] TanksDirectoryNations => tanksDirectoryNations; public byte[] TankBigIcon(string tankId, string pdaName) @@ -111,4 +111,35 @@ public partial class GameInterface return []; } + + private static readonly string equipmentPDAPrefix = + "Blitz/Content/TanksStuff/Equipment/PDA_Equipment"; + private static readonly string equipmentPDASuffix = ".uasset"; + + public byte[] EquipmentIcon(string[] names) + { + List candidates = []; + + foreach (var name in names) + { + candidates.AddRange([ + $"{equipmentPDAPrefix}{name}{equipmentPDASuffix}", + $"{equipmentPDAPrefix}_{name}{equipmentPDASuffix}", + ]); + } + + foreach (var candidate in candidates) + { + if (!files.Contains(candidate)) + { + continue; + } + + Console.WriteLine(candidate); + } + + // TODO: warn if no equipment icons found + + return []; + } } diff --git a/packages/game/Models/BlitzFileProvider.cs b/packages/game/Models/BlitzFileProvider.cs index 34b46cba3..1ac7081fe 100644 --- a/packages/game/Models/BlitzFileProvider.cs +++ b/packages/game/Models/BlitzFileProvider.cs @@ -8,7 +8,7 @@ namespace BlitzKit.Game.Models; public class BlitzFileProvider : DefaultFileProvider { - public BlitzFileProvider(string directory) + public BlitzFileProvider(string directory, string map) : base( directory: directory, searchOption: SearchOption.AllDirectories, @@ -16,12 +16,12 @@ public class BlitzFileProvider : DefaultFileProvider pathComparer: StringComparer.OrdinalIgnoreCase ) { - MappingsContainer = new FileUsmapTypeMappingsProvider("../../packages/closed/blitz.usmap"); + MappingsContainer = new FileUsmapTypeMappingsProvider(map); Initialize(); Mount(); // OodleHelper.DownloadOodleDll($"../../temp/oodle.so"); - OodleHelper.Initialize($"../../temp/oodle.so"); + // OodleHelper.Initialize($"../../temp/oodle.so"); } } diff --git a/packages/website-ue/src/components/TankopediaLoadout/index.tsx b/packages/website-ue/src/components/TankopediaLoadout/index.tsx index 40cf16168..019a275d3 100644 --- a/packages/website-ue/src/components/TankopediaLoadout/index.tsx +++ b/packages/website-ue/src/components/TankopediaLoadout/index.tsx @@ -58,9 +58,10 @@ function Consumables() { const isCompatible = useCompatibility(tank); return Object.values(consumables.consumables).map( - ({ compatibility, consumable }) => { + ({ compatibility, consumable, purchase }) => { if (!isCompatible(compatibility!)) return null; - return {consumable!.name_key}; + + return {JSON.stringify(consumable, null, 2)}; }, ); } diff --git a/scripts/build_game.sh b/scripts/build_game.sh new file mode 100755 index 000000000..8ef89e106 --- /dev/null +++ b/scripts/build_game.sh @@ -0,0 +1,2 @@ +cd packages/game +dotnet build --no-restore \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh index 7c3c47549..a523cbf6a 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -3,7 +3,6 @@ bun install cd packages/scripts bun run build:protos bun run build:proxyclient -bun run build:proxyclient bun run build:catalogitemaccessor cd ../game