Начало ActionProcessor

This commit is contained in:
2025-04-17 18:46:55 +04:00
parent efaa6c71d7
commit 10e3e274d5
5 changed files with 34 additions and 40 deletions
@@ -9,13 +9,13 @@ public class AonprdProcessorAttribute(string name, string type, string[] depende
public readonly IEnumerable<string> Dependencies = dependencies; public readonly IEnumerable<string> Dependencies = dependencies;
public AonprdProcessorAttribute(string type) : this(type, type, []) public AonprdProcessorAttribute(string type) : this(type, type, ["trait"])
{ {
} }
public AonprdProcessorAttribute(string type, string[] dependencies) : this(type, type, dependencies) public AonprdProcessorAttribute(string type, string[] dependencies) : this(type, type, dependencies)
{ {
} }
public AonprdProcessorAttribute(string name, string type) : this(name, type, []) public AonprdProcessorAttribute(string name, string type) : this(name, type, ["trait"])
{ {
} }
} }
@@ -0,0 +1,25 @@
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.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("action")]
internal class ActionProcessor(ProcessorInput input) : AbstractProcessor(input)
{
public override EntityType Type => EntityType.Trait;
public override Model.Structure.Action Object { get; } = new();
public override void Process()
{
}
}
@@ -3,7 +3,7 @@ using Pf2eDataScrapper.Model.Structure;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
[AonprdProcessor("trait")] [AonprdProcessor("trait", [])]
internal class TraitProcessor(ProcessorInput input) : AbstractProcessor(input) internal class TraitProcessor(ProcessorInput input) : AbstractProcessor(input)
{ {
public override EntityType Type => EntityType.Trait; public override EntityType Type => EntityType.Trait;
@@ -1,33 +0,0 @@
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
[AonprdProcessor("trait_traits", "trait", ["trait"])]
internal class TraitTraitsProcessor(ProcessorInput input) : AbstractProcessor(input)
{
public override EntityType Type => EntityType.Trait;
public override Trait Object { get; } = new();
public override void Process()
{
string id = Input.GetRequired<string>("id");
string name = Input.GetRequired<string>("name");
if (Input.GetOptional<JArray>("remaster_id") is not null)
{
throw new LegacyItemException(name);
}
// base.Process();
string url = Input.GetRequired<string>("url");
Model.Base.Targets.EntityExternal external = Context.EntityExternals.FirstOrDefault(x => x.Suffix == url) ?? throw new Exception("Entity not found?");
Entity = external.Entity;
AddTraits();
}
}
+6 -4
View File
@@ -5,14 +5,16 @@ namespace Pf2eDataScrapper.Model.Enum;
public enum ActionType public enum ActionType
{ {
[PgName("action")] [PgName("action")]
action, Action,
[PgName("free")] [PgName("free")]
free, Free,
[PgName("reaction")] [PgName("reaction")]
reaction, Reaction,
[PgName("passive")] [PgName("passive")]
passive, Passive,
} }