feat: output categorized data
This commit is contained in:
+72
-32
@@ -2,6 +2,7 @@ using CUE4Parse.Compression;
|
||||
using CUE4Parse.Encryption.Aes;
|
||||
using CUE4Parse.FileProvider;
|
||||
using CUE4Parse.MappingsProvider;
|
||||
using CUE4Parse.UE4.Assets.Exports.Actor;
|
||||
using CUE4Parse.UE4.Assets.Exports.Engine;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.UE4.Assets.Objects.Properties;
|
||||
@@ -72,27 +73,30 @@ class DumpByDaylight
|
||||
* itemdb dump
|
||||
*/
|
||||
var searchPaths = dataPak.Files.Keys.Where(x => x.Contains($"/ItemDB.uasset", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var items = new List<string>();
|
||||
var powers = new List<string>();
|
||||
var camperItems = new List<string>();
|
||||
|
||||
var slasherPowers = new List<string>();
|
||||
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
var cleanPath = path.Contains('.') ? path.Substring(0, path.LastIndexOf('.')) : path;
|
||||
if (provider.TryLoadPackageObject<UDataTable>(cleanPath, out var dataTable))
|
||||
{
|
||||
Console.WriteLine($"getting items / powers from {Path.GetFileName(path)}");
|
||||
Console.WriteLine($"getting items / powers from {Path.GetFullPath(path)}");
|
||||
|
||||
foreach (var row in dataTable.RowMap)
|
||||
{
|
||||
var roleProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Role");
|
||||
var typeProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Type");
|
||||
if (typeProperty?.Tag is EnumProperty enumProp)
|
||||
if (typeProperty?.Tag is EnumProperty typeProp && roleProperty?.Tag is EnumProperty roleProp)
|
||||
{
|
||||
string typeName = enumProp.Value.ToString() ?? "null";
|
||||
string typeName = typeProp.Value.ToString() ?? "null";
|
||||
string roleName = roleProp.Value.ToString() ?? "null";
|
||||
|
||||
if (typeName == "EInventoryItemType::Power")
|
||||
powers.Add(row.Key.Text);
|
||||
else if (typeName == "EInventoryItemType::Item")
|
||||
items.Add(row.Key.Text);
|
||||
if (roleName == "EPlayerRole::VE_Slasher")
|
||||
slasherPowers.Add(row.Key.Text);
|
||||
else
|
||||
camperItems.Add(row.Key.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,8 +104,8 @@ class DumpByDaylight
|
||||
|
||||
var itemsSerialized = new
|
||||
{
|
||||
Items = items.OrderBy(x => x).ToList(),
|
||||
Powers = powers.OrderBy(x => x).ToList()
|
||||
Camper = new { Items = camperItems.OrderBy(x => x).ToList() },
|
||||
Slasher = new { Powers = slasherPowers.OrderBy(x => x).ToList() }
|
||||
};
|
||||
File.WriteAllText("items.json", JsonConvert.SerializeObject(itemsSerialized, Formatting.Indented));
|
||||
|
||||
@@ -109,36 +113,39 @@ class DumpByDaylight
|
||||
* addon dump
|
||||
*/
|
||||
searchPaths = dataPak.Files.Keys.Where(x => x.Contains($"/ItemAddonDB.uasset", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
var itemAddons = new List<string>();
|
||||
var powerAddons = new List<string>();
|
||||
var camperAddons = new List<string>();
|
||||
var slaherAddons = new List<string>();
|
||||
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
var cleanPath = path.Contains('.') ? path.Substring(0, path.LastIndexOf('.')) : path;
|
||||
if (provider.TryLoadPackageObject<UDataTable>(cleanPath, out var dataTable))
|
||||
{
|
||||
Console.WriteLine($"getting item / power addons from {Path.GetFileName(path)}");
|
||||
Console.WriteLine($"getting item / power addons from {Path.GetFullPath(path)}");
|
||||
|
||||
foreach (var row in dataTable.RowMap)
|
||||
{
|
||||
var typeProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Type");
|
||||
if (typeProperty?.Tag is EnumProperty enumProp)
|
||||
bool isSlasherAddon = false;
|
||||
var roleProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Role");
|
||||
if (roleProperty?.Tag is EnumProperty roleEnumProp)
|
||||
{
|
||||
string typeName = enumProp.Value.ToString() ?? "null";
|
||||
|
||||
if (typeName == "EInventoryItemType::ItemAddOn")
|
||||
itemAddons.Add(row.Key.Text);
|
||||
else if (typeName == "EInventoryItemType::PowerAddOn")
|
||||
powerAddons.Add(row.Key.Text);
|
||||
string roleName = roleEnumProp.Value.ToString() ?? "null";
|
||||
if (roleName == "EPlayerRole::VE_Slasher")
|
||||
isSlasherAddon = true;
|
||||
}
|
||||
|
||||
if (isSlasherAddon)
|
||||
slaherAddons.Add(row.Key.Text);
|
||||
else
|
||||
camperAddons.Add(row.Key.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var addonsSerialized = new
|
||||
{
|
||||
Items = itemAddons.OrderBy(x => x).ToList(),
|
||||
Powers = powerAddons.OrderBy(x => x).ToList()
|
||||
Slashers = slaherAddons.OrderBy(x => x).ToList(),
|
||||
Campers = camperAddons.OrderBy(x => x).ToList()
|
||||
};
|
||||
File.WriteAllText("addons.json", JsonConvert.SerializeObject(addonsSerialized, Formatting.Indented));
|
||||
|
||||
@@ -147,40 +154,73 @@ class DumpByDaylight
|
||||
*/
|
||||
searchPaths = dataPak.Files.Keys.Where(x => x.Contains($"/OfferingDB.uasset", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
var offerings = new List<string>();
|
||||
var camperOfferings = new List<string>();
|
||||
var slasherOfferings = new List<string>();
|
||||
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
var cleanPath = path.Contains('.') ? path.Substring(0, path.LastIndexOf('.')) : path;
|
||||
if (provider.TryLoadPackageObject<UDataTable>(cleanPath, out var dataTable))
|
||||
{
|
||||
Console.WriteLine($"getting offerings from {Path.GetFileName(path)}");
|
||||
Console.WriteLine($"getting offerings from {Path.GetFullPath(path)}");
|
||||
|
||||
foreach (var row in dataTable.RowMap)
|
||||
offerings.Add(row.Key.Text);
|
||||
{
|
||||
var roleProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Role");
|
||||
if (roleProperty?.Tag is EnumProperty roleEnumProp)
|
||||
{
|
||||
string roleName = roleEnumProp.Value.ToString() ?? "null";
|
||||
if (roleName == "EPlayerRole::VE_Slasher")
|
||||
slasherOfferings.Add(row.Key.Text);
|
||||
else
|
||||
camperOfferings.Add(row.Key.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File.WriteAllText("offerings.json", JsonConvert.SerializeObject(offerings, Formatting.Indented));
|
||||
var offeringsSerialized = new
|
||||
{
|
||||
Slashers = slasherOfferings.OrderBy(x => x).ToList(),
|
||||
Campers = camperOfferings.OrderBy(x => x).ToList()
|
||||
};
|
||||
File.WriteAllText("offerings.json", JsonConvert.SerializeObject(offeringsSerialized, Formatting.Indented));
|
||||
|
||||
/*
|
||||
* perks
|
||||
*/
|
||||
searchPaths = dataPak.Files.Keys.Where(x => x.Contains($"/PerkDB.uasset", StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
var perks = new List<string>();
|
||||
var slasherPerks = new List<string>();
|
||||
var camperPerks = new List<string>();
|
||||
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
var cleanPath = path.Contains('.') ? path.Substring(0, path.LastIndexOf('.')) : path;
|
||||
if (provider.TryLoadPackageObject<UDataTable>(cleanPath, out var dataTable))
|
||||
{
|
||||
Console.WriteLine($"getting perks from {Path.GetFileName(path)}");
|
||||
Console.WriteLine($"getting perks from {Path.GetFullPath(path)}");
|
||||
|
||||
foreach (var row in dataTable.RowMap)
|
||||
perks.Add(row.Key.Text);
|
||||
{
|
||||
var roleProperty = row.Value.Properties.FirstOrDefault(p => p.Name.Text == "Role");
|
||||
if (roleProperty?.Tag is EnumProperty roleEnumProp)
|
||||
{
|
||||
string roleName = roleEnumProp.Value.ToString() ?? "null";
|
||||
if (roleName == "EPlayerRole::VE_Slasher")
|
||||
slasherPerks.Add(row.Key.Text);
|
||||
else
|
||||
camperPerks.Add(row.Key.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File.WriteAllText("perks.json", JsonConvert.SerializeObject(perks, Formatting.Indented));
|
||||
|
||||
var perksSerialized = new
|
||||
{
|
||||
Slashers = slasherPerks.OrderBy(x => x).ToList(),
|
||||
Campers = camperPerks.OrderBy(x => x).ToList()
|
||||
};
|
||||
File.WriteAllText("perks.json", JsonConvert.SerializeObject(perksSerialized, Formatting.Indented));
|
||||
|
||||
Console.WriteLine("\nAll dumper operations finished. Press any key to Close.");
|
||||
Console.ReadKey();
|
||||
|
||||
Reference in New Issue
Block a user