mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: implement mappeduobject
This commit is contained in:
1 parent
09abbbadc9
commit
37b5d1c6e8
2 files changed
+42
-3
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
using Blitzkit;
|
using Blitzkit;
|
||||||
using BlitzKit.CLI.Models;
|
using BlitzKit.CLI.Models;
|
||||||
|
using BlitzKit.CLI.Utils;
|
||||||
using Google.Protobuf.Collections;
|
using Google.Protobuf.Collections;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -27,20 +28,34 @@ namespace BlitzKit.CLI.Functions
|
|||||||
{
|
{
|
||||||
foreach (var tankDir in nation.Directories)
|
foreach (var tankDir in nation.Directories)
|
||||||
{
|
{
|
||||||
if (tankDir.Value.Name != "R90_IS_4")
|
// if (tankDir.Value.Name != "R90_IS_4")
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
var tank = MangleTank(tankDir.Value);
|
var tank = MangleTank(tankDir.Value);
|
||||||
|
|
||||||
|
if (tank == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
tanks.Tanks_.Add(tank.Id);
|
tanks.Tanks_.Add(tank.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tank MangleTank(VfsDirectory tankDir)
|
Tank? MangleTank(VfsDirectory tankDir)
|
||||||
{
|
{
|
||||||
var pdaName = $"PDA_{tankDir.Name}";
|
var pdaName = $"PDA_{tankDir.Name}";
|
||||||
var pda = tankDir.GetUasset($"{pdaName}.uasset").Get(pdaName);
|
var pda = tankDir.GetUasset($"{pdaName}.uasset").Get(pdaName);
|
||||||
var tankId = pda.GetName("TankId");
|
var tankId = pda.GetName("TankId");
|
||||||
|
var isDev = pda.TryGetBool("bInDevelopment") ?? true;
|
||||||
|
|
||||||
|
if (isDev)
|
||||||
|
{
|
||||||
|
PrettyLog.Warn($"Skipping dev tank: {tankId}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrettyLog.Success($"Mangling tank: {tankId}");
|
||||||
|
}
|
||||||
|
|
||||||
return new() { Id = tankId };
|
return new() { Id = tankId };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace BlitzKit.CLI.Models
|
|||||||
readonly Dictionary<string, BoolProperty> Booleans = [];
|
readonly Dictionary<string, BoolProperty> Booleans = [];
|
||||||
readonly Dictionary<string, FloatProperty> Floats = [];
|
readonly Dictionary<string, FloatProperty> Floats = [];
|
||||||
readonly Dictionary<string, ArrayProperty> Arrays = [];
|
readonly Dictionary<string, ArrayProperty> Arrays = [];
|
||||||
|
readonly Dictionary<string, TextProperty> Texts = [];
|
||||||
|
readonly Dictionary<string, IntProperty> Ints = [];
|
||||||
|
|
||||||
public MappedUObject(List<FPropertyTag> properties)
|
public MappedUObject(List<FPropertyTag> properties)
|
||||||
: base(properties)
|
: base(properties)
|
||||||
@@ -66,6 +68,18 @@ namespace BlitzKit.CLI.Models
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TextProperty text:
|
||||||
|
{
|
||||||
|
Texts.Add(property.Name.Text, text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IntProperty integer:
|
||||||
|
{
|
||||||
|
Ints.Add(property.Name.Text, integer);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new Exception($"Unhandled property type: {property}");
|
throw new Exception($"Unhandled property type: {property}");
|
||||||
@@ -78,5 +92,15 @@ namespace BlitzKit.CLI.Models
|
|||||||
{
|
{
|
||||||
return Names[name].Value.Text;
|
return Names[name].Value.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GetBool(string name)
|
||||||
|
{
|
||||||
|
return Booleans[name].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? TryGetBool(string name)
|
||||||
|
{
|
||||||
|
return Booleans.TryGetValue(name, out var entry) ? entry.Value : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user