From 776abeb58a82cb4684a20491d81aa54ea832a5fa Mon Sep 17 00:00:00 2001 From: Ilya Kozhemyakin Date: Sat, 13 Sep 2025 11:39:23 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation/Pf2eModel/Class.Spellcasting.md | 6 ++-- Documentation/Pf2eModel/Class.md | 2 +- .../Pf2eModel/Pf2eModel.Model.Enum.md | 1 + Documentation/Pf2eModel/SpellcastingType.md | 29 +++++++++++++++++++ .../Aonprd/Processors/Types/ClassProcessor.cs | 4 --- ...signer.cs => 20250913071004_1.Designer.cs} | 20 ++++++++----- ...0250602061959_1.cs => 20250913071004_1.cs} | 9 +++--- .../Migrations/Pf2eDbContextModelSnapshot.cs | 18 ++++++++---- Pf2eModel/Model/Enum/SpellcastingType.cs | 27 +++++++++++++++++ Pf2eModel/Model/Structure/Class.cs | 6 ++-- 10 files changed, 94 insertions(+), 28 deletions(-) create mode 100644 Documentation/Pf2eModel/SpellcastingType.md rename Pf2eModel/Migrations/{20250602061959_1.Designer.cs => 20250913071004_1.Designer.cs} (99%) rename Pf2eModel/Migrations/{20250602061959_1.cs => 20250913071004_1.cs} (99%) create mode 100644 Pf2eModel/Model/Enum/SpellcastingType.cs diff --git a/Documentation/Pf2eModel/Class.Spellcasting.md b/Documentation/Pf2eModel/Class.Spellcasting.md index 50af749..d960653 100644 --- a/Documentation/Pf2eModel/Class.Spellcasting.md +++ b/Documentation/Pf2eModel/Class.Spellcasting.md @@ -3,11 +3,11 @@ ## Class\.Spellcasting Property -Флаг, указывающий на то, что класс является заклинательным\. +Указание на тип заклинательства\. ```csharp -public bool Spellcasting { get; set; } +public Pf2eModel.Model.Enum.SpellcastingType Spellcasting { get; set; } ``` #### Property Value -[System\.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System\.Boolean') \ No newline at end of file +[SpellcastingType](SpellcastingType.md 'Pf2eModel\.Model\.Enum\.SpellcastingType') \ No newline at end of file diff --git a/Documentation/Pf2eModel/Class.md b/Documentation/Pf2eModel/Class.md index e3c7114..14ca194 100644 --- a/Documentation/Pf2eModel/Class.md +++ b/Documentation/Pf2eModel/Class.md @@ -22,6 +22,6 @@ Implements [IEntity](IEntity.md 'Pf2eModel\.Model\.IEntity') | [Entity](Class.Entity.md 'Pf2eModel\.Model\.Structure\.Class\.Entity') | Корневая сущность\. | | [Hp](Class.Hp.md 'Pf2eModel\.Model\.Structure\.Class\.Hp') | Количество очков здоровья\. | | [Id](Class.Id.md 'Pf2eModel\.Model\.Structure\.Class\.Id') | Идентификатор сущности\. | -| [Spellcasting](Class.Spellcasting.md 'Pf2eModel\.Model\.Structure\.Class\.Spellcasting') | Флаг, указывающий на то, что класс является заклинательным\. | +| [Spellcasting](Class.Spellcasting.md 'Pf2eModel\.Model\.Structure\.Class\.Spellcasting') | Указание на тип заклинательства\. | | [SubclassGroups](Class.SubclassGroups.md 'Pf2eModel\.Model\.Structure\.Class\.SubclassGroups') | Группы подклассов\. | | [Tradition](Class.Tradition.md 'Pf2eModel\.Model\.Structure\.Class\.Tradition') | Традиция заклинаний класса\. | diff --git a/Documentation/Pf2eModel/Pf2eModel.Model.Enum.md b/Documentation/Pf2eModel/Pf2eModel.Model.Enum.md index 45bce0b..58eb4e3 100644 --- a/Documentation/Pf2eModel/Pf2eModel.Model.Enum.md +++ b/Documentation/Pf2eModel/Pf2eModel.Model.Enum.md @@ -21,6 +21,7 @@ | [SizeEnum](SizeEnum.md 'Pf2eModel\.Model\.Enum\.SizeEnum') | Размер\. | | [SourceCategory](SourceCategory.md 'Pf2eModel\.Model\.Enum\.SourceCategory') | Перечисление категорий источников\. | | [SpellAreaType](SpellAreaType.md 'Pf2eModel\.Model\.Enum\.SpellAreaType') | Тип области заклинания\. | +| [SpellcastingType](SpellcastingType.md 'Pf2eModel\.Model\.Enum\.SpellcastingType') | Перечисление типа применения заклинаний\. | | [SpellDamageCategory](SpellDamageCategory.md 'Pf2eModel\.Model\.Enum\.SpellDamageCategory') | Тип урона заклинания\. | | [SpellDamageKinds](SpellDamageKinds.md 'Pf2eModel\.Model\.Enum\.SpellDamageKinds') | Тип урона заклинания\. | | [SpellTradition](SpellTradition.md 'Pf2eModel\.Model\.Enum\.SpellTradition') | Традиция заклинания\. | diff --git a/Documentation/Pf2eModel/SpellcastingType.md b/Documentation/Pf2eModel/SpellcastingType.md new file mode 100644 index 0000000..e298090 --- /dev/null +++ b/Documentation/Pf2eModel/SpellcastingType.md @@ -0,0 +1,29 @@ +#### [Pf2eModel](index.md 'index') +### [Pf2eModel\.Model\.Enum](Pf2eModel.Model.Enum.md 'Pf2eModel\.Model\.Enum') + +## SpellcastingType Enum + +Перечисление типа применения заклинаний\. + +```csharp +public enum SpellcastingType +``` +### Fields + + + +`None` 0 + +Не применяет заклинания\. + + + +`Prepared` 1 + +Заготавливаемое заклинательство\. + + + +`Spontaneous` 2 + +Спонтанное заклинательство\. \ No newline at end of file diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs index a3db82f..7ce090a 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs @@ -7,7 +7,6 @@ using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; using Pf2eDataScrapper.Processors; using Pf2eDataScrapper.Processors.Attributes; -using Pf2eDataScrapper.Processors.Collection; using Pf2eModel; using Pf2eModel.Model.Common; using Pf2eModel.Model.Common.I18n; @@ -88,15 +87,12 @@ internal partial class ClassProcessor( switch (tradition.Count) { case 0: - Object.Spellcasting = false; Object.Tradition = SpellTradition.None; break; case 1: - Object.Spellcasting = true; Object.Tradition = Input.Enum(tradition[0].ToString()); break; default: - Object.Spellcasting = true; Object.Tradition = SpellTradition.All; break; } diff --git a/Pf2eModel/Migrations/20250602061959_1.Designer.cs b/Pf2eModel/Migrations/20250913071004_1.Designer.cs similarity index 99% rename from Pf2eModel/Migrations/20250602061959_1.Designer.cs rename to Pf2eModel/Migrations/20250913071004_1.Designer.cs index e93cd61..c30439f 100644 --- a/Pf2eModel/Migrations/20250602061959_1.Designer.cs +++ b/Pf2eModel/Migrations/20250913071004_1.Designer.cs @@ -13,7 +13,7 @@ using Pf2eModel.Model.Enum; namespace Pf2eModel.Migrations { [DbContext(typeof(Pf2eDbContext))] - [Migration("20250602061959_1")] + [Migration("20250913071004_1")] partial class _1 { /// @@ -24,7 +24,7 @@ namespace Pf2eModel.Migrations .HasAnnotation("ProductVersion", "9.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "archetype", "army_tactic", "army_war_action", "class-feat", "class-feature", "defensive", "familiar", "interaction", "kingdom_activity", "kingdom_feat", "kingdom_feature", "offensive", "skill-action", "unknown" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "archetype", "army_tactic", "army_war_action", "class-feat", "class-feature", "familiar", "kingdom_activity", "kingdom_feat", "kingdom_feature", "skill-action", "unknown" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_enum", new[] { "1", "1 hour", "1 minute", "1-2", "1-3", "10 minutes", "2", "2-3", "2/2 rounds", "3", "30 minutes", "5 minutes", "free", "free/1", "other", "passive", "reaction", "reaction/1", "reaction/2", "reaction/3", "unknown" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "cha", "con", "dex", "free", "int", "str", "wis" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "ancestry_feat", "attribute_increase", "class_feat", "entity", "general_feat", "skill_feat", "skill_increase" }); @@ -134,13 +134,19 @@ namespace Pf2eModel.Migrations .HasColumnType("boolean") .HasColumnName("is_checked") .HasColumnOrder(9) - .HasComment("Флаг, указывающий, что сущность был проверен и не требует автоматической перезаписи"); + .HasComment("Проверено?"); + + b.Property("IsLegacy") + .HasColumnType("boolean") + .HasColumnName("is_legacy") + .HasColumnOrder(10) + .HasComment("Устаревшая?"); b.Property("IsTranslated") .HasColumnType("boolean") .HasColumnName("is_translated") .HasColumnOrder(8) - .HasComment("Флаг, указывающий, что у сущности существует перевод"); + .HasComment("Есть перевод?"); b.Property("Name") .IsRequired() @@ -890,11 +896,11 @@ namespace Pf2eModel.Migrations .HasColumnOrder(2) .HasComment("Количество очков здоровья"); - b.Property("Spellcasting") - .HasColumnType("boolean") + b.Property("Spellcasting") + .HasColumnType("integer") .HasColumnName("spellcasting") .HasColumnOrder(3) - .HasComment("Заклинатель?"); + .HasComment("Тип заклинательства"); b.Property("Tradition") .HasColumnType("spell_tradition") diff --git a/Pf2eModel/Migrations/20250602061959_1.cs b/Pf2eModel/Migrations/20250913071004_1.cs similarity index 99% rename from Pf2eModel/Migrations/20250602061959_1.cs rename to Pf2eModel/Migrations/20250913071004_1.cs index 3fec90b..85c952c 100644 --- a/Pf2eModel/Migrations/20250602061959_1.cs +++ b/Pf2eModel/Migrations/20250913071004_1.cs @@ -14,7 +14,7 @@ namespace Pf2eModel.Migrations protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterDatabase() - .Annotation("Npgsql:Enum:action_category", "archetype,army_tactic,army_war_action,class-feat,class-feature,defensive,familiar,interaction,kingdom_activity,kingdom_feat,kingdom_feature,offensive,skill-action,unknown") + .Annotation("Npgsql:Enum:action_category", "archetype,army_tactic,army_war_action,class-feat,class-feature,familiar,kingdom_activity,kingdom_feat,kingdom_feature,skill-action,unknown") .Annotation("Npgsql:Enum:action_enum", "1,1 hour,1 minute,1-2,1-3,10 minutes,2,2-3,2/2 rounds,3,30 minutes,5 minutes,free,free/1,other,passive,reaction,reaction/1,reaction/2,reaction/3,unknown") .Annotation("Npgsql:Enum:attribute_values", "cha,con,dex,free,int,str,wis") .Annotation("Npgsql:Enum:class_progression_type", "ancestry_feat,attribute_increase,class_feat,entity,general_feat,skill_feat,skill_increase") @@ -49,8 +49,9 @@ namespace Pf2eModel.Migrations img = table.Column(type: "character varying(255)", maxLength: 255, nullable: false, comment: "Изображение объекта"), description = table.Column(type: "text", nullable: false, comment: "Текстовое описание сущности"), rarity = table.Column(type: "entity_rarity", nullable: false, comment: "Редкость сущности"), - is_translated = table.Column(type: "boolean", nullable: true, comment: "Флаг, указывающий, что у сущности существует перевод"), - is_checked = table.Column(type: "boolean", nullable: true, comment: "Флаг, указывающий, что сущность был проверен и не требует автоматической перезаписи") + is_translated = table.Column(type: "boolean", nullable: true, comment: "Есть перевод?"), + is_checked = table.Column(type: "boolean", nullable: true, comment: "Проверено?"), + is_legacy = table.Column(type: "boolean", nullable: true, comment: "Устаревшая?") }, constraints: table => { @@ -194,7 +195,7 @@ namespace Pf2eModel.Migrations { id = table.Column(type: "integer", nullable: false, comment: "Идентификатор"), hp = table.Column(type: "integer", nullable: false, comment: "Количество очков здоровья"), - spellcasting = table.Column(type: "boolean", nullable: false, comment: "Заклинатель?"), + spellcasting = table.Column(type: "integer", nullable: false, comment: "Тип заклинательства"), tradition = table.Column(type: "spell_tradition", nullable: true, comment: "Традиция заклинаний"), additional_trained_skills = table.Column(type: "integer", nullable: false, comment: "Дополнительные навыки") }, diff --git a/Pf2eModel/Migrations/Pf2eDbContextModelSnapshot.cs b/Pf2eModel/Migrations/Pf2eDbContextModelSnapshot.cs index 8b39b72..288db0a 100644 --- a/Pf2eModel/Migrations/Pf2eDbContextModelSnapshot.cs +++ b/Pf2eModel/Migrations/Pf2eDbContextModelSnapshot.cs @@ -21,7 +21,7 @@ namespace Pf2eModel.Migrations .HasAnnotation("ProductVersion", "9.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); - NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "archetype", "army_tactic", "army_war_action", "class-feat", "class-feature", "defensive", "familiar", "interaction", "kingdom_activity", "kingdom_feat", "kingdom_feature", "offensive", "skill-action", "unknown" }); + NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_category", new[] { "archetype", "army_tactic", "army_war_action", "class-feat", "class-feature", "familiar", "kingdom_activity", "kingdom_feat", "kingdom_feature", "skill-action", "unknown" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "action_enum", new[] { "1", "1 hour", "1 minute", "1-2", "1-3", "10 minutes", "2", "2-3", "2/2 rounds", "3", "30 minutes", "5 minutes", "free", "free/1", "other", "passive", "reaction", "reaction/1", "reaction/2", "reaction/3", "unknown" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "attribute_values", new[] { "cha", "con", "dex", "free", "int", "str", "wis" }); NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "class_progression_type", new[] { "ancestry_feat", "attribute_increase", "class_feat", "entity", "general_feat", "skill_feat", "skill_increase" }); @@ -131,13 +131,19 @@ namespace Pf2eModel.Migrations .HasColumnType("boolean") .HasColumnName("is_checked") .HasColumnOrder(9) - .HasComment("Флаг, указывающий, что сущность был проверен и не требует автоматической перезаписи"); + .HasComment("Проверено?"); + + b.Property("IsLegacy") + .HasColumnType("boolean") + .HasColumnName("is_legacy") + .HasColumnOrder(10) + .HasComment("Устаревшая?"); b.Property("IsTranslated") .HasColumnType("boolean") .HasColumnName("is_translated") .HasColumnOrder(8) - .HasComment("Флаг, указывающий, что у сущности существует перевод"); + .HasComment("Есть перевод?"); b.Property("Name") .IsRequired() @@ -887,11 +893,11 @@ namespace Pf2eModel.Migrations .HasColumnOrder(2) .HasComment("Количество очков здоровья"); - b.Property("Spellcasting") - .HasColumnType("boolean") + b.Property("Spellcasting") + .HasColumnType("integer") .HasColumnName("spellcasting") .HasColumnOrder(3) - .HasComment("Заклинатель?"); + .HasComment("Тип заклинательства"); b.Property("Tradition") .HasColumnType("spell_tradition") diff --git a/Pf2eModel/Model/Enum/SpellcastingType.cs b/Pf2eModel/Model/Enum/SpellcastingType.cs new file mode 100644 index 0000000..6355762 --- /dev/null +++ b/Pf2eModel/Model/Enum/SpellcastingType.cs @@ -0,0 +1,27 @@ +using NpgsqlTypes; + +namespace Pf2eModel.Model.Enum; + +/// +/// Перечисление типа применения заклинаний. +/// +public enum SpellcastingType +{ + /// + /// Не применяет заклинания. + /// + [PgName("none")] + None, + + /// + /// Заготавливаемое заклинательство. + /// + [PgName("prepared")] + Prepared, + + /// + /// Спонтанное заклинательство. + /// + [PgName("spontaneous")] + Spontaneous, +} diff --git a/Pf2eModel/Model/Structure/Class.cs b/Pf2eModel/Model/Structure/Class.cs index 766b1b9..8307f47 100644 --- a/Pf2eModel/Model/Structure/Class.cs +++ b/Pf2eModel/Model/Structure/Class.cs @@ -31,11 +31,11 @@ public class Class : IEntity public int Hp { get; set; } /// - /// Флаг, указывающий на то, что класс является заклинательным. + /// Указание на тип заклинательства. /// [Column(Order = 3)] - [Comment("Заклинатель?")] - public bool Spellcasting { get; set; } + [Comment("Тип заклинательства")] + public SpellcastingType Spellcasting { get; set; } = SpellcastingType.None; /// /// Традиция заклинаний класса.