Структура подклассов

This commit is contained in:
2025-04-25 08:48:30 +04:00
parent 7dcf582c3e
commit a66aa834bd
21 changed files with 801 additions and 52 deletions
@@ -12,20 +12,59 @@ internal class AonprdSchemaBuilder(AonprdLoader loader)
// public readonly AonprdSchemaTypeResolver Resolver = new();
public readonly Dictionary<string, SchemaNode> Schemas = [];
public readonly Dictionary<string, SchemaNode> Schemas = new()
{
{ "_subclass", new SchemaNode {Path = "_subclass"} }
};
private string[] _subclassSchemaTypes =
[
"research-field",
"apparition",
"practice",
"instinct",
"muse",
"cause",
"tenet",
"doctrine",
"druidic-order",
"methodology",
"element",
"hybrid-study",
"mystery",
"conscious-mind",
"subconscious-mind",
"hunters-edge",
"racket",
"bloodline",
"style",
"implement",
"lesson",
"patron",
"arcane-school",
"arcane-thesis",
"way",
"innovation",
"ikon",
"epithet",
];
private SchemaNode GetSchema(AonprdLoader.LoaderEntry entry)
{
string key = entry.Type;
if (!Schemas.TryGetValue(key, out SchemaNode? value))
if (Schemas.TryGetValue(key, out SchemaNode? value))
{
value = new SchemaNode()
{
// Resolver = Resolver,
Path = key,
};
Schemas[key] = value;
return value;
}
value = new SchemaNode
{
// Resolver = Resolver,
Path = key,
};
Schemas[key] = value;
return value;
}
@@ -33,13 +72,18 @@ internal class AonprdSchemaBuilder(AonprdLoader loader)
{
Console.WriteLine("Building schemas...");
ProgressBar bar = new ProgressBar(Loader.ItemCount);
ProgressBar bar = new(Loader.ItemCount);
int i = 0;
foreach (AonprdLoader.LoaderEntry entry in Loader.Entries())
{
bar.Refresh(i++, entry.Type);
GetSchema(entry).AddValue(entry.Json);
if (_subclassSchemaTypes.Contains(entry.Type))
{
Schemas["_subclass"].AddValue(entry.Json);
}
}
bar.Refresh(Loader.ItemCount, "Done!");
+2 -1
View File
@@ -11,4 +11,5 @@ Pf2EFoundryImporter importer = new();
AonprdImporter importer = new();
importer.Prepare();
importer.Import();
// importer.Import();
importer.BuildSchemas();