Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cb8da9d56 | ||
|
|
a3a7578fd9 | ||
|
|
2d55282e3c |
+14
@@ -71,6 +71,8 @@ internal class MissingLegacyRemasterProcessor(string legacyId, string remasterId
|
||||
Entity legacyEntity = GetEntity(LegacyId);
|
||||
Entity remasterEntity = GetEntity(RemasterId);
|
||||
|
||||
TestExist(legacyEntity, remasterEntity);
|
||||
|
||||
Context.LegacyRemasters.Add(
|
||||
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()
|
||||
{
|
||||
Context.SaveChanges();
|
||||
|
||||
+89
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-11
@@ -82,7 +82,7 @@ internal abstract class FoundryEnAbstractProcessor<TEntity>(
|
||||
/// </summary>
|
||||
public virtual void CheckEntity()
|
||||
{
|
||||
string id = Input.GetRequired<string>("id");
|
||||
string id = Input.GetRequired<string>("_id");
|
||||
|
||||
if (Globals.Ignore.Any(s => s == id))
|
||||
{
|
||||
@@ -126,22 +126,26 @@ internal abstract class FoundryEnAbstractProcessor<TEntity>(
|
||||
return entities[0].Id;
|
||||
}
|
||||
|
||||
List<string> inputTraits = Input
|
||||
.GetRequired<JArray>("system.traits.value")
|
||||
.Select(token => token.ToString())
|
||||
.Order()
|
||||
.ToList();
|
||||
JArray? traitArray = Input.GetOptional<JArray>("system.traits.value");
|
||||
|
||||
foreach (Entity entity in entities)
|
||||
if (traitArray is not null)
|
||||
{
|
||||
List<string> entityTraits = entity
|
||||
.Traits.Select(t => t.Entity.Name[LocaleType.English])
|
||||
List<string> inputTraits = traitArray
|
||||
.Select(token => token.ToString())
|
||||
.Order()
|
||||
.ToList();
|
||||
|
||||
if (entityTraits.SequenceEqual(inputTraits))
|
||||
foreach (Entity entity in entities)
|
||||
{
|
||||
return entity.Id;
|
||||
List<string> entityTraits = entity
|
||||
.Traits.Select(t => t.Entity.Name[LocaleType.English])
|
||||
.Order()
|
||||
.ToList();
|
||||
|
||||
if (entityTraits.SequenceEqual(inputTraits))
|
||||
{
|
||||
return entity.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
"Mystery": "Oracle",
|
||||
"Conscious Mind": "Psychic",
|
||||
"Subconscious Mind": "Psychic",
|
||||
"Hunters Edge": "Ranger",
|
||||
"Hunter's Edge": "Ranger",
|
||||
"Racket": "Rogue",
|
||||
"Bloodline": "Sorcerer",
|
||||
"Style": "Swashbuckler",
|
||||
|
||||
-2948
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1
-5
@@ -13,11 +13,7 @@ using Pf2eModel.Model.Enum;
|
||||
namespace Pf2eModel.Migrations
|
||||
{
|
||||
[DbContext(typeof(Pf2eDbContext))]
|
||||
<<<<<<<< HEAD:Pf2eModel/Migrations/20250912112500_1.Designer.cs
|
||||
[Migration("20250912112500_1")]
|
||||
========
|
||||
[Migration("20250914093120_1")]
|
||||
>>>>>>>> origin/dev2:Pf2eModel/Migrations/20250914093120_1.Designer.cs
|
||||
[Migration("20250915055059_1")]
|
||||
partial class _1
|
||||
{
|
||||
/// <inheritdoc />
|
||||
Reference in New Issue
Block a user