Files
blitzkit/src/BlitzKit.CLI/Functions/Mangler.cs
T

71 lines
1.9 KiB
C#
Raw Normal View History

2025-01-28 12:59:59 -06:00
using BlitzKit.CLI.Models;
2025-01-28 19:52:49 -06:00
using BlitzKit.CLI.Utils;
using CUE4Parse.FileProvider.Objects;
2025-01-27 22:17:13 -06:00
2025-01-28 12:59:59 -06:00
namespace BlitzKit.CLI.Functions
2025-01-26 21:17:25 -06:00
{
public static class Mangler
{
2025-01-27 22:17:13 -06:00
public static void Mangle()
{
BlitzProvider provider = new();
foreach (var nation in provider.RootDirectory.GetDirectory("Blitz/Content/Tanks").Directories)
{
if (nation.Key == "TankStub")
continue;
foreach (var tank in nation.Value.Directories)
{
2025-01-28 19:52:49 -06:00
if (tank.Key != "R90_IS_4")
continue;
var attributeFileName = $"DA_{tank.Key}_Attributes.uasset";
var hasAttributesFile = tank.Value.HasFile(attributeFileName);
GameFile? attributes = null;
if (hasAttributesFile)
2025-01-28 12:55:02 -06:00
{
2025-01-28 19:52:49 -06:00
attributes = tank.Value.GetFile(attributeFileName);
}
else
{
PrettyLog.Warn(
$"No attributes file found for {nation.Key}/{tank.Key}, it may be misspelled; finding any attributes file..."
);
foreach (var file in tank.Value.Files)
{
if (file.Key.EndsWith("_Attributes.uasset"))
{
attributes = file.Value;
break;
}
}
if (attributes == null)
{
PrettyLog.Error(
$"No suffixed attributes file found for {nation.Key}/{tank.Key}; skipping..."
);
continue;
}
}
var objects = provider.LoadAllObjects(attributes.Path);
var objectsCount = objects.Count();
if (objectsCount != 1)
{
throw new Exception($"Expected 1 object for attribute objects, got {objectsCount}");
}
foreach (var obj in objects)
{
Console.WriteLine(obj.Properties);
2025-01-28 12:55:02 -06:00
}
2025-01-27 22:17:13 -06:00
}
}
2025-01-26 21:17:25 -06:00
}
}
}