Глобальный рефакторинг пространств имён

This commit is contained in:
2025-10-02 13:29:30 +04:00
parent d23d81fb53
commit 2fa94851cb
3176 changed files with 27146 additions and 30584 deletions
@@ -0,0 +1,43 @@
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Linq;
using Pf2e.Scrapper.Helpers;
using Pf2e.Scrapper.Importers.Implementations.FoundryEn.Helpers;
using Pf2e.Scrapper.Processors;
using Pf2e.Scrapper.Processors.Attributes;
using Pf2e.Database;
using Pf2e.Database.Model.Common.I18n;
using Pf2e.Database.Model.Enum;
namespace Pf2e.Scrapper.Importers.Implementations.FoundryEn.Processors.Entities;
[ProcessorCollection(
"foundry-en:action",
InnerType = "action",
CompendiumType = ProcessorCompendiumEnum.FoundryEn,
Description = "Действия",
Group = ProcessorGroupEnum.FoundryEnEntities,
Active = false
)]
[ProcessorDependencies(["foundry-en:compendium", "foundry-en:external"])]
internal partial class ActionProcessor(
DatabaseHelper databaseHelper,
Pf2eDbContext context,
FoundryEnGlobals globals,
ProcessorInput input
)
: FoundryEnAbstractProcessor<Database.Model.Structure.Action>(
databaseHelper,
context,
globals,
input
)
{
public override EntityType Type => EntityType.Action;
public override void Process()
{
base.Process();
}
}
@@ -0,0 +1,49 @@
using Newtonsoft.Json.Linq;
using Pf2e.Scrapper.Helpers;
using Pf2e.Scrapper.Importers.Implementations.FoundryEn.Helpers;
using Pf2e.Scrapper.Processors;
using Pf2e.Scrapper.Processors.Attributes;
using Pf2e.Scrapper.Processors.Collection;
using Pf2e.Database;
using Pf2e.Database.Model.Enum;
using Pf2e.Database.Model.Structure;
namespace Pf2e.Scrapper.Importers.Implementations.FoundryEn.Processors.Entities;
[ProcessorCollection(
"foundry-en:condition",
InnerType = "Item.condition",
CompendiumType = ProcessorCompendiumEnum.FoundryEn,
Description = "Состояния",
Group = ProcessorGroupEnum.FoundryEnEntities,
Active = false
)]
[ProcessorDependencies(["foundry-en:compendium"])]
internal class ConditionProcessor(
DatabaseHelper databaseHelper,
Pf2eDbContext context,
FoundryEnGlobals globals,
ProcessorInput input
) : FoundryEnAbstractProcessor<Condition>(databaseHelper, context, globals, input)
{
public override EntityType Type => EntityType.Condition;
public override void Process()
{
base.Process();
/*
JObject extra = new()
{
{ "duration", Input.Input.SelectToken("system.duration") },
{ "overrides", Input.Input.SelectToken("system.overrides") },
{ "references", Input.Input.SelectToken("system.references") },
{ "value", Input.Input.SelectToken("system.value") },
};
Object.Extra = extra.ToString(Newtonsoft.Json.Formatting.None);
Object.Group = Input.EnumOptional("system.group", ConditionGroup.Unknown);
Context.Conditions.Add(Object);
*/
}
}
@@ -0,0 +1,89 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
using Pf2e.Scrapper.Helpers;
using Pf2e.Scrapper.Importers.Implementations.FoundryEn.Helpers;
using Pf2e.Scrapper.Processors;
using Pf2e.Scrapper.Processors.Attributes;
using Pf2e.Database;
using Pf2e.Database.Model.Enum;
using Pf2e.Database.Model.Structure;
using Pf2e.Database.Model.Structure.DeityRelation;
namespace Pf2e.Scrapper.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 });
}
}
}