mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: more proto
This commit is contained in:
1 parent
5881b5b533
commit
67f312075a
5 files changed
+82
-78
No files matched your search
@@ -1,6 +1,9 @@
|
||||
using Blitzkit;
|
||||
using BlitzKit.CLI.Models;
|
||||
using BlitzKit.CLI.Utils;
|
||||
using CUE4Parse.FileProvider.Objects;
|
||||
using Google.Protobuf;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace BlitzKit.CLI.Functions
|
||||
{
|
||||
@@ -8,6 +11,7 @@ namespace BlitzKit.CLI.Functions
|
||||
{
|
||||
public static void Mangle()
|
||||
{
|
||||
Tanks tanks = new();
|
||||
BlitzProvider provider = new();
|
||||
|
||||
foreach (var nation in provider.RootDirectory.GetDirectory("Blitz/Content/Tanks").Directories)
|
||||
@@ -20,13 +24,14 @@ namespace BlitzKit.CLI.Functions
|
||||
if (tank.Key != "R90_IS_4")
|
||||
continue;
|
||||
|
||||
tanks.Tanks_.Add(tank.Key);
|
||||
var attributeFileName = $"DA_{tank.Key}_Attributes.uasset";
|
||||
var hasAttributesFile = tank.Value.HasFile(attributeFileName);
|
||||
GameFile? attributes = null;
|
||||
GameFile? attributesFile = null;
|
||||
|
||||
if (hasAttributesFile)
|
||||
{
|
||||
attributes = tank.Value.GetFile(attributeFileName);
|
||||
attributesFile = tank.Value.GetFile(attributeFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -38,12 +43,12 @@ namespace BlitzKit.CLI.Functions
|
||||
{
|
||||
if (file.Key.EndsWith("_Attributes.uasset"))
|
||||
{
|
||||
attributes = file.Value;
|
||||
attributesFile = file.Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (attributes == null)
|
||||
if (attributesFile == null)
|
||||
{
|
||||
PrettyLog.Error(
|
||||
$"No suffixed attributes file found for {nation.Key}/{tank.Key}; skipping..."
|
||||
@@ -52,20 +57,18 @@ namespace BlitzKit.CLI.Functions
|
||||
}
|
||||
}
|
||||
|
||||
var objects = provider.LoadAllObjects(attributes.Path);
|
||||
var objectsCount = objects.Count();
|
||||
var exports = provider.LoadAllObjects(attributesFile.Path);
|
||||
|
||||
if (objectsCount != 1)
|
||||
{
|
||||
throw new Exception($"Expected 1 object for attribute objects, got {objectsCount}");
|
||||
}
|
||||
var tankAttributesDataAsset =
|
||||
exports.First((export) => export.ExportType == "TankAttributesDataAsset")
|
||||
?? throw new Exception("TankAttributesDataAsset not found");
|
||||
var attr = JObject.FromObject(tankAttributesDataAsset);
|
||||
|
||||
foreach (var obj in objects)
|
||||
{
|
||||
Console.WriteLine(obj.Properties);
|
||||
}
|
||||
Console.WriteLine(attr);
|
||||
}
|
||||
}
|
||||
|
||||
var tanksBytes = tanks.ToByteArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user