Продолжение
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
|
||||
|
||||
[AonprdProcessor("archetype")]
|
||||
internal class ArchetypeProcessor(AonprdProcessorInput input) : AbstractProcessor(input)
|
||||
{
|
||||
public override EntityType Type => EntityType.Archetype;
|
||||
|
||||
public override Archetype Object { get; } = new();
|
||||
|
||||
protected override void Add() => Context.Archetypes.Add(Object);
|
||||
|
||||
public override void Process()
|
||||
{
|
||||
base.Process();
|
||||
|
||||
Object.Level = Input.GetOptional<int>("level");
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override string GetDescription()
|
||||
=> base.GetDescription() + AddedDescription([
|
||||
"prerequisite_markdown",
|
||||
"requirement_markdown",
|
||||
"summary_markdown"
|
||||
]);
|
||||
}
|
||||
+17
-1
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using LinqToDB;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Pf2eModel.Model;
|
||||
using Pf2eModel.Model.Common;
|
||||
@@ -76,6 +78,8 @@ internal class ClassProcessor(AonprdProcessorInput input) : AbstractProcessor(in
|
||||
Object.Tradition = SpellTradition.All;
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessDependecies();
|
||||
}
|
||||
|
||||
protected ICollection<ClassTraining> GetSkillTrainings()
|
||||
@@ -192,4 +196,16 @@ internal class ClassProcessor(AonprdProcessorInput input) : AbstractProcessor(in
|
||||
return classTraining;
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
protected void ProcessDependecies()
|
||||
{
|
||||
Trait? classTrait = Context.Traits.FirstOrDefault(t => t.Entity.Name == Entity.Name);
|
||||
|
||||
if (classTrait is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
classTrait.Type = TraitType.Class;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-12
@@ -1,15 +1,10 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
|
||||
|
||||
[AonprdProcessor("feat", ["trait", "source", "skill"])]
|
||||
[AonprdProcessor("feat", ["trait", "source", "archetype"])]
|
||||
internal class FeatProcessor(AonprdProcessorInput input) : AbstractProcessor(input)
|
||||
{
|
||||
public override EntityType Type => EntityType.Feat;
|
||||
@@ -24,6 +19,9 @@ internal class FeatProcessor(AonprdProcessorInput input) : AbstractProcessor(inp
|
||||
|
||||
Object.Level = Input.GetRequired<int>("level");
|
||||
|
||||
Object.Category = (Entity.Traits.Any(t => t.Type == TraitType.Class))
|
||||
? ActionCategory.ClassFeat
|
||||
: ActionCategory.Unknown;
|
||||
|
||||
AonprdProcessorInput.ActionStruct action = Input.ResolveActionString(Input.GetOptional<string>("actions") ?? "");
|
||||
Object.Actions = action.Actions;
|
||||
@@ -32,21 +30,34 @@ internal class FeatProcessor(AonprdProcessorInput input) : AbstractProcessor(inp
|
||||
Object.IsPassive = action.IsPassive;
|
||||
Object.IsReaction = action.IsReaction;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Object.Extra = GenerateExtra(
|
||||
"archetype",
|
||||
"element",
|
||||
"heighten",
|
||||
"element",
|
||||
"heighten",
|
||||
"heighten_group",
|
||||
"heighten_level",
|
||||
"school",
|
||||
"frequency"
|
||||
);
|
||||
|
||||
string[] archetypeStrings = Input.GetOptional<JArray>("archetype")?.Select(t => t.ToString()).ToArray() ?? [];
|
||||
|
||||
var archetypes = Context.Archetypes.Where(a => archetypeStrings.Contains(a.Entity.Name)).ToArray();
|
||||
|
||||
if (archetypes.Length != 0)
|
||||
{
|
||||
Object.Category = ActionCategory.Archetype;
|
||||
}
|
||||
|
||||
foreach (var archetype in archetypes)
|
||||
{
|
||||
Object.Archetypes.Add(archetype);
|
||||
|
||||
if (Entity.Name.Contains("Dedication"))
|
||||
{
|
||||
archetype.DedicationFeat = Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetDescription()
|
||||
|
||||
Reference in New Issue
Block a user