Compare commits

..
3 Commits
8 changed files with 120 additions and 4625 deletions
@@ -71,6 +71,8 @@ internal class MissingLegacyRemasterProcessor(string legacyId, string remasterId
Entity legacyEntity = GetEntity(LegacyId); Entity legacyEntity = GetEntity(LegacyId);
Entity remasterEntity = GetEntity(RemasterId); Entity remasterEntity = GetEntity(RemasterId);
TestExist(legacyEntity, remasterEntity);
Context.LegacyRemasters.Add( Context.LegacyRemasters.Add(
new() { LegacyId = legacyEntity.Id, RemasterId = remasterEntity.Id } new() { LegacyId = legacyEntity.Id, RemasterId = remasterEntity.Id }
); );
@@ -83,6 +85,18 @@ internal class MissingLegacyRemasterProcessor(string legacyId, string remasterId
} }
} }
public void TestExist(Entity legacyEntity, Entity remasterEntity)
{
if (
Context
.LegacyRemasters.AsNoTracking()
.Any(x => x.LegacyId == legacyEntity.Id && x.RemasterId == remasterEntity.Id)
)
{
throw new SilentSkipItemException();
}
}
public void Save() public void Save()
{ {
Context.SaveChanges(); Context.SaveChanges();
@@ -0,0 +1,89 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Helpers;
using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
using Pf2eDataScrapper.Processors;
using Pf2eDataScrapper.Processors.Attributes;
using Pf2eModel;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
using Pf2eModel.Model.Structure.DeityRelation;
namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Entities;
[ProcessorCollection(
"foundry-en:deity",
InnerType = "deity",
CompendiumType = ProcessorCompendiumEnum.FoundryEn,
Description = "Божества",
Group = ProcessorGroupEnum.FoundryEnEntities,
Active = true
)]
[ProcessorDependencies(["foundry-en:compendium", "foundry-en:external"])]
internal class DeityProcessor(
DatabaseHelper databaseHelper,
Pf2eDbContext context,
FoundryEnGlobals globals,
ProcessorInput input
) : FoundryEnAbstractProcessor<Deity>(databaseHelper, context, globals, input)
{
public override EntityType Type => EntityType.Deity;
public override void Process()
{
base.Process();
ProcessSanctification();
ProcessWeapons();
}
private void ProcessSanctification()
{
JObject? sanctification = Input.GetOptional<JObject>("system.sanctification");
if (sanctification == null)
{
Object.Sanctification = DeitySanctification.Any;
Object.SanctificationMust = false;
return;
}
if (
sanctification["what"] is not JArray sanctificationArray
|| sanctificationArray.Count == 0
|| sanctificationArray.Count == 2
&& sanctificationArray.Any(t => t.ToString() == "holy")
&& sanctificationArray.Any(t => t.ToString() == "unholy")
)
{
Object.Sanctification = DeitySanctification.Any;
}
else if (sanctificationArray.Any(t => t.ToString() == "holy"))
{
Object.Sanctification = DeitySanctification.Holy;
}
else if (sanctificationArray.Any(t => t.ToString() == "unholy"))
{
Object.Sanctification = DeitySanctification.Unholy;
}
else
{
Object.Sanctification = DeitySanctification.Any;
}
Object.SanctificationMust = sanctification["modal"]?.ToString() == "must";
}
private void ProcessWeapons()
{
List<string> weapons = Input
.GetRequired<JArray>("system.weapons")
.Select(token => token.ToString())
.ToList();
foreach (string weapon in weapons)
{
Object.DeityWeapons.Add(new() { DeityId = Object.Id, Weapon = weapon });
}
}
}
@@ -82,7 +82,7 @@ internal abstract class FoundryEnAbstractProcessor<TEntity>(
/// </summary> /// </summary>
public virtual void CheckEntity() public virtual void CheckEntity()
{ {
string id = Input.GetRequired<string>("id"); string id = Input.GetRequired<string>("_id");
if (Globals.Ignore.Any(s => s == id)) if (Globals.Ignore.Any(s => s == id))
{ {
@@ -126,8 +126,11 @@ internal abstract class FoundryEnAbstractProcessor<TEntity>(
return entities[0].Id; return entities[0].Id;
} }
List<string> inputTraits = Input JArray? traitArray = Input.GetOptional<JArray>("system.traits.value");
.GetRequired<JArray>("system.traits.value")
if (traitArray is not null)
{
List<string> inputTraits = traitArray
.Select(token => token.ToString()) .Select(token => token.ToString())
.Order() .Order()
.ToList(); .ToList();
@@ -145,6 +148,7 @@ internal abstract class FoundryEnAbstractProcessor<TEntity>(
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
throw new SkipItemException(name, ex.Message); throw new SkipItemException(name, ex.Message);
@@ -91,7 +91,7 @@
"Mystery": "Oracle", "Mystery": "Oracle",
"Conscious Mind": "Psychic", "Conscious Mind": "Psychic",
"Subconscious Mind": "Psychic", "Subconscious Mind": "Psychic",
"Hunters Edge": "Ranger", "Hunter's Edge": "Ranger",
"Racket": "Rogue", "Racket": "Rogue",
"Bloodline": "Sorcerer", "Bloodline": "Sorcerer",
"Style": "Swashbuckler", "Style": "Swashbuckler",
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -13,11 +13,7 @@ using Pf2eModel.Model.Enum;
namespace Pf2eModel.Migrations namespace Pf2eModel.Migrations
{ {
[DbContext(typeof(Pf2eDbContext))] [DbContext(typeof(Pf2eDbContext))]
<<<<<<<< HEAD:Pf2eModel/Migrations/20250912112500_1.Designer.cs [Migration("20250915055059_1")]
[Migration("20250912112500_1")]
========
[Migration("20250914093120_1")]
>>>>>>>> origin/dev2:Pf2eModel/Migrations/20250914093120_1.Designer.cs
partial class _1 partial class _1
{ {
/// <inheritdoc /> /// <inheritdoc />