diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs
index 439e16f..78b30b8 100644
--- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs
+++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Linq;
+using System.Text.RegularExpressions;
+using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Helpers;
using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers;
using Pf2eDataScrapper.Processors;
@@ -25,7 +27,7 @@ namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Processors.Subclasse
[ProcessorDependencies(
["aonprd:trait", "aonprd:source", "aonprd:class", "aonprd:spell", "aonprd:skill"]
)]
-internal class ApparitionProcessor(
+internal partial class ApparitionProcessor(
ProcessorInput input,
StringHelper stringHelper,
DatabaseHelper helper,
@@ -44,8 +46,17 @@ internal class ApparitionProcessor(
///
public override void ProcessObject()
{
- // Spells
- string spellMd = Input.GetRequired("spell_markdown");
+ AddSpells(Input.GetRequired("spell_markdown"));
+ AddFocal(Entity.Description);
+ AddTrainings(Input.GetRequired("skill_markdown"));
+ }
+
+ ///
+ /// Добавление заклинаний.
+ ///
+ ///
+ public void AddSpells(string spellMd)
+ {
List spellUrls = StringHelper
.ParseMarkdownLinks(spellMd)
.Links.Select(l => l.Url)
@@ -65,10 +76,32 @@ internal class ApparitionProcessor(
{
Object.Entities.Add(spellEntity);
}
+ }
- // Trainings
- string trainingMd = Input.GetRequired("skill_markdown");
+ ///
+ /// Добавление заклинания сосуда.
+ ///
+ ///
+ public void AddFocal(string description)
+ {
+ Match match = VesselSpellMarkdownRegex().Match(description);
+ string aonprdId = $"spell-{match.Groups[1].Value}";
+ var entity = Context
+ .EntityExternals.AsNoTracking()
+ .Where(x => x.ExternalId == aonprdId)
+ .Select(x => x.Entity)
+ .First();
+
+ Object.Entities.Add(entity);
+ }
+
+ ///
+ /// Добавление тренировок.
+ ///
+ ///
+ public void AddTrainings(string trainingMd)
+ {
List trainingNames = trainingMd.Split(", ").ToList();
List trainings = Context
.Trainings.Where(t => Pf2eDbContext.LocaleSearchArray(t.Name, trainingNames))
@@ -95,7 +128,10 @@ internal class ApparitionProcessor(
}
///
- protected override string GetDescription() =>
- base.GetDescription()
- + AddedDescription(["skill_markdown", "spell_markdown", "summary_markdown"]);
+ //protected override string GetDescription() =>
+ // base.GetDescription()
+ // + AddedDescription(["skill_markdown", "spell_markdown", "summary_markdown"]);
+
+ [GeneratedRegex(@"\*\*Vessel Spell\*\* \[.*?\]\(/Spells\.aspx\?ID=(\d+)\)")]
+ private static partial Regex VesselSpellMarkdownRegex();
}