Compare commits
1
Commits
master
..
73cb4a9982
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73cb4a9982 |
@@ -0,0 +1,13 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Helpers](Pf2eDataScrapper.Helpers.md 'Pf2eDataScrapper\.Helpers').[EntityView](EntityView.md 'Pf2eDataScrapper\.Helpers\.EntityView')
|
||||||
|
|
||||||
|
## EntityView\.Context Property
|
||||||
|
|
||||||
|
Контекст базы данных, используемый для получения сущностей\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
private Pf2eModel.Pf2eDbContext Context { private get; }
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Property Value
|
||||||
|
[Pf2eModel\.Pf2eDbContext](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Pf2eDbContext 'Pf2eModel\.Pf2eDbContext')
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
Корневая сущность\.
|
Корневая сущность\.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
public Pf2eModel.Model.Base.Entity? Entity { get; }
|
public Pf2eModel.Model.Base.Entity Entity { get; }
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Property Value
|
#### Property Value
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#### [Pf2eDataScrapper](index.md 'index')
|
|
||||||
### [Pf2eDataScrapper\.Helpers](Pf2eDataScrapper.Helpers.md 'Pf2eDataScrapper\.Helpers').[EntityView](EntityView.md 'Pf2eDataScrapper\.Helpers\.EntityView')
|
|
||||||
|
|
||||||
## EntityView\(Pf2eDbContext, EntityType, int\) Constructor
|
|
||||||
|
|
||||||
Конструктор класса, который получает сущность из базы данных и заполняет её данными\.
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
public EntityView(Pf2eModel.Pf2eDbContext context, Pf2eModel.Model.Enum.EntityType type, int id);
|
|
||||||
```
|
|
||||||
#### Parameters
|
|
||||||
|
|
||||||
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).context'></a>
|
|
||||||
|
|
||||||
`context` [Pf2eModel\.Pf2eDbContext](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Pf2eDbContext 'Pf2eModel\.Pf2eDbContext')
|
|
||||||
|
|
||||||
Контекст базы данных\.
|
|
||||||
|
|
||||||
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).type'></a>
|
|
||||||
|
|
||||||
`type` [Pf2eModel\.Model\.Enum\.EntityType](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Enum.EntityType 'Pf2eModel\.Model\.Enum\.EntityType')
|
|
||||||
|
|
||||||
Тип запрашиваемой сущности\.
|
|
||||||
|
|
||||||
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).id'></a>
|
|
||||||
|
|
||||||
`id` [System\.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System\.Int32')
|
|
||||||
|
|
||||||
Идентификатор запрашиваемой сущности\.
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Helpers](Pf2eDataScrapper.Helpers.md 'Pf2eDataScrapper\.Helpers').[EntityView](EntityView.md 'Pf2eDataScrapper\.Helpers\.EntityView')
|
||||||
|
|
||||||
|
## EntityView Constructors
|
||||||
|
|
||||||
|
| Overloads | |
|
||||||
|
| :--- | :--- |
|
||||||
|
| [EntityView\(Pf2eDbContext, Entity\)](EntityView.EntityView.md#Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Base.Entity) 'Pf2eDataScrapper\.Helpers\.EntityView\.EntityView\(Pf2eModel\.Pf2eDbContext, Pf2eModel\.Model\.Base\.Entity\)') | Конструктор класса, который получает сущность из базы данных по переданной сущности и заполняет её данными\. |
|
||||||
|
| [EntityView\(Pf2eDbContext, EntityType, int\)](EntityView.EntityView.md#Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int) 'Pf2eDataScrapper\.Helpers\.EntityView\.EntityView\(Pf2eModel\.Pf2eDbContext, Pf2eModel\.Model\.Enum\.EntityType, int\)') | Конструктор класса, который получает сущность из базы данных по типу и идентификатору и заполняет её данными\. |
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Base.Entity)'></a>
|
||||||
|
|
||||||
|
## EntityView\(Pf2eDbContext, Entity\) Constructor
|
||||||
|
|
||||||
|
Конструктор класса, который получает сущность из базы данных по переданной сущности и заполняет её данными\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public EntityView(Pf2eModel.Pf2eDbContext context, Pf2eModel.Model.Base.Entity entity);
|
||||||
|
```
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Base.Entity).context'></a>
|
||||||
|
|
||||||
|
`context` [Pf2eModel\.Pf2eDbContext](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Pf2eDbContext 'Pf2eModel\.Pf2eDbContext')
|
||||||
|
|
||||||
|
Контекст базы данных\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Base.Entity).entity'></a>
|
||||||
|
|
||||||
|
`entity` [Pf2eModel\.Model\.Base\.Entity](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Base.Entity 'Pf2eModel\.Model\.Base\.Entity')
|
||||||
|
|
||||||
|
Сущность, которую нужно обработать\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int)'></a>
|
||||||
|
|
||||||
|
## EntityView\(Pf2eDbContext, EntityType, int\) Constructor
|
||||||
|
|
||||||
|
Конструктор класса, который получает сущность из базы данных по типу и идентификатору и заполняет её данными\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public EntityView(Pf2eModel.Pf2eDbContext context, Pf2eModel.Model.Enum.EntityType type, int id);
|
||||||
|
```
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).context'></a>
|
||||||
|
|
||||||
|
`context` [Pf2eModel\.Pf2eDbContext](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Pf2eDbContext 'Pf2eModel\.Pf2eDbContext')
|
||||||
|
|
||||||
|
Контекст базы данных\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).type'></a>
|
||||||
|
|
||||||
|
`type` [Pf2eModel\.Model\.Enum\.EntityType](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Enum.EntityType 'Pf2eModel\.Model\.Enum\.EntityType')
|
||||||
|
|
||||||
|
Тип запрашиваемой сущности\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int).id'></a>
|
||||||
|
|
||||||
|
`id` [System\.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System\.Int32')
|
||||||
|
|
||||||
|
Идентификатор запрашиваемой сущности\.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Helpers](Pf2eDataScrapper.Helpers.md 'Pf2eDataScrapper\.Helpers').[EntityView](EntityView.md 'Pf2eDataScrapper\.Helpers\.EntityView')
|
||||||
|
|
||||||
|
## EntityView\.GetEntity\(EntityType, int\) Method
|
||||||
|
|
||||||
|
Получает сущность из базы данных по типу и идентификатору\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
private Pf2eModel.Model.Base.Entity GetEntity(Pf2eModel.Model.Enum.EntityType type, int id);
|
||||||
|
```
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.GetEntity(Pf2eModel.Model.Enum.EntityType,int).type'></a>
|
||||||
|
|
||||||
|
`type` [Pf2eModel\.Model\.Enum\.EntityType](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Enum.EntityType 'Pf2eModel\.Model\.Enum\.EntityType')
|
||||||
|
|
||||||
|
Тип сущности\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.GetEntity(Pf2eModel.Model.Enum.EntityType,int).id'></a>
|
||||||
|
|
||||||
|
`id` [System\.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System\.Int32')
|
||||||
|
|
||||||
|
Идентификатор сущности\.
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
[Pf2eModel\.Model\.Base\.Entity](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Base.Entity 'Pf2eModel\.Model\.Base\.Entity')
|
||||||
|
Сущность, соответствующая указанному типу и идентификатору\.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Helpers](Pf2eDataScrapper.Helpers.md 'Pf2eDataScrapper\.Helpers').[EntityView](EntityView.md 'Pf2eDataScrapper\.Helpers\.EntityView')
|
||||||
|
|
||||||
|
## EntityView\.GetSubEntity\(EntityType, int\) Method
|
||||||
|
|
||||||
|
Получает подчинённую сущность по типу и идентификатору\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
private Pf2eModel.Model.IEntity? GetSubEntity(Pf2eModel.Model.Enum.EntityType type, int id);
|
||||||
|
```
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.GetSubEntity(Pf2eModel.Model.Enum.EntityType,int).type'></a>
|
||||||
|
|
||||||
|
`type` [Pf2eModel\.Model\.Enum\.EntityType](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Enum.EntityType 'Pf2eModel\.Model\.Enum\.EntityType')
|
||||||
|
|
||||||
|
Тип сущности\.
|
||||||
|
|
||||||
|
<a name='Pf2eDataScrapper.Helpers.EntityView.GetSubEntity(Pf2eModel.Model.Enum.EntityType,int).id'></a>
|
||||||
|
|
||||||
|
`id` [System\.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System\.Int32')
|
||||||
|
|
||||||
|
Идентификатор сущности\.
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
[Pf2eModel\.Model\.IEntity](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.IEntity 'Pf2eModel\.Model\.IEntity')
|
||||||
|
Подчинённая сущность, соответствующая указанному типу и идентификатору\.
|
||||||
@@ -13,7 +13,8 @@ Inheritance [System\.Object](https://docs.microsoft.com/en-us/dotnet/api/System.
|
|||||||
|
|
||||||
| Constructors | |
|
| Constructors | |
|
||||||
| :--- | :--- |
|
| :--- | :--- |
|
||||||
| [EntityView\(Pf2eDbContext, EntityType, int\)](EntityView.EntityView(Pf2eDbContext,EntityType,int).md 'Pf2eDataScrapper\.Helpers\.EntityView\.EntityView\(Pf2eModel\.Pf2eDbContext, Pf2eModel\.Model\.Enum\.EntityType, int\)') | Конструктор класса, который получает сущность из базы данных и заполняет её данными\. |
|
| [EntityView\(Pf2eDbContext, Entity\)](EntityView.EntityView.md#Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Base.Entity) 'Pf2eDataScrapper\.Helpers\.EntityView\.EntityView\(Pf2eModel\.Pf2eDbContext, Pf2eModel\.Model\.Base\.Entity\)') | Конструктор класса, который получает сущность из базы данных по переданной сущности и заполняет её данными\. |
|
||||||
|
| [EntityView\(Pf2eDbContext, EntityType, int\)](EntityView.EntityView.md#Pf2eDataScrapper.Helpers.EntityView.EntityView(Pf2eModel.Pf2eDbContext,Pf2eModel.Model.Enum.EntityType,int) 'Pf2eDataScrapper\.Helpers\.EntityView\.EntityView\(Pf2eModel\.Pf2eDbContext, Pf2eModel\.Model\.Enum\.EntityType, int\)') | Конструктор класса, который получает сущность из базы данных по типу и идентификатору и заполняет её данными\. |
|
||||||
|
|
||||||
| Fields | |
|
| Fields | |
|
||||||
| :--- | :--- |
|
| :--- | :--- |
|
||||||
@@ -21,5 +22,11 @@ Inheritance [System\.Object](https://docs.microsoft.com/en-us/dotnet/api/System.
|
|||||||
|
|
||||||
| Properties | |
|
| Properties | |
|
||||||
| :--- | :--- |
|
| :--- | :--- |
|
||||||
|
| [Context](EntityView.Context.md 'Pf2eDataScrapper\.Helpers\.EntityView\.Context') | Контекст базы данных, используемый для получения сущностей\. |
|
||||||
| [Entity](EntityView.Entity.md 'Pf2eDataScrapper\.Helpers\.EntityView\.Entity') | Корневая сущность\. |
|
| [Entity](EntityView.Entity.md 'Pf2eDataScrapper\.Helpers\.EntityView\.Entity') | Корневая сущность\. |
|
||||||
| [SubEntity](EntityView.SubEntity.md 'Pf2eDataScrapper\.Helpers\.EntityView\.SubEntity') | Основная сущность\. |
|
| [SubEntity](EntityView.SubEntity.md 'Pf2eDataScrapper\.Helpers\.EntityView\.SubEntity') | Основная сущность\. |
|
||||||
|
|
||||||
|
| Methods | |
|
||||||
|
| :--- | :--- |
|
||||||
|
| [GetEntity\(EntityType, int\)](EntityView.GetEntity(EntityType,int).md 'Pf2eDataScrapper\.Helpers\.EntityView\.GetEntity\(Pf2eModel\.Model\.Enum\.EntityType, int\)') | Получает сущность из базы данных по типу и идентификатору\. |
|
||||||
|
| [GetSubEntity\(EntityType, int\)](EntityView.GetSubEntity(EntityType,int).md 'Pf2eDataScrapper\.Helpers\.EntityView\.GetSubEntity\(Pf2eModel\.Model\.Enum\.EntityType, int\)') | Получает подчинённую сущность по типу и идентификатору\. |
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers').[FoundryGlobals](FoundryGlobals.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers\.FoundryGlobals')
|
||||||
|
|
||||||
|
## FoundryGlobals\.FoundryTarget Property
|
||||||
|
|
||||||
|
Цель внешних ссылок для Foundry En\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public Pf2eModel.Model.Base.Targets.ExternalTarget FoundryTarget { get; set; }
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Property Value
|
||||||
|
[Pf2eModel\.Model\.Base\.Targets\.ExternalTarget](https://docs.microsoft.com/en-us/dotnet/api/Pf2eModel.Model.Base.Targets.ExternalTarget 'Pf2eModel\.Model\.Base\.Targets\.ExternalTarget')
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
### [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers')
|
||||||
|
|
||||||
|
## FoundryGlobals Class
|
||||||
|
|
||||||
|
Глобальные константы и утилиты для импорта данных в формате Foundry En\.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
internal class FoundryGlobals
|
||||||
|
```
|
||||||
|
|
||||||
|
Inheritance [System\.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System\.Object') 🡒 FoundryGlobals
|
||||||
|
|
||||||
|
| Properties | |
|
||||||
|
| :--- | :--- |
|
||||||
|
| [FoundryTarget](FoundryGlobals.FoundryTarget.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers\.FoundryGlobals\.FoundryTarget') | Цель внешних ссылок для Foundry En\. |
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#### [Pf2eDataScrapper](index.md 'index')
|
||||||
|
|
||||||
|
## Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers Namespace
|
||||||
|
|
||||||
|
| Classes | |
|
||||||
|
| :--- | :--- |
|
||||||
|
| [FoundryGlobals](FoundryGlobals.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers\.FoundryGlobals') | Глобальные константы и утилиты для импорта данных в формате Foundry En\. |
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
| [Pf2eDataScrapper\.Importers\.Implementations\.Aonprd\.Processors\.Types\.Rules](Pf2eDataScrapper.Importers.Implementations.Aonprd.Processors.Types.Rules.md 'Pf2eDataScrapper\.Importers\.Implementations\.Aonprd\.Processors\.Types\.Rules') | Обработчики правил с сайта [Archives of Nethys Pathfinder 2e](https://aonprd.com/ 'https://aonprd\.com/')\. |
|
| [Pf2eDataScrapper\.Importers\.Implementations\.Aonprd\.Processors\.Types\.Rules](Pf2eDataScrapper.Importers.Implementations.Aonprd.Processors.Types.Rules.md 'Pf2eDataScrapper\.Importers\.Implementations\.Aonprd\.Processors\.Types\.Rules') | Обработчики правил с сайта [Archives of Nethys Pathfinder 2e](https://aonprd.com/ 'https://aonprd\.com/')\. |
|
||||||
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn](Pf2eDataScrapper.Importers.Implementations.FoundryEn.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn') | Импортёр данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn](Pf2eDataScrapper.Importers.Implementations.FoundryEn.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn') | Импортёр данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
||||||
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Compendium](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Compendium') | Компендиум данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Compendium](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Compendium') | Компендиум данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
||||||
|
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Helpers') | |
|
||||||
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Processors\.Preparation](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Preparation.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Processors\.Preparation') | Обработчики для подготовки данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
| [Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Processors\.Preparation](Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Preparation.md 'Pf2eDataScrapper\.Importers\.Implementations\.FoundryEn\.Processors\.Preparation') | Обработчики для подготовки данных из модуля [pf2e](https://github.com/foundryvtt/pf2e 'https://github\.com/foundryvtt/pf2e') для FoundryVTT\. |
|
||||||
| [Pf2eDataScrapper\.Importers\.Repositories](Pf2eDataScrapper.Importers.Repositories.md 'Pf2eDataScrapper\.Importers\.Repositories') | Общее описание репозиториев для хранения данных, которые используются в импортёрах и процессорах\. |
|
| [Pf2eDataScrapper\.Importers\.Repositories](Pf2eDataScrapper.Importers.Repositories.md 'Pf2eDataScrapper\.Importers\.Repositories') | Общее описание репозиториев для хранения данных, которые используются в импортёрах и процессорах\. |
|
||||||
| [Pf2eDataScrapper\.Processors](Pf2eDataScrapper.Processors.md 'Pf2eDataScrapper\.Processors') | Общее описание обработчиков данных\. |
|
| [Pf2eDataScrapper\.Processors](Pf2eDataScrapper.Processors.md 'Pf2eDataScrapper\.Processors') | Общее описание обработчиков данных\. |
|
||||||
|
|||||||
@@ -40,56 +40,38 @@ public enum ActionCategory
|
|||||||
|
|
||||||
Действие классовой черты\.
|
Действие классовой черты\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.Offensive'></a>
|
|
||||||
|
|
||||||
`Offensive` 5
|
|
||||||
|
|
||||||
Действие атаки\.
|
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.Defensive'></a>
|
|
||||||
|
|
||||||
`Defensive` 6
|
|
||||||
|
|
||||||
Действие защиты\.
|
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.Interaction'></a>
|
|
||||||
|
|
||||||
`Interaction` 7
|
|
||||||
|
|
||||||
Действие взаимодействия\.
|
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.Familiar'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.Familiar'></a>
|
||||||
|
|
||||||
`Familiar` 8
|
`Familiar` 5
|
||||||
|
|
||||||
Действие фамильяра\.
|
Действие фамильяра\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.ArmyTactic'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.ArmyTactic'></a>
|
||||||
|
|
||||||
`ArmyTactic` 9
|
`ArmyTactic` 6
|
||||||
|
|
||||||
Действие тактики армии\.
|
Действие тактики армии\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.ArmyWarAction'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.ArmyWarAction'></a>
|
||||||
|
|
||||||
`ArmyWarAction` 10
|
`ArmyWarAction` 7
|
||||||
|
|
||||||
Действие войны армии\.
|
Действие войны армии\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomActivity'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomActivity'></a>
|
||||||
|
|
||||||
`KingdomActivity` 11
|
`KingdomActivity` 8
|
||||||
|
|
||||||
Активность королевства\.
|
Активность королевства\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomFeat'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomFeat'></a>
|
||||||
|
|
||||||
`KingdomFeat` 12
|
`KingdomFeat` 9
|
||||||
|
|
||||||
Действие черты королевства\.
|
Действие черты королевства\.
|
||||||
|
|
||||||
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomFeature'></a>
|
<a name='Pf2eModel.Model.Enum.ActionCategory.KingdomFeature'></a>
|
||||||
|
|
||||||
`KingdomFeature` 13
|
`KingdomFeature` 10
|
||||||
|
|
||||||
Действие особенности королевства\.
|
Действие особенности королевства\.
|
||||||
@@ -18,7 +18,7 @@ public class EntityView
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Корневая сущность.
|
/// Корневая сущность.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Entity? Entity { get; }
|
public Entity Entity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Основная сущность.
|
/// Основная сущность.
|
||||||
@@ -26,34 +26,65 @@ public class EntityView
|
|||||||
public IEntity? SubEntity { get; }
|
public IEntity? SubEntity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор класса, который получает сущность из базы данных и заполняет её данными.
|
/// Контекст базы данных, используемый для получения сущностей.
|
||||||
|
/// </summary>
|
||||||
|
private Pf2eDbContext Context { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор класса, который получает сущность из базы данных по типу и идентификатору и заполняет её данными.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">Контекст базы данных.</param>
|
/// <param name="context">Контекст базы данных.</param>
|
||||||
/// <param name="type">Тип запрашиваемой сущности.</param>
|
/// <param name="type">Тип запрашиваемой сущности.</param>
|
||||||
/// <param name="id">Идентификатор запрашиваемой сущности.</param>
|
/// <param name="id">Идентификатор запрашиваемой сущности.</param>
|
||||||
public EntityView(Pf2eDbContext context, EntityType type, int id)
|
public EntityView(Pf2eDbContext context, EntityType type, int id)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
Entity = GetEntity(type, id);
|
||||||
|
SubEntity = GetSubEntity(type, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор класса, который получает сущность из базы данных по переданной сущности и заполняет её данными.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">Контекст базы данных.</param>
|
||||||
|
/// <param name="entity">Сущность, которую нужно обработать.</param>
|
||||||
|
public EntityView(Pf2eDbContext context, Entity entity)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
Entity = entity;
|
||||||
|
SubEntity = GetSubEntity(entity.Type, entity.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получает сущность из базы данных по типу и идентификатору.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Тип сущности.</param>
|
||||||
|
/// <param name="id">Идентификатор сущности.</param>
|
||||||
|
/// <returns>Сущность, соответствующая указанному типу и идентификатору.</returns>
|
||||||
|
private Entity GetEntity(EntityType type, int id) =>
|
||||||
|
Context
|
||||||
|
.Entities.Where(e => e.Id == id && e.Type == type)
|
||||||
|
.Include(e => e.Sources)
|
||||||
|
.ThenInclude(s => s.Source)
|
||||||
|
.Include(e => e.Keywords)
|
||||||
|
.Include(e => e.Externals)
|
||||||
|
.ThenInclude(x => x.Target)
|
||||||
|
.Include(e => e.Traits)
|
||||||
|
.ThenInclude(t => t.Entity)
|
||||||
|
.FirstOrDefault() ?? throw new("Entity is null");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получает подчинённую сущность по типу и идентификатору.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">Тип сущности.</param>
|
||||||
|
/// <param name="id">Идентификатор сущности.</param>
|
||||||
|
/// <returns>Подчинённая сущность, соответствующая указанному типу и идентификатору.</returns>
|
||||||
|
private IEntity? GetSubEntity(EntityType type, int id)
|
||||||
{
|
{
|
||||||
Getter? getter = _getters.FirstOrDefault(g => g.Type == type);
|
Getter? getter = _getters.FirstOrDefault(g => g.Type == type);
|
||||||
|
return (getter != null)
|
||||||
Entity fullEntity =
|
? getter.Get(id, this.Context)
|
||||||
context
|
: (IEntity?)Context.Find(EntityOfTypeAttribute.Resolve(Entity), id);
|
||||||
.Entities.Where(e => e.Id == id && e.Type == type)
|
|
||||||
.Include(e => e.Sources)
|
|
||||||
.ThenInclude(s => s.Source)
|
|
||||||
.Include(e => e.Keywords)
|
|
||||||
.Include(e => e.Externals)
|
|
||||||
.ThenInclude(x => x.Target)
|
|
||||||
.Include(e => e.Traits)
|
|
||||||
.ThenInclude(t => t.Entity)
|
|
||||||
.FirstOrDefault() ?? throw new("Entity is null");
|
|
||||||
|
|
||||||
IEntity? subEntity =
|
|
||||||
(getter != null)
|
|
||||||
? getter.Get(id, context)
|
|
||||||
: (IEntity?)context.Find(EntityOfTypeAttribute.Resolve(fullEntity), id);
|
|
||||||
|
|
||||||
Entity = fullEntity;
|
|
||||||
SubEntity = subEntity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Pf2eModel.Model.Base.Source;
|
||||||
|
using Pf2eModel.Model.Base.Targets;
|
||||||
|
|
||||||
|
namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Глобальные константы и утилиты для импорта данных в формате Foundry En.
|
||||||
|
/// </summary>
|
||||||
|
internal class FoundryGlobals
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Цель внешних ссылок для Foundry En.
|
||||||
|
/// </summary>
|
||||||
|
public ExternalTarget FoundryTarget { get; set; } = null!;
|
||||||
|
}
|
||||||
+9
-14
@@ -1,5 +1,6 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Pf2eDataScrapper.Helpers;
|
using Pf2eDataScrapper.Helpers;
|
||||||
|
using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
|
||||||
using Pf2eDataScrapper.Processors;
|
using Pf2eDataScrapper.Processors;
|
||||||
using Pf2eDataScrapper.Processors.Attributes;
|
using Pf2eDataScrapper.Processors.Attributes;
|
||||||
using Pf2eDataScrapper.Processors.Collection;
|
using Pf2eDataScrapper.Processors.Collection;
|
||||||
@@ -20,26 +21,20 @@ namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Entiti
|
|||||||
internal class ActionProcessor(
|
internal class ActionProcessor(
|
||||||
DatabaseHelper databaseHelper,
|
DatabaseHelper databaseHelper,
|
||||||
Pf2eDbContext context,
|
Pf2eDbContext context,
|
||||||
|
FoundryGlobals globals,
|
||||||
ProcessorInput input
|
ProcessorInput input
|
||||||
) : FoundryEnAbstractProcessor(databaseHelper, context, input)
|
)
|
||||||
|
: FoundryEnAbstractProcessor<Pf2eModel.Model.Structure.Action>(
|
||||||
|
databaseHelper,
|
||||||
|
context,
|
||||||
|
globals,
|
||||||
|
input
|
||||||
|
)
|
||||||
{
|
{
|
||||||
public override EntityType Type => EntityType.Action;
|
public override EntityType Type => EntityType.Action;
|
||||||
|
|
||||||
public override Pf2eModel.Model.Structure.Action Object { get; } = new();
|
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
base.Process();
|
base.Process();
|
||||||
/*
|
|
||||||
Object.Type = EnumRequired<ActionType>("system.actionType.value");
|
|
||||||
Object.Category = EnumOptional<ActionCategory>("system.category", ActionCategory.Unknown);
|
|
||||||
Object.Actions = GetOptional<int>("system.actions.value");
|
|
||||||
Object.DeathNote = GetOptional<bool>("system.deathNote");
|
|
||||||
*/
|
|
||||||
JObject extra = new() { { "selfEffect", Input.Input.SelectToken("system.selfEffect") } };
|
|
||||||
|
|
||||||
Object.Extra = extra.ToString(Newtonsoft.Json.Formatting.None);
|
|
||||||
|
|
||||||
Context.Actions.Add(Object);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -1,5 +1,6 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Pf2eDataScrapper.Helpers;
|
using Pf2eDataScrapper.Helpers;
|
||||||
|
using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
|
||||||
using Pf2eDataScrapper.Processors;
|
using Pf2eDataScrapper.Processors;
|
||||||
using Pf2eDataScrapper.Processors.Attributes;
|
using Pf2eDataScrapper.Processors.Attributes;
|
||||||
using Pf2eDataScrapper.Processors.Collection;
|
using Pf2eDataScrapper.Processors.Collection;
|
||||||
@@ -21,17 +22,16 @@ namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Entiti
|
|||||||
internal class ConditionProcessor(
|
internal class ConditionProcessor(
|
||||||
DatabaseHelper databaseHelper,
|
DatabaseHelper databaseHelper,
|
||||||
Pf2eDbContext context,
|
Pf2eDbContext context,
|
||||||
|
FoundryGlobals globals,
|
||||||
ProcessorInput input
|
ProcessorInput input
|
||||||
) : FoundryEnAbstractProcessor(databaseHelper, context, input)
|
) : FoundryEnAbstractProcessor<Condition>(databaseHelper, context, globals, input)
|
||||||
{
|
{
|
||||||
public override EntityType Type => EntityType.Condition;
|
public override EntityType Type => EntityType.Condition;
|
||||||
|
|
||||||
public override Condition Object { get; } = new();
|
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
base.Process();
|
base.Process();
|
||||||
|
/*
|
||||||
JObject extra = new()
|
JObject extra = new()
|
||||||
{
|
{
|
||||||
{ "duration", Input.Input.SelectToken("system.duration") },
|
{ "duration", Input.Input.SelectToken("system.duration") },
|
||||||
@@ -44,5 +44,6 @@ internal class ConditionProcessor(
|
|||||||
Object.Group = Input.EnumOptional("system.group", ConditionGroup.Unknown);
|
Object.Group = Input.EnumOptional("system.group", ConditionGroup.Unknown);
|
||||||
|
|
||||||
Context.Conditions.Add(Object);
|
Context.Conditions.Add(Object);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+39
-118
@@ -3,9 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Documents;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Pf2eDataScrapper.Helpers;
|
using Pf2eDataScrapper.Helpers;
|
||||||
|
using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
|
||||||
using Pf2eDataScrapper.Processors;
|
using Pf2eDataScrapper.Processors;
|
||||||
using Pf2eDataScrapper.Processors.Definitions;
|
using Pf2eDataScrapper.Processors.Definitions;
|
||||||
using Pf2eModel;
|
using Pf2eModel;
|
||||||
@@ -19,86 +21,66 @@ using Pf2eModel.Model.Structure;
|
|||||||
|
|
||||||
namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors;
|
namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors;
|
||||||
|
|
||||||
internal abstract class FoundryEnAbstractProcessor(
|
internal abstract class FoundryEnAbstractProcessor<TEntity>(
|
||||||
DatabaseHelper databaseHelper,
|
DatabaseHelper databaseHelper,
|
||||||
Pf2eDbContext context,
|
Pf2eDbContext context,
|
||||||
|
FoundryGlobals globals,
|
||||||
ProcessorInput input
|
ProcessorInput input
|
||||||
) : AbstractInputProcessor(input)
|
) : AbstractInputProcessor(input)
|
||||||
|
where TEntity : class, IEntity?
|
||||||
{
|
{
|
||||||
protected DatabaseHelper Helper { get; } = databaseHelper;
|
protected DatabaseHelper Helper { get; } = databaseHelper;
|
||||||
|
|
||||||
public Pf2eDbContext Context { get; } = context;
|
public Pf2eDbContext Context { get; } = context;
|
||||||
|
|
||||||
public Entity Entity { get; set; } = new();
|
public FoundryGlobals Globals { get; } = globals;
|
||||||
|
|
||||||
public abstract EntityType Type { get; }
|
public abstract EntityType Type { get; }
|
||||||
|
|
||||||
public abstract IEntity Object { get; }
|
public EntityView View { get; private set; } = null!;
|
||||||
|
|
||||||
|
public Entity Entity => View.Entity;
|
||||||
|
|
||||||
|
public TEntity Object =>
|
||||||
|
View.SubEntity as TEntity
|
||||||
|
?? throw new InvalidOperationException(
|
||||||
|
$"Сущность {View.SubEntity} некорректного типа, ожидался тип {typeof(TEntity)}."
|
||||||
|
);
|
||||||
|
|
||||||
|
public virtual void ResolveEntity()
|
||||||
|
{
|
||||||
|
string name = Input.GetRequired<string>("name");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int id = Context
|
||||||
|
.Entities.Include(e => e.Name)
|
||||||
|
.Where(e => Pf2eDbContext.LocaleSearch(e.Name, name) && e.Type == Type)
|
||||||
|
.Select(e => e.Id)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
View = new EntityView(Context, Type, id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new SkipItemException(name, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
Entity.Id = Helper.NextEntityId;
|
ResolveEntity();
|
||||||
Entity.Type = Type;
|
|
||||||
|
|
||||||
Entity.Name[LocaleType.English] = Input.GetRequired<string>("name");
|
|
||||||
Entity.Img = Input.GetRequired<string>("img");
|
|
||||||
Entity.Description = Input.GetRequired<string>("system.description.value");
|
|
||||||
|
|
||||||
Entity.IsTranslated = false;
|
|
||||||
Entity.IsChecked = false;
|
|
||||||
|
|
||||||
Entity.Slug = Helper.GenerateSlug(Entity.Name[LocaleType.English]);
|
|
||||||
Entity.Rarity = Input.EnumOptional("system.traits.rarity", EntityRarity.Common);
|
|
||||||
|
|
||||||
Object.Id = Entity.Id;
|
|
||||||
|
|
||||||
Context.Entities.Add(Entity);
|
|
||||||
|
|
||||||
// Alias
|
|
||||||
/*
|
|
||||||
EntityAlias alias = new()
|
|
||||||
{
|
|
||||||
Type = LocaleType.English,
|
|
||||||
Alias = Entity.Group,
|
|
||||||
LegacyId = Entity.Id,
|
|
||||||
Entity = Entity
|
|
||||||
};
|
|
||||||
Context.EntityAliases.Add(alias);
|
|
||||||
*/
|
|
||||||
// Source
|
|
||||||
EntitySource source = new()
|
|
||||||
{
|
|
||||||
Entity = Entity,
|
|
||||||
|
|
||||||
Source = GetSource(Input.GetRequired<string>("system.publication.title")),
|
|
||||||
|
|
||||||
Suffix = "",
|
|
||||||
IsRemaster = Input.GetRequired<bool>("system.publication.remaster"),
|
|
||||||
};
|
|
||||||
Context.EntitySources.Add(source);
|
|
||||||
|
|
||||||
// External
|
// External
|
||||||
EntityExternal external = new()
|
EntityExternal external = new()
|
||||||
{
|
{
|
||||||
Entity = Entity,
|
Entity = Entity,
|
||||||
Target = GetTarget(),
|
Target = Globals.FoundryTarget,
|
||||||
|
ExternalId = Input.GetOptional<string>("_id"),
|
||||||
Suffix = Input.GetRequired<string>("_id"),
|
Suffix = Input.GetRequired<string>("_id"),
|
||||||
Md5 = Md5(Input.Input.ToString()),
|
Md5 = Input.Md5(),
|
||||||
};
|
};
|
||||||
Context.EntityExternals.Add(external);
|
Context.EntityExternals.Add(external);
|
||||||
|
|
||||||
// Traits
|
|
||||||
JToken? traitsJson = Input.Input.SelectToken("system.traits.value");
|
|
||||||
|
|
||||||
if (traitsJson?.Type != JTokenType.Array)
|
|
||||||
{
|
|
||||||
throw new Exception("system.traits.value is expected to be an array");
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Trait trait in GetTraits(traitsJson.ToArray().Select(jToken => jToken.ToString())))
|
|
||||||
{
|
|
||||||
Entity.Traits.Add(trait);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
@@ -120,65 +102,4 @@ internal abstract class FoundryEnAbstractProcessor(
|
|||||||
Context.Sources.Add(source);
|
Context.Sources.Add(source);
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ExternalTarget GetTarget()
|
|
||||||
{
|
|
||||||
const string name = "pf2e - Foundry module";
|
|
||||||
|
|
||||||
ExternalTarget? target = Context.ExternalTargets.FirstOrDefault(s => s.Name == name);
|
|
||||||
|
|
||||||
if (target != null)
|
|
||||||
{
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
target = new()
|
|
||||||
{
|
|
||||||
Name = "pf2e - Foundry module",
|
|
||||||
Icon = "",
|
|
||||||
Prefix = "https://github.com/foundryvtt/pf2e",
|
|
||||||
};
|
|
||||||
|
|
||||||
Context.ExternalTargets.Add(target);
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IEnumerable<Trait> GetTraits(IEnumerable<string> names)
|
|
||||||
{
|
|
||||||
List<Trait> result = Context
|
|
||||||
.Traits.Include(t => t.Entity)
|
|
||||||
.ThenInclude(e => e.Name)
|
|
||||||
// ReSharper disable once EntityFramework.UnsupportedServerSideFunctionCall
|
|
||||||
.Where(t => Pf2eDbContext.LocaleSearchArray(t.Entity.Name, names))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
/*
|
|
||||||
foreach (string name in names)
|
|
||||||
{
|
|
||||||
if (result.Any(t => t.Entity.Group.Contains(name)))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Trait trait = new()
|
|
||||||
{
|
|
||||||
Group = name,
|
|
||||||
Slug = name,
|
|
||||||
Type = TraitType.Regular,
|
|
||||||
Description = "",
|
|
||||||
};
|
|
||||||
Context.Traits.Add(trait);
|
|
||||||
result.Add(trait);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Md5(string input, bool isLowercase = false)
|
|
||||||
{
|
|
||||||
using MD5 md5 = MD5.Create();
|
|
||||||
byte[] byteHash = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
|
|
||||||
string hash = BitConverter.ToString(byteHash).Replace("-", "");
|
|
||||||
return isLowercase ? hash.ToLower() : hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers;
|
||||||
|
using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Helpers;
|
||||||
|
using Pf2eDataScrapper.Processors.Attributes;
|
||||||
|
using Pf2eDataScrapper.Processors.Definitions;
|
||||||
|
using Pf2eModel;
|
||||||
|
using Pf2eModel.Model.Base.Targets;
|
||||||
|
|
||||||
|
namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Processors.Preparation;
|
||||||
|
|
||||||
|
[Processor(
|
||||||
|
"foundry-en:external",
|
||||||
|
Description = "Создание цели внешних ссылок",
|
||||||
|
Group = ProcessorGroupEnum.FoundryEnPreparation
|
||||||
|
)]
|
||||||
|
[ProcessorDependencies(["foundry-en:repository"])]
|
||||||
|
internal class ExternalProcessor(FoundryGlobals globals) : AbstractSimpleProcessor
|
||||||
|
{
|
||||||
|
public Pf2eDbContext Context { get; } = new();
|
||||||
|
public FoundryGlobals Globals { get; } = globals;
|
||||||
|
|
||||||
|
public ExternalTarget FoundryTarget = null!;
|
||||||
|
|
||||||
|
public override void Process()
|
||||||
|
{
|
||||||
|
FoundryTarget = new()
|
||||||
|
{
|
||||||
|
Name = FoundryEnImporter.TargetName,
|
||||||
|
Icon = "http://www.google.com/s2/favicons?domain=foundryvtt.com",
|
||||||
|
Prefix = "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Save()
|
||||||
|
{
|
||||||
|
Context.ExternalTargets.Add(FoundryTarget);
|
||||||
|
Context.SaveChanges();
|
||||||
|
|
||||||
|
Globals.FoundryTarget = FoundryTarget;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,24 +37,6 @@ public enum ActionCategory
|
|||||||
[PgName("class-feat")]
|
[PgName("class-feat")]
|
||||||
ClassFeat,
|
ClassFeat,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Действие атаки.
|
|
||||||
/// </summary>
|
|
||||||
[PgName("offensive")]
|
|
||||||
Offensive,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Действие защиты.
|
|
||||||
/// </summary>
|
|
||||||
[PgName("defensive")]
|
|
||||||
Defensive,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Действие взаимодействия.
|
|
||||||
/// </summary>
|
|
||||||
[PgName("interaction")]
|
|
||||||
Interaction,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Действие фамильяра.
|
/// Действие фамильяра.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user