From b0d7a49b16ff47bd1df01f0d7a9f3e1155618f71 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:49:17 -0600 Subject: [PATCH] feat: missing icon handling --- src/BlitzKit.CLI/Functions/Mangler.cs | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/BlitzKit.CLI/Functions/Mangler.cs b/src/BlitzKit.CLI/Functions/Mangler.cs index c2e75908b..b1e7d2f6b 100644 --- a/src/BlitzKit.CLI/Functions/Mangler.cs +++ b/src/BlitzKit.CLI/Functions/Mangler.cs @@ -216,12 +216,28 @@ namespace BlitzKit.CLI.Functions async Task MangleIcon(UObject pda) { var id = PropertyUtil.Get(pda, "TankId").Text; - var smallIcon = BlitzKitExporter.Texture2D(PropertyUtil.Get(pda, "SmallIcon")); - Console.WriteLine(id); - var bigIcon = BlitzKitExporter.Texture2D(PropertyUtil.Get(pda, "BigIcon")); + PropertyUtil.TryGet(pda, "SmallIcon", out var smallIconTexture); + PropertyUtil.TryGet(pda, "BigIcon", out var bigIconTexture); - await assetUploader.Add(new($"tanks/{id}/icons/small.png", smallIcon)); - await assetUploader.Add(new($"tanks/{id}/icons/big.png", bigIcon)); + if (smallIconTexture is null) + { + PrettyLog.Warn($"Small icon missing for {id}"); + } + else + { + var smallIcon = BlitzKitExporter.Texture2D(smallIconTexture); + await assetUploader.Add(new($"tanks/{id}/icons/small.png", smallIcon)); + } + + if (bigIconTexture is null) + { + PrettyLog.Warn($"Big icon missing for {id}"); + } + else + { + var bigIcon = BlitzKitExporter.Texture2D(bigIconTexture); + await assetUploader.Add(new($"tanks/{id}/icons/big.png", bigIcon)); + } } async Task MangleHull(UObject pda)